Old BMS General Thread

Threads relating to the BMS system begun by Peter Perkins

Moderators: GregsGarage, retepsnikrep

MindMil2
Posts: 9
Joined: Wed Oct 29, 2008 5:44 pm
Location: Lithuania

Postby MindMil2 » Wed Oct 29, 2008 6:27 pm

retepsnikrep wrote:...No unforseen errors and cells are all within 40mv of each other according to the bms, which is about the limit of it's resolution. Spot checks with dmm put them bit closer than that but BMS can't resolve it. ...


Peter, I've been watching your progress and was impressed what results can be achieved with simple approach and consistent work.
I am working on my Honda HR-V conversion to DC powered EV. So far waiting for the motor and ThunderSky LFP90 batteries to arrive and designing my own Battery and Car Management System.
I like your approach and designed similar Battery Module which I plan to assemble and test on the desk soon and then go ordering PCBs and components.
Basic schematic is here http://www.sklandymas.lt/EV/BatteryModule_v2.png
These modules will be connected in daisy-chain. The lower cell module serial out connected to upper cell serial in. In this way the serial input is the input of lowest cell and output is serial output of highest cell connected to BMS master through optocouplers.
I've written the module software in assembler which is working on PIC PC simulator.

I've noticed that you are using the following formula for battery voltage measurements:

CellV = RefVADC *25 / CellA * 100 / 25
where RefVADC = 1270

This formula inherently gives a measurement rounding error which could be reduced by optimization therefore increased accuracy.
In my assembler code I use the transformed initial formula optimized for using maximum possible accuracy from 2byte Word operations:

CellV = RefVADC * 100 / 2 / CellA * 2

As RefVADC is constant 1270 this yields simplified formula:

CellV = 63500 / CellA * 2

The advantage is that multiplication by 2 is simple a bitwise shift left.

Hope it helps.

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

Postby GregsGarage » Wed Oct 29, 2008 9:06 pm

retepsnikrep wrote:I'm letting the cells capacity drop down a bit before I fit them to the car as the Insight will try and force charge them straight away to work out the SOC for it's oem system. You can't really prevent this so I need a couple of ah headroom for the install in December.


Interesting to see what the Insight makes of the SOC of a lithium pack as they have different fully charged characteristics than a NiMH pack. If I remember correctly NiMH actually has a voltage drop when it reaches full charge where as Lithium have a sharp voltage increase when they reach full charge. Let me know if I am wrong about this, or maybe the Insight determines SOC using a different method.
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:

Oh Lot's of questions

Postby retepsnikrep » Wed Oct 29, 2008 11:33 pm

Greg. The Insight Battery Contol Module (BCM) is not that well understood and the code it runs is not available. It has 10 individual voltage sensor wires which measure the voltage of each pair of subpacks (There are 20 subpacks in an insight battery, each consisting of 6 cells in series)

It also measures battery current in and out, and has a number of temp sensors, so we believe it works using columb/ah counting and voltage measurements. Others have attached more packs in parallel with the first and it does seem to allow the extra capacity to be used. No one ASFAIK has replaced the pack with one which has 10x the available capacity.

The BCM may get confused, we shall see, but we are hoping it relies more on voltage measurements to determine soc then ah counting. Nimh cells do have a voltage knee when they reach full charge but it is vey small say 3-5mv per cell. Also the Insight only allows the Soc to vary between about 20-80%, so it should never see the voltage dip at full charge.

It's SOC algorithm is certainly complex but it seems to work reasonably, the achilies heel appears to be cell balancing, as the Insight oem system has no balancing ability/system. This leads to a gradual imbalance and poor performance or IMA errors.

Poorly performing insight nimh packs have been rejuvenated by manually balancing them out of the car using a smart nimh charger on each subpack in turn. A laborious time consuming but valuable procedure.

One of my future projects is the injection of a small balancing current down the sensing wires of a standard Insight battery pack to ensure correct balance is maintained. :shock:


Mindaugas.

Nice to see your input on the thread thanks. I'll have a look at your formula and see how it works out.

Seem's interesting using windows calculator and decimals 8)

But Picaxe is limited to Integer only maths :(

Are you using some floating point maths routines?

Can you tell us what the resolution is using your formula with integers only, and what you see on the bench/simulator in terms of MV accuracy compared to your DMM/simulated input/supply V.

The minimum resolution for my formula is about 40mv, and the result varies by that amount as the voltage changes in use.

I see in your schematic you have a Picaxe shown, are you actually using a Picaxe and the associated editor software or the virgin pic chip and some other software? The schematic looks like it was drawn using VSM? Can you post a link to your assembler code and schematic source so we can have a look at it/play with it . I'm sure to learn something from that.

On your schematic I noticed a few things.

1) You don't have any pull down resistors on the fet inputs. They are recommended or they may not switch off correctly even if you toggle the Pic output low.

2) An led indicator in parallel with the load resistor is useful as a visual indicator the load is operating.

3) You may well be able to increase the value of R2 considerably and still get a reliable ref voltage. The 22K I used does mean a steady current drain of about 200ua.

4) Choose your pins carefully on the Pic as some functions are not available on all of them.

5) In your system I assume cell voltage data is passed from chip to chip and eventually to the master. Is data appended by each chip to a data stream. So the last pic has to transmit 20 or 30 cells worth of data?

Keep at it looks good.

Peter
Last edited by retepsnikrep on Thu Oct 30, 2008 11:57 am, edited 1 time in total.
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 » Thu Oct 30, 2008 11:51 am

More about buttons. The ones you press, not chocolate ones sorry :(

I'm moving over to the below design for a keypad/menu/bms buttons.

The present Master software uses 5 buttons.

A interesting read and much simpler for the Picaxe. You can use as many simple buttons as you like or some of the more complicated matrix based designs.

I'll be using the simple 5 button variant. Which means 2 lines of code instead of the current 20 :shock: Roger/Greg/Mike, I suggest do your buttons to this new design. You will be using one of the spare ADC inputs on the Master board now and not the old labelled button input. Which can be used for something else when we think of it :shock:

http://www.lancer3.com/ADC%20Keypad.htm

Edit Broken it now :roll:

http://www.youtube.com/watch?v=Cwuyf6dc3gk
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.

mikep_95133
Posts: 28
Joined: Thu Sep 25, 2008 6:38 pm

Postby mikep_95133 » Thu Oct 30, 2008 4:40 pm

Peter,

My system is now running on the bench with one cell. I'll bring two more cells to the lab (Ok, it's my master bedroom), and make sure all 3 work ok. I'll also change the cell count in the master software as you suggested, to 3 cells. I still need to put the master board in some sort of box, and add the 5 button panel.

This is very exciting!

I'll try and install the hardware into my truck this weekend. I have committed to helping a friend replace a bad battery in his EV this weekend. The whole pack of 28 gets dropped out of the bottom the vehicle.

Mike

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

Postby retepsnikrep » Thu Oct 30, 2008 5:10 pm

mikep_95133 wrote:Peter,

My system is now running on the bench with one cell. I'll bring two more cells to the lab (Ok, it's my master bedroom), and make sure all 3 work ok. I'll also change the cell count in the master software as you suggested, to 3 cells. I still need to put the master board in some sort of box, and add the 5 button panel.

This is very exciting!

I'll try and install the hardware into my truck this weekend. I have committed to helping a friend replace a bad battery in his EV this weekend. The whole pack of 28 gets dropped out of the bottom the vehicle.

Mike


Good news about your Master board but bad news about your friends batteries :shock: Looks like you will get it installed before I will. Nice to have another guinea pig :D

Will you use the new ADC button system as described a couple of posts above?

I need to re-make my buttons now to conform with that new design. :roll:

I've adjusted the Master software to include the new button routine but I still think it may have the musical bug!! :lol: I haven't tested it but it compiles correctly.

I suggest use the 'debug' command inserted into the Master code so you can see what values are being returned by the buttons and adjust as necessary if the buttons don't respond

If you use 5 buttons built as shown I think the code should be

readadc ButtonsADC,CountE ;Read ButtonsADC input and get value into Local 0-255 Variable CountE

CountE = CountE + 6 / 42 - 1 ;Convert ADC reading to button number.

We need that subtract 1 at the end, as the latest Master code uses the (on CountE gosub) command which branches according to the value in CountE, and CountE must be 0 for the first Branch to be valid.

I think a value of 5 should be returned in CountE if no buttons are pressed.

CountE should be 0-4 for the other keys.

www.solarvan.co.uk/bms/MASTER301008_V66_2400BAUD.TXT
Last edited by retepsnikrep on Thu Oct 30, 2008 5:17 pm, edited 1 time in total.
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.

mikep_95133
Posts: 28
Joined: Thu Sep 25, 2008 6:38 pm

Postby mikep_95133 » Thu Oct 30, 2008 5:12 pm

For those of you using HiPower brand Lithium cells, I'd like very much to hear from you on their performance and longevity in your vehicle. I need to decide on either HiPower or Thundersky cells. If Peter's 40 amp load test is any indicator, the HiPower cells could be a bit lower impedance and/or higher voltage under load. My 40ah Thundersky's hold about 3.07v at 40 amps. HiPower cells at 3.2v as Peter reported would make a large difference in a pack of 100-120 cells that my truck would require.

Please email me with your experience at mikep_95133 at yahoo.com.

Thanks,

Mike
Last edited by mikep_95133 on Thu Oct 30, 2008 6:40 pm, edited 1 time in total.

mikep_95133
Posts: 28
Joined: Thu Sep 25, 2008 6:38 pm

Postby mikep_95133 » Thu Oct 30, 2008 5:19 pm


Good news about your Master board but bad news about your friends batteries :shock: Looks like you will get it installed before I will. Nice to have another guinea pig :D

Will you use the new ADC button system as described a couple of posts above?



I plan on using what ever button config is current. If that's what works now then fine I'll make it. First I need a box for the master then I think I will add the buttons to that box, unless I get a brainstorm to mount them elsewhere.

MindMil2
Posts: 9
Joined: Wed Oct 29, 2008 5:44 pm
Location: Lithuania

Re: Oh Lot's of questions

Postby MindMil2 » Thu Oct 30, 2008 6:25 pm

retepsnikrep wrote:Mindaugas.

Nice to see your input on the thread thanks. I'll have a look at your formula and see how it works out...


Peter,

I'll go through your questions one by one.

I'm not using floating point maths.

The best estimated resolution is 20mV. This is just because my formula looses just one bit during calculation while yours looses 2. The reduced formulas for working with integers would be:
Yours: CellV = 31750 / CellA * 4
Mine: CellV = 63500 / CellA * 2

I am using generic PIC12F683 and software written just in assembler.
The VSM file is here http://www.sklandymas.lt/EV/BatteryModule_v2.DSN
The main daisy-chain serial comm concept is simulated by VSM in this test schematic http://www.sklandymas.lt/EV/BMS_Test4.DSN

I haven't built actual device yet and used the software compilation and debugging with PIC Simulator IDE from http://www.oshonsoft.com/
It works on it performing serial comms and ADC measurements.
I've put nearly finished .asm code here http://www.sklandymas.lt/EV/BatteryModule.asm
It does not do ADC 8 times oversampling and does not have the master reset routine implemented yet.

1) A very valid point. I had these pulldown resistor originally in but removed trying to simplify the schematic which is using just one wire to connect all the modules. I'll make final decision once I've built and tested working prototypes.

2) I'm using separate LED which is on when shunt is enabled and blinks when MCU sends data to serial out. Might put additional LED but now trying to get components count to minimum.

3) Again valid point regarding Ref current drain. I'll redo the calculations and put an optimal resistor value.

4) The pin choice exercise was done very carefully. Every pin number function was chosen with well grounded reason according to guidelines:
a) Comparator in and out pins used as serial in and out
b) ICSP programming should be possible without any jumpers needed

5) Actually No. The master is able to communicate to each chip directly while other chips are working just as simple serial line repeaters. This is done by using PIC's internal comparator. PIC works in two basic modes:
a) Transparent Receive mode. Comparator works in mode 011 which transparently passes inverted input signal out while software waits for comparator interrupt and and reads COUT while receiving
b) Transmit mode. Comparator works in mode 100 where COUT pin is general I/O pin and is used by software to send data byte. Please note that in this mode chip is able to receive data but it is not passed transparently to transmit

The communication protocol has several commands types according to which the chips communicate:

A. Read Battery / Balancing voltages from all cells. (hex commands 81 or 82 ) Master sends the command and all chips receive it knowing that chain voltages transmission will follow. The chip with ID=1 temporarily goes to transmit mode and sends two bytes: his ID and voltage (for example 01 54). Then it goes back to transparent receive mode. Next chip in chain has ID 2 and listens to transmission. When it receives that chip 1 has transmitted its value it would know "I'm next because I'm number 2" and transmits it's voltage value in the same fashion. And this goes on through the chain until last battery chip has transmitted its value. So for example master sends hex 81 and then receives 81 01 54 02 60 03 58 04 58 ... and so on. 81 is echo that went through all cells when transmitting the command. 54 60 58 58 are shifted voltage values from cells 1,2,3,4 and so on.

B. Read Battery / Balancing voltages from cell N ( hex commands A1 or A2 ). Master sends the command followed by chip ID it addresses. All chips receive it. All chips ignore this command except the chip that has the ID equal to the second byte of the command. It temporarily goes to transmit mode and transmits its ID and voltage. So for example master sends A1 03 to read cell 3 voltage. Then it receives A1 03 03 58 where 58 is the desired voltage response from cell 3.

C. Write balancing voltage commands ( hex commands C2 or E2 ). Slaves just receive the command in transparent mode and store the balancing voltage value if the command was addressed to them.

D. Enumerate cells and store their IDs (hex command C8 ). When receiving this command all slaves go to Transmit mode and wait to receive for ID assigned to them. Master sends 01 to lowest cell directly telling it "you are number 1". The chip receives it, stores it's ID in EEPROM, increments by 1 (which makes it 2 for next cell), sends to next upper cell and goes back to transparent receive mode. In this way all the cells enumerate automatically, store their IDs and report the number of cells back to the master.

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

Postby retepsnikrep » Fri Oct 31, 2008 8:28 am

That's very impressive. I hope it all works OK. Some of the command functions are similiar to what I was proposing many versions ago for the Digital Slaves in this thread on page 8, but which I haven't incorporated yet. My method of addressing them was slightly different though.

I'll have to get on with that because it would be useful. The Master software has taken up most of my time for the last month or more. :roll:

What data rate are you running your comms at? Will you be designing and building your own Master as well? Keep us updated. Peter

Edit

Fixed that glitch which was due to the nested if/then & gosub limit being exceeded :roll: , made a couple of improvements to Master software.

Charge and Big Display now toggle on and off using appropriate buttons. :)

Getting there with errors screen, but I'm still not completely happy with that display :? I may force user to cancel/acknowledge error by pressing a button before display returns to normal rather than using alternating screens like it does at present.

Also there is a world of difference between serious problems like cell over AbsMaxV for instance, and cell over MaxV, which is used for charging control. So I need to seperate all that lot, more work to do.

This working version of the Master is using a slightly older version of the button routine, as I made my buttons to an earlier design and can't be bothered to re-do them. People building now should use the button design a few posts up, remove my button specific lines of code and UNREM the single line of new code which is included. Hope that makes sense.

MenuButtons: ;Menu decodes button Inputs and returns 1 of 6 values (0,1,2,3,4,5) Note 5 = no button pressed!

See the above section in the Master code.

www.solarvan.co.uk/bms/MASTER311008_V68_2400BAUD.TXT

http://www.youtube.com/watch?v=pBGl4QNUpn8
Last edited by retepsnikrep on Fri Oct 31, 2008 3:00 pm, edited 1 time in total.
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 17 guests