# BMS design guidelines



## jeffcoat (Apr 16, 2012)

How about a low temperature shutdown for charging (at least as an option) - do not allow the charger to activate when temp is below 32F.


----------



## frodus (Apr 12, 2008)

Siwastaja,
Have you taken a peak at this:
http://www.amazon.com/Battery-Management-Systems-Large-Lithium/dp/1608071049

Click on "search inside book" on the left under the picture of the book. Some great info. Goes over all the different designs. Sitting on my shelf if you want me to look anything up for ya.




jeffcoat said:


> How about a low temperature shutdown for charging (at least as an option) - do not allow the charger to activate when temp is below 32F.


Having the charger on at a low current at that low temperature could actually keep the batteries from freezing.


----------



## Siwastaja (Aug 1, 2012)

frodus said:


> Siwastaja,
> Have you taken a peak at this:
> http://www.amazon.com/Battery-Management-Systems-Large-Lithium/dp/1608071049
> 
> Click on "search inside book" on the left under the picture of the book. Some great info. Goes over all the different designs. Sitting on my shelf if you want me to look anything up for ya.


Yeah, I have taken a peak inside; it looks excellent. Have been thinking about buying it.




> Having the charger on at a low current at that low temperature could actually keep the batteries from freezing.


Maybe, at least until they are full at which point you cannot charge anymore.

The "problem" is, lithium has way too "good" efficiency to do this well enough, and the efficiency is higher the lower the current is. Also, once it's full you cannot trickle charge it (or yes you can by using 100% SOC OCV, but it won't generate heat then).

For cold areas, a combination of battery insulation and battery heater is the only way. Good insulation should be enough for daily use, but the heater should be there in case the car is left for a few days sitting in cold with emptyish battery pack.

Oh, it's off-topic again .


----------



## frodus (Apr 12, 2008)

Siwastaja said:


> Yeah, I have taken a peak inside; it looks excellent. Have been thinking about buying it.


I highly recommend it. Basically reconfirmed everything I learned when I helped build/design some different BMS devices for a local Portland company. 




> Maybe, at least until they are full at which point you cannot charge anymore.


Yes, but if it's that cold, you know that it's cold well before and you can shut off the charger/turn it back on/turn off/turn on in anticipation. Eventually, you're right, but I don't think low temp should stop charging, it should continue it as long as it can.


----------



## Matter45 (Jan 2, 2013)

siwastaja said:


> bms is simple as hell. Don't overengineer it.


amen to that! :d


----------



## PStechPaul (May 1, 2012)

Thanks for starting this thread. The book on Amazon looks very good, and I see that the author is Davide Andrea of Elithion LLC. Having a comprehensive book such as this can be valuable, although in the electronics field the material can quickly become outdated. How much has changed since 2010, when it was published? And it was probably mostly written in 2008-2009. 

Another good source of information is companies who make batteries and those who offer ICs for various aspects of battery management. Some such sources are:
http://www.linear.com/products/battery_management
http://www.maximintegrated.com/products/power/battery_management/
http://www.ti.com/lit/sg/slyt420/slyt420.pdf
http://liionbms.com/php/index.php (Elithion)
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2087
http://www.freescale.com/webapp/sps/site/taxonomy.jsp?code=BATTMNGT
http://minibms.mybigcommerce.com/

I have several ideas which may be realized as separate designs or combined into a complete system

A simple single cell monitor which presents a minimal current drain (10-100 uA) and flashes one or more LEDs showing SOC based on cell voltage from 2V to 5V. Target cost < $5/cell.
Single cell monitor and charge/discharge controller. Flashing LEDs for indication of SOC. Bypass charge current upon maximum voltage. Isolated signal to charger to taper off charge and shut down when all cells fully charged and balanced. Open cell detection and protection: For charging by shunting charge current and sending shutoff signal to charger. For discharging avoid cell reversal by detecting low voltage and activating bypass circuit, and/or using power diode, and sending shutoff signal to controller and main interlock. Target cost < $10/cell.
Single cell analyzer, which can perform a pre-programmed sequence of charging and discharging at various rates and store data or send to PC via USB connection for further analysis. Test profile can also be changed and controlled by USB. Target cost $50-$200 depending on cell A-h rating and complexity of software.
Integrated modular battery pack for small cylindrical cells. Package 12 cells in series for 38.4V Li-Ion or 44.4V LiFePO4. Internal relay disconnects module under internal fault conditions, and requires external 12V signal to activate. Eight modules in series supplies 307V or 355V for 230 VAC VFD, or 15 in series for 576V or 666V for 460 VAC VFD. Modules may be connected in series or parallel for various voltage and current capacity.
Those are my ideas at this time. I want to do some testing on the inexpensive Li-Ion 18650 cells I found, as well as the NiMH which may be a viable alternative. Another version of these devices could be made for 12V SLAs and Flooded Lead batteries. My particular immediate interest is for use in small vehicles such as lawn tractors, wheelchairs, ATVs, and bikes, but may be scaled up for larger lithium cells of 20-100+ Ah capacity for road vehicles such as cars and trucks. I am focusing on standard industrial 3 phase motors so the battery pack voltage will be 300-600 VDC nominal, and 2-5 HP motors drawing 3 to 10 amps where one or two strings of 3600 Ah cells would be sufficient.


----------



## PStechPaul (May 1, 2012)

Here is a very simple and cheap single cell BMS which uses only about $3 in components and can be adjusted to limit charge to any voltage from about 3V to 4.5V. Here it is set to 3.62 volts. 










The functionality of the circuit could be replicated with much higher accuracy using a small PIC, with little difference in cost, and it can have a better SOC indicator and shutdown signal. The ASC file for this design is available at: http://enginuitysystems.com/pix/ShuntChargeLimiter_NMOS_PNP.asc


----------



## Tesseract (Sep 27, 2008)

Consider what will happen to your $5 BMS if the cell it is connected to goes open circuit, either from internal failure, or because one of the terminal bolts loosened up...

To protect against this all-too-common failure mode requires adding either a blocking diode or a DC fuse capable of withstanding the full pack voltage. Both solutions are sub-optimal: the diode will result in a temperature and current dependent offset in the cell voltage while HV DC fuses are big and expensive.


----------



## SimonRafferty (Apr 13, 2009)

Tesseract - is that not a problem with pretty much any of the commonly used BMS?

Do you have a better solution?

I guess you could use small PTC heater elements instead of the shunt resistors. They will get up to a pre-defined temperature and only sink the current required to maintain it. So even with the full pack voltage across it, the current is controlled and they will not spontaneously combust like a resistor!

Si


----------



## PStechPaul (May 1, 2012)

For the simple circuit I show above, during charging, if a cell opens up, the voltage is held at about 4 volts and the shunt resistor and MOSFET draw up to 20A. This voltage would be maintained as long as the charger were properly current limited, and of course this would be a fault condition which would be detected by the BMS (assuming it uses a PIC or other processor), and it would signal the charger to disconnect within 100 mSec or so.

In the case of a 150V pack with a 1 ohm (150A) load, the MOSFET reverse diode would conduct, and the 0.2 ohm shunt resistor would limit the current to 130 amps and there would be -27V across the cell BMS. The resistor would dissipate 3000 watts and the MOSFET would see 143 watts. But it would be easy to add an optoisolator so that any reverse voltage would turn it on and send a signal to the main interlock contactor to shut down. This would happen as soon as the voltage reached about -3V, at which point the shunt resistor saw about 12 amps which would be 28 watts, and the MOSFET would see 9 watts. If the cell opened gradually (as in 100 mSec or so), the voltage would rise slowly enough for the fault protection circuitry to shut down the pack before severe damage (or any danage) would occur. 

Another safeguard would be a TVS diode across each cell that would limit the voltage to 6 volts or so. Here is a 3000W TVS that can withstand a pulse current of 326 amps and costs less than $1. 
http://www.mouser.com/ProductDetail...=sGAEpiMZZMsYiK5PgaDog9xriego/BKRX2LxccMvWjs=

Or a 5000W version that can handle over 500A for about $2 in quantity:
http://www.mouser.com/ProductDetail...EpiMZZMsYiK5PgaDog38p0a8Da%2bhYvYJr%2bz8m5XI=

A 3.5 volt version may be better:
http://www.mouser.com/ProductDetail...GAEpiMZZMsYiK5PgaDogyJ4ny/JxXeZY8cFkHLu%2blg=

What happens when a cell opens without any BMS or other form of protection? Or with a commercially available BMS?


----------



## Tesseract (Sep 27, 2008)

SimonRafferty said:


> Tesseract - is that not a problem with pretty much any of the commonly used BMS?
> 
> Do you have a better solution?


No I don't have a better solution, and I consider this problem to be intractable when real-world economics are factored in. That is to say, it can't be solved without costing more money than consumers are willing to pay.



SimonRafferty said:


> I guess you could use small PTC heater elements instead of the shunt resistors.... i


Nope. The PTC resistor has to be rated for the full pack voltage.


----------



## EVfun (Mar 14, 2010)

Perhaps a 5.1 volt zener and a fuse could handle both open circuit and short circuit. The zener would be in parallel with the reg and the the fuse would be in series those. In the event of an open cell while driving the zener would conduct for only a fraction of a second, but a longer fraction of a second than the fuse would remain intact. In the event of a open circuit while charging the diode would conduct at about 1 volt and the fuse blow. Here is an idea for the fuse. It gets trickier to find a inexpensive fuse with a higher DC voltage rating as the desired current gets higher. Very little shunt current should be required if you start with a top balanced pack.


----------



## PStechPaul (May 1, 2012)

The only way I can see to protect against an open cell is to detect it quickly and shut down the charger or the pack main contactor if it opens while the vehicle is operating. For the small battery packs that I am considering for tractors and such, with pack "modules" of perhaps 12 cells in series, it would be fairly easy to use a wired-OR configuration of optoisolators which would turn on in the case of an overvoltage event due to opening of any single cell, and it could trip a relay that would disconnect the entire module. My idea is to require an external 12V (or higher) signal to activate the pack, and it could even latch on using the pack voltage to keep it closed. It would draw some current from the pack, but a relay with a 24 VDC coil with contacts rated at 30 amps has a coil resistance of 660 ohms for 36 mA and probably can be held in using a PWM circuit with about 10 mA, which would be less than 1% reduction of capacity for a pack rated at 3600 mA or higher.
http://www.mouser.com/ProductDetail...=sGAEpiMZZMtSzCF3XBhmW6vMa/MpJxoPyldbPKvob5Q=

This particular relay costs about $2 in quantity and can switch 30A at 28VDC or 240 VAC. Since the pack will have a BMS with 11 good batteries at 3.3V each and one open cell with a reverse voltage of -6V or less, the relay would actually only switch about 28VDC, especially if there were more than one series string in the battery pack. This would isolate the string and allow the others to provide enough continued capacity to operate the vehicle at reduced power.

Another way to handle an open cell would be for the relay to be an SPDT type which would open the path to the defective cell and shunt the rest of the current, which would just diminish the pack voltage by 3 volts or so. For a 150V pack with multiple strings in parallel this would only be a loss of 2% of full pack voltage and the current draw would still be fairly well balanced. If the packs were isolated with high current Schottky rectifiers it would avoid the problem of the higher voltage pack trying to charge the lower voltage pack, but unless the cells were fully charged it would probably soon balance itself even without diodes.

BTW, the fuse you suggest is only rated up to 5 amps, and costs about $3, which is more than the 30A relay I mention:
http://www.mouser.com/ProductDetail...CI-5-R/?qs=sGAEpiMZZMtLo%2bUrTGGA8ZHRY8wA6WCm


----------



## PStechPaul (May 1, 2012)

I just found this resource that seems rather comprehensive and worthwhile looking at. I found it when searching for "open cell protection lithium battery pack EV".

http://www.nfpa.org/assets/files/PDF/Research/RFLithiumIonBatteriesHazard.pdf

Some other links with useful info:

http://www.o2micro.com/prods/o2m_intbattery_catalog.pdf
http://www.ipd.anl.gov/anlpubs/2011/10/71302.pdf
http://www.ibt-power.com/Battery_packs/Li_Ion/Lithium_ion_tech.html
http://www.eosenergystorage.com/documents/2012_JES_Christensen_Kojic_Critical_Review_Li-air.pdf (Lithium-Air cells)
http://www.batteryspace.com/prod-specs/6059.pdf (testing)
http://industrial.panasonic.com/www-data/pdf/ACI4000/ACI4000PE5.pdf
http://www.transportation.anl.gov/b...oundtable/battery_mgmt_system_tsinghua_lu.pdf
http://www.mpoweruk.com/protection.htm (also many other topics)
http://www.transportation.anl.gov/pdfs/TA/149.pdf (costs)
http://www-scf.usc.edu/~rzhao/LFP_study.pdf
http://www.evolveelectrics.com/Lithiumate_Lite.html (Elithion BMS)
http://www.te.com/content/dam/te/gl.../knowledge-center/documents/mhp-techpaper.pdf
http://www.nrel.gov/vehiclesandfuels/energystorage/pdfs/apesaran.pdf (thermal issues)
http://www.batteryfaq.net/battery-news/how-much-do-you-know-batterys-protection-circuits-1056.html
http://ecec.mne.psu.edu/Pubs/2006-Smith-JPS-1.pdf (power and thermal)

and the list goes on. There is a huge amount of information out there, but really not very much specifically addressing the problem of open cell failure.


----------



## EVfun (Mar 14, 2010)

PStechPaul said:


> BTW, the fuse you suggest is only rated up to 5 amps, and costs about $3, which is more than the 30A relay I mention:
> http://www.mouser.com/ProductDetail...CI-5-R/?qs=sGAEpiMZZMtLo%2bUrTGGA8ZHRY8wA6WCm


You shouldn't need to bypass much current. I have seen no need to bypass more than 1/2 amp (EVpower regs) with a pre-balanced pack. I was eying a 2 amp fuse for about a 1.5 amp shunt.

What impressed me about the fuse I listed was the DC interrupt rating. Up to 450 volts DC with up to a 5900 amp interrupt. They where listed for $2.17 each at Digi-Key. If an inexpensive zener that will hold on longer than the fuse is available it would be a few extra dollars a cell. 

There have been some BMS systems that drain a cell dead without warning if subjected to brief reversals or over-voltage conditions. I was thinking in terms of shutting the cell module down dead so so the monitoring loop would throw an error. There may be simpler, even passive, to provide that kind of protection against over voltage and reverse voltage.


----------



## PStechPaul (May 1, 2012)

I think the 1/2 amp bypass specification is only for charge equalization, where it removes, say, 5% of total charge current of 10 amps until other cells with greater capacity reach maximum SOC. But if a cell opens, with a constant current source, there will be a voltage imposed on the open cell which will be the full charger compliance voltage less the voltage of the intact cells. So a battery charger which uses a 170 VDC peak voltage (from a 120 VAC rectified line voltage), on a 120V nominal pack with 38 cells at 3.2V each, will have 170-(37*3.2) = 51.6V applied to it. If the rest of the pack cells have internal resistance of 0.05 ohms (probably much less), it only takes 20*1.9 = 38 VDC to maintain a 10 amp charge. 

The situation is much more dire in the case of discharge during maximum current draw, where the entire remaining pack voltage can be applied to the open cell, and the inductance of the motor could generate a much higher voltage. So it is important to have a fast passive means to maintain continuity of the circuit during fault conditions, long enough for a secondary means of shutdown can be activated.

As I explained before, having multiple strings of cells in parallel eliminates most of the problem by providing auxiliary paths for the current, and a simple disconnect of a defective string, or bypass of an open cell, can permit continued use of the EV until the defective cell can be replaced.


----------



## Matter45 (Jan 2, 2013)

the balance circuit that i have passes a certain % of current based on how unbalanced that cell is from the rest of the pack. costs about $1 - $1.50 per cell if the parts are bought in bulk.

so PStechpaul is talking about passing current when the max voltage has been reached? or just a maximum safety voltage thingy?

And dont tell me that the mainstream dc motors that we DIY's buy dont have feedback protection? (as PStechpaul metions above)


----------



## Tesseract (Sep 27, 2008)

EVfun said:


> ... Here is an idea for the fuse....


The Cooper Bussmann BK-PCx series fuses are a pretty good choice here, with the caveat that low amperage fuses tend to fail early from vibration/fatigue in automotive applications. 

Aside from that, the only real problem is that they are relatively expensive, ranging in price from $1.55 to $6.10 each in 100s. Hence my earlier comment about there being no solution to the open-cell failure problem which is economically viable.

In the end, the least expensive and most reliable way to protect a non-balancing BMS (ie - one that only monitors cell voltage) is with a series diode rated for more than the full pack voltage, accepting that the forward voltage drop of the diode will vary with temperature (and current, hence why I say to only use it with a BMonS) and that variation can only be partially compensated for in software (or hardware, if you are into a strictly analog solution).


----------



## PStechPaul (May 1, 2012)

I have made an initial design of a single cell BMS system:










It has a shunt MOSFET and a 0.47 ohm power resistor which is designed to limit charging voltage to a voltage determined by the PIC, and it can shunt up to 7 amps before the voltage will climb above 3.3 volts. The top balance voltage can be programmed to anything from 3V to 4.5V, and at that point it will start shunting the charge current and also will activate the optoisolator which can shut down the charger. It is possible to connect the optoisolator outputs in series so that shutdown will occur only when all cells have been balanced, or if connected in parallel the first cell to reach maximum voltage will shut down the charge. There is also a visual indication from the red LED. 

If a reverse voltage is applied, as may happen if a cell is depleted during discharge, the MOSFET reverse diode will conduct and the current will be shunted by the 0.47 ohm resistor. It will also activate the optoisolator which should be connected so as to shut down the pack. Of course, in normal operation, the PIC would sense a drop in cell voltage before reversal occurred, and it would flag the error and shut down. But in case of a sudden open circuit of a cell, it would also protect the system by limiting the voltage. 

The green LED is used as a status indicator. It can be set up to flash at a variable rate to indicate battery voltage. Thus during charging it can show the progress as the voltage increases, or it can also use the time elapsed as a measure of SOC. This design does not have a current sensor, so it cannot comput Ah, but that is more a function of the charger. 

In the absense of charging current, the PIC is powered from the cell, and can provide a flashing green LED signal to indicate open circuit voltage. The PIC itself draws only about 25 uA when operating and as little as 20 nA standby. The LED is visible at current as low as 2 mA and it can have a duty cycle of 100 mSec/10 sec which is the equivalent of 20 uA. So an average draw of 50 uA on a 3 Ah battery would drain it to 90% capacity in 6000 hours. It could also be programmed to enter standby mode if the open cell voltage was less than, say, 2.8 volts, so it would not deplete the battery even after years of storage. 

The total cost of this design is mostly the PIC ($0.50), MOSFET ($0.75), Optoisolator ($0.25), and power resistor ($0.50). The other components are mostly penny and nickle parts or maybe $0.25 total, and the PCB would be about $1 in 100pc quantity. So about $3.25 total. Of course this is designed for a small pack of 3-10 Ah capacity, but the design could be scaled up to handle 40-200 Ah cells. 

This is still in its "infancy" so it may change as I dig into details. Also I have chosen the smallest and cheapest PIC I could find, just to see if it could work, and I have a couple of development boards using this part. A more capable part with more I/O pins would still be less than $1. I also need to deal with the problem of reading the cell voltage which will be the same as or greater than the supply voltage. A voltage divider would be the obvious answer, but the ADC requires a maximum source impedance of 10kohms, which would be 320 uA on a 3.2 volt cell. Probably still OK. But I could use an external MOSFET to connect the ground side of the divider only during measurement. Such things are part of the challenge and allure of electronic design. So please tell me any pros and cons of this circuit, and any features that might be desired. 

Thanks.


----------



## GerhardRP (Nov 17, 2009)

PStechPaul said:


> <snip> It could also be programmed to enter standby mode if <snip>


I would be a non-BMS person, but anyway, could you program the unit to go to standby if there is no voltage change in say 15 minutes indicating that the system is neither charging nor running and thus needs no management?
Gerhard


----------



## EVfun (Mar 14, 2010)

PStechPaul said:


> It has a shunt MOSFET and a 0.47 ohm power resistor which is designed to limit charging voltage to a voltage determined by the PIC, and it can shunt up to 7 amps before the voltage will climb above 3.3 volts. The top balance voltage can be programmed to anything from 3V to 4.5V, and at that point it will start shunting the charge current and also will activate the optoisolator which can shut down the charger. It is possible to connect the optoisolator outputs in series so that shutdown will occur only when all cells have been balanced, or if connected in parallel the first cell to reach maximum voltage will shut down the charge. There is also a visual indication from the red LED.


There is a concern with having the optical isolator turn ON to indicate a fault. If the unit fails it may never turn on. If the cell voltage falls to low it will not turn on. Most of the Lithium BMS designs use a normally ON optical isolator. That uses power, but with a PIC on board it could be pulsed for a small on time. Alternately, you could set up a bus type system where perhaps a 10 milliamp "constant current" on the BMS sensing board would result in a voltage between 5 and 6 volts on that pair. 2 wires from the sensing board to the first reg, and the rest in parallel to the far end of the string where you would have a "terminator" that could be an LED and voltage regulator. If the BMS loop string opened the voltage would rise. If a cell reg closed the voltage would fall. 

Another thing to consider is how they would work if someone was not using the monitoring loop. If they just use them as a shunt reg what happens in each failure mode?

You may want the optical isolator voltage and the shunting voltage to be 2 different points. For example, start shunting at 3.5 volts but don't shut down unless a cell hits 3.7 volts.


----------



## PStechPaul (May 1, 2012)

Good ideas.

(1) There could be separate charging and discharging modes. When charging, the main problem will be overvoltage, and it does not matter if the optoisolator draws 5 mA from the charger. So the optoisolator outputs will be wired in series and must be ON for the charger to be enabled. The bypass will start at the rated top balance voltage (3.4 to 3.5V) and the charger will only be disabled if any cell exceeds 3.6 or 3.7V. It could also be a fault condition if a cell is less than, say, 2.5V. This would be almost automatic since the forward voltage of the optoisolator LED and perhaps a series diode would turn it off at about that voltage.

(2) In discharge mode, the 5 mA current draw is insignificant as long as the pack is being used, which can be determined by detecting normal rise and fall of cell voltage from delivering current to the controller or from regeneration. During discharge, shutdown would only be needed for a low cell voltage. There could be a time delay to allow for short bursts of high current during acceleration. As in charge mode, the optoisolator would shut down anyway at about 2V. If a longer time delay is needed, a capacitor could hold the PIC supply voltage above 3V for 1 or 2 seconds.

(3) The PIC has a built-in temperature sensor, so it could detect an abnormally high temperature of the cell and/or the shunt resistor. It could also adjust the threshold voltages depending on cell temperature.

(4) It seems like the charge and discharge modes can be just about the same, and the normally ON shutdown signal can be used for either. If no change is detected after 15 minutes it could go into standby mode where it could wake up every minute to take a voltage sample. That would require the watchdog timer to be running while asleep, but that takes only about 500 nA.

Thanks for the suggestions!


----------



## PStechPaul (May 1, 2012)

OK, I made some changes that should make this work:










I added a Schottky diode across the battery which will be more effective at limiting reverse voltage to about 0.5V. But it may not be necessary. The Overvoltage LED DS2 automatically limits the cell voltage to about 3.8 VDC even without the PIC. This also may not be necessary.

Otherwise, as long as there is at least 2.5 VDC for the PIC, it will be operational, and the internal reference of 2.048V will be available, and the voltage divider will provide 1/3 battery voltage to the ADC. It presents 15k impedance or about 213 uA drain on the battery. When the voltage is within normal range, RA2 will be held low which activates the optoisolator and lights the green LED. When the voltage reaches the 3.4V top balance voltage, the output of RA1 will start to turn on the MOSFET which will shunt some of the charge current. It is a PWM output so it can provide a variable voltage to control the MOSFET. A capacitor on the gate provides a smooth DC, but it is also possile to use PWM without the capacitor to reduce power in the MOSFET.

If a fault condition is detected, the output of RA2 will go high which turns off the optoisolator and turns on the red LED.

When no change is sensed over a 15 minute interval the device will enter a sleep mode which turns off the LEDs. This would occur when the system is neither being charged nor providing current. It would still draw current through the voltage divider, but even that could be turned off if a small MOSFET were added to the ground leg, and turned off during sleep. That would require another I/O pin, which can be provided with another PIC.

I think this thing is ready to be built and tested.


----------



## Matter45 (Jan 2, 2013)

why have you got 2 diodes in parallel?

Also what is JP1 and JP2?


----------



## PStechPaul (May 1, 2012)

Matter45 said:


> why have you got 2 diodes in parallel?


That is a center tap dual diode in TO-220 package. I have a bunch of them. It may not even be needed if the BMS detects a low cell and shuts off the controller. Otherwise it needs to handle full pack current.



> Also what is JP1 and JP2?


Those are jumpers that need to be removed for programming the PIC using in circuit programming, which is through the five pin header J2.

I have updated the schematic to make it a bit clearer. What do you think?


----------



## Siwastaja (Aug 1, 2012)

GerhardRP said:


> I would be a non-BMS person, but anyway, could you program the unit to go to standby if there is no voltage change in say 15 minutes indicating that the system is neither charging nor running and thus needs no management?
> Gerhard


A proper digital BMS should "know" if it is charging, driving or idle (power off) by communicating with the main unit, so no need to deduce that from the voltage change.

A modern MCU takes very little power, so practically the only component taking some current is the optoisolating communication link (LED). A good alternative today would be a transformer-based communication isolator IC.

Therefore, a digital BMS should be constructed so that in the "power off" mode (not charging nor driving), the optoisolator LED is OFF. The MCU can be in a sleep or low-power mode, but it is not absolutely necessary, as even "full on" mode consumption of about 0.5 - 1 mA may not be too much; but the LED may take 10-20 mA and should be off. 

Actually, this is the problem of simple analog "miniBMS" type, as it cannot recognize between "power off" and "in use" modes and needs to always have the LED on. This is the only downside I can think of and it's usually not a problem if the user knows about it.

But when designing a _digital_ BMS, there is no reason to use that much current.

In a digital BMS, the main unit should turn the cell modules "on" when either charging or driving starts (_receiving_ these commands won't take a lot of current in the cell modules), and refuse switching charger / drive contactors on before every cell module has reported "I'm on now, the cell is fine, voltage is x, tempareture is y".

This way, the "power off" consumption from the cells can be easily made about 100 - 500 µA, depending on design, "power on" consumption being somewhere around 1 - 20 mA, depending on whether using transformer based or optoisolated communication.


----------



## PStechPaul (May 1, 2012)

The circuit I show is designed to provide top charge management as well as in-use protection during discharge, and also as a single cell status indicator with minimal current draw. The idea is to have one of these on each cell, and when a pack is connected to a charger (or the controller in an EV), the optoisolators will be connected in series and function as a fault protection interlock.

The maximum number of cells would be that required for a 360V or 720V pack for use with a commercial 230 or 460 volt VFD. So for LiFePO4 (3.2V) it would be 112 or 224, and for Li-Ion (3.7V) it would be 98 or 196. It may be possible to tell the charger what the total pack voltage at maximum charge should be, by adding a 36 ohm or 42 ohm resistor to each optoisolator, so that the charger can inject a 10 mA signal to the string and it should read 360 or 420 mV per cell, corresponding to 3.6 or 4.2 volts per cell. So a 112 cell LiFePO4 pack would read 112*0.36 or 40.3V, while the 196 cell Li-Ion pack would read 82.3V. The saturation voltage of the optoisolator transistors would add another 200-300mV per cell, but it could be calculated by sampling at two different currents. For instance, with the optoisolator LED at 5 mA, a 5 mA collector current causes a 600 mV drop, while a 2.5 mA current causes a 200 mV drop. So the apparent resistance due to the saturation voltage changes from 120 ohms to 80 ohms, while the actual resistance will stay at 36 or 42 ohms. This might not be practical, but it's just an idea to consider. Maybe a diode would be better, since it has a fairly predictable forward drop if you know the temperature, and it is about 600-800 mV.

There are more sophisticated ways to communicate between the charger or controller and the battery pack, of course. The usual BMS reads perhaps 16 cells, so a 720V pack could be handled by 12 BMS units. They could be connected by means of isolated transmit and receive USARTs where each BMS has a unique address and thus each may be queried for information as well as controlled by the motor controller or the charger. That could even be done with up to 255 devices with unique 8 bit addresses.

Probably best to use the KISS principle, however.


----------



## PThompson509 (Jul 9, 2009)

I have 108 CALB60 that I currently have the miniBMS on. The miniBMS does most of what I want, but it doesn't let me know WHICH cell has gone soft. If you could figure out a way to signal this (via LED) or via the master, that would be great - I would be willing to be a Scratch Monkey for this project.

Cheers, Peter



PStechPaul said:


> The circuit I show is designed to provide top charge management as well as in-use protection during discharge, and also as a single cell status indicator with minimal current draw. The idea is to have one of these on each cell, and when a pack is connected to a charger (or the controller in an EV), the optoisolators will be connected in series and function as a fault protection interlock.
> 
> The maximum number of cells would be that required for a 360V or 720V pack for use with a commercial 230 or 460 volt VFD. So for LiFePO4 (3.2V) it would be 112 or 224, and for Li-Ion (3.7V) it would be 98 or 196. It may be possible to tell the charger what the total pack voltage at maximum charge should be, by adding a 36 ohm or 42 ohm resistor to each optoisolator, so that the charger can inject a 10 mA signal to the string and it should read 360 or 420 mV per cell, corresponding to 3.6 or 4.2 volts per cell. So a 112 cell LiFePO4 pack would read 112*0.36 or 40.3V, while the 196 cell Li-Ion pack would read 82.3V. The saturation voltage of the optoisolator transistors would add another 200-300mV per cell, but it could be calculated by sampling at two different currents. For instance, with the optoisolator LED at 5 mA, a 5 mA collector current causes a 600 mV drop, while a 2.5 mA current causes a 200 mV drop. So the apparent resistance due to the saturation voltage changes from 120 ohms to 80 ohms, while the actual resistance will stay at 36 or 42 ohms. This might not be practical, but it's just an idea to consider. Maybe a diode would be better, since it has a fairly predictable forward drop if you know the temperature, and it is about 600-800 mV.
> 
> ...


----------



## PStechPaul (May 1, 2012)

PThompson509 said:


> I have 108 CALB60 that I currently have the miniBMS on. The miniBMS does most of what I want, but it doesn't let me know WHICH cell has gone soft. If you could figure out a way to signal this (via LED) or via the master, that would be great - I would be willing to be a Scratch Monkey for this project.
> 
> Cheers, Peter


If you can supply information about the BMS you have, and the parameters you want for determining a bad cell, I'll see if I can make this design work for that. I would also need to know how your master charger and/or motor controller works, and if you need this for charging or running the vehicle. The visual indication would be pretty easy, if a simple LED for each cell would be OK. Would the open circuit voltage alone be able to determine a bad cell? 

Thanks for the "Scratch Monkey" offer. I'm not sure exactly what you mean, although I assume that you would be willing to cover some or all the cost of materials and PC boards and install them on your vehicle or testing. That would be a lot of boards for 108 cells, although they could be combined on a panel of, say, 10x12 or 120 small boards that are scored so they can be snapped off as individual circuits, or left intact. 

The indication only could be done with the boards located remotely from the cells and connected by small wires (which need to be fused), while the charge bypass and reverse cell protection need to be able to handle higher current, so need to connected directly to each cell.

If you have all the optoisolator outputs wired in series to enable the controller, you could attach an LED across each one, so that it will light when that opto turns off. The charger or controller (or master) would need to be able to detect that, which is a little harder than an open circuit. With 2.5 mA through the string, the normal voltage would be 108*0.2 = 21.6 V. So if the indicator LED had a 1k series resistor, the fault voltage would be 21.6 + 2.5*1 = 24.1 V. And the LED would not be very bright at 2.5 mA. But it should be possible to make a simple circuit that would operate at much lower current and charge a capacitor that would discharge into an LED with a bright flash every second or so. This can be done with a $0.25 unijunction transistor or another tiny PIC, or even a small SCR or Diac (which is only about $0.15).

Sorry to ramble on so much, but I'm sort of going through the design process while writing down various options. But I think the Diac and flashing LED will be the best option and will add only about $0.25/cell.

Here is a Diac LED flasher circuit:
http://electroschematics.com/5698/high-volt-led-flasher/

I found information on the MiniBMS here:
http://www.cleanpowerauto.com/MiniBMS.html

I see that the individual modules are $12 each, and the "head board" is $30. So for your 108 cells the system is $1326. That's probably reasonable for a commercial product, since it appears that the modules use some fairly pricy components, such as an electromechanical relay. Usually a good target selling price is 3x cost, which provides some payback on engineering NRE, as well as warranty and liability insurance, and some profit for the manufacturer. 

But I see that the shunt current is limited to about 1 amp, while mine can handle 10 amps or more. And I don't think the MiniBMS provides direct reverse cell protection with a large Schottky diode, although this may be unnecessary. It seems like the MiniBMS does show a visual (and optionally audible) indication of individual cell failure.


----------



## PThompson509 (Jul 9, 2009)

Howdy,

Yes, I am using the miniBMS with the small "master" unit. I have the Manzanita PFC-20 charger (using the interconnect to allow the miniBMS to shut down the charger). The car is a 1975 Porsche 914.

I've got 3 bays with batteries, most in the rear bay (about 18 in the middle bay, and about 30 in the front bay). The rear bay is separated from the middle and front bay by the passenger compartment. 

The miniBMS provides a LED to show the battery is in "safe" range and is in shunt mode, but nothing to show that the battery has been in "unsafe" range lately, so it's really hard to find the battery that is soft. The open circuit voltage won't show a bad cell any more than the miniBMS can.

Sorry about the lingo - "Scratch Monkey" is an old computer term, meaning I am willing to be the test fixture. (do a google search for "scratch monkey"). 

Yes, the $1325 sounds about right for my system. Because I have the batteries split between different bays, it makes things difficult for me to have a BMS that can handle the distance. The previous BMS couldn't handle the noise that my system was producing, hence the switch to miniBMS.

More info can be found on my blog: http://cruzware.com/peter/blog

Cheers,
Peter




PStechPaul said:


> If you can supply information about the BMS you have, and the parameters you want for determining a bad cell, I'll see if I can make this design work for that. I would also need to know how your master charger and/or motor controller works, and if you need this for charging or running the vehicle. The visual indication would be pretty easy, if a simple LED for each cell would be OK. Would the open circuit voltage alone be able to determine a bad cell?
> 
> Thanks for the "Scratch Monkey" offer. I'm not sure exactly what you mean, although I assume that you would be willing to cover some or all the cost of materials and PC boards and install them on your vehicle or testing. That would be a lot of boards for 108 cells, although they could be combined on a panel of, say, 10x12 or 120 small boards that are scored so they can be snapped off as individual circuits, or left intact.
> 
> ...


----------



## PStechPaul (May 1, 2012)

Thanks for the additional information. What conditions would be necessary to determine that a cell is "soft"? I had thought that the open circuit voltage gave some indication, but perhaps it needs to be under some sort of load. It is certainly possible for the single cell BMS that I am designing, to apply the shunt load (in this case 0.47 ohms) to the cell (about 6 amps at 3 volts), long enough to take a voltage reading under load. Hopefully this would be able to trigger the fault indicator which would open the output of the optoisolator.

To display the open circuit condition of the optoisolator of a bad cell, I would use an LED flasher as I mentioned above. It can be made from a Diac, but also from an SCR. I just happen to have several thousand SCRs I got surplus, which are 2N6504, rated 50V and 25A. I'm not sure they would work, but I found a SPICE model for a similar SCR, MCR8SN, and it seems to work well enough in simulation:












It shows a fairly bright 14mA pulse through the LED at a rate of about twice a second. If this will work for the MIniBMS, it should be easy enough to build a prototype circuit to see if it works. This simulation uses a 48V supply with a 10k resistor as a nominal 5mA signal for the BMS master. When the opto is open, as shown, this circuit draws only about 400 uA.

Unfortunately, the 2N6504 requires about 10mA gate trigger current compared to 25uA for the MCR8S. There is a 2N5064 sensitive gate SCR in a TO-92 package rated at 800 mA with 200uA(max) trigger current, and it's only $0.16/100. I am ordering a few to try. There's also a BT150 in a TO220 package rated at 4A with a 15uA gate, or $0.60/1 and $0.46/100. 

The 2N6027 PUT is only $0.16 that may work at a low voltage (about 6V). The Diac takes about 30V and costs more. But it could be combined with the 2N6504 to make a high power flasher.

Whereabouts in San Diego are you? It's been over ten years since I last visited, and when I have, I stayed in Ocean Beach, which is a really cool place similar to the more local Rehoboth Beach. I've also explored the San Gabriel mountains (Mt Wilson Observatory), Pacific Crest Trail, Old Town, Balboa Park, Tecate (Mexico), and Torrey Pines. I wouldn't mind taking another trip out that way sometime.


----------



## PThompson509 (Jul 9, 2009)

In order to determine which battery is soft, it has to be done under a load. I'm sure this is covered in other threads, so I won't toss out any (mis)information I may have.

I live near the football stadium, not near the beach (much to my regret - I used to live near the beach in Santa Cruz). 

So once the cell BMS has discovered that a battery is soft, how will this be communicated to the head unit? Have you figured out how to get communications to work in noisy EM environments?

Cheers, Peter


----------



## PStechPaul (May 1, 2012)

The head unit will see the open optoisolator in the series string as a drop in current, which will disconnect the charger or adjust the throttle (which is how the MiniBMS works). You would have to look at the LEDs on the cells to determine which one is bad and then remove it for repair or replacement. The LEDs could be mounted remotely but you would need one wire for each cell. 

To implement a more sophisticated intercell communication system, my idea is to equip each cell monitor with an isolated receiver and transmitter. Actually only the receiver needs to be isolated. I might use a high speed optocoupler such as the HCPL-0302 or a digital isolator such as the SI8421. They are about $1 each. But a simple optotransistor such as the PS2561, which I'm already using, is only about $0.20 each and with 3-5 uSec rise/fall times it should be able to handle communication at 38k bps. 

What I would do is connect the master unit's transmitter to the receiver of the first cell monitor, and then daisy chain them with transmitter to receiver. The transmitter of the last unit would have its transmitter connected to the receiver of the master. The master can send a coded signal initially that will request the devices to "enumerate", where the first device assigns itself an address of "001", and then sends the command to the next, which assigns itself as "002". When these messages have propagated to the last unit (in your case #108), it will send its signal back to the master, which would then know that there are 108 units. 

The master may query any unit by sending a message with its unique address and a command, which would be acted upon and an acknowledgement would be sent on down the chain back to the master. An individual unit may also send an alarm signal down the chain which will eventually arrive at the master for processing. The total propagation time for a 4 byte data packet at 38k through 108 units is a little over 1 mSec, so there is no major timing issue. 

There are PICs available with everything needed to implement this communication function and many other tasks, for less than $1 each. For instance, the PIC16F1823, which is a 14 pin device. I already have a couple of a similar PIC16F1825 and its 8 pin cousin the PIC16F1822, which are only a little more expensive. If this works as I expect, it should be relatively immune to the EMI environment. It may even be possible to use fiber optics for the data connections, but that can get pricey.


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> But a simple optotransistor such as the PS2561, which I'm already using, is only about $0.20 each and with 3-5 uSec rise/fall times it should be able to handle communication at 38k bps.


$0.20 is pretty cheap but still not zero. Voltage difference between two cells is just few volts so it's possible to use a simple capacitor to isolate the BMSs. In my miniBMS I'm using such an approach. Communication is like PStechPaul described. I use ATTiny45 which is just $0.60 per unit with a temperature sensor on board and ability to work from 2.7V to 6V. Total cost around $2 including PCB


----------



## PStechPaul (May 1, 2012)

smpavlik said:


> $0.20 is pretty cheap but still not zero. Voltage difference between two cells is just few volts so it's possible to use a simple capacitor to isolate the BMSs. In my miniBMS I'm using such an approach. Communication is like PStechPaul described. I use ATTiny45 which is just $0.60 per unit with a temperature sensor on board and ability to work from 2.7V to 6V. Total cost around $2 including PCB


Are you the designer and manufacturer of the miniBMS? I'm not necessarily trying to compete with your product but I'm just trying to provide some features that the miniBMS does not seem to have. I was planning to make this an open source project and if you can incorporate the additional features in yours, then it would be better if I pursued other interests and perhaps work with you to develop a unit that meets the needs or desires as being discussed in this thread.


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> Are you the designer and manufacturer of the miniBMS?


I'm a designer and hopefully a manufacturer 
Open source is my goal too. I already have a project site but there's nothing to show now. Nevertheless next week I expect to have PCBs and actively start to implement my ideas. I 'm really happy to share my experience and want to accommodate any features people might need in the BMS.



PStechPaul said:


> I'm not necessarily trying to compete with your product but I'm just trying to provide some features that the miniBMS does not seem to have.


I understand this and didn't try to compete too . Just wanted to show one more way how to do something. Actually my goal is to create a project as simplest as possible and as featured as possible


----------



## PStechPaul (May 1, 2012)

I thought you meant the miniBMS that is commercially available at www.cleanpowerauto.com. It's probably best not to use that name, as it may be a registered trademark. Maybe MicroBMS? 

I also found your thread about using IR for communication. It may be a good idea, but I think it may be complicated if you have multiple emitters and receivers, and it may require some power and could be expensive. Maybe using fiber optic coupling? I think wire coupling with an optoisolator may be the easiest and most reliable. Actually, just one wire could be used. It would connect to a resistor and an open collector driver to the cell (-) of the first module, and the second module would already have a connection to the first cell (+) which connects to the second cell (-). So that connection will drive the LED of the optoisolator of the receiving module. 

That will be for an "enhanced" design, and I'll post a schematic for my concept soon. For now I want to make a prototype of my simpler concept which will just perform top charge balancing and overall shutdown (with flashing LED indication) when any cell is determined to be faulty or "weak". It could be set up so that on power-up, and on external reset, it will perform a load test on the cell by activating the bypass limiter and taking a reading which can be compared to the open circuit reading. It could do this for a quick test in a few mSec so the battery drain will be insignificant, even with a test current of 6 amps. 

Would you be willing to post your schematic so we can discuss any pros and cons of your design? I showed you mine, so now show me yours!


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> I thought you meant the miniBMS that is commercially available at www.cleanpowerauto.com. It's probably best not to use that name, as it may be a registered trademark. Maybe MicroBMS?


Good idea, Thanks 



PStechPaul said:


> I also found your thread about using IR for communication. It may be a good idea, but I think it may be complicated if you have multiple emitters and receivers, and it may require some power and could be expensive.


This is not my idea, and as you I was concerning about it. However I thought about the solution Multiple emitters is not a problem. I had designed some IRDA devices and know how to deal with it. Power is not a problem too. We have a lot Ah Moisture and dust is my concern. Water could be unbreakable obstacles for IR. Also I wanted to split batteries for few banks. How to communicate in this case. Than's why I've decided to go with a wire


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> It could be set up so that on power-up, and on external reset, it will perform a load test on the cell by activating the bypass limiter and taking a reading which can be compared to the open circuit reading. It could do this for a quick test in a few mSec so the battery drain will be insignificant, even with a test current of 6 amps.


I'll take your idea into my design  Likely this is just a firmware update


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> Would you be willing to post your schematic so we can discuss any pros and cons of your design?


Yes, I will. Give me a little time for publication. This is just a draft for now. It looks primitive and this was a goal. Looks forward for a avalanche of questions


----------



## PStechPaul (May 1, 2012)

OK, looks simple enough. The devil is in the coding, eh!

One thing I see as a problem is the IRF7821 MOSFET which really needs 4.5V for the gate, although the curves show minimal operation at 2.5V. But the power supply for the ATTiny is two diode drops below the battery voltage, which may be as low as 3.3 volts during charging, so there might not be enough to turn the device on. A better choice may be the FDS6574A which only costs a little more and is fully characterized for 2.5V gate drive and even 1.8V. 
http://www.mouser.com/ProductDetail...ha2pyFaduif3b3oZ1SEUSUGF2A22InXhJ4m%2b8Xho0I=

If you can accommodate a TO-252 package you can use FDD6530A which can handle 21 amps and 33 watts and is about $0.50/100:
http://www.mouser.com/ProductDetail...GAEpiMZZMsrr1kXJis%2bJ24zftF0OaFr5mFNqfcVECA=

Otherwise it looks OK, although I question what C2 is for? And when you send signals through the capacitors of the uplink, there will be transients that exceed the power supply rails, so there should be some protection for the uC input. 

Looking forward to your test results when you get your PCBs!


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> OK, looks simple enough. The devil is in the coding, eh!
> 
> One thing I see as a problem is the IRF7821 MOSFET which really needs 4.5V for the gate, although the curves show minimal operation at 2.5V.


Yes, you are right. But as I said, this is a draft. I put the IRF for PCB design only. 



PStechPaul said:


> I question what C2 is for? And when you send signals through the capacitors of the uplink, there will be transients that exceed the power supply rails, so there should be some protection for the uC input.


This is a trick  All modules have C2 and don't have T1, R6 and R1. So all of them including a "host" can communicate through LINKs. If you don't have a host, you can connect a relay to an open connector. In this case the very first module should have T1, R6 and R1 but C2 removed. Then the devil in the coding will do everything else


----------



## PStechPaul (May 1, 2012)

I scanned through the specs of the AVR ATtiny, and it has some nice features. The ADC can be configured as differential input with an optional x20 gain element that would make it easy to read 0-50 mV for current measurement with a shunt. The internal selectable voltage reference is good, and it seems to have a very capable PWM generator. It might be possible to use the SPI system for the communications. The Microchip products have similar capabilities, and I will stay with those since I'm more familiar with the architecture and code and programming tools.


----------



## PStechPaul (May 1, 2012)

I made a more detailed and updated schematic showing the connection for two cells. I was able to find a way to use the little PIC10F320 to provide cell to cell communication so a master unit can query each cell and take action accordingly. So it looks like a BMS can be built for about $3.00/cell and $50 for a master controller which can shut down the charger or throttle back the motor to protect weak cells or to perform top (or bottom) balancing. It also has a temperature sensor for each cell, and it has EEPROM to store calibration constants or cell history. I figure it can operate with an average current of several hundred microamps and provide shunt current top balancing up to five amps or so, and also bottom balancing if so desired.

http://enginuitysystems.com/files/BMS.pdf


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> I made a more detailed and updated schematic showing the connection for two cells. I was able to find a way to use the little PIC10F320 to provide cell to cell communication so a master unit can query each cell and take action accordingly. So it looks like a BMS can be built for about $3.00/cell and $50 for a master controller which can shut down the charger or throttle back the motor to protect weak cells or to perform top (or bottom) balancing. It also has a temperature sensor for each cell, and it has EEPROM to store calibration constants or cell history. I figure it can operate with an average current of several hundred microamps and provide shunt current top balancing up to five amps or so, and also bottom balancing if so desired.


Few questions:
1. What is purpose of D1 connected in parallel to MOSFET? Revers connect protection? It looks like a firework  It will burn immediately in reverse connection. Also Q1 has an embedded diode and you'll get 8A in this case.
2. What is purpose of C1 47uF? 
3. VSS is not connected to GND. U1 will not work


----------



## PStechPaul (May 1, 2012)

smpavlik said:


> Few questions:
> 1. What is purpose of D1 connected in parallel to MOSFET? Revers connect protection? It looks like a firework  It will burn immediately in reverse connection. Also Q1 has an embedded diode and you'll get 8A in this case.
> 2. What is purpose of C1 47uF?
> 3. VSS is not connected to GND. U1 will not work


D1 is supposed to take care of a situation where a cell becomes weak and the BMS has been unable to throttle or shut down the load. In such a case the cell will actually be reverse charged. If it should fail shorted, there is no problem other than a dead cell. But if it should fail open, the entire current of the load would be imposed on it and the voltage could reach 300V. So this diode will just provide a path with a voltage drop of only about 0.3-0.8V at current up to 40A (although that's still a lot of power). It's an optional component and might be "overkill", but I thought it would be worthwhile to discuss its merits. Without it, Q1's diode will conduct but R1 will see the full current and may quickly overheat. 

C1 was for operating Q1 in the linear region for charge balancing, but if true digital PWM is OK then it can be eliminated. 

Good catch on the Vss GND connection. I was cleaning up the schematic and it got deleted!


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> D1 is supposed to take care of a situation where a cell becomes weak and the BMS has been unable to throttle or shut down the load. In such a case the cell will actually be reverse charged. If it should fail shorted, there is no problem other than a dead cell. But if it should fail open, the entire current of the load would be imposed on it and the voltage could reach 300V. So this diode will just provide a path with a voltage drop of only about 0.3-0.8V at current up to 40A (although that's still a lot of power).


Let's look at a use case. A motor with maximum current 40A?  I doubt. Real current would be much more so the "protecting" diodes are just a kamikaze (I mean a fuse) 
This is a second point. The first point is if cell voltage become zero and even -0.3V..-0.8V, there is already nothing to protect! Only God can save the cell  



PStechPaul said:


> C1 was for operating Q1 in the linear region for charge balancing, but if true digital PWM is OK then it can be eliminated.


Work in leaner region and dissipate power on a MOSFET instead of a resistor? I doubt this is exactly you want


----------



## PStechPaul (May 1, 2012)

This BMS is initially intended for use with my tractor project, which will use 320 or 640 VDC and a VFD and at most a 5 HP (3.7 kW) motor, so current will be about 20-30 amps maximum. For higher power applications, I am considering the option of having multiple 10 or 20 Ah 320 or 640 VDC packs in parallel with separate BMS functions for each string. This has the advantage that a failure of one cell in a string can just result in taking out that string, so the others can provide continued power. It could be disconnected with a fairly small relay without danger of arcing contact damage because the other packs will keep the voltage at a minimal value and it won't be much current because the other packs will be providing that.

I was not sure if a true PWM would be OK for charging bypass. It would consist of alternately bypassing about 7 amps and allowing full charge current through the cell at the top balance voltage. The average current would be reduced and the average cell voltage would be also reduced, but the peaks might be higher than optimum. Also, the MOSFET can dissipate 20W so it could supplement the power of the resistor. But probably cheaper to use a higher power resistor and use true PWM.


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> I made a more detailed and updated schematic showing the connection for two cells. I was able to find a way to use the little PIC10F320 to provide cell to cell communication so a master unit can query each cell and take action accordingly.


Again, let's look at a use case. Two cells have a common wire so you have not to use opto-decoupling. It's absolutely enough to use a trivial level shifter. Same story with a master which most likely has a common wire with the first cell. Problem is with the last cell. But based on my experience, it's much more better logically to have a response from the first cell rather than wait for it through a chain. 
That's exactly I did in my design. The difference is I use a capacitor for decoupling. The advantage is I can connect not necessarily neighbors just to maintain voltage within the capacitor rate.


----------



## PStechPaul (May 1, 2012)

Perhaps I don't understand how your uplink and downlink are connected. I can see how the downlink of cell #1 could be connected to a transmitter in the master, and the uplink could be connected as well for communication with that cell. But how does communication occur with cell #2 and others? 

Also, in your design, I see two 100k resistors for cell voltage monitoring, but most ADCs need a lower impedance source like 5k or 10k. But a large (10 nF?) capacitor would hold the voltage during transfer to the ADC sampling capacitor.


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> Perhaps I don't understand how your uplink and downlink are connected. I can see how the downlink of cell #1could be connected to a transmitter in the master, and the uplink could be connected as well for communication with that cell. But how does communication occur with cell #2 and others?


Each cell including the first one responds on a packed addressed to him otherwise unconditionally re-transmit the packed UP->DOWN or DOWN->UP. Simplified connection is attached

Forgot to add. Single-wire half-duplex protocol is not a problem


----------



## PStechPaul (May 1, 2012)

OK, I found information about the single wire USART as implemented in Atmel devices:
http://www.atmel.com/Images/AVR274.pdf

So, AIUI, communication is initiated by the master pulling the line low on unit #1. It will then read the data packet, and if the address corresponds to unit #1, it will transmit the requested information and/or perform the command. So at 9600 baud a 24 bit data packet will be received in 2.5 mSec, and the response will be another 2.5 mSec, for a 5 mSec loop response.

But if there are 100 cells for a 320V pack, the master will have to wait 500 mSec for the round trip before it can send another packet. This may be acceptable, and if you operate the AtTiny at higher than 1 MHz you can use higher baud rates at the expense of additional current draw.

With the system I plan to implement, at the same baud rate, every transmission will take the same amount of time for the round trip, but subsequent commands can be sent with only a couple of stop bits of time between them, so a continuous stream of cell condition can be realized.


----------



## EVfun (Mar 14, 2010)

I find that concept quite interesting smpavlik. Inexpensive cell monitoring, shunting, and feedback that doesn't require a separate monitoring board.

I think the shunting ability should be smaller, saving size and cost. I've used the EVpower BMS modules and they only shunt 600 milliamps. It was more than enough, any pack in good condition and already balanced will have very little cycle to cycle balancing to handle. A 1 amp shunt would be more than a plenty. 

Protection should be carefully thought out. It is fine if cell reversal kills the module, so long as it also throws an error that will be noticed before charging. After all, it almost certainly killed the cell anyway. The biggest trick is to make sure the BMS modules don't become the cause of fire if they see full pack voltage forward or reversed. Users disconnecting a cell before disconnecting every small pack load have killed a number of other BMS modules. If your system can tolerate that it would be feature.

A damaged module, for any reason, should throw an error. Your idea seems much more likely to throw an error if something fails compared to a simple photo-fet output.


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> But if there are 100 cells for a 320V pack, the master will have to wait 500 mSec for the round trip before it can send another packet. This may be acceptable, and if you operate the AtTiny at higher than 1 MHz you can use higher baud rates at the expense of additional current draw.


Yes, round trip is just twice longer. But maybe you'll be surprised if I say that full polling time is the same in both cases! Let's calculate:
You have 3 cells and you need to poll each one. Let's assume a cell responds immediately and one packet needs 1 mSec to transmit. In chain case you need to send 3 packets and responses will arrive after 4 mSec each. Total 12 mSec. Round trip case needs 2mSec to poll the first cell, 4 mSec to poll the second one and 6 mSec for the last. Total 12mSec!

Anyway I don't see any problem. Batteries are charged with BIG amps and you are worry about 10mA(?) peak current? I think LED consumes more  No need to poll continuously. It could be event-based communication. Batteries are charged withing many hours, why not to wait one on two seconds? Overcharge approaches rapidly but not in milliseconds. I believe this is seconds and even ten-seconds range.


----------



## smpavlik (Mar 28, 2011)

EVfun said:


> Protection should be carefully thought out. It is fine if cell reversal kills the module, so long as it also throws an error that will be noticed before charging. After all, it almost certainly killed the cell anyway. The biggest trick is to make sure the BMS modules don't become the cause of fire if they see full pack voltage forward or reversed. Users disconnecting a cell before disconnecting every small pack load have killed a number of other BMS modules. If your system can tolerate that it would be feature.


Thank you. I totally agree with you. Protection must be the number one. Honestly, I didn't calculate what happened if a user disconnect a cell having its module in a chain.


----------



## PStechPaul (May 1, 2012)

I have thought about adding a TVS diode across the module, perhaps instead of the Schottky diode. A unidirectional TVS is like a zener which is a normal diode in one direction (which would limit reverse charging voltage to about 0.7V, while in the other direction it would limit the voltage across the BMS unit to, say, 5 or 6 or even 10 volts, well below the 20V breakdown of the MOSFET. A TVS can handle the likes of 100 amps and 1 kW, but only for less than one or two milliseconds. The unit should protect itself from an overvoltage by automatically turning on the shunt charge MOSFET, so that it would see very little voltage and the series resistor would limit the voltage depending on how much current is being applied.

I'm not sure of the mechanism involved for damaging a BMS during connection or disconnection to/from the battery pack. If the pack is disconnected from the vehicle, there should be no load, so opening a jumper between two cells should not cause any current flow, nor impose any voltage on the BMS. I suppose it is possible, however, for a high voltage transient such as static discharge or even leakage current to be applied to the MOSFET, which may be damaged and then later fail. The TVS would take care of this problem.

I missed the point about having a small pack load still connected when a cell is disconnected, and if the load is no more than a couple of amps I think the cell BMS could handle it. Besides, with each BMS unit protecting each cell, there should never be an open cell position with the BMS still connected to the pack. 

If anyone can provide more details on the construction of the BMS units that have sustained damage, and the circumstances that cause failure, it would be helpful in designing safeguards for new products as being discussed.

I have tried to find information:

http://www.iis.fraunhofer.de/conten...tery_Management_System_BMS-ACB1_Datasheet.pdf
http://www.evconversions.ca/manual/images/Charles_Richer_BMS.pdf
http://szsmartec.en.alibaba.com/pro...13S65_399_13S_.html?tracelog=cgsotherproduct1
http://www.all-battery.com/protectivepcbsforlifepo4.aspx
http://www.avdweb.nl/solar-bike/electronics/bms.html
http://focus.ti.com/download/trng/docs/seminar/Topic%202%20-%20Battery%20Cell%20Balancing%20-%20What%20to%20Balance%20and%20How.pdf
http://zeva.com.au/Research/BMS/ (has a schematic and theory of operation, but appears to be a terrible design!)
http://www.orionbms.com/wp-content/uploads/2011/08/OrionBMSWiringManual1.006.pdf
http://www.mpoweruk.com/bms.htm (outlines most possible features and techniques)

There are too many to list, but I found some specifically about BMS failures and reliability issues:

http://www.endless-sphere.com/forums/viewtopic.php?f=5&t=22382
http://www.launchpnt.com/portfolio/energy/hi-rel-lithium-ion-battery-management-systems/ (target reliability and MTBF)
http://www.evdl.org/archive/index.html#nabble-td4560590
http://www.linkedin.com/groups/Can-BMS-TMS-provide-robust-1606827.S.66209971
http://researchcommons.waikato.ac.n...Rebuildability-LeijenScott2011.pdf?sequence=1

Whew, so much information!


----------



## PStechPaul (May 1, 2012)

I made a quick stab at a new design which uses open collector transistors between modules as level shifters. I don't like it a whole lot but eliminating the optos is probably simpler and lower power. I still have status LEDs however, which will flash green while communicating and the red will turn on (or flash) in case of a fault. I like the idea of having an autonomous module on each cell that will show the status when powered down and still not cause excessive current drain. The BMS can also function as a cell tester under control of a master unit or possibly even a 5V TTL RS232 port.

I reversed the pullup resistor on the PIC to a pulldown and since it is also the MCLR and VPP I would rather have it be a pullup. I think I can just reverse the transistors and have the direction of transmission from top to bottom rather than bottom to top. The master unit will have optoisolated inputs and outputs so the battery polarity and voltage will be non-issues, and I like having galvanic isolation. The only connection between cells is the resistor in series with the base of the RX input transistor, and it is fairly easy to protect that from abuse. Here is the modified circuit:

http://enginuitysystems.com/files/BMS_NonOpto.pdf

and an improved version:

http://enginuitysystems.com/files/BMS1.pdf

I removed the capacitors on the gate of the MOSFET and also the Schottky diodes in series with the PIC Vdd supply. A reverse connection will just forward bias the large Schottky (if I even keep it), and the MOSFET reverse diode will conduct through the load resistor. It's fairly difficult to protect against everything, and as long as the module does not catch fire, it's cheap enough not to worry about such a rare event which would probably only occur during building or maintenance. I might consider a fuse on the battery (+) connection, but the question is whether it needs to be rated at only a few volts for the battery to which it's connected, or the possibly 300-600 VDC of the entire pack? I think it need only be a 5A fast blow fuse such as the following which are rated 300A interrupting capacity at 32VDC and 50A at 125VDC, and are about $0.65 each:
http://www.mouser.com/ds/2/240/448-15437.pdf
http://www.mouser.com/ProductDetail/Littelfuse/0448005MR/?qs=sGAEpiMZZMseCiJT91fwIt6%252bInDDBFvH2%2fLR5eKTTFg%3d

The 2410 series fuses are also well rated and about the same price:
http://www.mouser.com/ds/2/418/surface-mount-fuses-124918.pdf
http://www.mouser.com/ProductDetail...=sGAEpiMZZMseCiJT91fwItAs9aGOVkHoqO4P2/VWD0E=


----------



## EVfun (Mar 14, 2010)

Wow PStechPaul, you found quite a few links about BMS issues. The failures I've been told about are when a cell is disconnected without every load being disconnected first. Something small, like an idling DC to DC converter, is left connected. 

Image the pack all wired up in series, complete with BMS, with a small load on the output, say a 100k ohm resistor. Now imagine that one of the cells goes internally open, so now just the BMS module is in its place. It usually isn't a cell failing open but rather a user connecting or disconnecting the cell. In the process there can be a point where the BMS connection is made at a terminal while the cell connection is not. The BMS sees pack voltage in reverse. A zener or unidirectional TVS would prevent that from being a destructive event, provided the small reverse voltage still allowed wouldn't kill the module. 

Rumor has it that a couple users have touched a cell module onto a cell backwards while assembling a pack. There is also the possible issue of a cell open condition happening during charge, resulting in a high forward voltage.


----------



## Otmar (Dec 4, 2008)

smpavlik said:


> The difference is I use a capacitor for decoupling. The advantage is I can connect not necessarily neighbors just to maintain voltage within the capacitor rate.


Smpavlik, 
I'm curious if you have heard of anyone using capacitor coupled communication in an EV? The reason I ask is that there is a lot of noise on the battery pack coming from the charger and controller and I always wondered if it would be possible to use capacitive isolation for communication on a battery pack. 

Years ago I did a test with just one wire that would isolate from each module (no breaks and no linking so the whole pack noise was on it) and I found it was not going to be easy to get data through the noise, but maybe links from just one cell to another would be easier? I'd be curious to hear how anyone got it to work.


----------



## smpavlik (Mar 28, 2011)

Otmar said:


> Smpavlik,
> I'm curious if you have heard of anyone using capacitor coupled communication in an EV? The reason I ask is that there is a lot of noise on the battery pack coming from the charger and controller and I always wondered if it would be possible to use capacitive isolation for communication on a battery pack.


I didn't hear about that but did some experiments in noisy environment. You are right, capacitive isolation is not the best way but it's possible. I wait for PCB and shortly will do the experiment.


----------



## PStechPaul (May 1, 2012)

Dan5ielle said:


> Make sure ALL error conditions cause shutdown for motor controller and charger.


Yes, that is the idea. The only thing that this BMS does not have is a current monitor, which should be the responsibility of the charger or controller. It could be incorporated in the master unit, perhaps, as an auxiliary measurement for redundancy. 

My idea for multiple high voltage packs in parallel would allow for a small relay to open on a series string as long as the other parallel strings keep the voltage fairly constant. This could be accomplished by having a fairly large capacitor across the series string. Thus if a relay opened a pack it would not see the entire pack voltage and the capacitor would handle the current of the load or the charger long enough for the contacts to be fully open.

Here is the idea, showing what would happen if a 5 amp charger with 420V capability was disconnected from a 320V battery pack by a relay. Note that the voltage on the relay contacts rises slowly so that at 20 mSec (a typical opening time), the contacts have less than 30VDC on them. After that, it would rise to 100V in this case, but by that time the connection is fully open and the contacts only need to withstand the DC voltage:










BTW, your jpgs should be gifs:


----------



## smpavlik (Mar 28, 2011)

PStechPaul said:


> My idea for multiple high voltage packs in parallel would allow for a small relay to open on a series string as long as the other parallel strings keep the voltage fairly constant. This could be accomplished by having a fairly large capacitor across the series string. Thus if a relay opened a pack it would not see the entire pack voltage and the capacitor would handle the current of the load or the charger long enough for the contacts to be fully open.


I don't really understand you proposal. Why do you need to disconnect battery strips separately? And if you really want this, how do you connect the stripes to a motor? 
Batteries can be connected in series and then the strips connected in parallel; or connect batteries in parallel and then connect the packs in series. The last variant is widely used in laptops. No need to tell that all batteries must have same capacity and BMS is a must.


----------



## PStechPaul (May 1, 2012)

My idea is to be able to have multiple battery modules, complete with BMS protection, with an internal relay or contactor to disconnect the internal batteries from the external connections in case of fault. It could also be set up so that the contactor would be open until an external signal were applied, so that the module would be safe to handle. This would also provide the safety factor desired in case of accident, in which case all of the modules would be shut down and the risk of contacting high voltage by occupants or first responders would be minimized. 

The concept of multiple high voltage modules in parallel also provides redundancy, where the failure of any pack would not totally disable the vehicle. And it allows for the augmentation of the battery kWh by simply adding modules in parallel as needed. 

The modules would have internal sensors to determine if there is one or more batteries externally connected and energized, and would allow activation in parallel only if the external voltage is close to its own voltage. Each pack could also have a series diode which would eliminate high current charging of a weak pack with a stronger one, as is the case with direct parallel connection. With the diode on a 160V pack, its forward drop would be less than 1 volt at normal current draw of 10-20 amps, which is less than 1% of capacity. It is also possible to make an active synchronous rectifier with MOSFETs, where the voltage drop is dependent only on the RdsOn, which can be 10 milliohms or so for only 100-200 mV drop. Such a solid state switching device could also replace an electromechanical contactor for pack protection, and since it can switch much faster, it would be suitable for DC. 

If such modules can be made for easy replacement in an EV, it would even make it possible to have precharged modules available at refueling stations. The concept would be similar to trade-in propane tanks. Since the batteries are subject to aging, each pack could contain a charge/discharge counter and a real time clock, which could be read and the cost of a replacement pack could be adjusted by the differential between the new pack and the old. 

I think I've strayed a bit off-topic, and perhaps this would be worth a separate thread. But it's also what I see as a logical extension of the BMS concept and would make the protection independent of external components. It could also possibly incorporate a charging module so that all you need to do is connect the pack to a 120/240 VAC line.


----------



## smpavlik (Mar 28, 2011)

Understand. Actually I thought about a multi-pack battery but moved the idea to a position #8 in my list 
One thing that you are right is this should be a separate thread and discussion should be very detailed. For example 10-20 amps load is not a common use case. It should be hundreds amps and this is different story


----------



## PStechPaul (May 1, 2012)

Yes, I started another thread:

http://www.diyelectriccar.com/forum...ttery-pack-integral-bms-protection-83028.html


----------



## PStechPaul (May 1, 2012)

I built a single cell management module using the PIC10F322 development board. I found that the ADC has only 8 bits resolution. and although the chip has an internal reference, it can only be read by the ADC, which uses Vdd as its reference. This is actually a handy feature, since the Vdd is the battery voltage I want to measure, so if I measure the internal 2.048V reference, I can determine the Vdd voltage by using the formula (for the high limit): 2.048*256/4.2 = 125. I think I will need to use a more capable unit for the final product. The PIC12F1822 has everything I need in an 8 pin package and still costs only about $1. Here's a video:


----------



## jhuebner (Apr 30, 2010)

I want to share my recent finding on my infrared BMS.

So the infrared communication itself: its slow, about 2000 to 3000 bits per second. Each data packet is about 100 bits, so the round trip time for 20 modules (120 cells) would be 1s. I'm using a FEC code on each value (not the entire packet!) that can correct a 1-bit error and detect a 2-bit error (Extended Hamming 16/11 code)

The voltage sensing: as to not waste energy in voltage dividers I wanted to find out how far you can take it. I ended up with 10M/1.5M on the 6th cell and accordingly lower values on the other cells. Each input is buffered with a 1nF cap.
Every channel is sampled about 150 times per second in Atmels ADC noise reduction mode (shuts off most of the MCU to reduce switching noise). Every sample is fed to an IIR filter. The output of the IIR filter is transmitted on request. During transmission no A/D conversion is done because the transmission causes significant noise.

Here is the result of a long term test I ran last night:










The cells are top balanced and floating at 3.34V according to my voltmeter. As you can see, 4 channels do not have any error, channel 3 is constantly offset by 0.01V (might be a rounding error) and channel 6 (the one with the highest input resistance) has a glitch of 0.06V after 2h.

Then I placed the pack outside for it to cool down and then placed it in the oven for a temperature test:



















Channel 1 is not affected by the temperature, channel 2 is affected a bit, channels 3-5 seem to have some sort of temperature coefficient and channel 6 is happily moving about. But still, the largest error is still only 0.06V

I don't quite understand why it works so well, but I have some theories:
- The ADC is designed for 15kSMPS at an input resistance of 10k
- While sampling it has an input resistance between 1k and 100k in series with 14pF
- The leakage current is at most 0.01µA
-> I underclock it at 16 kHz for at most 1kSMPS
-> I excessively filter the values
-> I buffer the input with a cap, making it slow but stable
-> I use noise reduction mode

In former experiments I used the internal band gap reference to compensate for supply voltage swings. Turns out the bandgap reference is more unstable itself at temperature changes than the supply voltage, so I ditched that.


----------



## PStechPaul (May 1, 2012)

The results look pretty good. If you have a 10 bit ADC and a 5 volt reference, your resolution will be 5/1024 = 0.005V, so anything more than 0.01V variance must be due to other effects. With a high impedance voltage divider, RFI may be a problem, and it could be power line noise of 50/60 Hz. One way to remove this is to use a sampling rate of 300 per second which is 5 samples per cycle at 60 Hz and 6 samples per cycle at 50 Hz. If you sample at that rate for 100 mSec (30 samples) it will read 6 cycles at 60 Hz or 5 cycles at 50 Hz. The integral number of cycles cancels out the power line noise. If you are using 150 samples/sec it will also be effective. You will have 5 or 6 samples per half-cycle which is still OK.

You can also get more effective resolution by adding the 30 samples for a total of 30720 counts which will have a resolution of 162 uV. Accuracy will still be limited to the reference and the 10 bits of the ADC, but it might result in less "jitter". 

Of course, the high impedance divider may limit how quickly you can perform conversions. The 10M/1.5M for the 6th cell converts 3.6*6=21.6V by a factor of 1.5/11.5 to 2.817V. The 1nF makes a time constant of about 0.0015 seconds and for 1% settling (5 TC) it is 7.5 mSec. This may pose a problem for high sampling rates, especially if the readings vary greatly. But if the readings are all about the same, the sampling capacitor in the ADC will already be at about the same voltage so it will not draw much current from the external 1 nF capacitor.

I am not really familiar with IIR filters per se, although I know about some of the examples, such as Butterworth. Here is an explanation for anyone else: http://en.wikipedia.org/wiki/Infinite_impulse_response

Something else to consider is how you are measuring the individual cell voltages. Cell #1 is measured directly so you can use the entire range of the ADC. But if you are using V(batt6) - V(batt5) for the reading of Cell #6, you have two readings which have reduced resolution by a factor of 5 and 6, so you may only have a true resolution of 7 or 8 bits. Thus that cell's reading may vary by almost 1%, or 0.036 volts. In your chart it seems that the lower cell variation has steps of 0.01V, while the higher cells are 0.02V per step. This may explain it.

Good work!


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> The results look pretty good. If you have a 10 bit ADC and a 5 volt reference, your resolution will be 5/1024 = 0.005V, so anything more than 0.01V variance must be due to other effects.


Are you referencing the glitch of channel 6?
I think the math is a bit different. The voltage divider maps 0-25.3V to 0-3.3V. So the resolution is 25.3/1024=0.024V. So 0.06V corresponds to 2.42LSB. From here I agree, it must have been "some other effect".



PStechPaul said:


> With a high impedance voltage divider, RFI may be a problem, and it could be power line noise of 50/60 Hz. One way to remove this is to use a sampling rate of 300 per second which is 5 samples per cycle at 60 Hz and 6 samples per cycle at 50 Hz. If you sample at that rate for 100 mSec (30 samples) it will read 6 cycles at 60 Hz or 5 cycles at 50 Hz. The integral number of cycles cancels out the power line noise. If you are using 150 samples/sec it will also be effective. You will have 5 or 6 samples per half-cycle which is still OK.


How would power line noise show? Not sure I got any of that. Most variations happen over long periods. The time scale for the temperature test is 1h.



PStechPaul said:


> You can also get more effective resolution by adding the 30 samples for a total of 30720 counts which will have a resolution of 162 uV. Accuracy will still be limited to the reference and the 10 bits of the ADC, but it might result in less "jitter".


Slowly here  How did you work that out?



PStechPaul said:


> Of course, the high impedance divider may limit how quickly you can perform conversions. The 10M/1.5M for the 6th cell converts 3.6*6=21.6V by a factor of 1.5/11.5 to 2.817V. The 1nF makes a time constant of about 0.0015 seconds and for 1% settling (5 TC) it is 7.5 mSec. This may pose a problem for high sampling rates, especially if the readings vary greatly. But if the readings are all about the same, the sampling capacitor in the ADC will already be at about the same voltage so it will not draw much current from the external 1 nF capacitor.


Yeah exactly! didn't think of it. Somehow assumed that the S/H cap is always discharged when connected to the source.



PStechPaul said:


> I am not really familiar with IIR filters per se, although I know about some of the examples, such as Butterworth. Here is an explanation for anyone else: http://en.wikipedia.org/wiki/Infinite_impulse_response


Actually the equation of the filter I use is simple. The is a filter constant C (=4 in my case). The filter value then is
filtered=(2*adcValue + (2^C - 1) * filtered)/2^C
So the last filter result is taken into account when calculating the current filter result. The 2* adds a 2x gain to give me an extra digit.



PStechPaul said:


> Something else to consider is how you are measuring the individual cell voltages. Cell #1 is measured directly so you can use the entire range of the ADC. But if you are using V(batt6) - V(batt5) for the reading of Cell #6, you have two readings which have reduced resolution by a factor of 5 and 6, so you may only have a true resolution of 7 or 8 bits. Thus that cell's reading may vary by almost 1%, or 0.036 volts. In your chart it seems that the lower cell variation has steps of 0.01V, while the higher cells are 0.02V per step. This may explain it.


Very true. Like said, for the last cell 25.2V are mapped to the ADC range. So for the last two cells the error compensates (best case) for adds up (worst case). My aim is to keep the error below 0.09V over the complete temperature range because thats completely sufficient accuracy for HVC/LVC. And perhaps shunting later on.



PStechPaul said:


> Good work!


Thanks 

Oh, one more thing I found: 5% resistors seem to have a larger temp coefficient than 1% ones. (Could have looked that up in the data sheet...)


----------



## PStechPaul (May 1, 2012)

Here are articles that explain dithering. I may have been wrong about the number of additional bits, though:
http://electronicdesign.com/analog/squeeze-10-bit-performance-8-bit-adc-part-3-self-dithering-adcs
http://www.analog.com/library/analogDialogue/archives/40-02/adc_noise.html

As for the resolution of the 6 channels, AIUI you have a 3.3V power supply (rather than 5V, as I had assumed), and you have a voltage divider of 4.2/3.3 for the first cell. So you have an effective resolution of 4.2/1024=0.004V. The sixth cell voltage has, as you say, a resolution of 25.2/1024=0.025V. You are computing the actual cell differential voltage by using V(cell6)=V(6)-V(5), where both readings may have a 1 bit uncertainty of about 0.025V, so the differential voltage may easily have a fluctuation of 0.05V. So the resolution becomes worse as the number of voltage dividers increases.

This can be improved by using differential amplifiers for each cell. But they need to have a high CMRR, and they may be costly, perhaps as high as $2-$5/cell. OK for a lab instrument, but not so good for a BMS. Actually, by measuring the two voltages and subtracting, you are essentially making a digital differential amplifier, except for cell #1.

One way to achieve better accuracy may be to use analog switches to sample the cell voltages. You can transfer the voltage from each cell to a capacitor, and then connect that capacitor to the ADC, which also means that you need only one ADC channel, or you can use a higher performance external ADC. This would also essentially eliminate the constant drain on the cells from the voltage dividers, as they would not be used, and the inputs of analog switches have input currents measured in picoamps. The main drawback is the need for a power supply greater than that of the total voltage of the cells you are measuring, but the current needed is low, and a simple capacitor charge pump may be sufficient. A CMOS MUX such as the CD4016 is good for this purpose, but its power supply is limited to 15V.
http://www.fairchildsemi.com/ds/CD/CD4016BC.pdf
The 74HC4052 is another choice but voltage limited to +/-5V:
http://www.nxp.com/documents/data_sheet/74HC_HCT4052.pdf
The DG408/409 work on 44V power supply, so that may be ideal:
http://www.vishay.com/docs/70062/dg408.pdf

An OptoMOS might also work. Perhaps an H11F1 or this:
http://www.mouser.com/ds/2/408/Toshiba-TLP172A-189487.pdf (about $1)

Search for "flying capacitor" for more information:
http://upcommons.upc.edu/e-prints/bitstream/2117/1398/4/GASULLA.pdf

Oops! The idea is patented!
http://www.freshpatents.com/Method-...lying-capacitor-dt20080710ptan20080164880.php

Your 5% resistors are probably carbon film or composition, and they do have a poor tempco as well as higher noise and, of course, wide tolerance. I use 1% metal film resistors for all my projects so I don't see this sort of thing. The cost difference is really minimal, and it's good to have a 100PPM tempco. For your 75C range, the metal film could vary by as much as 0.75%, or 0.03V for the first cell. The last cell could be off by as much as six times that, or 0.18V. But the good news is that the variations usually track, so the ratios of the voltage dividers are unlikely to change, as long as they are all at the same temperature.


----------



## jhuebner (Apr 30, 2010)

PStechPaul said:


> This can be improved by using differential amplifiers for each cell. But they need to have a high CMRR, and they may be costly, perhaps as high as $2-$5/cell. OK for a lab instrument, but not so good for a BMS. Actually, by measuring the two voltages and subtracting, you are essentially making a digital differential amplifier, except for cell #1.
> 
> One way to achieve better accuracy may be to use analog switches to sample the cell voltages. You can transfer the voltage from each cell to a capacitor, and then connect that capacitor to the ADC, which also means that you need only one ADC channel, or you can use a higher performance external ADC. This would also essentially eliminate the constant drain on the cells from the voltage dividers, as they would not be used, and the inputs of analog switches have input currents measured in picoamps


Clearly, it is the route to a more accurate cell monitor. Or an all in one IC like the LTC6803. If you're investigating battery packs under various load conditions, this is what you want. But for simple over(dis)charge protection 0.1V worst-case accuracy is just fine as far as I can think.



PStechPaul said:


> Your 5% resistors are probably carbon film or composition, and they do have a poor tempco as well as higher noise and, of course, wide tolerance. I use 1% metal film resistors for all my projects so I don't see this sort of thing. The cost difference is really minimal, and it's good to have a 100PPM tempco. For your 75C range, the metal film could vary by as much as 0.75%, or 0.03V for the first cell. The last cell could be off by as much as six times that, or 0.18V. But the good news is that the variations usually track, so the ratios of the voltage dividers are unlikely to change, as long as they are all at the same temperature.


Looks like the variations track, otherwise I should have seen huge variations. I'll do some more testing once I have a couple of PCBs populated.


----------



## dcb (Dec 5, 2009)

Sorry, late to the party 

I'm on board with the distributed approach (i.e. attiny w/10bit adc). I couldn't make the capacitively coupled async comm make sense, and optos are slow or sorta expensive so these are my thoughts. Ring topology, controller sends "init" with address 0, first node adds 1 to the address, saves it for itself, then sends init, 1 to the next node, which gets address 2, etc, till the last node sends the init back to the controller with the number of nodes (via more robust comm).

I want to do majority vote, because EVs can be very noisy (large IGBT's sending 260volt bits through many lengths of wire). Bi-directional would be nice for troubleshooting, but an led would suffice (look where the LEDs stop lighting and you know where the trouble is), let's assume not working is the exception. USI doesn't do majority vote, and UART costs extra, so that will be asm cycle timing, and I may need to control the number of bits too (i.e. less than 5 or more than 9). The controller should know if there is trouble on the ring because it won't get the expected responses.


Anyway, this is what I'm thinking to level shift the bits up the stack one node at a time:









I have a small pile of 328's and some breadboards on order so I can experiment soon.

with bit-level passthrough off, the node will read the entire datagram before sending it to the next node. With passthrough on, it will send each bit as soon as it votes on it (truing up the bit length at each node and stopping noise from propagating). Also voting should help when using the internal oscillator (4mhz assumed for 1.8v operation).

Also, some notes on measuring VCC:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=80458

I have to focus on a charger first though, just wanted to brain dump a bit.

Edit: also with the nodes addressed sequentially, node level cooperation is possible to avoid unnecessary propogation delays.
i.e. controller sends packet cmd=readvolts|address=0|adcvalue=0 to first node. Each node can tell when it has passed the data from the previous node based on address then xmit the data from its own node, and the controller will see a predictable stream of data from the ring. And it doesn't send anything else until the stream finishes.


----------



## dcb (Dec 5, 2009)

decided to experiment with ~4-20ma current loop drivers in ltspice, the idea being that *hopefully* you can get away with one wire between adjacent cells/nodes, and maybe twisted pair for longer runs.

I'm pulsing the batteries at 8khz, 1.8 to 5v here (I hope no battery ever sees anything like that in production, or how well the chip and adc will like it), with majority vote it looks possible. sending a 100khz digital pulse. r7 is just for displaying current. v(rx) consistently swings from 0 to vcc for that cell (digital in is a function of vcc).

the left npn can be powered by a pin, and the right toggled for serial data. drain is in nanos when they are left low (i.e. sleep). Probably gonna add $0.50 ish to the costs. Should compare actual costs to see if a workable opto is available (1.8v isn't much for an opto, and probably well outside the range of any standard 4-20ma chips)

EDIT: did a quick BOM from mouser, I don't think an opto can compete on price vs performance. This is like auto-stabilization level shifting.

Also the through hole attiny24A price has skyrocketed. It looks like the next best target is the ATTINY88-AUR [email protected]$0.688 (worth the extra penny over a tiny48), gonna focus on smd these days anyway.

Edit2: 10adc on the 88, hard to not do more than once cell at a time with that...


```
1x pnp PMBT3906,215  [email protected]
2x npn BC847-T       [email protected]
4x diode LL4148-GS08 [email protected]
1x 10k CRCW060310K0FKEA [email protected]
1x 50  CRCW060350R0FKEA [email protected]
2x 330 CRCW0603330RFKEA [email protected]
1x 30  CRCW060330R0FKEA [email protected]
1x 110 CRCW0603110RFKEA [email protected]

Total per bms node (comm only) for ~4-20ma driver/detection $0.266
```


----------



## dcb (Dec 5, 2009)

just for fun I wanted to try the isolated voltage controlled oscillator approach (make sure you get a good temperature stable cap for c1). Parts wise, probably $0.50/cell for the voltage to isolated pulses. That is to say using long pulses to minimize pwd effects and etc (enable cheaper optos). no adc required on cpu, thinking it would be a good fit for an ATtiny2313A (<$1) in a uart daisy chain (with a 5v+gnd along the whole bus, controller shuts the whole string down). After rx,tx,xtal1,xtal2 there are 13 pcint pins available. so 12 voltages and a slope detector on a thermistor? easy arduino controller w/uart (tx to first node/12 cells attiny rx, last node tx back to arduino rx) maybe with the constant current driver above (adds $0.02 per cell @ 12 cells/board). Heck, might as well use a mega for a prototype with 18 available pcint pins.

328 note: reset/xtal/rxtx aside, there are 6 pcints available per port (PB,PC,PD) so it can monitor 3 cells at a time (interrupt and time stamp), round robin through 6 cells each, best case scenario is 0.042 seconds to grab all 18 readings at low voltage, not too awful. Or take pin snapshot of associated port and do all 18 readings simultaneously in .0025 to .009 seconds (with more lost interrupts).

some observations:
This is drawing 127.52µA from the cell (even cell draw).

time between peaks
2.5ms @ 5v (40,000 cpu cycles @ 16mhz)
3ms @ 4v
4ms @ 3v
4.9ms @ 2.5v
6.9ms @ 2v
8.16ms @ 1.8v

edit: the diode voltage references could use more temperature stability also, *maybe* cpu temp can assist in calibration, might just insulate the whole shebang and make an "oven" out of it.

generic implementation using arduino micros() would give 4uS out of 3mS (4v) resolution or 0.005v, can make the pulses longer too, or skip arduino and use higher resolution timer.


----------



## PStechPaul (May 1, 2012)

I have built part of the following BMS circuit and it seems like it works pretty well, although there are some issues:










I have programmed the BMS PIC so that it starts to apply a PWM signal to the shunt resistor at 3.4V and turns on the shunt fully at 3.6V. I have the terminals for the battery connected to a current-limited power supply and as I increase the voltage to the 3.4V threshold, the PWM shunting drops the voltage so that the next time the samples are taken, it is below threshold, and so it toggles back and forth with what seems to be an excess amount of ripple. It is even worse when I adjust the current with a fixed voltage.

I think it will work better if I apply the current to the second set of terminals, and I can add the inductor and capacitors to smooth out the current applied to the cell.

The second portion of the circuit, not yet built, is a buck current converter that will use the comparator and the SR latch of the PIC12F1822 to provide a smooth regulated current from a voltage source such as a wall-wart or laptop power supply. It can be modulated by means of the second opto-isolator. This is meant to be a single-cell charging and discharge module to characterize a lithium cell and perform either top or bottom balancing. I can add a Bluetooth module to do datalogging. 

One feature of this circuit is the isolated shunt circuit, which consists of just a 4.7 ohm resistor (I'm using 3.6 ohms in the prototype), an MJE170 BJT, and an opto-isolator. There is also a white LED with a 332 ohm resistor to indicate shunting. Total parts cost is well under $1, and it allows the shunting to be controlled for multiple cells in series, from a single PIC.

For voltage monitoring, I want to try using a DG408A (or DG508A) 8 to 1 multiplexer, which will be able to monitor the voltage of up to 8 cells in series (up to 28V or 36V for Li-Ion). It should present only a few microamps drain on unselected cells, and the sample for the selected cell can be read into a 100k/10k divider (or higher) that will have a maximum current draw of 28/100 = 280 uA for only a few mSec to take the reading. Thus the effective current draw for 1 second samples will be only a few uA. My immediate need is for a 6-cell BMS for an electric drill, but the same circuit could be used for an EV battery pack in clusters of 8 cells.


----------



## PStechPaul (May 1, 2012)

Well, the charging portion of that circuit may be problematic, especially without the second PIC, and using the inductor. 










It's better with a 5 ohm load, but there is still a rather large voltage overshoot, which would be a problem for the 5V PIC to be used as a BMS element:









http://enginuitysystems.com/pix/BMS_12F1822_Basic_Inductor.asc

So, I made a linear current regulator using only discrete components, and the results seem much better. This is really more of a simple one-cell charger, with the BMS controlled by a PIC, and for a multiple-cell BMS a separate higher voltage charger would be used.









http://enginuitysystems.com/pix/BMS_12F1822_Basic_Charger.asc

The charge current is basically determined by the voltage drop on the 0.5 ohm resistor R2 and the Vbe of the transistor Q4, which turns off the series pass element comprised of Q1 and Q3. I also added a 4.7V zener D1, which limits the output voltage to about 5.4V, protecting the PIC that will replace the pulse voltage source for the shunting resistor. There are also some components that are not really needed, such as D2, D3, and C2. I found C3 to be necessary to avoid oscillation, and its value may need to be adjusted in a real circuit.

It may even be better to use analog components such as precision voltage references and op-amps to provide the basic BMS and charging functions, at least for a simple single-cell charger. But I want to be able to use a PIC because of additional features, such as data monitoring, display, and logging.


----------



## dcb (Dec 5, 2009)

charging adds a fair bit of complications no matter how you slice it, and active balancing isn't of much use if it cannot work while you drive, i.e. if you have a cell that is %10 below capacity of the others, the bms needs to be able to move %10/N charge to that battery, perhaps at hiway speeds, before the pack runs out, to make the most of your pack.

All that is really needed from a bms is a "service battery pack light" when it determines it is out of balance (plus charge/discharge voltage limits monitored per cell), plus temperature probes are good. A shunt is a nice to have, but I wonder how often they are really necessary (not thinking of the shunt top balancers here, though shunt usage there would be an indication of charge consistency). But having to balance at every charge seems like something is wrong with the system.

Edit: one useful thing a bms can do is keep track of which cell terminates charging, and if a different cell ever terminates discharge (or gets close enough for a warning) then consider that an out of balance condition. Otherwise the pack should be limited by the weakest cell, that's normal.

Also, I see the logic in bottom balancing, charging is done under fairly controlled conditions. Discharge can be all over the place, and if a cell goes low, the rest of the pack will turn on it. It isn't as convenient, but if the bms is integrated with the charger it can be automated. Top balancing isn't nearly as pragmatic.


----------



## PStechPaul (May 1, 2012)

Perhaps we need to revisit the purposes of a BMS and what it should or can do to protect the individual cells of a battery pack.

1. Overcharging can be prevented to a large degree by having charge current shunts that bypass any cell when its terminal voltage exceeds a safe level. But this is limited by the charge current that might be applied, and the power that can be dissipated in the shunt. A 1C charge for a 100 A-h pack will need to dissipate 36 watts just to shunt 10% of the charge. So there must be a way for the BMS to shut down the charger. If the charge is due to regeneration in a vehicle, there may need to be an external braking resistor, although this would only be a problem for a fully charged pack.

2. Depletion of a cell while drawing current can cause reverse polarity and irreparable damage, so it is necessary to detect this while operating the vehicle. Early warning of a cell nearing depletion can use throttle limiting to protect it while allowing limited "limp home" capability, but if the cell has become defective and has greatly reduced capacity, there may need to be another way to deal with it. An SPDT relay on the cell could bypass it and allow the vehicle to continue running at slightly reduced voltage, but this would require a relay (or semiconductor device) rated at over 100A. 

3. Monitoring a battery pack during long-term storage may be useful to prevent excessive self-discharge, but the very act of monitoring presents a load that may easily exceed the self-discharge. However, there may be techniques that limit the monitoring current such that it will take several years to deplete the pack by 50%.

4. Cell failures (or connection failures) that create an open circuit cause a high voltage condition on the BMS that may be unavoidably destructive. It is possible to use a transient voltage suppressor (TVS) and a fuse that will disconnect the BMS in this case, but it requires a fuse rated for the maximum pack voltage, and a characteristic that opens quickly enough to avoid destruction of the TVS. This adds cost (probably at least $5/element), and the resistance of the fuse can affect the cell voltage measurement.

5. Overcurrent protection would involve a fuse, circuit breaker, or current sensor in series with the cell that would interrupt the excess current. Individual fuses and circuit breakers would need such high current and voltage ratings as to be impractical. Current sensors for each cell would add a lot of expense and/or voltage drop, but could signal the controller or charger to shut down. However, an overcurrent condition would probably cause a significant change in cell voltage, and this could be detected and transmitted to the controller.

6. Charge balancing can be accomplished by means of the shunt resistors. Top balancing occurs during charging as each cell reaches the shunting voltage threshold. Bottom balancing can be done by commanding the modules to activate the shunt resistor until the low voltage limit of each cell is reached. Because of practical limitations of shunt wattage, perhaps 5-10 watts, discharge would be in the order of 1 or 2 amps, so it would only be practical for a nearly depleted pack. It's possible to use a DC-DC converter to transfer the energy elsewhere, such as a pack that is being charged, but that adds a great deal of complexity and cost.

There may be other factors, such as temperature, that should be monitored. It's not very difficult or expensive, but would involve having a thermistor or other sensor attached to each cell with at least one wire connected to the BMS. It may be useful to monitor the overall pack temperature and/or the environment, to adjust cell voltage thresholds and charging or discharge current limits, and that is easily done by the controller or master BMS module. Extreme temperature rise in a cell due to failure could be monitored with a string of NC thermostats in series, and any one would shut down the charger or controller and sound an alarm.


----------



## dcb (Dec 5, 2009)

for some of you vets this may seem obvious, but with the divider network approach it is possible to eliminate/minimize bms induced imbalance with a position specific resistor.

Here is a 6 cell node network, I am still tweaking it to be able to use 6 differential 1.1v referenced inputs on an attiny for a stack of 4.2v cells, and of course calibration is always needed, but you get the idea. With all the voltages the same at 4.1v the draw is identical @410uA, which is reasonably low. lower voltage cells draw less, so it is a tiny bit self-balancing. Good old thevenin


----------



## PStechPaul (May 1, 2012)

Yes, that is what I did on one of my simulations to balance the current draw on each cell. But it may be unnecessary where the current draw of the BMS itself is an order of magnitude greater, but still insignificant for larger packs. If the BMS has shunting resistors, it might be possible for it to identify cells that have a higher charge than others and perform a burst shunt correction to bleed a bit off. This might achieve bottom balancing as the weakest cell shows less charge and triggers charge reduction from the others. 

I still think an analog MUX with up to 8 channels would be best. It would need only one divider for all eight cells, and it would only draw current when activated. It will always draw more current from the bottom cell, but with a short duty cycle and a high resistance divider it would be negligible. 

Perhaps a differential MUX with two four-channel multiplexers could be used, and a well designed instrumentation amplifier would have two inputs of essentially infinite impedance. There are also eight channel differential MUX devices, or you can use two of the 8-1 devices.

Another possibility is to have a capacitor of some size connected to the outputs of the differential multiplexers. It will essentially draw some energy from the first cell as it charges to the cell voltage. But then as the capacitor is sequentially connected across other cells, it will either draw charge from a "high" cell or inject charge into a "low" cell, thus distributing charge without wasting it in a shunt resistor. This same principle might work during charging as well as discharging. It won't be "perfect", as some power will be dissipated in the resistance of the multiplexer, but it may be a simple way to get a bit more from a poorly balanced pack.


----------



## dcb (Dec 5, 2009)

for this approach I was looking at a barebones cell monitor with no-balancing, minimal hardware (add cpu & regulator and tx), and I thought it would be kind of cruel if it imposed a constant 300uA imbalance  (that would be 1% imbalance every 45 days on my 33ah bike)

For a lot of folks it looks like balancing is rarely required, and is a lot simpler than adjusting valves on the sabre (and a cell monitor can help). I'm not looking to get in the OEM market or anything with the barebones approach, but the diy'ers might find it handy and affordable.


----------



## dcb (Dec 5, 2009)

sorry for space rapping here. Anyway for the "cheap" 8 cell bms, this makes the most sense as far as I can tell, and I wouldn't recommend the network in post 80.

problem is with that one (post 80) is each node is scaled down by the same factor. While it makes sourcing resistors easier, it means the ones lower on the stack have the same bits/volt as the top ones, so the resolution starts out course and stays course. Who cares? Well the thing is the measurements towards the top are essentially differential measurements, based on the reading from the cell below it, and on the cell below that, etc. If we can take advantage of higher resolution lower on the stack, it makes a better foundation to compute the cell values higher up the stack. 

So this one is scaled 4:1 on the first node, so that with the 1.1v reference you can measure 4.4v (error!) and the cell voltage is measured in 0.0043v increments. The next one is 8:1 so that when it reads 1.1v at the cpu at 8.8v and the actual cell resolution is in 0.0086v increments, etc: till you get to the top one that is 32:1. If you add up all the errors over 8 readings, it is a bit cringy at 0.158v worst case scenario. (note long settling time needed too). But it is an improvement over the 0.206v accumulated error potential of the one in post 80. But 8 is probably too many for a cheap bms without differential op amps or something. but draw is in the 72uA range and balanced.

At 4 cells (you can just cut this circuit in half removing the higher numbered cells) the accumulated error in the below example is less than 0.05v, which is probably fine for a cheap bms IMHO (assuming you do some calibrating after assembly), and the draw per cell goes down to 36uA. Plus you are into attiny44 (or?) range with 4adc. bla bla bla


----------



## dcb (Dec 5, 2009)

just a note on optos. FYI, again I'm focusing on cheap hardware here, but it has other expenses in time, for sorting it out, and probably calibration/characterization steps. Not saying this is for everyone. But even with "expensive" hardware you still need to validate all your assumptions about it plus research.

So the main problem with 4 pin optos is the base has no where to drain, so you cant tweak it to get a better (not perfect) output waveform. Here I've kinda split the difference between 2.5v and 4.4v for driving it. Just a rough draft.

If used with a stable vcc then you can dial it in much better both on driving the LED and on getting the right drain rate, but single cpu/cell having stable vcc gets messy.

edit: also you can use it as a photodiode input into an amp by using the base and collector pair and ignoring the emitter which can be very fast, but that might not be a good fit for a single cell driven receiver.
also looked at digital isolators, but those are rather high power (and about $1 apiece) by comparison.

more single cpu thoughts:
was looking at PIC12F1572, better internal voltage reference, but the i/o power is weak for an opto at varying vdd, but lots of threshold/hysterisis options. It can take a crystal, but it doesn't have the same sort of fine grained automatic baud correction as the ATtiny, so extra components (xtal,caps,led driver).
through hole is nice though. And IIRC mplab works w/ubuntu, which is also nice. Maybe an led with a slightly higher voltage than the 4n27 and an npn and a low value resistor to make a "constant current" driver for it, that doubles as, well, an led.


the ATTINY1614 is interesting. i/o is a little stronger, would probably rx without a crystal (clock recovery), which is less power. unknown accuracy on the internal voltage ref, but calibration is needed anyway, at least at room temp (more is better), temp sensor. can use 5 bit characters if comm is weak. Much more familiar with that toolchain too. Plus more pins (mixed blessing, gotta re-eval multiple cells/cpu again).

One side note is with single cpu/board, low power balancing is trivial, just leave the optos/leds on somehow via protocol.

hmm.


----------



## PStechPaul (May 1, 2012)

There has been an interesting discussion in Solarsail's thread on the 18650 48V battery pack, for several new ideas for a BMS. I proposed several concepts.

1) The DG408 analog multiplexer could be used on eight cells to connect the voltage taps to a voltage divider to a PIC or other controller. the maximum voltage for LiFePO4 is 3.5 * 8 = 28 VDC, and for Li-Ion is 4.5 * 8 = 36 VDC. The MUX is rated for at least 40V. The processor can be powered from the lowest cell in the stack, which has a voltage range of 2.5 to 3.5 V for LiFePO4 and 3.0 to 4.5 V for Li-Ion. So the internal ADC reference should be set to 2.048 volts. A voltage divider to handle the maximum stack voltage would be 28/2.048 = 13.7/1 for LiFePO4 and 36/2.048 = 17.6/1 for Li-Ion. A 10 bit ADC would provide 28/1024 = 27 mV/count or 35 mV/count. A 12 bit ADC makes these 7 mV/count or 9 mV/count. A voltage divider of 100k would draw at most 36/100 = 360 uA while sampling, and almost nothing when the MUX is disabled.

2) A variation on this circuit uses a resistor and capacitor to charge up to a setpoint of a comparator for each measurement, and the time can determine the voltage. A 250k resistor and 220nF capacitor takes 4.2 mSec for 25.6V (8 cells nominal 3.2V) and 51 mSec for the lowest cell. For a 1 MHz clock, that works out to 4200 counts at 25.6V (6 mV/count), and 51000 counts for 3.2 volts (0.06 mV/count). It is fairly easy to change the clock rate to, say, 100 kHz for the lower voltages, and change the RC integrator to 500k and 470nF for 240 mSec to 2.048V and 3.2V. A 100 kHz clock would read 24,000 counts or 133 uV/count. The capacitor is discharged after each reading. Here is a preliminary design:










3) Using two DG408 multiplexers, it is possible to sample each cell voltage by charging a capacitor. When the MUX is disabled, the capacitor will be floating. Then another MUX could connect the capacitor to the ADC input of the microcontroller. The only problem is that the capacitor could be charged to as much as 4.5 volts, which would also be the power supply for the processor, and the reference would need to be less, perhaps 2.048V. This issue might be solved with a 2.5/1 voltage divider, but that would start discharging the sampling capacitor. A separate op-amp powered from the bottom two cells (6.4V nominal) could provide the drive to the voltage divider without affecting the charge.

This method utilizes the full range of the ADC, so 10 bits on 3.2 volts is 3.1 mV/count, and for 12 bits it is 780 uV/count.

Another feature of this flying capacitor design is that the charge from a higher voltage cell would be transferred to a lower cell. The amount of balancing would be minimal, but the sampling process draws very little current from the pack.

4) More effective shunt balancing can be accomplished by using Darlington opto-isolators, such as PS2502-4, which is a quad device capable of 160 mA per channel, and costs only about $2. A 22 ohm resistor would dissipate the power, which is only about 1/2 watt. If stronger shunt balancing is needed, a MOSFET could be added to each cell.

5) Communication between 8-cell modules can be done using digital isolators like the Si8621A which has two channels, draws less than 2mA, handles up to 1 Mb/sec, and costs about $1.00, using the Txd and Rxd of the USART of the PIC or other device. it draws about 2 mA but could be powered off at a low duty cycle.

6) The Txd and Rxd may also be connected to a Bluetooth module for remote monitoring and control. However, it uses as much as 100 mA so that might be a problem.

7) An LCD display module could be added to the I2C or SPI interface, but also may draw too much current to be practical.


----------



## dcb (Dec 5, 2009)

couple thoughts if you don't mind.

re: 4 pin opto, see above. Also re: digital isolator, both sides need to wake up and power it, so how do you communicate to the receiving side that it is time to wake up, opto is more flexible there.

still trying to sort out the details of the DG408, will get back to you on that but definitely a possibility, depending on how it affects calibration/characterization. It *looks* like it is applying 36v to the cpu at times, but with the 200k resistor it isn't going to fry anything, but still probably clamping. I think you do need another one (or might just as well use the resistor network) to float both ends of the cap to the cell then bring it back down to adc ground reference for measurement. If you stagger the pins between them by 1 I think you can just give them the same address and the d-outs will be the difference (connected to capacitor), just leave cell 1 out of it on the higher shifted dg408 (and compensate for any reading differences on it) and use that multiplexer pin to feed the adc when you shift it back down and the same pin on the other dg408 to ground the other end of the capacitor. Lemme know If I need to draw a picture. But you are up to $2-$3 for the pair.


how many digits do we really need though, srsly, I mean the more the better, but I'd be happy with 8 bits over 5v equivalent, as long as it is accurate, i.e. 0.02v, folks *should* be using enough charge/discharge safety margin that it won't matter, even 2/10 of a volt imbalance isn't an action item for me as long as it stops charging when the highest cell gets to 4 or 4.1v.

supply voltage, maybe a balance resistor on the top cells to match bottom cell drain, dunno, I'm being nitpicky. 

Another issue is I just thought of is, say you are at 3v, and you (lets say leaf cells) decide to briefly tap them for 500 amps, well the voltage will drop below 2 volts. Perfectly "reasonable" scenario. I appreciate 1.8v is a "hard" limit on the cpu, but ideally nothing else is going to increase that limit to a higher value. And dropping below 2.5v is reasonable under load.

Fwiw, I'm trying to imagine a pin controlled dual power zener limiter/divider for an "active" power supply and a sleep supply. Mostly it is the high side resistor that needs to change, perhaps a pnp (or p-channel, but pnp is prolly cheaper) bypass through a lower value resistor for "high power" mode, feeding a carefully chosen zener and capacitor in parallel. Also wary of reading 8 cell voltage if the dg408 v+ is below the rail cuz of the pnp, actually that might be a problem if it were at the rail.


----------



## dcb (Dec 5, 2009)

here is the "dual mode" zener regulator rough draft, tweak r12 to suit your minimum power requirements while sleeping. When off it is drawing 29 micro amps, not entirely sure why npn is working with so little base current, so just some fudging around in a simulator.

Draws 25ma from pack when ON, 12 for the opto and 13 in "reserve" being dumped by the zener for the most part, voltage relatively stable. Lots of little and ultimately very carefully selected parts though, is there a chip that will do this that isn't costly? I suppose matching it to the needs of everything else is the hard part.

r10 is just simulating a gpio pin going high when the cpu wakes up.

So this is meant to be part of a system where it will turn off each bms node when not charging or driving, but the bms nodes draw just enough power that they can respond to a "wake up" call. And no more built-in imbalance within the node plus a much more stable voltage to work from (well, it has a bit of ripple, but it stays high regardless of cell voltage). But it is "riding the knee" on the zener here in low power mode, so that might be weird when temperature changes. changing r12 makes the low power vdd 4.2v and draws 560uA from the cells at full charge and 200uA at low charge, so definitely some room to play with there in exchange for overall discharge rate.

I suppose a linear regulator is the next obvious choice if it can handle 36v, though those start at ~2ma quiescent, and no spec for current rating at 36v.


----------



## PStechPaul (May 1, 2012)

I don't think such a complicated power supply is needed for the microcontroller. The low cell can supply it through a Schottky diode, so even at a minimum voltage of 2.5 volts the PIC will see about 2.3 volts. A small supercapacitor could be used to hold the voltage in case a sudden current surge drops the cell to less than 2 volts. 

There are also charge pump devices that can boost low voltages. They can be as much as 98% efficient.

It may be possible to tweak an extra bit of resolution from the ADC by setting the positive reference to 2.048V and the negative reference to 1.024V. With a 2.3/1 voltage divider this would measure 2.355 to 4.710 volts, with a precision of 2.3 mV/count.


----------



## dcb (Dec 5, 2009)

is that lower vref thing a microchip specific trick? 

yah the zener thing is a little complicated, but guarantees balance and allows the occasional dip, and overcomes the draw problems with just a zener, any voltage regulator is gonna look funky on the inside, this is just an attempt at special purpose one (we are looking at just the power supply section, right?) without getting too fancy.

re supercaps and charge pumps, probably would rather just see a buck converter on the whole stack (could be charge pump too), driving an opto is 10's of milliamps, really any decent signal needs a bit of power behind it, and standard uart is active high by default (and emitter follower seems to be the best response mode for an opto). 

But 5v capable supercaps start at $1.73! more of a marketing gimmic IMHO, not really sure why trying to make 1 cell in charge of the whole stack.


fwiw, instead of single cpu/board I'm leaning towards a two cell module these days and a suitable ldo regulator. Still reasonable resolution on both cells (~0.01v), enough voltage headroom to handle the occasional tromp, while minimizing differences in vdd (and associated headaches) half the interconnects and optos, still a real simple sensing circuit, just 2 dividers and a balance resistor for the upper cell, the ldo (and prolly a cap or two), an opto and resistors, led, and a cpu. And I don't think having multiples of 2 cells is an oppressive design requirement for a vehicle (actually kind of hard to avoid if using leaf cells). Just trying to find the "right" ldo currently. Hopefully small enough pcb that you can bond it to the cell and get some temperature hints, mebbe I should avoid through hole for that reason alone, but also want to avoid having folks soldering on grains of rice...

also for quick and easy pcb design I'm looking at this. http://fritzing.org/ so as not to scare too many people off w/the process. But also looking into other alternatives as it is a bit arduino centric.


----------



## dcb (Dec 5, 2009)

also, don't supercaps have horrible self-discharge rates? Wouldn't that also apply to whatever battery it was connected to?


----------



## PStechPaul (May 1, 2012)

Where did you get that curve? What I found indicates adequate voltage for as long as seven days. The voltage only needs to hold during such times as the pack is being discharged at a very high current, as during acceleration, which is just a few seconds.

https://www.tecategroup.com/ultraca...What_is_the_self_discharge_or_leakage_current










Regarding ADC positive and negative references, I think most PICs have both, and the Atmel devices probably do as well. The Atmel ATMega series have only a positive reference. What I found:

http://www.atmel.com/Images/Atmel-8...rstanding-ADC-Parameters_Application-Note.pdf

http://www.atmel.com/Images/doc8060.pdf

http://extremeelectronics.co.in/microchip-pic-tutorials/using-adc-of-pic-microcontroller/

I am not sure if the Vref- can be set to 1/2 Vref+, however.


----------



## dcb (Dec 5, 2009)

so no part numbers on those graphs, the one I posed was kinda old too.

The thing to note is rp in this picture from your same link:









From my understanding you want to feed the cap from the bottom cell through a diode, well you will be feeding rp from the bottom cell as well, creating a measure of imbalance.

so lets look at a $1.70 5.5v 10mF cap (you don't want to put a couple 2.7 in series and have to worry about their balance as well, also mentioned in your link) 

https://content.kemet.com/datasheets/KEM_S6015_FY.pdf

this was the first one that gave any hints about self discharge in the 5-6v range, and instead of being precise (well the capacitance itself is −20/+80%!) about rp, they gave this information:
discharge from 5v to 4.2v in 24 hours no load. So it would be like putting a 50meg resistor in parallel with the lowest cell, not really a deal killer in the cell balance part which was my main concern (~0.8uA at full charge). It might be suitable for a single cpu per cell arrangement though if that was your meaning, but not at $1.73 apiece 

but you are still running a microcontroller and opto and multiplexer and led and a mosfet and various bias resistors and whatnot from that one cell though, to monitor 8 cells. That is definitely a concern in the balance department, especially if it were on a string of small capacity cells.


----------



## PStechPaul (May 1, 2012)

Perhaps an efficient buck converter powered by the eight cells to provide power for the controller would be a way to assure equal drain on all cells. A linear regulator would cause roughly 8 times the drain on the pack and that would not be very efficient. The charge shuttling option would tend to reverse the effects of the drain on the bottom cell. If it is lower in voltage than the others, it would be charged from the higher voltages of those in the upper cells.

It is possible to apply the selected cell voltages to the power supply of the PIC, and use that as the Vref+ of the ADC. The input to the ADC would be the internal reference voltage, 2.048 VDC. The PIC Vdd can be determined in this way.

A 100,000 uF 5.5V ultracapacitor is only $1.45 in quantities of 10:
https://www.mouser.com/ProductDetai...GAEpiMZZMuDCPMZUZ%2bYl5h6rep0zAk/0j/ffoOkOEQ=

Here are 4 farad 5.5 volt capacitors $10.39 for 10 pieces:
https://www.banggood.com/10pcs-5_5V...-p-1213342.html?rmmds=search&cur_warehouse=CN


----------



## dcb (Dec 5, 2009)

well I'm considering 2 cells per node to give the extra voltage headroom and not lose too much accuracy on the top cell, so the losses from a ldo won't be so bad there, vs 8 cells. 8 cells has challenges in that department, but if the buck converter costs less than 4 ldo then you will be ahead in the cost/cell in that department (8 cell is already ahead in the cpu/cell dept cost, and prolly pcb/cell cost). But you will need another multiplexer if you are trying for accuracy on the upper cells. 

The multiplexer is interesting, but does it behave differently near the rail? I know with a simple differential op-amp it is less concern since you are dividing the inputs, but not sure here, but you need more adc pins for that (but no address line concerns). 

With the required current limiting I don't see it being practical for charge shuttling though.


----------



## PStechPaul (May 1, 2012)

It looks like I (or someone) needs to build a prototype to test various designs. I also have some other ideas:

1) I found an MOSfet opto-isolator TLP175A for about 60 cents in 100 piece quantity, with an LED trigger current of 1 mA maximum. So there could be eight of these connected to each tap of the battery pack, to sample each cell into a flying capacitor. Then two more would connect the capacitor to the ADC input of the controller. This does add $5.40 to the cost, but replaces the cost of two DG408 multiplexers, $2.80 in quantity 10. It is also extensible to any number of cells, as long as the controller has enough I/O pins to turn on pairs of the optos. Two 74HC138 3-8 encoders ($0.28 each) can do the selection with 3 I/O pins each, and one more I/O for the measurement. For 16 cells, 74HC154 ($0.68 each) can be used. This system also can be used for lead-acid 12V battery packs up to 96 volts or 192 volts.

2) Using the DG408 multiplexers, a differential or instrumentation amplifier can be used to read voltages on the battery pack taps at ground level of the processor. The AD8420 is only $2.45 in quantity 10 and can operate at 36 VDC with current draw of 90 uA.


----------



## dcb (Dec 5, 2009)

re: tlp175a, has *5ms* turn on/turn off delay though, probably has the same issues as other 4 pin optos (gate has no where to drain) but I don't know why the turn on time is so slow, the $0.20 4n27 has similiar power levels and about *5us* turn on and off with an appropriate base drain. See post 48. You are looking at best 100 baud with that mosfet unless I'm doing it wrong. Maybe there are mitigating factors you have in mind that make 100 baud ok? I'm thinking of token ring so it would kill what I have in mind.

I'm working on an tiny1614 board, but still experimenting with different layout tools, really tired of the crap I've been using.


----------



## PStechPaul (May 1, 2012)

The TLP175A is to be used for sampling the cell voltage to a flying capacitor, so the 5 mSec maximum (1 mSec typical) response time is adequate. Faster and cheaper devices can be used for communication.

It can also handle 100 mA with a 50 ohm resistance (500mW) so they might be able to perform some cell balancing by connecting to a floating load. Actually two in series are 100 ohms and with 3.6 volts on a cell that is just 36 mA. 

The TLP222A can handle 500 mA with a 2 ohm ON resistance, and is not terribly expensive at $0.97 each in 100 piece quantity.

I use Mentor Graphics PADS2004sp2 for schematics and layout with pretty good autorouting. But it's rather costly. I tried KiCad years ago and didn't much like it, but I have heard it is now much improved, and it is open source. 

I have DesignSpark and ExpressPCB, mostly to open the files others have supplied. DipTrace is another I have heard of. No real experience with any of them, though.


----------



## dcb (Dec 5, 2009)

doh, sorry didn't realize the opto was part of the multiplexer. My bad.


----------



## bradleyk (Apr 3, 2013)

PStechPaul said:


> It looks like I (or someone) needs to build a prototype to test various designs. I also have some other ideas:
> 
> 1) I found an MOSfet opto-isolator TLP175A for about 60 cents in 100 piece quantity


You thinking like this? http://www.falstad.com/circuit/circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+43%0Av+208+64+208+16+0+0+40+5+0+0+0.5%0Aw+208+16+208+0+0%0Aw+272+0+320+0+0%0Aw+320+0+320+16+0%0Aw+320+64+320+80+0%0Aw+272+64+320+64+0%0Aw+320+128+320+144+0%0Aw+272+128+320+128+0%0Aw+320+192+320+208+0%0Aw+272+192+320+192+0%0Aw+320+256+320+272+0%0Aw+272+256+320+256+0%0Aw+320+320+320+336+0%0Aw+272+320+320+320+0%0Av+208+128+208+64+0+0+40+5+0+0+0.5%0Av+208+384+208+320+0+0+40+5+0+0+0.5%0Av+208+320+208+256+0+0+40+5+0+0+0.5%0Av+208+256+208+192+0+0+40+5+0+0+0.5%0Av+208+448+208+384+0+0+40+5+0+0+0.5%0Av+208+192+208+128+0+0+40+5+0+0+0.5%0Ag+208+448+208+464+0%0Aw+384+368+384+304+0%0Aw+384+304+384+240+0%0Aw+384+240+384+176+0%0Aw+384+176+384+112+0%0Aw+384+112+384+48+0%0Aw+320+368+384+368+0%0Aw+384+304+320+304+0%0Aw+320+240+384+240+0%0Aw+384+176+320+176+0%0Aw+320+112+384+112+0%0Aw+384+48+320+48+0%0Aw+208+320+272+320+0%0Aw+272+256+208+256+0%0Aw+208+192+272+192+0%0Aw+272+128+208+128+0%0Aw+208+64+272+64+0%0Aw+272+0+208+0+0%0Aw+208+64+144+64+0%0Af+144+32+96+32+8+1.5+0.02%0Aw+96+48+96+64+0%0Aw+96+64+144+64+0%0Aw+48+400+48+336+0%0Aw+48+336+48+272+0%0Aw+48+272+48+208+0%0Aw+48+208+48+144+0%0Aw+48+144+48+80+0%0Aw+48+80+48+16+0%0A209+0+-16+0+32+0+0.000001+4.969841241799555+1%0Aw+48+-16+384+-16+2%0Aw+384+-16+384+48+0%0Aw+208+384+272+384+0%0Aw+320+432+384+432+0%0Aw+272+384+320+384+0%0Aw+320+384+320+400+0%0Aw+384+432+384+368+0%0Af+272+32+320+32+1+1.5+0.02%0Af+272+96+320+96+1+1.5+0.02%0Af+272+160+320+160+1+1.5+0.02%0Af+272+224+320+224+1+1.5+0.02%0Af+272+288+320+288+1+1.5+0.02%0Af+272+352+320+352+1+1.5+0.02%0Af+272+416+320+416+1+1.5+0.02%0Ar+272+96+240+96+0+1000%0Ar+272+160+240+160+0+1000%0Ar+272+224+240+224+0+1000%0Ar+272+288+240+288+0+1000%0Ar+272+352+240+352+0+1000%0Ar+272+416+240+416+0+1000%0Ar+272+32+240+32+0+1000%0AR+240+32+240+16+0+0+40+50+0+0+0.5%0Aw+240+160+240+96+0%0Aw+240+96+240+32+0%0Aw+240+224+240+288+0%0Aw+240+288+240+352+0%0Aw+240+352+240+416+0%0Ar+144+32+176+32+0+1000%0Aw+96+16+48+16+0%0Aw+96+80+48+80+0%0Aw+96+128+144+128+0%0Aw+96+112+96+128+0%0Af+144+96+96+96+0+1.5+0.02%0Aw+208+128+144+128+0%0Aw+96+144+48+144+0%0Aw+96+192+144+192+0%0Aw+96+176+96+192+0%0Af+144+160+96+160+0+1.5+0.02%0Aw+208+192+144+192+0%0Aw+96+208+48+208+0%0Aw+96+256+144+256+0%0Aw+96+240+96+256+0%0Af+144+224+96+224+0+1.5+0.02%0Aw+208+256+144+256+0%0Aw+96+272+48+272+0%0Aw+96+320+144+320+0%0Aw+96+304+96+320+0%0Af+144+288+96+288+0+1.5+0.02%0Aw+208+320+144+320+0%0Aw+96+336+48+336+0%0Aw+96+384+144+384+0%0Aw+96+368+96+384+0%0Af+144+352+96+352+0+1.5+0.02%0Aw+208+384+144+384+0%0Aw+96+400+48+400+0%0Ar+144+416+144+448+0+1000%0Aw+96+448+144+448+0%0Aw+96+432+96+448+0%0Af+144+416+96+416+0+1.5+0.02%0Aw+208+448+144+448+0%0Aw+144+0+208+0+0%0Aw+48+-16+0+-16+0%0Aw+48+16+0+32+2%0Aw+240+224+240+160+0%0Ag+176+32+176+48+0%0Ag+176+96+176+112+0%0Ar+144+96+176+96+0+1000%0Ag+176+160+176+176+0%0Ar+144+160+176+160+0+1000%0Ag+176+224+176+240+0%0Ar+144+224+176+224+0+1000%0Ag+176+288+176+304+0%0Ar+144+288+176+288+0+1000%0Ag+176+352+176+368+0%0Ar+144+352+176+352+0+1000%0Aw+272+448+208+448+0%0A159+272+448+272+416+0+20+10000000000%0A159+272+384+272+352+0+20+10000000000%0A159+272+320+272+288+0+20+10000000000%0A159+272+256+272+224+0+20+10000000000%0A159+272+192+272+160+0+20+10000000000%0A159+272+128+272+96+0+20+10000000000%0A159+272+64+272+32+0+20+10000000000%0A159+144+0+144+32+0+20+10000000000%0A159+144+64+144+96+0+20+10000000000%0A159+144+128+144+160+0+20+10000000000%0A159+144+192+144+224+0+20+10000000000%0A159+144+256+144+288+0+20+10000000000%0A159+144+320+144+352+0+20+10000000000%0A159+144+384+144+416+0+20+10000000000%0Aw+288+432+608+224+0%0Aw+128+400+608+272+0%0Aw+288+368+608+192+0%0Aw+128+336+608+192+0%0Aw+128+272+608+160+0%0Aw+288+304+608+160+0%0Aw+128+208+608+128+0%0Aw+288+240+608+128+0%0AL+608+224+640+224+0+0+false+5+0%0AL+608+192+640+192+0+0+false+5+0%0AL+608+160+640+160+0+0+false+5+0%0AL+608+128+640+128+0+0+false+5+0%0Aw+128+144+608+96+0%0Aw+288+176+608+96+0%0Aw+128+80+608+64+0%0Aw+288+112+608+64+0%0Aw+128+16+608+32+0%0Aw+288+48+608+32+0%0AL+608+96+640+96+0+0+false+5+0%0AL+608+64+640+64+0+0+false+5+0%0AL+608+32+640+32+0+0+false+5+0%0Ad+608+224+608+272+1+0.805904783%0Ad+608+304+608+272+1+0.805904783%0AL+608+304+640+304+0+0+false+5+0%0Ap+-112+224+-112+400+1+0%0Aw+-112+400+96+448+0%0Af+-64+208+-112+208+0+1.5+0.02%0Ar+-64+208+-64+240+0+10000%0Ag+-64+240+-64+256+0%0Aw+-112+192+-112+-16+0%0Aw+-112+-16+0+-16+0%0Aw+-112+400+-144+400+0%0Aw+-112+224+-144+224+0%0Ar+-144+224+-144+400+0+1000000%0A159+-64+208+-64+144+0+20+10000000000%0Aw+-48+176+16+464+0%0Aw+16+464+512+480+0%0Aw+512+480+608+304+0%0Aw+-64+144+96+64+0%0Ao+48+64+0+4099+10+0.1+0+2+48+3%0A

I wonder what size cap and switching freq would be needed to have an effect on balancing. maths for another day I think

I have a bunch of PS2501-4's only 50ma tho. but should be plenty to test on some hobby lipo's


----------



## dcb (Dec 5, 2009)

bradleyk said:


> You thinking like this? http://www.falstad.com/circuit/circuitjs.html?cct=$+1+0.000005+10.20027730826997+50+5+43%0Av+208+64+208+16+0+0+40+5+0+0+0.5%0Aw+208+16+208+0+0%0Aw+272+0+320+0+0%0Aw+320+0+320+16+0%0Aw+320+64+320+80+0%0Aw+272+64+320+64+0%0Aw+320+128+320+144+0%0Aw+272+128+320+128+0%0Aw+320+192+320+208+0%0Aw+272+192+320+192+0%0Aw+320+256+320+272+0%0Aw+272+256+320+256+0%0Aw+320+320+320+336+0%0Aw+272+320+320+320+0%0Av+208+128+208+64+0+0+40+5+0+0+0.5%0Av+208+384+208+320+0+0+40+5+0+0+0.5%0Av+208+320+208+256+0+0+40+5+0+0+0.5%0Av+208+256+208+192+0+0+40+5+0+0+0.5%0Av+208+448+208+384+0+0+40+5+0+0+0.5%0Av+208+192+208+128+0+0+40+5+0+0+0.5%0Ag+208+448+208+464+0%0Aw+384+368+384+304+0%0Aw+384+304+384+240+0%0Aw+384+240+384+176+0%0Aw+384+176+384+112+0%0Aw+384+112+384+48+0%0Aw+320+368+384+368+0%0Aw+384+304+320+304+0%0Aw+320+240+384+240+0%0Aw+384+176+320+176+0%0Aw+320+112+384+112+0%0Aw+384+48+320+48+0%0Aw+208+320+272+320+0%0Aw+272+256+208+256+0%0Aw+208+192+272+192+0%0Aw+272+128+208+128+0%0Aw+208+64+272+64+0%0Aw+272+0+208+0+0%0Aw+208+64+144+64+0%0Af+144+32+96+32+8+1.5+0.02%0Aw+96+48+96+64+0%0Aw+96+64+144+64+0%0Aw+48+400+48+336+0%0Aw+48+336+48+272+0%0Aw+48+272+48+208+0%0Aw+48+208+48+144+0%0Aw+48+144+48+80+0%0Aw+48+80+48+16+0%0A209+0+-16+0+32+0+0.000001+4.969841241799555+1%0Aw+48+-16+384+-16+2%0Aw+384+-16+384+48+0%0Aw+208+384+272+384+0%0Aw+320+432+384+432+0%0Aw+272+384+320+384+0%0Aw+320+384+320+400+0%0Aw+384+432+384+368+0%0Af+272+32+320+32+1+1.5+0.02%0Af+272+96+320+96+1+1.5+0.02%0Af+272+160+320+160+1+1.5+0.02%0Af+272+224+320+224+1+1.5+0.02%0Af+272+288+320+288+1+1.5+0.02%0Af+272+352+320+352+1+1.5+0.02%0Af+272+416+320+416+1+1.5+0.02%0Ar+272+96+240+96+0+1000%0Ar+272+160+240+160+0+1000%0Ar+272+224+240+224+0+1000%0Ar+272+288+240+288+0+1000%0Ar+272+352+240+352+0+1000%0Ar+272+416+240+416+0+1000%0Ar+272+32+240+32+0+1000%0AR+240+32+240+16+0+0+40+50+0+0+0.5%0Aw+240+160+240+96+0%0Aw+240+96+240+32+0%0Aw+240+224+240+288+0%0Aw+240+288+240+352+0%0Aw+240+352+240+416+0%0Ar+144+32+176+32+0+1000%0Aw+96+16+48+16+0%0Aw+96+80+48+80+0%0Aw+96+128+144+128+0%0Aw+96+112+96+128+0%0Af+144+96+96+96+0+1.5+0.02%0Aw+208+128+144+128+0%0Aw+96+144+48+144+0%0Aw+96+192+144+192+0%0Aw+96+176+96+192+0%0Af+144+160+96+160+0+1.5+0.02%0Aw+208+192+144+192+0%0Aw+96+208+48+208+0%0Aw+96+256+144+256+0%0Aw+96+240+96+256+0%0Af+144+224+96+224+0+1.5+0.02%0Aw+208+256+144+256+0%0Aw+96+272+48+272+0%0Aw+96+320+144+320+0%0Aw+96+304+96+320+0%0Af+144+288+96+288+0+1.5+0.02%0Aw+208+320+144+320+0%0Aw+96+336+48+336+0%0Aw+96+384+144+384+0%0Aw+96+368+96+384+0%0Af+144+352+96+352+0+1.5+0.02%0Aw+208+384+144+384+0%0Aw+96+400+48+400+0%0Ar+144+416+144+448+0+1000%0Aw+96+448+144+448+0%0Aw+96+432+96+448+0%0Af+144+416+96+416+0+1.5+0.02%0Aw+208+448+144+448+0%0Aw+144+0+208+0+0%0Aw+48+-16+0+-16+0%0Aw+48+16+0+32+2%0Aw+240+224+240+160+0%0Ag+176+32+176+48+0%0Ag+176+96+176+112+0%0Ar+144+96+176+96+0+1000%0Ag+176+160+176+176+0%0Ar+144+160+176+160+0+1000%0Ag+176+224+176+240+0%0Ar+144+224+176+224+0+1000%0Ag+176+288+176+304+0%0Ar+144+288+176+288+0+1000%0Ag+176+352+176+368+0%0Ar+144+352+176+352+0+1000%0Aw+272+448+208+448+0%0A159+272+448+272+416+0+20+10000000000%0A159+272+384+272+352+0+20+10000000000%0A159+272+320+272+288+0+20+10000000000%0A159+272+256+272+224+0+20+10000000000%0A159+272+192+272+160+0+20+10000000000%0A159+272+128+272+96+0+20+10000000000%0A159+272+64+272+32+0+20+10000000000%0A159+144+0+144+32+0+20+10000000000%0A159+144+64+144+96+0+20+10000000000%0A159+144+128+144+160+0+20+10000000000%0A159+144+192+144+224+0+20+10000000000%0A159+144+256+144+288+0+20+10000000000%0A159+144+320+144+352+0+20+10000000000%0A159+144+384+144+416+0+20+10000000000%0Aw+288+432+608+224+0%0Aw+128+400+608+272+0%0Aw+288+368+608+192+0%0Aw+128+336+608+192+0%0Aw+128+272+608+160+0%0Aw+288+304+608+160+0%0Aw+128+208+608+128+0%0Aw+288+240+608+128+0%0AL+608+224+640+224+0+0+false+5+0%0AL+608+192+640+192+0+0+false+5+0%0AL+608+160+640+160+0+0+false+5+0%0AL+608+128+640+128+0+0+false+5+0%0Aw+128+144+608+96+0%0Aw+288+176+608+96+0%0Aw+128+80+608+64+0%0Aw+288+112+608+64+0%0Aw+128+16+608+32+0%0Aw+288+48+608+32+0%0AL+608+96+640+96+0+0+false+5+0%0AL+608+64+640+64+0+0+false+5+0%0AL+608+32+640+32+0+0+false+5+0%0Ad+608+224+608+272+1+0.805904783%0Ad+608+304+608+272+1+0.805904783%0AL+608+304+640+304+0+0+false+5+0%0Ap+-112+224+-112+400+1+0%0Aw+-112+400+96+448+0%0Af+-64+208+-112+208+0+1.5+0.02%0Ar+-64+208+-64+240+0+10000%0Ag+-64+240+-64+256+0%0Aw+-112+192+-112+-16+0%0Aw+-112+-16+0+-16+0%0Aw+-112+400+-144+400+0%0Aw+-112+224+-144+224+0%0Ar+-144+224+-144+400+0+1000000%0A159+-64+208+-64+144+0+20+10000000000%0Aw+-48+176+16+464+0%0Aw+16+464+512+480+0%0Aw+512+480+608+304+0%0Aw+-64+144+96+64+0%0Ao+48+64+0+4099+10+0.1+0+2+48+3%0A


You broke the vscope track every movement bot with that link


----------



## PStechPaul (May 1, 2012)

Here is my implementation of a four cell flying capacitor BMS with shunt cell balancing and possibly charge shuttling. I haven't totally figured out the power supply yet, but it will probably have Vdd connected to the low cell BT1:










As I envision it working, the controller will select the bottom cell BT1 using RC4. This will turn on U1 and U5 and will transfer charge from the cell to 220 nF capacitor C3. For 3 volts this is an energy drain of 0.5*220*9 = 990 nanojoules, while a 10 A-h cell has energy of 30*3600 = 108,000 Joules. This represents about 1E-11 of the total energy of the cell. So with one sample every second it would take 1E10 seconds to drain 10% of its energy. Check my math, but this is clearly insignificant. 

What is significant is the current draw from the low cell to turn on the opto-MOSFETs, perhaps 10 mA. But the sample can be taken in something like 10 mSec. This represents an equivalent drain for four cells of 10 mA * 40 mSec / 1000 mSec (for one sample per second) or 400 uA. For a 10 A-h 3V cell, this will drain 10% of its energy in 1 / 4E-7 or 250,000 hours.

When RC4 goes low, the capacitor will hold the charge and will be floating. Now RC0 and RC1 will turn on U10 and U11 which apply the charge to the ADC input of the PIC through R9 and C4. The voltage may drop about 1% as some charge transfers from C3 to C4, which is 100 times smaller. Now the voltage of the selected cell can be read.

This process is repeated to read BT2, BT3, and BT4. Since C3 is already charged, very little energy transfer will occur, and it may be in either direction due to voltage differences of the cells. Some charge shuttling may occur, but for it to be significant it will require a much larger capacitor.

If it is desired to shunt balance a high cell, that cell is selected by means of RC4:RC7, and RC2 goes low to turn on U9. This applies the load resistor R4 (in this case 30 ohms) which causes a drain of about 100 mA.


----------



## WolfTronix (Feb 8, 2016)

Just making sure you guys know you can buy entire battery management systems on a chip:

http://www.analog.com/media/en/technical-documentation/data-sheets/AD7280A.pdf


----------



## PStechPaul (May 1, 2012)

WolfTronix said:


> Just making sure you guys know you can buy entire battery management systems on a chip:
> 
> http://www.analog.com/media/en/technical-documentation/data-sheets/AD7280A.pdf


Yes, but that chip is about $9 and requires external MOSFETs and resistors for shunt balancing. It also draws 5-9 mA when operating, and is limited to six cells and 30 volts maximum. It does support a daisy chain configuration with up to eight devices for a total of 48 cells and nominal pack voltage of 3.3 * 48 = 158 volts or 4.1 * 48 = 197 volts. It seems to be designed for Li-Ion but should be programmable for LiFePO4.

There are other BMS chips available, and they make sense for OEMs and production battery packs, but there is a certain amount of fun involved with designing and building one's own BMS - a BMS grin, if you will! 

My design can certainly be improved upon. I think there may be a way to use MOSFETs directly rather than opto-isolators. And a DG409 can be used in place of the eight TLP222a devices, if charge shuttling proves to be impractical. Also, my design can be used for a lead-acid battery pack consisting of four 12V batteries. Also, shunt balancing can still be implemented with four TPL222a devices, or even transistor output optos driving the gates of power MOSFETs. I like the flying capacitor design, but a good instrumentation amplifier with high CMRR might be better.


----------



## bradleyk (Apr 3, 2013)

Yeah, the fun of a custom design. 

This looks good tho. 
(bq76925 Host-Controlled Analog Front End)
http://www.ti.com/lit/ds/symlink/bq76925.pdf

built in 50ma shunt, $3.75 in single qty. 3-6 cells
Power Consumption
– 40 µA Typical in Normal Mode
– 1.5 µA Maximum in Sleep Mode

just needs a micro to control it  and some passives for filtering


----------



## PStechPaul (May 1, 2012)

Looks like a good device. I have been trying to simulate using just MOSFETs to implement the flying capacitor design. It worked for the top cell, but when I tried to add the second cell, it caused the V[ADC] to read about 300 mV high. It is probably due to the intrinsic diode of the MOSFETs. I have them disconnected in this simulation:


----------



## PStechPaul (May 1, 2012)

I was able to design and simulate an analog multiplexer using two N-channel and two P-channel MOSFETs. They are less than 10 cents each, and this is a two-channel multiplexer. It is necessary to use the top channel for the higher voltage, and I have verified that it works for cells V1 through V4.










Changing the load R6 to 15 ohms and R9 and R10 to 1 ohm provides shunt balancing current of over 100 mA for the 2.5 volt cell. The circuit draws 420 uA from V1 and V3 when sampling and balancing with 100 mA. It draws 51 pA when the channels are off. 

Here is a pretty good tutorial on analog switches and multiplexers:
http://www.analog.com/media/en/training-seminars/tutorials/MT-088.pdf


----------



## bradleyk (Apr 3, 2013)

That is cool. Hmm. choices

Does have some issues with the high side mosfet not being switched hard enough
http://tinyurl.com/yanrumrs


----------



## PStechPaul (May 1, 2012)

I couldn't quite make out how to use that web-based simulator. The logic level of the inputs to the MOSFETs on the bottom seem to stay 0V even when I click on the input which changes from L to H. My LTSpice simulation shows the MUX working on all cells. 

I have uploaded the LTSpice ASCII files for anyone to play with:

http://enginuitysystems.com/pix/electronics/Analog_Mux.asc

http://enginuitysystems.com/pix/electronics/BMS_Flying_Capacitor.asc

The Falstad simulator looks intriguing.


----------



## bradleyk (Apr 3, 2013)

Hmm that is strange, the simulator seems to work for me. I just click on the L for cell 1-4 and get a voltage across the cap. http://tinyurl.com/y7yfpfau 

it works fine when not balancing, but Falstad doesn't like trying to put 100ma through the high side for cell 1. I expect LTspice is more accurate. 

Works fine at 4v per cell. fails at 3v per cell. as in the 3rd pic. 
3v cell. 30ohm shunt 40mA. 
there is a 0.6v drop across the fet. I have set the fet to the nominal gate voltage settings of -1v per the datasheet, gain 50
Hopefully this is just an issue with the Falstad sim.

circled in red is the High side voltage. 
in blue is the low side voltage.


I might need to install LTspice.


----------



## PStechPaul (May 1, 2012)

I figured out why it didn't seem to work for me. Doh! I had stopped the simulation.  I'm just not used to a dynamic interactive simulation. For LTSpice I usually run a transient sim for a certain period of time and then examine the graph to see what happens at various time points. I have also used TINA, which has interactive capability, but it's been a long time. Maybe I'll look into your circuit to see why it has problems reading the high side.

It looks like it's working just fine. I tried various voltages down to 2.7V and all seems good.


----------



## bradleyk (Apr 3, 2013)

whoops, that would do it.
That should be your circuit, I just added the extra channels to see how it worked for all cells

sweet. ltspice has a better model of the mosfet than falstad


----------



## PStechPaul (May 1, 2012)

I found a potential problem with the circuit. The MOSFET gates are rated up to 20 volts (which is not a problem if used for just four lithium cells), but I am considering using it for 12V batteries, or four more lithium cells (perhaps 8). I added 15V zeners from gate to source, and put resistors in series with the gates:









I think I will be breadboarding this soon and I have started a PCB-ready design using PADS Layout.


----------



## PStechPaul (May 1, 2012)

Here's the full circuit:










I still need to add communications and power supply and a few other things. It looks like a lot to breadboard - I might have to get some PCBs made, but first I want to make sure I include everything really needed.


----------



## bradleyk (Apr 3, 2013)

I was playing with comms today. thoughts on the circuits?
http://tinyurl.com/yamr3m3g
this is for master TX. I have never switched sources before. haven't thought, or understand noise. 

Master RX
http://tinyurl.com/yajv5ltk

Need to decide on propagation delay and if a bunch of opto's would be better.


I am still planning to go with An IC I think. bq76925. http://www.ti.com/lit/ds/symlink/bq76925.pdf 
just trying to sort out Comms, thinking a custom protocol, mix between I2C and SPI. essentially unidirectional I2C, or spi with no SS pin.


----------



## kennybobby (Aug 10, 2012)

@Paul, it looks like the FET drivers will be draining pack current 320uA all the time. 

Also for the low side drivers feeding MUX-, it appears that the pack voltage will be fed back to the cells thru 200k, a forward drop of the zener diode, and 10R.


----------



## PStechPaul (May 1, 2012)

You are right. I have fixed it in the following simulation. I show it for four 12V lead-acid batteries, for which it draws 2 mA when sampling, but that is largely due to the gate protection zeners, which are turned on with 50 volts available from the pack. The circuit draws less than 100 nA when not sampling. With nominal 3 volt lithium cells, it draws less than 200 uA when sampling. 










Now I need to incorporate these changes in my PADS schematic.


----------



## PStechPaul (May 1, 2012)

Bradley, I looked at the simulations for the comms, but I don't understand what is being done. The master RX seems to send switch closures in each module down the chain to the bottom module. And the master TX looks like the bottom unit can send a signal to the left side or right side of the upper units. Perhaps that is a way to address a specific one of the three upper modules with binary 01, 10, an 11.

My working concept is something like SPI. Each unit will have an isolated transceiver. An external master controller will transmit the the RXD inputs of all the slave modules, each of which will have a unique address. The TXD outputs of the modules will be connected to Schottky diodes and a pull-up resistor in a wire-OR configuration. Communication is initiated by the master by sending an address and a command, each of which could be 4 bits, allowing 16 modules and 16 commands. If a slave module receives a matching address, it will respond with one or more bytes of data.


----------



## bradleyk (Apr 3, 2013)

with master tx one, I was just curious on thoughts about the two different designs to send a signal up the line. left vs right side. 
I was just trying to figure out a cheaper way to do comms without needing an isolated transceiver. same for RX. the switch simulates a micro pin.

I don't understand what you mean by the shocky diodes in an or config, with different ground levels.
yeah. SPI with slave address, not SS


----------



## PStechPaul (May 1, 2012)

Here is my design. The lower right side of the schematic shows a master unit with connectors for two slave units. The master RX line is pulled low for transmission from either of two slave units.


----------



## bradleyk (Apr 3, 2013)

ahh, do you plan to use a transceiver for each board? 
I am confused about the dual slaves.
so a slave needs to be plugged into J4 or J3. 
But where is Txw and RxW connected to the transceiver.


----------



## PStechPaul (May 1, 2012)

It's actually TXM and RXM (for Master). They will be connected to another PIC in the master unit, which has yet to be designed. The ISO7221 is a logic level digital isolator. I still need to finalize the slave design by adding the power supply connection, probably through a Schottky diode to cell #1. I think I will post this design on sci.electronics.design where there are lots of experts who might be able to comment and offer suggestions and caveats. I don't think it should be quite so complicated. Maybe someone has the schematic for the DG408 and DG409.


----------



## bradleyk (Apr 3, 2013)

ahh, yes, you are going to have each slave connect to a master.

I was planning on have master -> slave(1) -> slave(n-1) -> slave. with each slave translating the voltage.


----------



## PStechPaul (May 1, 2012)

I got some good suggestions from folks in sci.electronics.design. Mostly, it helped me to rethink the concept, and I have been able to greatly simplify the MOSFET design. I should be able to use just PMOS devices biased by a pull-down for each pair. PMOS will work for any voltages more than about 2V above ground. It's really not necessary to sample the low tap of the stack - it's already GND. Here is a simulation:










However, there is a problem. A similar cell measuring across V3, but turned off, will conduct through the body diodes and cause heavy current flow and erroneous readings. Here is that simulation, ugly though it might be:










I will need to see if my original design has the same problem.


----------



## PStechPaul (May 1, 2012)

Here is a simulation showing a single analog MUX element using two PMOS devices in back-to-back series. This shows that it properly samples input voltages down to about 2.5 volts and up to the supply rail:










That seems to work. The following shows the MUX reading a high cell while another element is connected to a lower cell, but not turned on:


----------



## rev0 (Oct 7, 2017)

I suppose you don't like dealing with SMD parts, but here's an option for a regulator, 3.3V 100mA with 3.5uA quiescent current, $0.70 each and 36V capable: https://www.digikey.com/product-detail/en/richtek-usa-inc/RT9058-33GV/1028-1253-1-ND/4021246


----------



## PStechPaul (May 1, 2012)

I don't mind SMT parts - in fact I prefer them now, even for prototypes. That does look like a good part, but I think a switching buck regulator might be better. A linear regulator draws the same input current as output, so when the processor draws, say, 5 mA, the linear regulator will drop 10 volts on a 13.3 volt supply. Here is a simple buck regulator that draws about 2.4 mA from a 20v supply with a 5.1 mA 3.4 V load:










I found a low power dual op-amp with a high accuracy 2.5 reference for less than $1 each:
http://www.mouser.com/ds/2/389/tsm103w-974403.pdf

There may be other lower current designs. This device draws as much as 2 mA on a 30V supply.


----------



## rev0 (Oct 7, 2017)

PStechPaul said:


> I don't mind SMT parts - in fact I prefer them now, even for prototypes. That does look like a good part, but I think a switching buck regulator might be better. A linear regulator draws the same input current as output, so when the processor draws, say, 5 mA, the linear regulator will drop 10 volts on a 13.3 volt supply. Here is a simple buck regulator that draws about 6 mA from a 20v supply with a 5 mA 3.4 V load:
> 
> I found a low power dual op-amp with a high accuracy 2.5 reference for less than $1 each:
> http://www.mouser.com/ds/2/389/tsm103w-974403.pdf
> ...


My thinking is the whole design should use as little current as possible, and buck converters tend to be very inefficient at low load. Here's one that draws 25uA at no load: https://www.digikey.com/product-detail/en/richtek-usa-inc/RT6208GE/RT6208GECT-ND/5639579 You can see the efficiency drops off a cliff below 1mA, which it would spend a lot of time in (when the BMS is in sleep/standby mode for example). I would prefer a linear regulator mostly because I'm lazy and like to keep the parts count low


----------



## PStechPaul (May 1, 2012)

Linear Technology has some micropower buck regulators, but most of them are more than $5. Microchip has a MCP16301 that works on 4-30V and 600mA output with 7uA shut-down and 2mA quiescent, for $1.10/1 and $0.76/100, in an SOT23-6 package. There is also an SC4530 for 3-30V and 300mA output with 19 uA quiescent, for $1.43/1 and $0.76/100, in a tiny MLPD-W-8 package. 

But the easiest method may be to use the lowest cell in the pack, and then perform charge balancing. Perhaps it would be possible to charge the bottom cell from the entire pack? For efficiency, The pack voltage could be applied to an inductor which would then apply the current to the lowest cell. This would be basically a buck regulator, but controlled by the PIC itself. Four cells at 3.5V each (14V) applied to a 470uH inductor will reach 100mA in 3.35 uSec. A 470uH 140mA inductor is only about $0.25/1 and $0.14/100. I'll do a simulation to see how it works.

Here it is:










There may be a challenge switching the high side MOSFET from a low side MOSFET using 3V logic.


----------



## PStechPaul (May 1, 2012)

I made a cheap gate driver using an NPN and PNP transistor driven by a low gate voltage NMOS device. Note that the bottom cell contributes the 3.2 mA into the 1k load continuously, and the entire pack only draws significant current (peak 260 mA) for 13 uSec out of 250 uSec that the inductor is being charged. Then it transfers its charge through D1 into the bottom cell in 31 uSec.


----------



## bradleyk (Apr 3, 2013)

that is an idea. simplicity of single cell supply, with even cell drain.

what is d3 needed for?

also as the regulator is driven from a micro, it should be easy to replace d2 with another fet driven by the micro with an interleaving pwm to increase efficiency. 

also you should be able to connect the collector of Q2 to C1, to improve the efficiency of the driver, tho that will be ~2.5nf per switch. ) 0.8khz switching freq = ~24uA

this is tempting to design a balancing charger.


----------



## PStechPaul (May 1, 2012)

You are right - D3 is not needed. I added it at one time when it seemed to help. I don't know much about interleaving PWM, and it sounds a bit more complex than what is needed. It does seem to work better with Q2-C connected to C1. Thanks for the idea.

Here is the complete schematic at this point:










The simulation (I added a zener for gate protection in the case of pack voltage >20):









And the LTSpice ASCII file: 
http://enginuitysystems.com/pix/electronics/BMS_Low_Cell_Charger_3.asc


----------



## PStechPaul (May 1, 2012)

I have been working on a final prototype and I have a preliminary layout that fits on a 2" x 6" PCB. It could be even smaller. I may commit to copper and FR4 pretty soon. 

Meanwhile, I have also considered the simpler approach of using a DG409 for 4 cells or two DG408s for eight cells. Instead of the flying capacitor, I looked into using a high CMRR instrumentation amplifier, but only a few will handle inputs at the supply rail. The LT1636/7 is the only one I found, and it is actually an op-amp. It will work on 44 volts, and costs about $3 in single quantity.

So, I got an idea of using a matched pair of PNP BJTs and a few resistors to translate the voltage of an upper cell to ground. Here is the simulation I came up with, and the BC857B matched pair is only about 50 cents. R3 and R4 simulate the channel resistance of the MUX:










Here is the LTSpice file:
http://enginuitysystems.com/pix/electronics/Cell_Monitor.asc

It looks like a 1 mSec sample is sufficient to get a reading within 1 mV and the circuit only draws about 50 uA while reading. The current draw is the same when reading V2. The low cell V4 would be read directly. This looks too good to be true. Tell me if there is some sort of "gotcha"!


----------



## bradleyk (Apr 3, 2013)

That is awesome. Looks like the same solution I was going to use for the RX slave to master, but i have never used it.
My thoughts were, how close do they need to be matched? and then how does ageing affect the accuracy, this is going to be temperature dependant.

I'm thinking I might just throw up a design on a PCB and test it. 
The next question is cell balancing. this should work cheaply for accurate voltage measurement.


resistors don't need to be the same. if you're using an internal 2.56v reference. and want to measure 4.5v R2 = 25.8k = (2.56-0.5)v/(4.5-0.5)v *50k
but this will have a side effect as there is an offset of ~0.5v(current dependant) form the transistors


----------



## PStechPaul (May 1, 2012)

I was able to get somewhat better accuracy by making R2 50.2k, but there is still an error related to the common mode voltage.

I have found a problem. Measuring the second lowest cell, the reading is adversely affected if the lowest cell is significantly lower in voltage. 
Here is what I found (*** indicates significant error):

V3=4.0 V4=3.0 Vout=3.558 ***
V3=4.0 V4=4.0 Vout=3.994
V3=3.5 V4=3.0 Vout=3.476 ***
V3=3.5 V4=3.5 Vout=3.495
V3=3.2 V4=2.5 Vout=3.031 ***
V3=3.2 V4=3.0 Vout=3.197
V3=3.2 V4=3.2 Vout=3.197
V3=3.2 V4=3.5 Vout=3.197
V3=3.0 V4=3.0 Vout=2.998
V3=2.5 V4=3.0 Vout=2.499
V1=3.5 V4=3.0 Vout=3.503
V1=3.0 V4=3.0 Vout=3.001
V1=2.5 V4=3.0 Vout=2.504

Image: 








LTSpice: http://enginuitysystems.com/pix/electronics/Cell_Monitor.asc

I thought it might be better to use a lower value resistor for R2, to get a voltage of 1/2 the cell value:

V3=4.0 V4=3.0 Vout=1.921 -4.0%
V3=4.0 V4=4.0 Vout=1.921 -4.0%
V3=3.5 V4=3.0 Vout=1.721 -1.6%
V3=3.5 V4=3.5 Vout=1.722 -1.6%
V3=3.2 V4=2.5 Vout=1.601 OK
V3=3.2 V4=3.0 Vout=1.601 OK
V3=3.2 V4=3.2 Vout=1.601 OK
V3=3.2 V4=3.5 Vout=1.602 OK
V3=3.0 V4=3.0 Vout=1.521 +1.4%
V3=2.5 V4=3.0 Vout=1.321 +5.7%
V1=3.5 V4=3.0 Vout=1.723 -1.5%
V1=3.0 V4=3.0 Vout=1.523 +1.5%
V1=2.5 V4=3.0 Vout=1.323 +5.8%

Image: 








LTSpice: http://enginuitysystems.com/pix/electronics/Cell_Monitor_2.asc

I also played around with the same circuit for 12V batteries:

Divided by 10:
V3=14 Vout=1.314 -6.5%
V3=12 Vout=1.201 OK
V3=10 Vout=1.088 +8.8%
V1=14 Vout=1.315 -6.5%
V1=12 Vout=1.203 OK
V1=10 Vout=1.089 +8.9%

Image: 








LTSpice: http://enginuitysystems.com/pix/electronics/Cell_Monitor_12V.asc

No division:
V3=14 Vout=12.572 -11.3%
V3=12 Vout=12.003 OK
V3=10 Vout=10.005 OK
V1=14 Vout=14.034 +0.2%
V1=12 Vout=12.032 +0.3%
V1=10 Vout=10.030 +0.3%

Image: 








LTSpice: http://enginuitysystems.com/pix/electronics/Cell_Monitor_12V_1.asc


----------



## PStechPaul (May 1, 2012)

I decided to try the same circuit using a pair of PMOS devices. It appears to work pretty well!

Very good for 3V nominal lithium cells:

V3=4.0 V4=3.0 Vout=4.002
V3=4.0 V4=4.0 Vout=4.002
V3=3.5 V4=3.0 Vout=3.502
V3=3.5 V4=3.5 Vout=3.501
V3=3.2 V4=2.5 Vout=3.201
V3=3.2 V4=3.0 Vout=3.201
V3=3.2 V4=3.2 Vout=3.201
V3=3.2 V4=3.5 Vout=3.201
V3=3.0 V4=3.0 Vout=3.001
V3=2.5 V4=3.0 Vout=2.501
V1=3.5 V4=3.0 Vout=3.502
V1=3.0 V4=3.0 Vout=3.001
V1=2.5 V4=3.0 Vout=2.501

Image: 








LTSpice: http://enginuitysystems.com/pix/electronics/Cell_Monitor_PMOS.asc

Almost as good for a 12V battery pack:

V1=10V V4=12V Vout=10.001
V1=12V V4=12V Vout=12.002
V1=14V V4=12V Vout=14.003
V3=10V V4=12V Vout=10.001
V3=12V V4=12V Vout=12.002
V3=14V V4=12V Vout=13.996
V3=14V V4=10V Vout=13.006 -7.6%
V3=16V V4=10V Vout=14.008 -14.2%
V3=12V V4=10V Vout=11.992

Image: 








LTSpice: 
http://enginuitysystems.com/pix/electronics/Cell_Monitor_12V_PMOS.asc

I don't know how closely matched the MOSFETs need to be. I'll have to look for matched pairs.


----------



## PStechPaul (May 1, 2012)

I just finished laying out the BMS using discrete MOSFETs and flying capacitor and low cell buck charger.


----------



## PStechPaul (May 1, 2012)

Well, I did finally build this circuit, but I ran into several problems. First and foremost, perhaps, was that I used the wrong decal for the PIC16LF15345, so I had to bend the leads under the package to solder to the pads:










That worked well enough, and then I spent some time working on the PIC code. Eventually I got the ADC working and the USART which I connected to a Bluetooth module so I could read cell voltages using TeraTerm:










Those are not correct, because there were some other problems on the PCB. The PMOS device decals were incorrect (gate and source switched), so I had to turn them upside down and add some ugly jumpers:










But, more importantly, there are some basic design flaws that do not properly pass the voltage on the flying capacitor to the ADC. I'm not 100% sure just what the problem is, but the full voltage of the four cell taps gets put to the input of the ADC for the top 3 measurements, and the bottom cell does not take MUX- to ground. 

It looks like this topology is at a dead end. There are some ways to fix it, but that involves some major changes and will probably add too much complexity as well as being less efficient. So now I have four blank boards that are essentially junk, not even usable for other purposes. The low cell charger circuit works pretty well, but it's probably not all that useful. Some take-away from this:

1. The DG408 and DG409 circuits can do the flying capacitor method for battery packs up to 8 cells and about 36V maximum.

2. The opto-MOS SSRs can be used for packs of 12V SLAs, up to 8, or nominal 8*12=96V.

3. It may be best to provide a buck switching supply to use full pack voltage for the PIC power supply. It can charge a fairly large capacitor and then shut down until the voltage drops low enough to need another charge cycle. It can provide full 3.3V or 5.0V for the Bluetooth module, but it is really only for development purposes. The final design will use digital isolators to communicate with a master module.

I will probably remove some of the more expensive components from this PCB and junk it. Anybody want some boards to play with?


----------



## [email protected] (Dec 10, 2017)

Thank you all for some of the interesting input. I have been developing my own BMS which transmits voltages and temperatures via bluetooth to a network module (https://www.drmiot.com/my-bluetooth-bms/). It works very well but some of the topics proposed by Siwastaja are worth considering.


----------

