Old BMS Software Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Postby GregsGarage » Sun Jan 03, 2010 1:50 pm

retepsnikrep wrote:Good point I need to adjust that so it sends data from the current I2CAddress point until it catches up with itself. So it sends the full 64k data on every dump. I'll think about that a bit more.


How about something like this;

Code: Select all

DumpData:               ;Sends Stored EEPROM BMS data to remote display and/or PC Logger
                  ;Txd sends 5 byte preamble to lock with Rxd, then qualifier "bms"
                  ;followed by control code and then data. Data rate is limited to
                  ;2400 baud and 64kbyte may take upto 4 minutes to transmit

   serout Video,BaudT9600,(27,67,"Sending ",#I2CAddress,10,13,"Bytes Be Patient")   ;Video Display   

   serout DriveInhibit, BaudN2400, (0x55, 0x55, 0x55, 0x55, 0x55)       ;Txd 5 byte preamble to clear Rxd
   pause 10            ;Pause for 5ms to allow serial rxd to clear
   serout DriveInhibit, BaudN2400, ("bms",1)   ;Txd Qualifier and control code (1) (2400 baud at 8mhz)
   pause 10            ;Pause for 5ms to allow serial rxd to clear
   for VarA = 0 to 65535         ;SUGGESTED CHANGES
   inc I2CAddress            ;SUGGESTED CHANGES
   hi2cin I2CAddress,(b0)         ;SUGGESTED CHANGES
   serout DriveInhibit, BaudN2400, (b0)   ;Txd BMS Data byte via 443mhz Tx 2400 baud
   toggle WatchDogLed         ;Keeps watchdog happy, Prevents alarm during data transmision
   next VarA            ;Repeat loop until all eeprom data sent
   
   serout DriveInhibit, BaudN2400, (255)   ;Txd BMS Data end flag (255) via 443mhz Tx 2400 baud
      

   goto ExitMenu            ;Returns to main program loop

Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Postby retepsnikrep » Sun Jan 03, 2010 2:06 pm

I'll tinker with that in a few day when my eeprom chips arrive.

I'm busy building up my new pack now.
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Postby retepsnikrep » Wed Jan 06, 2010 4:51 am

I'm going to do some testing today on one of the 10R resistors and the wire I have been using for the BMS and a single cell. I'll see what the voltage drop is for the load end when used on wire of average length in my setup.

I used fairly thin wire which may prove to be a bit of a pain. Anyway I have adjusted the Slave & Master software to correct this hopefully.

So we now have 12 available commands that can be sent to the slaves!

Command 1 = Send Cell Voltage on Master Bus (1ms pulse)
Command 2 = Increase Load CutIn Voltage by 10mv (2ms pulse)
Command 3 = Decrease Load CutIn Voltage by 10mv (3ms pulse)
Command 4 = Increase Load CutOut Voltage by 10mv (4ms pulse)
Command 5 = Decrease Load CutOut Voltage by 10mv (5ms pulse)
Command 6 = Set Slave Load Defaults (6ms pulse)
Command 7 = Turn On Slave Load for 0.5 seconds (Flashes Led) (7ms pulse)
Command 8 = Set Baud rate to 9600bps (8ms pulse)
Command 9 = Set Baud rate to 2400bps (9ms pulse)
Command 10 = Increase Load On Compensation Voltage by 10mv (10ms pulse)
Command 11 = Decrease Load On Compensation Voltage by 10mv (11ms pulse)
Command 12 = Set Load On Compensation Voltage to 0mv (Zero) (12ms pulse)

We now have the individual load Cut in and out point adjustments back.
We have longer command pulses to avoid false triggering.
We have a new adjustable voltage compensation variable which can be added to the Cell voltage if the bypass load is active on that cell.
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Postby retepsnikrep » Thu Jan 07, 2010 5:33 am

More thoughts.

The slaves currently measure cell voltage about 500 times a second!

They can also switch the load on/off at this speed causing quite a bit of noise.

How about slaves turning off the load prior to measuring the cell voltage?

Would also need to reduce the cell loop speed to twice a second or something.

1) So slave measures voltage and turns on load as required. (This takes about 1.5ms)

2) Then waits in a fast loop for half a second for a Command input on slave bus.

3) If no input turns load off then goes to step 1

This reduces the measuring to twice a second but more importantly reduces the rate at which the load could be switched on/off. Hmm?
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Postby retepsnikrep » Thu Jan 07, 2010 5:39 pm

I've done some new slave code which now checks cell voltage twice a second and turns off the load before it does the measurement.

Hopefully we won't have to do the voltage compensation stuff now.

The cell voltage measurement still takes place in under 2ms so the load can still be on for 996ms every second.

I'll test it tomorrow weather conditions permitting as it's too cold to spend much time in workshop :(
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

steiner
Posts: 89
Joined: Mon Sep 08, 2008 1:50 am
Location: Florida

Postby steiner » Fri Jan 08, 2010 3:48 am

Peter,

Very interesting stuff you are doing. Have you done any tests to see how long it takes for the cell voltage to stabilize after the load resistor has been turned off? I know your system uses a relatively low load resistor so it may return very quickly. The slaves are running so fast that it may need a short delay before it measure the cell voltage after turning off the load resistor.

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Postby retepsnikrep » Fri Jan 08, 2010 5:03 am

On the todo list Rick. I think the recovery will be almost instant at 350ma load.
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

User avatar
retepsnikrep
Posts: 1387
Joined: Sat May 26, 2007 4:50 pm
Location: North Yorkshire England
Contact:

Postby retepsnikrep » Fri Jan 08, 2010 9:06 am

Well it's working a lot better now but I'm still not 100% happy.

The turning on/off of the load causes spikes due to the voltage drop in the BMS wires which I believe also effects the neighbouring slaves as they all share a cell wire. We don't get that problem with the cell top version! So we do not want to turn it (the load) on and off rapidly.

The voltage drop at the BMS with the load active on my system is about 50-70mv compared to the cell terminals.

I managed to balance my cells with a 175v 350ma cc supply and voltages all looked OK this morning.

I'm open to software ideas on how to manage this issue better?

www.solarvan.co.uk/bms/SerSla19.txt
www.solarvan.co.uk/bms/MASTER_8MHZ_0701 ... UD_I2C.txt


The Master also has a problem with a stack overflow so I must have a dodgy loop or gosub somewhere :roll:

As it's about -10C in my garage all work is on hardware hold!! :shock:
Regards Peter

Two MK1 Honda Insight's. One running 20ah A123 Lithium pack. One 8ah BetterBattery Nimh pack.
One HCH1 Civic Hybrid running 60ah A123 Lithium pack.

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Postby GregsGarage » Fri Jan 08, 2010 12:59 pm

Could we have each slave calculate it's own "Load On Compensation Voltage" each time it reaches the load on voltage. It could compare the voltage value before and after switching on the load and then adjust it's voltage measurements accordingly. If we also had a command to switch off all loads from the master and sent it periodically, say every 5 or 10 minutes, this could force the slaves to recaculate the compensation voltage as it may change a bit as the cells get more charged. This could also mean the number of commands needed could be reduced to possibly 8;

Command 1 = Send Cell Voltage on Master Bus (0.1ms pulse)
Command 2 = Increase Load Operation Voltage by 10mv (0.2ms pulse)
Command 3 = Decrease Load Operation Voltage by 10mv (0.3ms pulse)
Command 4 = Set Slave Load Defaults (0.4ms pulse)
Command 5 = Turn On Slave Load for one second (Flashes Led) (0.5ms pulse)
Command 6 = Set Baud rate to 9600bps (0.6ms pulse)
Command 7 = Set Baud rate to 2400bps (0.7ms pulse)
Command 8 = Turn Off any Slave Loads
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191

GregsGarage
Posts: 870
Joined: Tue Apr 01, 2008 5:27 pm
Location: Galashiels, Scottish Borders
Contact:

Postby GregsGarage » Fri Jan 08, 2010 11:27 pm

Some further thoughts on the idea of the slaves self compensating for the voltage drop with the load on. I went back to this version http://www.solarvan.co.uk/bms/SerSla15.pbp.

-----------We need two 16 bit variables-------------

NoLoadV var Word 'Used to store no load cell voltage
LoadOffset var Word 'Amount of voltage drop with load on

------------A 1bit variable---------------------

LoadFlag var bit 'Controls load 1=load on, 0=load off

Then after the line "CellV = CellV * 2 "
add the line "CellV = CellV - LoadOffset

Replace the section

Code: Select all

if CellV > CutInV then      'If Cell V > CutInV then
   high Load         'Turn on bypass resistor and bypass led
   endif

with

Code: Select all

If CellV > CutInV then
    if LoadOffset = 0 and LoadFlag = 1 then     'This will be true on second loop that CellV > CutInV
    LoadOffset = NoLoadV - CellV     'Calculate load offset value
    endif   
    if LoadOffset = 0 and LoadFlag = 0 then     'this will be true on the first loop that CellV > CutInV
    NoLoadV = CellV      'Store voltage value of cell with no load
    LoadFlag = 1       'Turn on load flag, turns on load at the end of Main loop
    endif
endif


Replace this

Code: Select all

if CellV < CutOutV then      'If Cell V < CutOutV then
   low Load         'Turn off bypass resistor and bypass led
   endif

with

Code: Select all

if CellV < CutOutV and LoadOffset > 0 then      'Don't switch off the load before calculating LoadOffset
LoadFlag = 0
LoadOffset = 0
endif


At the end of the Main loop you then switch the load on or off based on the LoadFlag setting. It can also be switched off from the master by setting LoadFlag and LoadOffset to 0. I am not yet familiar with the actual syntax of PicBasic so consider the above as pseudo code. It probably has mistakes, but the general idea is there.


EDIT
Loads of edits, also I think the section that sets the LoadFlag to 0 needs to come before the section that sets the LoadFlag to 1
Greg Fordyce

Daewoo Matiz
http://www.evalbum.com/4191


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 7 guests