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:

Postby retepsnikrep » Tue Aug 04, 2009 3:36 pm

GregsGarage wrote:
retepsnikrep wrote:Any not too hard additional features reqd. :?


How about a motor rpm input. A software routine could be added that prevents the motor from over-revving.


You could do that with the current Master Using one of the spare old button inputs a hall effect sensor, magnet and the 'Count' Command.
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 Aug 05, 2009 4:29 am

New version of Master due later today.

Current Counting routine was total cobblers :roll:

I did some manual calculations and it was all over the place :oops:

I've finally got it sorted i think :)

Def going on longer test run in pm as well.
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 Aug 05, 2009 7:22 pm

Tidying and some final testing today.

Vehicle speed mph and odometer now work 8)
Still not quite sure about Ah counting need to look back at some of my older versions :?
Some pics of various BMS screens. Vehicle stationery.
No unwanted errors now!!

www.solarvan.co.uk/bms/BMS050809001.jpg
www.solarvan.co.uk/bms/BMS050809002.jpg
www.solarvan.co.uk/bms/BMS050809003.jpg
www.solarvan.co.uk/bms/BMS050809004.jpg
www.solarvan.co.uk/bms/BMS050809005.jpg
www.solarvan.co.uk/bms/BMS050809006.jpg

I'll post Master when it's done. Bug hunting certainly takes time. I've also gone through so many versions of the Master software I'm going to re-number them from the start, so the first one I start to use in earnest in the car over next few days will become V1.00.

I have allowed it to do an unattended charge cycle now so I'm much more confident. When an Alarm conditon occurs you get the audible alarm and negative screen with details etc.

The screen remains negative until the BMS is reset so you know an Alarm has occured perhaps while system unattended. I'm working on storing last few alarms now so you can recall them via another screen.

The BMS control buttons are shown in little cubby hole under radio in dashboard. Grid on screen pics is photo artefact :roll:

The Zivan charger is controlled in three ways.

1) It's own internal alogorithim, it is adjusted to 180v max CV output.
2) Via BMS and opto isolated voltage pull down opto.
3) Via BMS and charger mains control relay.

The voltage pull down is operated when any cell goes over 3.75V

The charger mains relay is cut if any cell goes over 3.80v, or if either battery pack goes over Max Temp, or if there is a serial comms problem.

At the end of todays charging cycle the BMS did not need to take control at any time 8) as the Zivan just finished it's normal cycle. All cells were within indicated 20mv at end of charge.

I'm using the two analog lm335 sensors as well now. Others may be OK with the I2C ones but I have so much emi to overcome that was difficult.
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 » Thu Aug 06, 2009 10:54 am

Peter,

Having a look at the latest master version that you posted and thinking about the ah problem. How about using the timer inside the CheckCurrent routine. What I am thinking is after you read BatCurrent read the timer value and store this for the next time the program loops. You then subtract the current timer value from the previous timer value of the last loop. You can then directly calculate amps per millisecond since the last cycle (you may need to adjust timer tick rate). It should then be possible to simply add (or subtract) the amps per millisecond and then once per minute convert to Amp hours. Hope that makes sense. :wink:
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 » Thu Aug 06, 2009 12:33 pm

To be honest Greg I think it's pretty much sorted now anyway. I've been fiddling with variables for ah counting and speedometer all morning, now got both to be about as accurate as I can.

Speedo agrees with car now +/- 1mph. Ah counting now working OK.

Of course the speedo and alarm counting routines etc will all need to be adapted depending on what others use for the sensors etc.

I've also added an alarm count loop in case of erroneous alarms. An alarm has to occur a number of times in a row before the Alarm subroutine is called. You can specifiy how many. I'm using 3. So the program must loop three times returning an Alarm condition before the alarm sounds. 3 loops on the move only takes about 2 seconds so I'm happy with that response rate. As the system gets more stable I can tweak that number down.

I was getting the very odd eroneous error/alarm so I added this as a double/treble check. Most won't need it.

I would say the software is now fit for the masses 8) In fact here is my working Master & Slave code :D

www.solarvan.co.uk/bms/MASTER_SERIAL_06 ... 00BAUD.txt

Slave code still as the other day.

www.solarvan.co.uk/bms/SLAVE_SERIAL_020 ... 00BAUD.txt

Car is sat outside charging as we speak. :lol:
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 » Thu Aug 06, 2009 2:17 pm

O.K. I had the idea while looking at Arduino code samples. The Arduino has a function millis() which returns the number of milliseconds since the program started. The example showed using millis() inside a loop to measure how long it takes for 1 loop. Once you know how long it has been since the previous measurement it is then easy to calculate amp hours used.

Glad you got it working though!


retepsnikrep wrote:At the end of todays charging cycle the BMS did not need to take control at any time 8) as the Zivan just finished it's normal cycle. All cells were within indicated 20mv at end of charge.


I think this shows that massive balancing currents are not required. 8) If the cells can't balance with just a small bypass current then you have a problem that needs investigating. :shock:
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 » Fri Aug 07, 2009 10:17 am

Still tweaking odd bits of code.

Improved accuracy of odometer using some scaling x 10 to maximise 16 bit maths.

Adjusted variable values for temp sensors to compensate for individual variances in my sensors.

Might add some hysteresis to the charger control opto as when the first cell reaches the opto turn on point it hunts a bit at the minute. Or might just make it a one time trigger, once triggered opto stays on holding charger voltage until cycle finished, have to see how that works. :?:
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 Aug 07, 2009 1:03 pm

retepsnikrep wrote:Might add some hysteresis to the charger control opto as when the first cell reaches the opto turn on point it hunts a bit at the minute. Or might just make it a one time trigger, once triggered opto stays on holding charger voltage until cycle finished, have to see how that works. :?:


Is the "hunting" causing any problems with the charger? Another option would be to turn on the opto for something like 5 seconds at a time.
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 » Fri Aug 07, 2009 1:13 pm

GregsGarage wrote:
retepsnikrep wrote:Might add some hysteresis to the charger control opto as when the first cell reaches the opto turn on point it hunts a bit at the minute. Or might just make it a one time trigger, once triggered opto stays on holding charger voltage until cycle finished, have to see how that works. :?:


Is the "hunting" causing any problems with the charger? Another option would be to turn on the opto for something like 5 seconds at a time.


Not particulary but sounds naff as fan speeding up and down as / voltage current goes up and down as opto goes on/off. As you say might use a timer, It's not a major issue.

Here is latest Master code. This has another function in that it tells you which cell is highest/lowest as well as what voltage they are.

www.solarvan.co.uk/bms/MASTER_SERIAL_07 ... 00BAUD.txt

I have also removed the extra Alarm code I put in yesterday and test drive was fine. So it will now give an alarm the first time an error occurs rather than waiting for an error to occur a number of times before triggering.

Three more pics.

One on the move :shock: me jugling camera and bimbling along at 30mph with a bit of assist!

www.solarvan.co.uk/bms/BMS070809006.jpg

One charging on the drive.

www.solarvan.co.uk/bms/BMS070809001.jpg

One showing layout in car. Buttons in cubby hole under radio. Screen on dash just like GPS.

www.solarvan.co.uk/bms/BMS070809003.jpg
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 Aug 07, 2009 3:30 pm

retepsnikrep wrote:Not particulary but sounds naff as fan speeding up and down as / voltage current goes up and down as opto goes on/off. As you say might use a timer, It's not a major issue.


How's this for an idea? When you get a high voltage warning from a cell, store the current charging amp rate in a variable, that we could call say, MaxChgAmp. Then use the opto to not only control the charger when a cell voltage goes to high, but also if the charging current goes above MaxChgAmp. Then every time you get a high cell warning you check the amp rate and if the new rate is lower than MaxChgAmp you then set MaxChgAmp to the new lower rate. If you get 2 warnings at the same amp value then you could decrease MaxChgAmp by say 0.5 amps.

Here is latest Master code. This has another function in that it tells you which cell is highest/lowest as well as what voltage they are.

Cool 8)


Three more pics.

One on the move :shock: me jugling camera and bimbling along at 30mph with a bit of assist!

Just so long as you didn't take those with your phone as that is not allowed ! :lol: :lol:

What value are you using for R8 on the master board. You said you had changed it from 10K to 510R when you were using the pulse method, how about now that you have gone back to serial data.? I am making a note of the changes on a schematic. :shock:
Greg Fordyce

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


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 22 guests