Old BMS Software Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

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

Re: BMS Software

Postby retepsnikrep » Mon Apr 19, 2010 3:10 pm

Please bear in mind the SOC calculation is my own cobbled up affair and works for me with the far from accurate Allegro hall effect chips. May well need some serious tweaking to suit different sensors etc. I look forward to seeing your code and how you have implemented the sensor. Can you post a schematic for it? and did you follow my ideas for the master V2 lem connections?
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

Re: BMS Software

Postby steiner » Tue Apr 20, 2010 3:35 am

Peter,

I sent you an e-mail with the code attached as I wasn't sure how to post it here. The current sensor only needs 5v, ground, and an A/D input so it connects directly to the J2 "Current Sensor Input" on the master v1.0 board. You will see the lines of code I added to work with this particular current sensor. My vehicle will peak at 600 amps of current so I needed a higher range sensor than the one you are using. I think the resolution is about 2.3 amps per A/D count. This is fine for discharge but I would like to get higher resoluton (1/10 amp) when charging. I going to try to work on a small circuit to accomplish this.

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

Re: BMS Software

Postby retepsnikrep » Wed Apr 21, 2010 10:45 am

Rick thanks for that.

Here is Rick's Master code which includes his routines for the LEM current sensors. Very useful.

http://www.solarvan.co.uk/bms/RICKSMAST ... 00BAUD.txt


Also here is a couple of newer versions of my own code.

The new master code should hopefully improve the multislave load on/off time a bit more. I moved the slave load on command to a different position so it follows on immediately the cell voltages have been received by the Master now, rather than waiting for the Master to evaluate the received data first.

http://www.solarvan.co.uk/bms/MASTER_8M ... UD_I2C.txt

The new slave code is mainly cosmetic changes to the comments, however I did remove one redundant item. Functionality is unchanged from V26

http://www.solarvan.co.uk/bms/PicMultiS ... 190410.txt
http://www.solarvan.co.uk/bms/PicMultiS ... 190410.hex
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:

Re: BMS Software

Postby retepsnikrep » Wed May 05, 2010 5:10 pm

Rick have you tried the latest master code V2.16? any further updates on how it is working 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.

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

Re: BMS Software

Postby steiner » Wed May 05, 2010 8:42 pm

No... I have been out of town (Family trip to Disney). I am going to start working on it this weekend.

I wanted to ask you about displaying individual cell voltages. I haven't turned this section of the code on yet so this may be in error. It looks like when you press button 2, the software goes and displays the voltage of the first cell. As you push the button again, it displays the next cell voltage.

My question is it looks as though you clear the screen prior to displaying the cell voltage. Why can't we display as many cells on the screen at one time that will fit? It would seem as though it would certainly display 9 cells as there are 9 lines on the display and might even fit 18 cells (2 cells per line). This way you wouldn't have to push the button so many times to go through all of the cells. Just a thought......

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

Re: BMS Software

Postby retepsnikrep » Thu May 06, 2010 4:29 am

Rick. It doesnt clear the screen between displaying individual cell voltages, so they just scroll down the screen until you reach the bottom when the top one drops off as the new one comes on at the bottom. Tap the button to scroll/display slowly or hold it down and it auto repeats and displays/scrolls quickly. you can change the speed there is a pause in there somewhere. :wink: Try it if it dosent work how you want fiddle away. There is probably a video showing this in action .

http://www.youtube.com/watch?v=wsUUgJMkhWQ

2mins 20 seconds in you can see it working.
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

Re: BMS Software

Postby steiner » Mon May 10, 2010 12:13 am

Peter,

I tested the new "check voltage" portion of the master software and everything seems to be working fine. It looks like the duty cycle for the load resistors has improved. I measured the duty cycle with a scope and it is about 88% on. I also got the individual cell display routine working. I'm just using the "ButtonA" and "ButtonB" routine for now since I am still using the version 1 of the master board.

I noted a few things that happened today and wanted to get your thoughts. I had a small problem that turned out to be a poor crimp in one of my sense leads. This caused the "cell #4 error" to display as it should. I happened to be charging at the time and several of the cells were by-passing. I noticed that when "cell error" happened none of the load resistors were on even though several of the cells were above 3.65 volts. I don't have my charger tied into the master board at this time. I notice that the software looks for any error flags and if they are present it won't allow the charging routine to start. However, I don't see any provisions for the situation if an error flag occurs after the charging routine has started.

The second thing I noticed which was not related to above was I happened to be charging and several load resistors were on. When I triggered the individual cell voltage screen, the load resistors stayed on. They didn't have the periodic blink. I'm sure this is because the program is just sitting in the "DisplayB" routine and not updating the cell voltages. I am wondering if we need a timer to prevent someone from leaving the software on this screen. Since the software isn't doing anything relative to checking cell voltages while in this mode, I wonder if a potential problem could occur.

The final thing that I saw was while charging with a few of the load resistors on, I lost power to the master due to a temporary power connection. This caused the load resistors to remain on. This condition could cause a cell to be drained significantly if the fuse blew that provides the master with its input power. I noticed that the slave software performs a check and would turn the load resistor off once the cell reached 2.5 volts. Why did you choose this low of value to turn the load resistor off?

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

Re: BMS Software

Postby retepsnikrep » Mon May 10, 2010 1:11 am

Rick

Thanks for those detailed observations.

steiner wrote:Peter,

I tested the new "check voltage" portion of the master software and everything seems to be working fine. It looks like the duty cycle for the load resistors has improved. I measured the duty cycle with a scope and it is about 88% on. I also got the individual cell display routine working. I'm just using the "ButtonA" and "ButtonB" routine for now since I am still using the version 1 of the master board.

I noted a few things that happened today and wanted to get your thoughts. I had a small problem that turned out to be a poor crimp in one of my sense leads. This caused the "cell #4 error" to display as it should. I happened to be charging at the time and several of the cells were by-passing. I noticed that when "cell error" happened none of the load resistors were on even though several of the cells were above 3.65 volts. I don't have my charger tied into the master board at this time. I notice that the software looks for any error flags and if they are present it won't allow the charging routine to start. However, I don't see any provisions for the situation if an error flag occurs after the charging routine has started.


The master software is in the middle of the data collection from the slaves at the point where you got the cell data error, and the slave loads were turned off with a command prior to sending the cell voltage request command. Only if all the cells return valid data will the loads be turned back on, so that works correctly.

If your charger relay is controlled by the BMS then that will drop out when this error occurs and require you to manually start charging again once the error is cleared/fixed. I strongly recommend your charger mains input is controlled by a BMS powered 12v relay (Mine is).

If the BMS can't control the charger either by cutting off the mains or controlling the charger output voltage via the opto, then your are crippling it's ability to intervene and protect the cells. If you don't hear or respond to the audio/visual alarm in your setup then the BMS can't do anything else to protect the cells. :cry:

steiner wrote:The second thing I noticed which was not related to above was I happened to be charging and several load resistors were on. When I triggered the individual cell voltage screen, the load resistors stayed on. They didn't have the periodic blink. I'm sure this is because the program is just sitting in the "DisplayB" routine and not updating the cell voltages. I am wondering if we need a timer to prevent someone from leaving the software on this screen. Since the software isn't doing anything relative to checking cell voltages while in this mode, I wonder if a potential problem could occur..


You are right in that the main BMS loop is not executing when the individual cell voltages are displayed. But remember this main loop also feeds the watchdog chip on the master board. If you remain in the cell voltage display mode for more than the watchdog time out period (1-2 minutes) then the watchdog will reset the BMS clearing this issue. Do you have the watchdog 08M chip fitted and working? I note the master main loop toggle watchdog led code is remmed out in your code posted a few posts above :wink:

steiner wrote:The final thing that I saw was while charging with a few of the load resistors on, I lost power to the master due to a temporary power connection. This caused the load resistors to remain on. This condition could cause a cell to be drained significantly if the fuse blew that provides the master with its input power. I noticed that the slave software performs a check and would turn the load resistor off once the cell reached 2.5 volts. Why did you choose this low of value to turn the load resistor off?


You can change that voltage to whatever you want, 2.5v was a bit low but it was just a fail safe voltage plucked out of thin air. You could set it to say 100mv less than your normal slave load cut off voltage. Then it will cut off the load much quicker.

I have ideas to improve the code for the project all the time. (Note to self. I must write them down!) I'm grateful for other ideas from others.

I would like the slaves to go into a low power mode if no commands are recieved from the master within a specified period, then wake up again later.

I now have an idea to better utilise the DS18B20 I2C temp sensors on the master.
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

Re: BMS Software

Postby steiner » Mon May 10, 2010 2:40 am

Peter,

That all makes sense and is good news. It sounds like you have each one of these issue covered once I get the complete code running. I fully intend to let the BMS control the charger. I am just slowly adding the features one by one. I need to get a new charger that has an input that will allow the BMS to reduce its current output. I also have to order the relay that will turn the charger off. This is why I currently only charge while I am present which is getting old.

Your right about the watchdog. I had trouble with it at the very beginning and just remed it out. I will work on it next to get it operational. I think I will try the latest watchdog code you wrote for the non-picaxe chip.

Putting the slaves to sleep when they are not used is a good idea. I also had it in my notes of things to do but there are so many more critical items I need to get completed first. I just wish I had more time.....

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

Re: BMS Software

Postby retepsnikrep » Sun May 30, 2010 9:40 pm

Someone e-mailed to say may be a problem with an error in Master software a few days ago can they post the details here please. Rick, was it you? Cell data error issue?

Anyway I've made a small change to the Non Picaxe Slave software and adjusted the failsafe load cut off voltage to <3.35v so that the load cuts off when the cell falls to around the normal cell resting voltage for lifepo4 which is about 3.30v.

This means if the master locks up with the slave loads turned on the cells will not be overdischarged. I had it set to 2.5v before which was bit silly. I'll post the code tomorrow. I suggest those using the current slave software upgrade to this new version. Of course the failsafe voltage can be adjusted to match you own Lithium battery chemistry.

This new code gives a window of about 300mv between the slave load turn on point which is V > 3.65V and the fail safe turn off point of V < 3.35V hopefully this is a wide enough gap so that voltage drop in the cell BMS wires does not cause a problem. Users should still use a decent gauge wire for the BMS connections and keep them a short as practicable to avoid problems with slaves sharing cell connections.

This is untested and it may be the cells still interfere with each other in which case we may have to widen the gap, but with the new master commands I hope this will all work OK.

I've also added some improved I2C temp sensor routines back into the Master software.

You can choose to use analog sensors or digital I2C DS18B20 sensors but not both at the same time. You simply rem out the check temp routine you don't want in the main loop section of the Master code. Due to display screen space constraints the software only supports two sensors analog or digital. You could have more than two I2C sensors but you can't display them on screen with the current layout. It should be possible to display the highest and lowest out of a larger number of I2C sensors so that would cover this issue. Again this code is untested but will be posted tomorrow.

Peter
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.


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 43 guests