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: Old BMS Software Thread

Postby retepsnikrep » Fri Sep 24, 2010 6:00 am

Go for the newest versions then we know where we are with testing.
Any improvements are only made to the newest versions.
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: Old BMS Software Thread

Postby retepsnikrep » Fri Sep 24, 2010 4:23 pm

GregsGarage wrote:If I understand the soc routine, you are directly converting battery current into soc. Maybe it would be easier to calculate ah used and compare that to battery capacity to calculate soc. This may also make wh/mile easier to calculate as well.

For example, the program loops once a second, so every second you add or subtract the amp value to the total giving you a running amp/second value. Store pack capacity as a amp/second value (100ah = 360,000 amp/seconds) and you can directly compare the 2 values. Hope that makes sense, what do you think?


I quite like the amp seconds solution but sadly the limit for pic word variables is 65335 and we can't use PBL (long) as we are not using a Pic 18 device.

As the main program loop will be quite stable when polling the cells we can just add any reqd delay to make the whole loop take a second. Not elegant I know, but it should be fine. I need to upgrade my 50 slaves now to try the new code in earnest. Possibly later next week I may get some time :roll:
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:

Re: Old BMS Software Thread

Postby GregsGarage » Fri Sep 24, 2010 7:50 pm

retepsnikrep wrote:I quite like the amp seconds solution but sadly the limit for pic word variables is 65335 and we can't use PBL (long) as we are not using a Pic 18 device


I think we can still use amp/seconds. We need 2 word variables, an AmpSecond and AmpHour (actually AmpHour/10) variable. We display the AmpHour variable and adjust it using the AmpSecond variable. Since 1 amp hour = 60 amp minutes = 3600 amp seconds and we want the AmpHour to be accurate to the tenth of an Ah so 0.1 ah = 6 amp minutes = 360 amp seconds. So every time through the loop we add or subract the amp value to AmpSecond, then check if it has gone above 360 or below -360. If it has then add or subtract 360 from AmpSecond and increment/decrement AmpHour by one and display new value. How does this sound?
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:

Re: Old BMS Software Thread

Postby GregsGarage » Sat Sep 25, 2010 3:18 pm

Quick update. I've got 32 cells working with my 2x 16 cell slaves and the latest software. So far no problems, just need to wire up my last 2 small battery boxes to test the complete system.
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:

Re: Old BMS Software Thread

Postby retepsnikrep » Sat Sep 25, 2010 4:46 pm

Excellent 8) Let's have a few pics please.
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:

1 second timing loop.

Postby GregsGarage » Mon Sep 27, 2010 8:32 pm

retepsnikrep wrote:... scope the master watchdog pulses ...

Peter, something you said gave me an idea on how it may be possible to force the master program to loop only once per second. It should be possible to get the watchdog pic to time this and send a signal to the master once a second. At the moment the master toggles a pin connected to the watchdog every time through the loop. It should be possible to use this link between the master and watchdog to send signals both ways, or the ugly solution is to add a wire jumper between unused pins on the master and watchdog, ugly but may be easier on the software side. Changes to the master software are minimal, just need to add a loop somewhere that waits for the 1 second signal. Since the watchdog program is fairly small, it should be easier to code without breaking something else. I will have a look at some timer examples that I have found on the internet and give it a go.

P.S. hope to post some pics soon.
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:

Re: Old BMS Software Thread

Postby retepsnikrep » Mon Sep 27, 2010 10:02 pm

Good lateral thinking Greg.

But means we have to keep changing input to an ouput and vice versa on the chips to listen/send to each other on that single line. Not so easy :(

I simply think get the stopwatch out, time how long the master takes to do thirty high/low pulses with all your cells and add a delay.
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:

Re: Old BMS Software Thread

Postby GregsGarage » Mon Sep 27, 2010 10:29 pm

retepsnikrep wrote:But means we have to keep changing input to an ouput and vice versa on the chips to listen/send to each other on that single line. Not so easy :(

Agreed, but on the watchdog, pins 2 and 7 are unused, they were for the picaxe programming header and on the master X1 (resonator) is unused so this gives us access to pins 9 and 10 on the master. It's a simple matter to run a single jumper wire which gives us a second line between the watchdog and the master.

I simply think get the stopwatch out, time how long the master takes to do thirty high/low pulses with all your cells and add a delay.

My goal is to have a simple routine in the watchdog that would require minimal changes to the master software. It should be a simple matter to comment out your delay and add a loop that waits for a timing signal from the watchdog and easily revert back if it doesn't work. :shock: BTW how accurate is the speed and distance measurements, I noticed they also require a 1 second timer?
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:

Re: Old BMS Software Thread

Postby retepsnikrep » Mon Sep 27, 2010 10:52 pm

GregsGarage wrote:BTW how accurate is the speed and distance measurements, I noticed they also require a 1 second timer?


As accurate as our one second timer and the maths associated with the code. My mph is within 1mph of my oem speedometer. Odometer is within 10%. WH mile is all over the place :roll: I hate that part of the code and am highly tempted to scrap and remove it. I'm not clever enough with the maths :oops: It could be greatly improved no doubt.

Any sort of BMS alarm or pressing of the menu button immediately screws up the calculations anyway if the one second loop is interupted/delayed.

Have ago at your watchdog idea if you want of course.

Been playing with a simple opto controlling the voltage of another modifed charger today, driving the opto led via 5k pot 3v battery. Works well adjusting output voltage up and down. But needs HPWM facility if we are to implement it on the Master, which I don't believe we have sadly on the charger control opto ouput pin :( Something else for V3 careful choice of pic pins. I'll check this.

I intend to spend a bit of time now getting the remote display and data dumping to a PC sorted. The remote display will not support data dumping in future, it uses too much code space. it will be a simple visual indication / alarm.

Dumping BMS data will be/is done by the redundant master programming port and picaxe usb lead direct into an excel speadsheet. This allows much higher comms speed for a start.

I haven't tested any of the dumping/remote code since we moved to pbpro!!
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:

Re: Old BMS Software Thread

Postby GregsGarage » Tue Sep 28, 2010 4:20 pm

Peter,

I'll have a go at the watchdog code while you are working on the remote display and data dump routines. Then we can look again at the ah, soc, etc. I can't make any promises, lots on at the moments, we are busy with some work on the house that involves moving the stairs, :shock: but will see what I can squeeze in.

The idea that I have is for the watchdog to toggle one of the extra pins once a second. In the master routine just before it toggles the watchdog output it will wait for the watchdog to toggle it's pin, then the master will reply with it's existing toggle. I'll add timeouts so the program won't hang if it doesn't receive a toggle. If you do add a pause, put it before the watchdog toggle.
Greg Fordyce

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


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 14 guests