Old BMS Software Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

martinwinlow
Posts: 79
Joined: Mon Jun 11, 2007 9:35 am
Location: Herts, UK

Re: Old BMS Software Thread

Postby martinwinlow » Fri Feb 04, 2011 6:38 pm

Peter, Looking at the schematic, it appears the Master Bus is in parallel and the Slave Bus is in series implying that if I moved the Slave bus connection temporarily to the first of the next 4 slaves on test that the system would recognize them and work correctly, yes? MW
Regards, Martin Winlow
Herts, UK
http://www.evalbum.com/2092
www.winlow.co.uk

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 Feb 04, 2011 6:57 pm

martinwinlow wrote:Peter, Looking at the schematic, it appears the Master Bus is in parallel and the Slave Bus is in series implying that if I moved the Slave bus connection temporarily to the first of the next 4 slaves on test that the system would recognize them and work correctly, yes? MW


Yes that will work. Be careful where you connect :shock: Don't want to blow the optos.
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
dillond666
Posts: 139
Joined: Mon May 26, 2008 7:52 pm
Location: Central Scotland

Re: Old BMS Software Thread

Postby dillond666 » Fri Feb 04, 2011 8:08 pm

Peter said,
If we could eliminate or reduce it to less than say 25-50mv then it would be possible to go back to a much simpler and faster version of the slave/master code which would return balancing time to the full 350ma.

Here is the wire I'm using for the connecting leads.
http://www.rapidonline.com/Cables-Conne ... able/62327

Doing some testing I get the following results:
Leads were 2 metres long, load was a 33R 7W resistor
12v = 359mA = 20mV drop per lead = 40mV drop due to leads overall
2.74v = 80mA = 4.5mV drop per lead = 9mV drop due to leads overall
If we take these currents to represent the BMS in the shunting and non shunting modes we get a difference of 31mV when shunting 359mA.
Perhaps the 31mV could be factored into the calculation of the slave depending on whether the slave is shunting or not?

Note: The psu I was using wouldn't go lower than 2.74v, I realise the 80mA is more than the slave will probably use.
It's also possible the leads might be shorter than 2 metres each.

This should give an idea of what we're dealing with. :wink:

Derek

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 Feb 05, 2011 5:24 pm

Here is a snippet of code to give an approx 5 second program loop when the charger is operating.

Alarms = 0 'Reset Alarms to 0 (Clears any Alarms)

if ChgBit = 1 then 'Checks if charger is operating
pause 4000 'Pause for 4 seconds
endif


goto mainloop 'Goto main program loop



Just add the bit in bold at end of main loop before it goes back to start another loop.
This should greatly increase balancing efficency, and does not effect system when charger is off when loop operates at max speed.

In fact thinking aloud we could disable balancing when in normal operating mode :wink: which would mean cell voltage updates and all the main loop stuff would be much faster, as we only have to send one command to the slaves instead of three! We still have the warnings/alarms if a cell is going over voltage. The effect of the balance resistor is negligible in regen scenarios anyway, plus the slaves still have the built in fail safe over voltage load trip.. I'll add this code as well asap!! Good progress I like it.

So in normal operating mode when first switched on master just sends load off Command 2 once, then Command 1 Get cell voltage ad infinitum.

Only when in charge mode, and only then at 5 second intervals does it send the load on/off commands. I like it 8)
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.

jackbauer
Posts: 19
Joined: Wed Jan 26, 2011 8:38 pm
Location: Ireland
Contact:

Re: Old BMS Software Thread

Postby jackbauer » Sat Feb 05, 2011 8:47 pm

I think that would greatly help the soc calcs as the loop time for a given number of cells should be reasonably constant and measurable. One thing regarding wh/mile can we use the motor power number for that calculation?

martinwinlow
Posts: 79
Joined: Mon Jun 11, 2007 9:35 am
Location: Herts, UK

Re: Old BMS Software Thread

Postby martinwinlow » Tue Feb 08, 2011 6:26 pm

Hi peter, I just posted a connection diagram for my LEM Current Transducer HTFS 400-P/SP2 on the Hardware thread... can I confirm that to get it to read right (subject to a little tweaking maybe) the relevant line of code that needs changing in the subroutine calculatesoc is 'BatCurrent = ((Offset - BatCurrent) * 2) / 10' and I need to substitute '* 8' for '* 2'?

Sensor datasheet.. http://www.lem.com/docs/products/htfs_sp2_e.pdf ... 'HTFS400P/SP2 PCB current transducer' available from RS part no 532-9249 at £11.76.
Last edited by martinwinlow on Wed Feb 09, 2011 3:36 pm, edited 1 time in total.
Regards, Martin Winlow
Herts, UK
http://www.evalbum.com/2092
www.winlow.co.uk

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 » Tue Feb 08, 2011 6:38 pm

Lets us know what it reads as is with a constant 1 or 10A flowing then we can work it out.

Please post link to the sensor datasheet.

Edit

Your formula looks like it will give approx -400 - 0 - +400 range. It's actually 408A in each direction with that maths, but might be able to tweak the maths a bit later.
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 » Wed Feb 09, 2011 6:47 am

OK new code seems to work :D

Attached is latest code selection. We now have another submenu in master.

This allows you to toggle on/off the pc logging option and the remote display tx option. These are off by default for faster loop time. When in charge mode the cell voltage is checked every 5 seconds to allow maximum balancing time within current slave timeout limits. The slave included with this download has a 10 second timeout so the master could have an even longer balancing time if reqd.

You do not have to update slaves to use the new master software.

I may well add a few more options to the new menu later.

Lost a whole day farting around with that transposition error on the pins. :evil: The soc should now be accurate with luck during charge and discharge. I'm going to rewrite/tidy up the master code as it's now a bit messy. But i'm happy enough to leave my car charging unattended 8)

If you are going to use the new master code then you must also use Greg's watchdog 1S pulse software and connect a 1k resistor between pin 7 on the watchdog pic and pin 9 on the master pic. The resistor limits the current in case you get it wrong or the pic pins get out of sync somehow :shock:

Edit Important

File removed due to below Alarm failure issue.
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 » Wed Feb 09, 2011 8:27 am

Oops charger did not switch off when cell went over abs cellV max :shock: I was monitoring it at the time though!

Caused by the new master code. The alarms normally need to occur for a number of consecutive loops to avoid glitches driving you mad (3 currently), as we are bypassing loops when charging the alarms got cancelled Duh!!

I have now added a line of code which causes alarms to trigger on first occurence if charge bit is set. This makes it more sensitive during charging which is better IMO.

Only when chg bit is off (when driving) are a number of consecutive alarms reqd for master to trigger warning.

We should be able to add a few more functions now we have the timer working. Things like

1) Estimated time to complete charge.
2) Charger time limit.
3) Charge duration.
4) WHr /Ah charged.

Edit

:) Seems OK now

FYI for my A123 20ah cells I have set slave balance cut in voltage as >3.55v and abs max cell voltage as >3.66V.
The charge cutback opto operates at >3.60

Remember the slave and master cut in voltages must be the same. The master uses the slave load turn on point to set a bit saying that cell is charged. Once all cells reach the load voltage then charge will terminate. #

So if you adjust the load turn on point in the master you must use the command system to adjust the load turn on point in the slaves.

I did this by sending the set default voltage command 6 which is 3.65v so all slaves are reset, and then sending command 5 twice which reduces the cut in point by 50mv each time.
Attachments
BMSFiles090211Updated.zip
(38.64 KiB) Downloaded 301 times
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.

jackbauer
Posts: 19
Joined: Wed Jan 26, 2011 8:38 pm
Location: Ireland
Contact:

Re: Old BMS Software Thread

Postby jackbauer » Wed Feb 09, 2011 7:33 pm

Up and running on the bench. I did my usual mods to the socunit and i2c temp reading parts. I also went back to the old current routine as i'm using a lem hass 300s at +/- 500amps. I'm sure the new routine could be made to work with this part but just want to get it on test. Still got the timer in the top right but the "M" is not flashing anymore.


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 16 guests