# Coming up: BMS (monitoring only) with infrared communication



## jhuebner (Apr 30, 2010)

Hi everyone,

I've been scratching my head for years now how to monitor the 160 LiFePo4 cells in my Renault R4. I really like the simplicity of MiniBMS but I think I've come up with something even simpler:

Here's my line of thought:
- I only wanted HVC/LVC, no shunting
- I started out with TS431 references, opto couplers and some logic ICs
- I realized that for HVC/LVC very crude voltage measuring is fine
- I realized that the opto coupler can also be an infrared transmission channel

So here's what I've come up with:
Each cell module (=slave) can measure up to 6 cells by using simple resistive voltage dividers. The data is sampled by an inexpensive µC and memorized.
The master requests the values with an infrared command and the slave replies with the 6 voltages. The throughput is only 1-2kb/s so measuring 160 cells in round robin fashion will take 1-2s.
So after one round the master knows all the voltages and can issue HVC/LVC or whatever you want. You can also log the voltages but the system was never meant to be accurate, the expect an accuracy of +/-0.05V.

I have designed the circuit to be powered from all 6 cells (works with 2 cells as well). In active mode the current draw will be around 10mA, in sleep mode (which is entered after no communication with the master for x minutes) it is only around 200µA.

I've set up a first test bench and the infrared communication also works when its reflected.

So these are the benefits:
- No wires needed
- inherently isolated
- cheap (parts cost around $4 per board)
- Gives you an idea of the individual cell voltages
- Master unit can also do Coulomb counting as an extra
- Low current drain in sleep mode

I'm ordering the first batch of PCBs soon (outline 25x100mm). After some testing in the R4 I might offer a kit.

Like it?


----------



## smpavlik (Mar 28, 2011)

IR is good but you have to place properly all the miniBMS to be in range. And protect them from moisture and dust otherwise you'll lose connection. Wired solution is better to me. And cheaper. 

My miniBMS is around $2 per board including PCB. It has small outline (~ 25x25mm) and extended features
*Voltage monitoring
*Temperature monitoring
*up to 255 miniBMS in series
*Shunt balancing 
*Works as a host
*etc

Do you like it? Kits are coming soon


----------



## dougingraham (Jul 26, 2011)

jhuebner said:


> Each cell module (=slave) can measure up to 6 cells by using simple resistive voltage dividers. The data is sampled by an inexpensive µC and memorized


The problem is that the resistive voltage dividers place different loads on each cell thus unbalancing them.

Each block of 6 cells will have a slightly different load and thus will unbalance that 6 cell block from the others.

The only reasonable way to do a battery monitor is to use essentially an infinite resistance load on the cell. A properly configured op-amp for each cell will do this. To keep the pack in balance there must be essentially no load on individual cells. Over several years even a few microamps of difference adds up.

You could probably live with a difference of a few microamps and just decide to rebalance every few years but to get reasonable numbers with cheap microprocessors you will have much greater differences.


----------



## PStechPaul (May 1, 2012)

This probably belongs in the other thread on design considerations, but I don't see the problem with such small current drain that the typical sample/hold ADCs of microcontrollers use. A 3:1 voltage divider for a single cell could have a total resistance of 30k, which is a current draw of about 100 uA. A 40 Ah cell will provide this much current for 400,000 hours, or about 45 years. You can do the math for larger cells and DOD, but this much load on any cell will only reduce its capacity by a few percent per year. Moreover, a 6 cell unit would have six voltage dividers that will draw the same current from each cell, within the 1% tolerance of the resistors. So the imbalance will be another factor of 1/100, which I assert is absolutely negligible. Since battery capacity is determined by cell geometry and materials, normal manufacturing tolerances will very likely vary the true capacity by at least 1% and probably more like 5%.


----------



## jhuebner (Apr 30, 2010)

dougingraham said:


> The problem is that the resistive voltage dividers place different loads on each cell thus unbalancing them.
> 
> Each block of 6 cells will have a slightly different load and thus will unbalance that 6 cell block from the others.


Theoretically I can see that.
The first cell feeds into all voltage dividers, so it "sees" 6 times more current than the last cell. I my case each voltage divider has a cross current of 50µA (the ADC is buffered with 100n caps). So the first cell feeds 2.7Ah into the divider every year whereas the last one only feeds 0.45Ah into the divider. So leaving a 40Ah pack sitting with only the voltage dividers for 15 years would empty the first cell and leave 33Ah in the last cell. It is for sure a systematic imbalancer. In theory.

But like Paul pointed outed: does this really matter in practice or do other tolerances "swallow" this? Cell level BMSs, does every cell module draw the exact same current from every cell? I'm sure it doesn't but some make up for this by top balancing.

I'm sorry for opening a second discussion on BMS design, any ideas how to merge this?


----------



## jhuebner (Apr 30, 2010)

dougingraham said:


> The only reasonable way to do a battery monitor is to use essentially an infinite resistance load on the cell. A properly configured op-amp for each cell will do this. To keep the pack in balance there must be essentially no load on individual cells. Over several years even a few microamps of difference adds up.


Can you point out how exactly? In non inverting configuration the amplification is always >1, in inverting configuration it is negative. I don't know how to attenuate a signal with an opamp, i.e. 20V -> 3V


----------



## jhuebner (Apr 30, 2010)

smpavlik said:


> IR is good but you have to place properly all the miniBMS to be in range. And protect them from moisture and dust otherwise you'll lose connection. Wired solution is better to me. And cheaper.


I doubt the last statement. IR means: IR diode, IR receiver. Wired means: opto/inductive coupler, 2 connectors (in, out), cable with matching connectors. 

When it comes to reliability a wire is a no-brainer for sure. But I think its just a matter of tweaking to get reasonable reliability out of IR. I've tested various obstacles in front of the receiver, it's hard to block it. It's an AWGN channel which is well understood.


----------



## PStechPaul (May 1, 2012)

From: http://en.wikipedia.org/wiki/Instrumentation_amplifier

An instrumentation amplifier as shown above has essentially infinite input impedance because the signal sees only the inputs of two op-amps. There may be some problem reading voltages close to the power supply rails, but some op-amps can do so. If you remove R(gain), the output can be adjusted greater than or less than 1, since it is based on the ratio of R3/R2. 

The voltage dividers for a six-cell BMS unit might have a 10k resistor to ground for each of six ADCs. For an ADC reference of 1.5 volts, a 3:1 divider will be able to read the bottom cell up to 4.5 volts, and the divider will have a resistance of 30k or 100 uA at 3 volts. 

For the second cell, you would need a 6:1 divider to present the same range to the ADC, so it would have a resistance of 60k which will also draw 100 uA from the second cell. This will be true for as many cells as are being monitored. The microcontroller would have to perform subtraction of each subsequent reading (along with the scale factor) to obtain the individual cell voltages of higher cells. However, the accuracy of higher cells will suffer because they utilize less bits of the ADC. 

It is also possible to use analog switches (MUXs) to obtain samples of each battery voltage and then read it with an instrumentation amplifier. It would require two 8-1 switches for 8 cells, or you can get dual 4-1 switches for 4 cells. Current will be drawn only during the time of signal acquisition by the ADC, which is only several micoseconds. So you have essentially zero current draw if you sample only a few times a second.


----------



## smpavlik (Mar 28, 2011)

jhuebner said:


> I doubt the last statement. IR means: IR diode, IR receiver. Wired means: opto/inductive coupler, 2 connectors (in, out), cable with matching connectors.


Isolated - yes, but why do you think opto/inductive coupled is the only solution? One capacitor per module and single wire to connect all BMS in a chain. Plus one quick-connect per module...

I will calculate BOM more accurate and provide details. Also I want to share my design for discussion. Hopefully next week


----------



## jhuebner (Apr 30, 2010)

smpavlik said:


> Isolated - yes, but why do you think opto/inductive coupled is the only solution? One capacitor per module and single wire to connect all BMS in a chain.


Actually thats what I thought were the only ways. So capacitive decoupling then - looking forward to see that.


----------



## dougingraham (Jul 26, 2011)

jhuebner said:


> Can you point out how exactly? In non inverting configuration the amplification is always >1, in inverting configuration it is negative. I don't know how to attenuate a signal with an opamp, i.e. 20V -> 3V


You would most likely want to use unity gain and in your case use the op-amp as a level shifter only. + input to the positive terminal of the cell and - input to the negative terminal of the cell you are interested in. Not sure you can find opamps with 24 volt rails but I know you can find + and - 15 volt devices so use the center of the cells as the ground and the most positive and most negative terminals of your 6 cell cluster for the rails. Run the A/D of your micro with a 5V reference and you need just a little gain to make your 4.35V worst case the cell is about to do something bad voltage become 5V for the A/D input. You still will have minor imbalance since the upper half of the 6 cells will be driving the microprocessor.

Another solution to your divider issue would be to add a loading resistor across each cell such that all cells see the same load within the tolerance of the chosen resistors. The most negative cell would not have one and as you go up towards the higher cells the load increases (lower resistance). This would be hands down the least expensive way to balance the load on the individual cells.


----------



## jhuebner (Apr 30, 2010)

dougingraham said:


> Another solution to your divider issue would be to add a loading resistor across each cell such that all cells see the same load within the tolerance of the chosen resistors. The most negative cell would not have one and as you go up towards the higher cells the load increases (lower resistance). This would be hands down the least expensive way to balance the load on the individual cells.


I think thats the way to go. Keeps the BOM small and puts 300µA of load (+ µC supply) on each cell.

Thanks


----------



## jhuebner (Apr 30, 2010)

Ok, with standard resistors I can match the current +/-20µA (largest 327µA, smallest 308µA). I guess thats in the negligible range.


----------



## dougingraham (Jul 26, 2011)

jhuebner said:


> Ok, with standard resistors I can match the current +/-20µA (largest 327µA, smallest 308µA). I guess thats in the negligible range.


This looks like about a 350mah worst case imbalance per year. You could add a second resistor in parallel to trim better than this but as you say, it is fairly negligible. You will probably want to rebalance every couple of years.

This is a phantom load and I really don't like those. I have thought about getting rid of the clock in the car but it draws so little I have trouble measuring it.


----------



## PStechPaul (May 1, 2012)

You might consider using analog switches to sample the battery voltage so the voltage divider will not be always connected and causing drain. Here is a four channel analog MUX which works up to 40V and uses 5V digital logic to activate. It is only about $1:

http://www.mouser.com/ds/2/427/dg201hs-113557.pdf
http://www.mouser.com/ProductDetail...GAEpiMZZMtxrAS98ir%2bs0szLGzxh/uD65kmr8uWGjU=

However, it draws 10 mA.

If you can use a 10V part, there is this, which only draws about 40 uA, and costs about $0.25:
http://www.mouser.com/ds/2/302/74HC_HCT4066-180895.pdf
http://www.mouser.com/ProductDetail...EpiMZZMtxrAS98ir%2bswY3LC9E%2bOpNeverOQHcEwE=

Or this, which works on up to 18V with current of 5 uA and is about the same price:
http://www.mouser.com/ds/2/405/schs026c-127261.pdf
http://www.mouser.com/ProductDetail...GAEpiMZZMtxrAS98ir%2bs8JwmYDsswDMlwCBoSOuwTQ=


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> You might consider using analog switches to sample the battery voltage so the voltage divider will not be always connected and causing drain. Here is a four channel analog MUX which works up to 40V and uses 5V digital logic to activate. It is only about $1:http://www.mouser.com/ProductDetail...GAEpiMZZMtxrAS98ir%2bs8JwmYDsswDMlwCBoSOuwTQ=


The devices are good and I have a shutdown circuit for the external ICs anyway.
But then throwing in another IC (remember I need 6 channels) to eliminate 300µA seems a bit over-engineered.

I just conducted another experiment: I connected the ADC to the source with 5M resistance buffered with 100nF (makes a nice 0.3Hz low pass). It sits rock hard on the same digit value. So another very low-tech measure: crank up those dividers


----------



## jhuebner (Apr 30, 2010)

So, first cut is out










I have increased the resistance of the voltage dividers as announced, so now the highest value is 6,7M+1M. This outs a cross current of ~3µA on the last cell 18µA on the first cell. Even theoretically this is not going to disbalance a 40Ah cell in a reasonable time span. It takes 309 years to discharge a 40Ah cell with 18µA

I have decreased the capacity of the low pass caps to 10nF, because I decided the cut off frequency would be too low otherwise.
I have tested the circuit with just the inverter running (which puts off my cheap multimeter) and the readings are dead stable. Same with the motor running at full speed. It is also fast enough to show the voltage sag when accelerating.

I mounted more modern infrared receivers which are even harder to block than the ones I used before.

The current draw is 5mA average in active mode and 40µA in sleep mode. Waking up from sleep mode takes 8s in the worst case.


----------



## brainzel (Jun 15, 2009)

Little hint off topic:
it seems in that picture, that you bolted the measuring wire under the cell connectors. That's not the best idea, because the main current connection should be flat and directly to the battery terminal.
Like in this picture I made.


----------



## jhuebner (Apr 30, 2010)

brainzel said:


> Little hint off topic:
> it seems in that picture, that you bolted the measuring wire under the cell connectors. That's not the best idea, because the main current connection should be flat and directly to the battery terminal.
> Like in this picture I made.


Very true, the battery connection is a bit rigged up, so the picture is certainly not a reference on how to do it 
The correct way is like you dipict:
- Use some stout and flat for the main current path
- Use ring lugs for the measuring wires
- Use screw + cup spring (Tellerfeder) + washer for tightening

Initially it looked like a good idea to use screws with integrated toothed locked washer for the sake of simplicity. But when tightened the cell connectors start to spin as well, so the screws can't be actually tightened. Plus its not a good idea to put a ring lug beneath a toothed locked washer because it renders the teeth useless.

Lesson learned, I hope


----------



## brainzel (Jun 15, 2009)

Made good experiences with the Disk-Lock / Nord-Lock washer.
But back to your thread, sorry for hijacking it


----------



## jhuebner (Apr 30, 2010)

I made a video of 5 units working. I doubt presenting stuff is my strong point but I hope you still get the idea 

http://youtu.be/dyKqOaVm8gg


----------



## PStechPaul (May 1, 2012)

Looks promising! Do you have a website or a document describing the design and operation of these BMS units? I know some of it is in this thread, but a single point of reference would be helpful.


----------



## ndplume (May 31, 2010)

jhuebner said:


> I made a video of 5 units working. I doubt presenting stuff is my strong point but I hope you still get the idea
> 
> http://youtu.be/tII-69Klcr8


I just found your thread. I like your idea. The video helps. 

On my current BMS, it has twisted pairs between the batteries and the controller. Getting the noise out of the system was a PIA. I still have some intermittent issues with it at various motor speeds, hence the desire for a noiseless communication. This IR is a great solution to that since its low cost. I had thought of a fiber optic communications too.

One suggestion is that I see batteries sold in 12V units, consisting of 4 cells. So a 4 cell version may be a good quantity for a board.

A question : So if a pack consists of 3 "banks" of 16 cells (48 total for 144V) located nder Trunk, under back seat, under hood. How is the IR collected in each bank. Would it be as simple as locating a single IR receiver in each bank vicinity? And only having to deal with noise on that receiver line being routed back to the "gateway"?


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> Looks promising! Do you have a website or a document describing the design and operation of these BMS units? I know some of it is in this thread, but a single point of reference would be helpful.


Yeah, very good suggestion. I always go "build first, then document". I will setup a website. A proper embedded head unit is still in the making to replace Gateway+PC.



ndplume said:


> I just found your thread. I like your idea. The video helps.
> 
> On my current BMS, it has twisted pairs between the batteries and the controller. Getting the noise out of the system was a PIA. I still have some intermittent issues with it at various motor speeds, hence the desire for a noiseless communication. This IR is a great solution to that since its low cost. I had thought of a fiber optic communications too.


Thanks  If you look closely you'll see some unpopulated parts. That was to be my fall-back option, 2 wire communication.



ndplume said:


> One suggestion is that I see batteries sold in 12V units, consisting of 4 cells. So a 4 cell version may be a good quantity for a board.


Actually, you don't have to use all 6 channels. The extra parts for each channel are 2 resistors, 1 capacitor and a cage clamp.
Not using all channels is also a way to improve accuracy. The upper channels have a greater quantization error. 



ndplume said:


> A question : So if a pack consists of 3 "banks" of 16 cells (48 total for 144V) located nder Trunk, under back seat, under hood. How is the IR collected in each bank. Would it be as simple as locating a single IR receiver in each bank vicinity? And only having to deal with noise on that receiver line being routed back to the "gateway"?


Actually I have that situation in my conversion, half the pack in the trunk, the other half under the hood.
The solution is as simple as you point out: multiple IR transceivers. They should be connected with shielded cable, like CAT5 ethernet cable or whatever you can get hold of.


----------



## ndplume (May 31, 2010)

jhuebner said:


> Actually I have that situation in my conversion, half the pack in the trunk, the other half under the hood.
> The solution is as simple as you point out: multiple IR transceivers. They should be connected with shielded cable, like CAT5 ethernet cable or whatever you can get hold of.


I have the same setup, 1 in trunk, 1 under hood. One of the guys in our club has them under the back seats too. I may go there too in order to increase range without losing my trunk space.

What I like about this idea is that the IR can traverse the noisier areas near the power path. So the shielded cable going to the IR receiver can be further away from noise sources.


----------



## jhuebner (Apr 30, 2010)

ndplume said:


> I have the same setup, 1 in trunk, 1 under hood. One of the guys in our club has them under the back seats too. I may go there too in order to increase range without losing my trunk space.
> 
> What I like about this idea is that the IR can traverse the noisier areas near the power path. So the shielded cable going to the IR receiver can be further away from noise sources.


Very true. Actually the EMI crashes my USB/TTL adapter if I place it right on top of the battery pack (seperated by fibreglass). A few centimeters away its fine.


----------



## jddcircuit (Mar 18, 2010)

jhuebner said:


> I made a video of 5 units working. I doubt presenting stuff is my strong point but I hope you still get the idea
> 
> http://youtu.be/tII-69Klcr8


Very excellent.

I can relate. I have also been working on low cost cell voltage monitoring with some success. My prototype works on the bench but hasn't been tested in real world yet.

Did you meet your cost per cell goals?

Jeff


----------



## jhuebner (Apr 30, 2010)

jddcircuit said:


> Very excellent.
> 
> I can relate. I have also been working on low cost cell voltage monitoring with some success. My prototype works on the bench but hasn't been tested in real world yet.
> 
> ...


Thanks again  I was targeting 1€ per cell. Right now it is:
- PCB: 1.23€
- Parts: 5€
- Assembly cost: unknown
So parts cost is 6.23€ and thus 1.03€ per cell. With assembly cost I will obviously exceed the target. Will find out later today how much that is.

If I get my girl friend to pre-arrange the parts for me on a sheet of paper each board takes 45 minutes to assemble, program and test. I think thats a bit long even in DIY terms.

Edit: connected the 5 boards to the battery pack today, heres the display:









All batteries should be sitting at 3.34V so anything above or below is measurement error. That is down to 2 things: I did no calibration whatsoever and some of the wires seem to make a bad connection.


----------



## jhuebner (Apr 30, 2010)

Made a video of the units mounted on a pack:
http://youtu.be/dyKqOaVm8gg


----------



## PStechPaul (May 1, 2012)

It appears that you still have hardwired connections (with fuses) from each cell back to the master unit, and I'm wondering just where the infrared communication is taking place. As I develop my own concept of a BMS, I'm thinking that it would be best to have one slave module per cell and have a sequence of communication from each one to the next, which is then relayed to subsequent units and finally back to the master.

My idea is to have blocks of perhaps 4-12 cells (or as many 12V SLAs) and then use short pieces of fiber optic cable from an emitter on one cell to a sensor on the next. Thus there will be no electrical connection and no need to run wires and use fuses. The connections from the master unit might need to be twisted pair wires or possibly also (longer) fiber optic cables. I think the connections between cells could be very short and simple, and not require fancy and expensive terminations and connectors, but just holes for the optical light pipe to be inserted.

The IR LEDs and sensors are pretty cheap (less than $1/pair), but another method would be optocouplers which are also pretty cheap. However, that requires having wires connected to one of the battery terminals, and thus would need more care in handling and fuse protection.

Can you post some schematics or a block diagram and a more detailed explanation of the concept? You may have already implemented some of what I plan to do, and no sense duplicating efforts. I'm also looking at low cost implementation and maybe offer PCBs and kits for DIY use, and only charge enough to cover costs and just a little extra for the NRE and to make it worthwhile to fool with orders, packaging, handling, and shipping.

[edit] I just went back and looked at the earlier parts of the thread as well as the other video. So now I see that this uses hardwired connections for groups of 6 cells and it eliminates the problem of routing so many wires with possibly very high voltage to a central master BMS. I see a USB cable from the master unit to the laptop computer, but I'm not sure how the master unit sends commands and received data. If that is also via IR, then it seems the master needs to be located in the vicinity of the slaves. Then there is the question of handling additional blocks of 6 cells each. For a high voltage pack you may have 100-200 cells and thus up to 35 sets.


----------



## dougingraham (Jul 26, 2011)

PStechPaul said:


> It appears that you still have hardwired connections (with fuses) from each cell back to the master unit, and I'm wondering just where the infrared communication is taking place. As I develop my own concept of a BMS, I'm thinking that it would be best to have one slave module per cell and have a sequence of communication from each one to the next, which is then relayed to subsequent units and finally back to the master.


The problem is and always has been that the measurement must affect the measured item as little as possible. Any BMS that powers itself from the cell it is measuring affects the outcome of the measurement. The BMS itself becomes the device that unbalances the pack because the load on the individual cells is different. Problem one is how to measure the voltage of a cell without loading that cell differently than any other. It is so tempting to want to measure four (or more) cells in a group with a single CPU that has four (or more) A/D input pins. The obvious way to do this is with resistor dividers. But this places a different load on each cell. You need a device with multi megaohm input impedence to measure the cell voltage. Problem two is ensuring that the voltage references from potentially a hundred different devices are all the same. Problem three is that 10 bits is not enough and 12 bits is marginal if what you are trying to do is measure a voltage accurate enough to determine a difference in a resting state of charge. Doing a BMS wrong is a trivial exercise in engineering. Doing it correctly is far from trivial and expensive in the small quantities we are talking about.

The assertion is that you need a BMS because you will ruin your batteries if you don't have one. The reason for this is because the cells will get out of balance on their own and then over charge or over discharge when near the end points. I have spent months watching a small sample of cells (both prismatic and cylindrical) and I haven't been able to detect self discharge. I have been told that some people have seen it in a few cells and I believe them. However I suspect there was either some outside load involved or the cells were already damaged in some way that caused them to leak. A properly operating LiFePO4 cell does not self discharge. At least not over a temperature range that is tolerable to humans. In my experience they are the easiest cells to deal with. You measure the capacity of every cell and record that. Then top or bottom balance them. If you have top balanced then you charge until you reach something a little over 3.4 volts per cell and then stop. No need for a CV phase as doing so adds little extra energy and is where the damage to the cell occurs. If you bottom balanced then charge the pack while watching the lowest capacity cell and when that cell reaches 3.4 volts measure the whole pack voltage and use that value as the charge cutoff point. In both cases count AH during discharge and stop at the point you feel comfortable with (ie 70%, 80%, 90%). Limit the discharge voltage to half the nominal pack voltage for winter use. The rest of the time you will never get that low.

A BMS won't protect you from ruining a cell. It might tell you that one is going bad. It might help you find it when it goes bad. It might tell you to stop driving in a low state of charge condition but human nature will cause you to ignore it and keep driving. Because of all that I came to the conclusion that even though I would like to see the data it doesn't do anything to make my battery pack work better or make the car safer to own or drive. If anything having that data available while driving is nothing more than a distraction. And after a couple of weeks almost nobody would pay any attention to it anyway.

None of this matters because it is your EV and you are Doing It Yourself so you can put anything in it you want to. And I will applaud you for getting it on the road. Personally I want a flux capacitor in my car.


----------



## Siwastaja (Aug 1, 2012)

Wrong, wrong, wrong and again wrong. Practically everything what you state is wrong, but let's go through it bit by bit.



dougingraham said:


> The problem is and always has been that the measurement must affect the measured item as little as possible.


No, it has mostly been a imaginary problem for certain no-BMS arguments. It usually goes along with the claim that BMS is there to burn the car. It has been repeated without proof so many times it has become "the truth".

The truth is that a typical battery cell contains so much energy that you must be real idiot if you can significantly use that energy to monitor its voltage.

Many small battery powered devices monitor the battery voltage and the battery can still last for YEARS (I'm working with one such system); and the battery might be 1 Ah, compare that to our 40-200 Ah EV cells.

Actually, some BMS systems which use RIDICULOUS currents (such as miniBMS), in order 100x more than proper digital designs, are very popular despite of this, with little or no problems reported, so certainly a properly designed system has no problem here.



> Any BMS that powers itself from the cell it is measuring affects the outcome of the measurement.


Yes -- you cannot measure voltage without consuming current from the measured point (finite impedance). The question is, how much does it affect it and in which way.



> The BMS itself becomes the device that unbalances the pack because the load on the individual cells is different.


Untrue -- in many cases, most of the load is proportional to the resting voltage and the device becomes balancing, not unbalancing. In fact, resistor network balancer is well known and used for series capacitors.

Also, in a properly designed system, the difference in currents is so small that even if it becomes unbalancing, it takes many years for significant unbalancing effect. A proper BMS also rebalances the pack on every charge cycle.



> It is so tempting to want to measure four (or more) cells in a group with a single CPU that has four (or more) A/D input pins.


It sounds anything else than tempting to me; a wire spaghetti prone to EMC problems, level shifting analog signals from different levels, >5V voltage levels, separate power supplies, etc.

The OBVIOUS way to make a BMS is a cell module with isolated or level shifted digital communication. Make the building block as small as possible and just multiply it.



> The obvious way to do this is with resistor dividers. But this places a different load on each cell.


Yes it does, which is good -- what you see as an unbalancer is, in _reality_, an automatic balancer. (Check the precision of the components you use, however.) (The importance of this point is actually zero, you don't want to design the divider to take so much current that it would have any effect on anything anyway. But just saying...)

The discharging effect is undesired, anyway. Large resistor values in the divider make it more prone to EMC related problems. But the BEST way to reduce these problems is to keep the wires short. Hence, distributed BMS is the way to go, again.



> Problem two is ensuring that the voltage references from potentially a hundred different devices are all the same.


Why does it matter? You are making up some odd requirements here. What BMS does is to ensure that all cells work within the SoC limits. It does not matter anything if the cells are at a tiny bit different SoC, as long as none are overcharged or overdischarged. Balancing (top, that is) is there for maximizing the energy.



> Problem three is that 10 bits is not enough and 12 bits is marginal if what you are trying to do is measure a voltage accurate enough to determine a difference in a resting state of charge.


Yes and 12 bits is not enough if you want your BMS to fly like a helicopter and fill your tax report and.....

The point being; Why in the world would you want to do that? You know, you cannot use voltage measurement to determine the SoC with these cells ANYWAY, no matter how accurate voltage measurement you have. You only measure voltage to detect charge and discharge endpoints, and in this case 10 bits is ample.



> Doing a BMS wrong is a trivial exercise in engineering.


I agree. Don't overengineer it by making up totally unneeded "features" and finding problems in them.



> A properly operating LiFePO4 cell does not self discharge.


Manufacturers disagree with this; they allow a small self discharge in cells that otherwise perform normally. This seems to be the main reason why some non-BMS users seem to find "faulty cells" every now and then. They are not faulty, they have self discharge within specs and it would cause no visible effects when used with a BMS, but they do fail due to the non-BMS abuse.



> In my experience they are the easiest cells to deal with.


This is true and a very good point. Thanks.



> Then top or bottom balance them.


Bottom balancing makes no sense with a BMS.



> If you have top balanced then you charge until you reach something a little over 3.4 volts per cell and then stop.


You seem to have pretty relaxed voltage limit values when you think that 10 bit resolution is not enough...

(Yes, you can stop randomly between 3.4 and 3.65 volts and it would work pretty nice. But if you charge at relatively high current, you can't stop at 3.4 volts, and you'll need the CV phase if you want to get them full. This is because of internal resistance (upward voltage "sag") becoming significant in quick charging.)



> If you bottom balanced then charge the pack while watching the lowest capacity cell


In theory, yes, but you never want to do this. If you can watch individual cell voltages and react with them automatically, then you have a BMS, and when you have a BMS, you don't want to bottom balance, because it's only a non-BMS protection kludge and top balancing gives you more energy and power (slightly however).



> A BMS won't protect you from ruining a cell.


What, this is ground breaking! Last time I checked, it's the BMS's sole purpose. If there is a BMS that (when properly installed) fails to do this, please report it.

What it cannot do is to save a cell that has a real manufacturing defect. OTOH, in a BMS system, moderate self-discharge alone is not a manufacturing defect (while it is one in a non-BMS system).



> It might tell you that one is going bad. It might help you find it when it goes bad.


True.



> It might tell you to stop driving in a low state of charge condition but human nature will cause you to ignore it and keep driving.


Then the BMS is either faulty or installed incorrectly; a proper BMS installation warns first and then prevents driving because it doesn't do anything good to destroy your battery.

I know many people just use MiniBMS and a small buzzer. Many people also go without a BMS. It's their choice not to choose automated protection.



> Because of all that I came to the conclusion that even though I would like to see the data it doesn't do anything to make my battery pack work better or make the car safer to own or drive.


You have clearly based your "conclusion" on urban myths rather than information or data.

Seeing individual cell data is the least important feature of a BMS. It's an eye candy. You don't usually want it. A proper system works transparently. If you have a computerized system to measure something, it makes no sense to have you manually look at those numbers when you can program it to do what is needed to save your time.


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> Can you post some schematics or a block diagram and a more detailed explanation of the concept? You may have already implemented some of what I plan to do, and no sense duplicating efforts.


Schematic exists only for the slave unit and is rather straight-forward. The optocouplers and connected parts are not mounted! That is just an option to be able to provide a version with a wired link.











PStechPaul said:


> [edit] I just went back and looked at the earlier parts of the thread as well as the other video. So now I see that this uses hardwired connections for groups of 6 cells and it eliminates the problem of routing so many wires with possibly very high voltage to a central master BMS. I see a USB cable from the master unit to the laptop computer, but I'm not sure how the master unit sends commands and received data. If that is also via IR, then it seems the master needs to be located in the vicinity of the slaves. Then there is the question of handling additional blocks of 6 cells each. For a high voltage pack you may have 100-200 cells and thus up to 35 sets.


Yes exactly, no cable needs to be routed to the master.
Currently there is no actual master unit, just the breadboard gateway. It receives commands from the PC like "setadr" or "get data" and translates those commands to the binary protocol used by the IR link.
Yes, for a high voltage pack you need #cells/6 slave units. If you don't have multiples of 6 cells, you can use a slave unit with down to 2 cells.
And yes, the IR transceiver has to be in a line of sight with the slave units. Therefor the transceiver(s) won't be mounted on the master unit but will be connected to the master unit through a shielded cable.


----------



## jddcircuit (Mar 18, 2010)

jhuebner said:


> Schematic exists only for the slave unit and is rather straight-forward. The optocouplers and connected parts are not mounted! That is just an option to be able to provide a version with a wired link.
> 
> 
> 
> ...


j,
Thanks for posting the schematic. Very low component count.

Are you happy with the accuracy of your measurements?
I would think that those large value resistors in the voltage dividers would be susceptible to the input leakage current of the micro but since I don't know what that is just a first glance assumption on my part.

6.7M * 20nA = .134V, so not a lot of leakage can make a significant voltage bias.

I just pulled the data sheet on ATtiny24 and it shows max leakage up to 1uA but typical is less than 50nA.


Regards
Jeff


----------



## jhuebner (Apr 30, 2010)

jddcircuit said:


> j,
> Thanks for posting the schematic. Very low component count.
> 
> Are you happy with the accuracy of your measurements?
> ...


Hi Jeff,

I was very doubtful about this topic as well. I set up a first test with an ATMega32, 10M resistor and 1nF capacitor. The readings were dead stable even under temperature changes (tested from 5°C to 90°C).
I think the reason for the nice behaviour is that I'm measuring DC quantities with a low sampling rate. So the sample&hold capacitor is always at the same level and hardly biases the divider voltage. Add the 10nF buffer cap and there should be enough head room.


----------



## PStechPaul (May 1, 2012)

It seems that your ratios are not consistent. They appear to be as follows:


```
1  1.330  /1= 1.330
2  2.600  /2= 1.300
3  4.320  /3= 1.440
4  5.700  /4= 1.420
5  6.600  /5= 1.320
6  7.520  /6= 1.283
```
It may be better to use another 1M for R7, which will reduce the maximum voltage to the ADC to 1.8V for a 3.6V cell, rather than 2.7V as it is now, but you can use a standard 2.048V reference to get a better number of counts. Then the values for R8 through R12 will be simply 3M, 5M, 7M, 9M, and 11M. You can use combinations of one, two or three standard values in series to get the exact values using commonly available and inexpensive components, which are 1M, 2M, 3M, and 4.99M. These values are about $0.05 each, while the intermediate values are $0.50 or more (for 1/8 to 1/4W thru hole parts).


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> It seems that your ratios are not consistent. They appear to be as follows:
> 
> 
> ```
> ...


The resistors are 0603 parts with 1% tolerance. The common values cost 0.008€ while the intermediate ones cost 0.036€. In addition to that all 0603 parts are supplied by the PCB manufacturer and thus cost nothing extra at all.
There is only a 1.1V reference with poor accuracy on board the MCU. The 3.3V from the regulator are far more stable.


----------



## PStechPaul (May 1, 2012)

I am planning to build a battery charger/monitor for a pack of four SLAs and I tried a simulation to see how the battery currents were affected by the divider network. I found that with your system, the current in BT1 is about 2.1 uA and in BT4 it is 8.75 uA, for cells at 3 volts.

I tried some other combinations and it seems that the only way to achieve perfect current balance is to have separately isolated monitor circuits, or to add shunt resistors to the upper cells to draw more current. I made a quad differential amplifier which provides a 10:1 voltage ratio so that the ADCs can read directly without subtracting other values, but even with 10 Meg resistors the current draw of my circuit is about 69 uA. But 51 uA of that is drawn by the quad precision op-amp. I used an LT1179A for my simulation and it is beyond its rail rating of 44V but the principles still apply.










The ASCII files for the LTSpice simulations are available at:
http://enginuitysystems.com/pix/Battery_Monitor_4x_12V_5.asc
http://enginuitysystems.com/pix/Battery_Monitor_4x_3V.asc


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> I am planning to build a battery charger/monitor for a pack of four SLAs and I tried a simulation to see how the battery currents were affected by the divider network. I found that with your system, the current in BT1 is about 2.1 uA and in BT4 it is 8.75 uA, for cells at 3 volts.
> 
> I tried some other combinations and it seems that the only way to achieve perfect current balance is to have separately isolated monitor circuits, or to add shunt resistors to the upper cells to draw more current. I made a quad differential amplifier which provides a 10:1 voltage ratio so that the ADCs can read directly without subtracting other values, but even with 10 Meg resistors the current draw of my circuit is about 69 uA. But 51 uA of that is drawn by the quad precision op-amp. I used an LT1179A for my simulation and it is beyond its rail rating of 44V but the principles still apply.


So what are you saying?

EDIT: if capacity=40Ah BT4 is drained by the network after 2174 years whereas BT1 is drained after 521 years. In other words: within 20 years the network unbalances the cells by 1.16Ah or given 40Ah cells by 2.9%. My guess is that differing self-discharge rates and aging effects are higher.


----------



## PStechPaul (May 1, 2012)

I did not really consider the discharge time, and you are correct that it is insignificant. It may be helpful in explaining this to those who object to a BMS because of the supposed unbalancing effect. It would be good to show a table of current values and discharge times. So, for a 10 Ah cell and 10% discharge (1 Ah):


```
1.00 uA  1,000,000 hrs.   114 years
10.0 uA    100,000 hrs.  11.4 years
100 uA      10,000 hrs.  1.14 years
1.00 mA      1,000 hrs.  41.7 days
10.0 mA      100.0 hrs.  4.17 days
100.0 mA     10.00 hrs.
```
However, there is still the question of the inconsistent ratios using the resistor values you have chosen. They introduce a very significant error. Normalizing to the ratio for BT1, and then performing the subtractions to get individual cell voltages:


```
BT1  2.2556  3.000
BT2  2.3077  3.069  *2 = 6.138  3.138
BT3  2.0833  2.771  *3 = 8.313  2.185
BT4  2.1053  2.800  *4 = 11.20  2.887
```
I am actually astonished that there is such a large variation in the normalized cell voltage readings. But this is what I get when I use the transformation:


```
n*V[n] - (n-1)*V[n-1]
```
The actual values should be 330k, 1.66M, 2.99M, and 4.32M. And for cell 5: 5.65M. cell 6: 6.98M. The tolerance of the resistors higher in the string becomes critical. Worst case with 1% resistors 5.59M and 7.05M would be:


```
BT5  2.276  3.027 *5 = 15.13
BT6  2.236  2.974 *6 = 17.84
 
BT6 = 2.705  (almost 10% error)
```


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> I did not really consider the discharge time, and you are correct that it is insignificant. It may be helpful in explaining this to those who object to a BMS because of the supposed unbalancing effect. It would be good to show a table of current values and discharge times. So, for a 10 Ah cell and 10% discharge (1 Ah):
> 
> 
> ```
> ...




```

```
[/QUOTE]
Yes, I should comment on this in the users manual. I'd actually never calculated it until you brought it up.



PStechPaul said:


> However, there is still the question of the inconsistent ratios using the resistor values you have chosen. They introduce a very significant error. Normalizing to the ratio for BT1, and then performing the subtractions to get individual cell voltages


Why would you want them to be perfectly consistent? The software knows the divider values and thus calculates the correct voltage from the digit value. Heres an example for a string of 3V cells:



```
[FONT=Courier New]Ucell Ustring Rdiv Udiv  ADC Ustringcalc Ucellcalc
   BT1      3       3 0,33 2,256 700           3         3
   BT2      3       6 1,6  2,308 716           6         3
   BT3      3       9 3,32 2,083 646           9         3
   BT4      3      12 4,7  2,105 653          12         3
[/FONT]
```
The formulars are
Udiv = Ustring/(1+Rdiv)
ADC = Udiv/Uref*1024
Ustringcalc = ADC/1024*Uref*(1+Rdiv)
Ucellcalc = U - U(n-1), n>1

So whatever the divider value, it is finally cancelled out by the reverse calculation


----------



## PStechPaul (May 1, 2012)

I just wanted to reduce the floating point operations to make things simpler and faster. Actually, what I might do is use the same divider for each tap, so that the value for the maximum string (6 *4 = 24V) gives very nearly a full scale ADC reading. With the 3.3V reference, 1000 counts is 3.223 volts. So a divider with 10M and 1.54M (a standard value) will give cell voltages of 167 counts for 4 volts or 125 counts for 3 volts. So then you can just do integer arithmetic such as 500-375 = 125 for cell #3, and then multiply by 0.024 to get the value in volts for the display. The microcontroller really doesn't need floating point for its operation, as you can just set integer values for minimum and maximum cell voltages for alarm or charger/controller cutoff.

You don't really get any better accuracy by having different divider values to get near full scale ADC readings because the tolerance is multiplied by the floating point operations, while with identical dividers the error is divided by the same amount you lose in resolution. With six cells and a 10 bit ADC you still have better than 1% resolution. Also you might be able to use resistor networks which will have better tempco tracking and good tolerance on the ratio, which is more important than actual value.

I'm not trying to be critical, but just want to understand why certain design decisions were made, and perhaps shed some light on the observed variations of measurement that you reported earlier. Every engineer probably has certain fundamental ways of designing something and I think it is a good idea to compare them and use what is "best", but that can be a difficult term to define.


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> I'm not trying to be critical, but just want to understand why certain design decisions were made, and perhaps shed some light on the observed variations of measurement that you reported earlier. Every engineer probably has certain fundamental ways of designing something and I think it is a good idea to compare them and use what is "best", but that can be a difficult term to define.


Fair enough.

Here are some of my fundamental principles:


Minimalism: What parts can be removed/replaced by cheap parts without defeating the purpose of the system
Complexity to software: sometimes hardware can be simplified by doing some more stuff in software. The divider network is an example.
Optimize only when needed: optimization usually makes clean code ugly. So if my hardware is fast enough to run the unoptimized software, why optimize it?
The modules will spit out up to 378 voltages per second. The master unit, an STM32F1 runs at 72Mhz and can possibly complete 1000000 floating point operations per second.


I have met developers with very contrary views. Sometimes I learned from them, sometimes I decided that both is valid, and sometimes I found that views can become outdated. 

For example (no pun intended) I found that people who have done embedded software for the last decades still plan with the poor performance of old day MCUs in mind. Therefor they optimize straight from the start without even evaluating the performance. In this very application (the master unit), what good is a CPU that is idle 95% of the time?


Speaking of learning: I should indeed try to match the ratios a bit closer. The current ones are the result of the digikey database search for low temp coeff resistors. The attiny24 has a differential mode + gain amplifier which might turn out useful but is unusable with the current ratios.


----------



## jhuebner (Apr 30, 2010)

New PCBs have arrived

As they arrive:









Populated:









This is the final version.
They come from the factory with all the resistors and capacitors already populated. So assembly now takes about 10 minutes.

Of course they can also populate the whole board but I wasn't ready with the logistics i.e. having the extra parts sent to the factory.


----------



## PStechPaul (May 1, 2012)

The boards look very nice! Some of the reference designations seem different from what I am accustomed to. 

CN Connector (I use J for fixed connector or TB for terminal block)
T Transistor (I use Q - T is normally for Transformer)
OK Opto Coupler? (I usually use U - for Integrated Circuit - you use IC)
LED I usually use DS for lamps and displays (for Device, Signaling)


I am confused about R20 and LED1 with the overlapping decals. 

I also note what appear to be yellow pads on IR1, and two other yellow dots (probably fiducials). I assume that is either bare copper or gold?

But the proof of the pudding is the functionality, and that seems to have been shown in the prototype. The board seems to be nicely laid out with a good ground plane. As long as the readings are accurate and the current drain is insignificant, then it's a success!


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> The boards look very nice! Some of the reference designations seem different from what I am accustomed to.
> 
> CN Connector (I use J for fixed connector or TB for terminal block)
> T Transistor (I use Q - T is normally for Transformer)
> ...


Kind words, thanks 
The reference designations are pretty much eagle's default. I only paid some attention to the indexes so make a bit of sense. OK means opto coupler (Koppler) indeed. Very German there 

The parts that seem to overlap are for the optional opto coupler version. In that case the two IR parts are not populated.
The dots are not in my design, I guess it somehow helps the machine that populates the parts.

I also did another temp test. Up to 85°C and down to -20°C. I couldn't observe any temperature coefficient. Could it be true...


----------



## jhuebner (Apr 30, 2010)

Ok, I'm aware that I haven't updated this in a while.

But now that I have a system up and running I thought I should.

Here is what I have:
- 26 sense modules
- 2 IR communication units (ircom)
- 1 current sensing/actor unit
- 1 Beagle Bone Black

ircom, current sense unit and beagle bone are connected by one RS485 bus. Communication is text based.
The ircoms communicate with a binary protocol over infrared with the sense modules.
The beagle bone runs a python script that reads all 152 voltages+26 temperatures, does a bit of averaging and triggers a relay as soon as a cell limit is surpassed. The round trip time is 2-3s.
It also reads the current and does coulomb counting. The SOC is passed on to the actor unit to be displayed by a fuel gauge.

So it does everything I wanted. After clearing up the wiring it also works when the inverter is running.

Here is the part/manufacturing cost
- 12€ per sense board
- 12€ per ircom board
- 35€ per current sense/actor board
- 49€ per beagle bone black.

So I equipped my 152 cell car with a BMS capable of measuring every single cell voltage and doing the vehicle interfacing for just 420€ or 2.76€ per cell. Even at a market driven price of 800€ it would still be reasonably priced.

I'll post some more photos soon.

I have no real plans what to do with the design. I don't really feel like managing another kit though. Any ideas are welcome.


Here is a screenshot of a test drive. The distance between min/max voltage are an artifact of an older revision firmware. They are within +-0.05V while floating on the newer firmware


----------



## wguinon (Sep 26, 2010)

If you are worried about the voltage dividers imbalancing the pack you can use T or PI attenuators. There are several online calculators for designing these. You would design for constant input and load resistances with the required attenuation. Of course this would take an extra resistor.


----------

