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:

An obscure potential software problem.

Postby retepsnikrep » Mon Jan 11, 2010 12:43 am

Long Long ago in a thread far far away we used the ADC 0-1023 10bit readings directly to speed things up for low power software. This early example will rings a few bells.

http://www.solarvan.co.uk/bms/SlaveAnal ... _v1_13.txt

Now I have implemented the 100x adc oversampling and we have the compiled code I can see the possibility for an obscure bug at very low cell voltages < 2.00v

In the example given in the above software the ADC reading for a cell at 1.92v is given as 650.

650 x 100 = 65,000 and the limit for the word variables is 65535.

So I would say the absolute minimum voltage the software will read is around 1.90v any lower and the variable will overflow giving an incorrect high voltage reading which will generate an error at the Master anyway.

Just for your info really. I don't intend to address it.
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.

mcudogs
Posts: 16
Joined: Sat Jan 09, 2010 8:31 am

Postby mcudogs » Mon Jan 11, 2010 9:27 am

Hi All,

I finally got my login to work, many thanks to Tim.

The FRC or free running clock is an internal RC oscillator dedicated to the A/D whose frequency varies with VDD. In that mode, if the device main clock is above 1 MHz the interference caused to the A/D conversion by the main clock transitions makes the A/D result unreliable. If you select a divisor of the main clock source as the A/D clock source the comparisons are timed to coincide with a quiet part of the clock cycle ie half way between transitions. The other option to get reliable results is to do the conversions during sleep mode using the FRC as A/D clock source. In sleep mode the main clock is not operating.

I had a closer look at your circuit regarding the impedance issue. It really only becomes an issue when the sampled voltage is changing, as the internal sample and hold cap has to charge from the source impedance. The sample and hold cap will hold most of it's charge in between conversions. In this circuit the A/D input is always connected to the same voltage source so the cap will not have to charge / discharge much and the impedance of the source should not matter greatly.

I've been thinking a bit more about the problem with adjacent cells switching when a load is switched on. Do we really want the load to switch off if the battery is being charged? I would think that if a cell reached its bypass voltage it should stay in bypass until the charge cycle was terminated. If you just do a balance without charging you would want the load to turn off when the voltage dropped to the turn off point. It would mean a new command to put the slave into charge mode.

Don

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

Postby GregsGarage » Mon Jan 11, 2010 1:39 pm

mcudogs wrote:I've been thinking a bit more about the problem with adjacent cells switching when a load is switched on. Do we really want the load to switch off if the battery is being charged? I would think that if a cell reached its bypass voltage it should stay in bypass until the charge cycle was terminated. If you just do a balance without charging you would want the load to turn off when the voltage dropped to the turn off point. It would mean a new command to put the slave into charge mode.

Don


Hi Don, thanks for the explanation of the free running clock. Regarding the loads switching on and off, that is probably a good point, is there any reason for them to do this?. My experience with the first analog version of the slaves is that they would start switching on and off for a bit before they stayed on. It was never a problem with them mounted on the cells, so no-one thought much of it. If we want to prevent the behavior though it can simply be addressed by widening the gap between load on and off, I think Peter has already done this. A bit of experimenting to find the best value would be needed, but no new commands need to be written to do this. 8)

Another thing we could do is to lower the load on value at the start of the charge to say 3.4 volts. When you then have a certain percent of the cells reach 3.4 volts start to increase the load on value gradually until you get to 3.6 volts and then leave it there. This will allow some extra balancing on the lead cells that they would not otherwise get.

For balancing in general, my personal view is that there is no point in making sure every cell gets perfectly balanced every time. The capacity of the pack with this system is going to be determined by the cell with the least capacity. As long as that particular cell gets fully recharged, any further balancing will have no effect whatsoever, you will never get any more capacity out of the pack. Of course the only way to know if this is the case is to fully discharge your pack, which you may never do, so Peters method of doing a balance charge every 3-4 months with a 350ma CC supply is an idea I will use as well.
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 » Mon Jan 11, 2010 2:10 pm

GregsGarage wrote:Another thing we could do is to lower the load on value at the start of the charge to say 3.4 volts. When you then have a certain percent of the cells reach 3.4 volts start to increase the load on value gradually until you get to 3.6 volts and then leave it there. This will allow some extra balancing on the lead cells that they would not otherwise get.

For balancing in general, my personal view is that there is no point in making sure every cell gets perfectly balanced every time. The capacity of the pack with this system is going to be determined by the cell with the least capacity. As long as that particular cell gets fully recharged, any further balancing will have no effect whatsoever, you will never get any more capacity out of the pack. Of course the only way to know if this is the case is to fully discharge your pack, which you may never do, so Peters method of doing a balance charge every 3-4 months with a 350ma CC supply is an idea I will use as well.


In my experence with the digital system and the highpower cells for over a year now they are all damm well balanced without much effort. We may end up chasing our tails to make the system perfect when that's not required.

I quite like the idea of bringing the load on a bit earlier I'll think about that.

I've removed all my load resistors in preperation for installing either 50ma or 100ma ones. The board won't stand more than one unsoldering without getting messy so I have to get it right now :shock: I'll probably play safe and use the 50ma ones. My cells are only 8ah so 10hrs would give a 500ma adjustment. 7-8% of capacity.

I think if Greg uses decent wire and keeps leads short as possible he may get away with the 350ma loads, have to see :oops:

Anway some tidied up software (Comments and corrections)

Master still has an issue with random resets can't see anything obvious I'll keep looking. I'm sure it will be some sort of stack / gosub problem.

www.solarvan.co.uk/bms/MASTER_8MHZ_1101 ... UD_I2C.txt

www.solarvan.co.uk/bms/SerSla21.txt
www.solarvan.co.uk/bms/SERSLA21.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:

Postby retepsnikrep » Mon Jan 11, 2010 2:18 pm

mcudogs wrote:I've been thinking a bit more about the problem with adjacent cells switching when a load is switched on. Do we really want the load to switch off if the battery is being charged? I would think that if a cell reached its bypass voltage it should stay in bypass until the charge cycle was terminated. If you just do a balance without charging you would want the load to turn off when the voltage dropped to the turn off point. It would mean a new command to put the slave into charge mode. Don


That would be good if you could also immediately switch your charger to cc mode (same output as bypass resistor) as soon as the first slave hit the bypass point. The Master can detect this point as it knows the default slave load on/off points (unless you alter them with the commands).

Then it would not matter if the charger stayed on add infinitum. The others cells would all slowly catch up with the ones that were bypassing.

That's basically what I do with my 3-4 months cc 250ma balancing charge on my current car. Set charger to 250ma and leave it a few hours. 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.

mcudogs
Posts: 16
Joined: Sat Jan 09, 2010 8:31 am

Postby mcudogs » Tue Jan 12, 2010 9:52 am

The charger I am using has an optional CAN bus interface for full control from a BMS. It wouldn't be too hard to implement a CAN interface off the Master.

I have had a look at the master bus communications and I think it can be improved by lowering the source impedance and increasing the current to about 20mA. This should make it a lot more resistant to interference. Ideally this bus should be CAN or isolated RS485. Have you had any issues with data errors on this bus? It would probably not be evident on the bench but when you put it in a car and run the bus from the front to the rear of the vehicle as I will be doing there could be errors. It is also not a good idea to connect a micro input pin directly to an external bus which is susceptible to interference. This can cause processor lock ups and resets due to the input pins of the processor going above VDD or below GND. A simple solution would be to opto couple the bus to the PICAXE.

With changing those resistors, you could use these pcb pins (farnell 1183354)and then solder the resistors to the pins making them easier to change later.

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

Postby retepsnikrep » Tue Jan 12, 2010 2:05 pm

Feel free to modify it as you wish, please post your results.

I had a lot of trouble with interference on the master bus initially in my Car (Insights are a noise nightmare) however that was cured by the varistors and a bit more filtering. As you say some zeners and diodes to prevent the bus straying outside Vdd & Gnd etc are a good idea. Another layer of opto isolation at the master end is another idea. I suggest use twisted pair screened wire for the master bus connections. More current might be better as well.

I make no claims about the merit of the initial design or software it's just what I came up with after a lot of reading and input form others. I have no electronic/computer qualifications whatsoever. I'm a Police Sergeant who enjoys tinkering in the shed.

I think it's important to use the latest version of the picaxe editor program when uploading to the Master. The latest version is 5.27. That may be cause of my Master program crashing when uploaded with an older version! I've just installed the latest editor and re-uploaded it as I can't see any obvious errors. Have to see if it is stable now. :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.

mcudogs
Posts: 16
Joined: Sat Jan 09, 2010 8:31 am

Postby mcudogs » Wed Jan 13, 2010 2:51 am

retepsnikrep wrote:Feel free to modify it as you wish, please post your results.

I had a lot of trouble with interference on the master bus initially in my Car (Insights are a noise nightmare) however that was cured by the varistors and a bit more filtering. As you say some zeners and diodes to prevent the bus straying outside Vdd & Gnd etc are a good idea. Another layer of opto isolation at the master end is another idea. I suggest use twisted pair screened wire for the master bus connections. More current might be better as well.

I make no claims about the merit of the initial design or software it's just what I came up with after a lot of reading and input form others. I have no electronic/computer qualifications whatsoever. I'm a Police Sergeant who enjoys tinkering in the shed.

I think it's important to use the latest version of the picaxe editor program when uploading to the Master. The latest version is 5.27. That may be cause of my Master program crashing when uploaded with an older version! I've just installed the latest editor and re-uploaded it as I can't see any obvious errors. Have to see if it is stable now. :roll:


I am by no means criticising your design, just offering my expertise from 30 odd years of experience in this field. I think what you have produced is amazing for someone with no training in electronics. This design really has it all and at an affordable price.

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

Postby retepsnikrep » Wed Jan 13, 2010 3:12 am

No offence was taken, I think you might have seen my roll eye smiley as a comment about the whole post, it was about my problem with the Master code. :lol: i.e. A reflection on my useless abilities as a programmer to work out why the Master was crashing. :wink:

I/We are very glad to have you or anyone else on board. If you can make it better in any way then great!

E-Mail and forums are a funny medium it's easy to misinterpret without the aid of non verbals etc, and when we come from different countries where subtle differences in language can cause :oops:
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 » Wed Jan 13, 2010 3:52 am

mcudogs,

You had mentioned that your charger has a CAN bus interface to connect to a BMS. Would you mind saying what brand of charger you are using? I am looking at a charger that also has a CAN bus interface and didn't know how difficult it will be to create some code to communicate with it.


Return to “BMS thread”

Who is online

Users browsing this forum: No registered users and 5 guests