# Homemade BMS



## Chuechco (Aug 18, 2012)

Hi,
I've been working on a Battery Management System for a few days. That's not my first experience with such circuits, however I have never been happy with the result. I hope to succeed with my new design.
I have some headway cells here connected to a battery consisting of 16 cells in series.
I want to split the BMS in half. So I have two boards, each controlling 8 cells. 
The baords have an ATmega8 that can read the cell voltages and can discharge cells via a balancing resistor. There will be a third board, the 'masterboard' containing a bigger MCU. All MCUs will be connected by an SPI bus. The masterboard handles the charge current and so on. 

Thats my circuit for one of the two boards so far:
http://img203.imageshack.us/img203/9079/l2rk.png

I have drawn a circle around the most important parts. 
The cell voltages need to be in respect to ground. Since I do not want the BMS to get expensive, I will just use a differential amplifier with some 0.1% resistors. Each amplifier draws some current, so I added a MOSfet controlled by the Atmega that can switch on the power for the OpAmps if needed.(Activate Opamps in the schematic).
In the schematic I have an analog multiplexer for the atmega to select the cell voltage that goes to PC0. I did this because the Atmega8 doesnt have 8 ADC pins, but I think I will just buy a bigger atmega, maybe atmega16, that has enough ADC available.
Same with the shift register right to the atmega. I wanted to save pins, but thats probably nonsense when I have the atmega16.
On the bottom-right I have the SPI connection that goes to the masterboard. I will transmit cell voltages, so the masterboard can shut down the charge-current. I need the optocopplers since the ground in this circuit may not be the same ground as in the masterboard.

Can someone please look over the schematic and tell what to modify?


----------



## PStechPaul (May 1, 2012)

I thought I saw some major problems with your concept, but I think it should work. The MOSFETs have a low gate threshold, so they will turn on at cell voltage of at least 2.25 volts. You are using 0.1% resistors in the differential amplifiers, so that will help with accuracy at higher common mode voltages. 

The current drain on the cells will be unequal, and as much as 28V/200k = 140 uA, and will drain 10% of a 100 Ah cell's capacity in 71000 hours or 8 years. So that is not much of a problem. It may be a good idea to use precision opamps rather than the LM358 to reduce offset error. Actually, I have shown that it can be just as effective to use simple voltage dividers from each cell junction to ground, with perhaps a 10:1 ratio, with fair size capacitors, and read the voltages directly by the processor. The voltage for the bottom cell will be seen as about 0.32V, while that of the top cell will be 2.56V. You can get the voltage for each cell by subtracting adjacent voltage readings, and with a 10 bit ADC you can still achieve a precision of 7 bits, or 1/128, or better than 1%. You may be able to get resistor networks with 8 matched resistors, and you might be able to use as high as 1 Meg/100k, although 100k/10k would be OK as well, at least for larger battery packs.

You will probably not save a lot of power by removing power from the op-amps, if you choose to keep them, and it will cause the protection diodes to conduct, although the current will be safely limited. 

The 74AC164 is one way to set which shunt resistors need to be turned on, but you could also use an 8 channel addressable latch 74HC259. The shift register takes less IO pins.

I'm not sure what you are doing with the SPI interface. I think it may be better to use a digital isolator and possibly a serial interface with a USART, needing just two optoisolators. I found a similar circuit to what you have: 
http://www.powersystemsdesign.com/optimize-data-rates-in-isolated-spi-buses?a=1&c=1230
You could also use this, but a bit pricy at $3 each:
http://www.linear.com/product/LTC6820

There are other communication schemes that use a daisy-chain configuration from each module to the next. It can be implemented with opto-isolators, or by using capacitors to pass the AC signals but block the DC potential difference between modules.

It doesn't look bad, but there are already many ideas that have been proposed. See the thread(s) on BMS design.


----------



## Elithion (Oct 6, 2009)

The circuit will unbalance the battery: the top cell is drained 8 times faster than the 2nd cell from the bottom, and the bottom cell is not drained at all.
The 5 V regulator will drain the battery in 10 AH / 5 ma = 2000 hours = 5 years. That's not bad in the battery starts full. But what if the battery is already empty? Then it will kill the cells in just a few days, and there's nothing to stop it, until the full battery voltage is down to 1 V or so
With that shift register it's a bit too easy for a load to be latched on and stay stuck on, killing a cell
The offset of the OP-AMP's you chose is rather high
The measurement tolerance is set by the tolerance of the 5 V regulator, which is 10 % or 5 % (depending on the part). At 3.6 V, you could be off by 360 mV or 180 mV. That's a lot.
Reference


----------



## Chuechco (Aug 18, 2012)

Thanks for your help!
I will look up some other threads about BMS on this forum to get some ideas


----------



## Chuechco (Aug 18, 2012)

I'm searching this forum for a while now, but I cannot find a similar DIY BMS-project.

Does someone have a thread or just a schematic in mind that could help me out?


----------



## Siwastaja (Aug 1, 2012)

I have designed a very simplistic solution that uses distributed ATTiny25V microcontrollers with capacitively coupled digital daisy chain communication, on/off switchable voltage divider for the measurement and 20 mA balancing directly from an IO pin. The component count is 9 or 10 per cell, including the MCU, fuse, all resistors and capacitors and an LED. I'll try to build it in the next few weeks, we have a 90-cell Hobbyking-"LIPO" pack waiting. I have only tested the communication so far.

You should get the idea from this description...

Go distributed. It makes the design much more simple. It's always easier to shift or isolate a one-wire digital communication than analog voltage measurements.


----------



## Chuechco (Aug 18, 2012)

Siwastaja, I appreciate your help, but I think a completely distributed BMS won't work for me. I have a lifepo4 Headway pack. It gets difficult to connect sixteen single BMS-modules to them.
I will stick to my partly-split design. I lowered the amount of cells per module from 8 to 4 now however. It makes the design much simpler,

That's what I have so far:
http://imageshack.us/a/img4/7717/dgxv.png

I also changed the following:

-As I said, the board handles just 4 cells. So I can connect the voltages of the cells seperately to the atmega8. No need for an analog Multiplexer anymore. The balancing resistors are also controlled seperatley by an own digital I/O pin. Reduces error-possibilities. With the lower voltages, I think the error made by the amplifiers is lower at lower voltages, isn't it?
-I swapped the LM358 for a precision amplifier, the LTC272. Offset-Voltage is 1.1mV typically, as the datasheet says.
- I swapped the usual 7805 voltage regulator for LP2950. The quiescent current should be well below 1mA during operation.
- As Elithion mentioned, the voltage readings will be inaccurate due to the tolerance of the 7805. I now have a precise 2.5V voltage reference, the LM 4040 CIZ-2,5. Datasheet says +- 0.5%. It is activated by the Atmega8, just as the OpAmps. I connected the 2.5V to the reference pin of the atmega. This way, I had to change the resistor ration in the differential amplifier so that the atmega doesn't get any voltage higher than 2.5V.
-I got rid of a few LEDs to safe power
-I got away from the SPI, I will transmit the voltages via I2C. That's what the optocopplers are for.

What I couldn't improve in this design is that the board still loads the cells differently. I think I will not have any problem anyway. The current draw is still too low. I will simply disconnect the cells from the BMS if I won't be using the battery for a long time.

The board's dimensions are about 10cm * 6cm. Smaller than I thought.









I have a few questions:

During the winter the temperature will fall below 0° celsius. I considered this while choosing my electronic parts. When I looked for the amplifier, I found it hard to get a precise one that can be operated below 0°C and which is still affordable. Can I operate the LTC272 when it's below 0°C, although datasheet says i shouldn't? What will happen? Alternatives?

I know that motor controllers switch on and off the current of the battery during operation. So the cell voltages will go up and down, too. Is it neglectable or do I need low pass filters before the ADC to smooth out the waves?

My Headway pack will problably have a capacity of 20Ah, so two in paralell. I chose the resistor to give roughly 360mA of balancing current. Is that enough?



So that's it, I hope someone can answer.


----------



## Elithion (Oct 6, 2009)

> I now have a precise 2.5V voltage reference,

Too low to measure the V1 voltage, which is not attenuated. Either use a 4.096 V reference, or use a voltage divider on V1.

> What I couldn't improve in this design is that the board still loads the cells differently. 

Sure you can: size your resistors differently for each channel, and add a resistor across V1.

> When I looked for the amplifier, I found it hard to get a precise one that can be operated below 0°C and which is still affordable. 

MCP6L01UT , USD 0.30, -40°C ~ 125°C, 2 pA bias, 1 mV offset

You wouldn't need amplifiers if you followed Siwastaja's sugggestion.

> Can I operate the LTC272 

No such part exists. 

The TLC272 does exist, and comes in 0 C and -40 C versions. The -40 C version costs about 10 % more: well worth it, don't you think? Still both of them cost far more than the MCP6L01UT.

> when it's below 0°C, although datasheet says i shouldn't? 

> What will happen?

The offset will increase, though the manufacturer won't say by how much.

I suggest that you would save yourself a lot of time and avoid going down a less than ideal path by reading the BMS book.


----------



## Siwastaja (Aug 1, 2012)

Chuechco said:


> Siwastaja, I appreciate your help, but I think a completely distributed BMS won't work for me. I have a lifepo4 Headway pack. It gets difficult to connect sixteen single BMS-modules to them.


Nothing stops you from using electrically "distributed" design as larger physical modules. We use "RC LIPO" packs, these are 9-cell modules with a "balance" connector. So we have one PCB do 9 cells. We just copy the cell modules on the same PCB. The footprint of one cell module is approx. 1x2 cm so 9 modules take up about 5x5 cm including the connector.

Distribution here is to simply avoid the analog voltage level shifting and ADC multiplexing. This lowers component count and makes the BMS to behave identically to every cell -- or at least as identically as possible. The MCU also integrates the voltage reference and a temperature sensor.

And, then it's easy to go to a physically distributed (one PCB per cell) with the same design on large prismatic cells where it makes sense.

Just remember that when doing a centralized system, you really need to minimize the physical distance between the cells and the BMS and keep the wiring short. Wire spaghetti is to be avoided.

I'd just say your design is overly complex. You can do it that way but it's more expensive and more prone to errors.


----------



## PStechPaul (May 1, 2012)

Here are some other threads on BMS:

http://www.diyelectriccar.com/forum...ng-up-bms-monitoring-only-infrared-82772.html
http://www.diyelectriccar.com/forums/showthread.php/beginner-bms-question-87054.html
http://www.diyelectriccar.com/forums/showthread.php/battery-balancing-bms-holy-war-84252.html
http://www.diyelectriccar.com/forums/showthread.php/12v-sla-fla-bms-charger-design-87081.html
http://www.diyelectriccar.com/forums/showthread.php/looking-making-my-own-bms-85520.html
http://www.diyelectriccar.com/forums/showthread.php/cutting-off-charger-minibms-84438.html
http://www.diyelectriccar.com/forums/showthread.php/charge-shuttling-bms-chip-84090.html
http://www.diyelectriccar.com/forums/showthread.php/bms-design-guidelines-82646.html


----------



## Chuechco (Aug 18, 2012)

Ok guys,

I had some other things to do during the last few weeks. Now I come back to the BMS.
You concinved me to go distributed and to watch every single cell on its own using an Attiny uC.
Some are using Attiny25V, I intend to use Attiny44A. I get it cheaper and it does all I need, I think.
It still operates at 1.8V, it has a 1.1V bandgap voltage, 10bit ADC, Interrupts on pin changes...










To measure voltage, I don't need any voltage dividers. I set Vcc as voltage reference and with the Attiny44A, it is possible to select the internal 1.1V as the voltage to measure. A little math will tell me the Vcc(the cell voltage) accuratly. I might calibrate the bandgap voltage though for every uC.
Some of you added a shottky diode for reverse voltage protection. This wouldn't allow me to measure Vcc anymore because of the voltage drop.
I use a n-channel MOSfet instead as an ideal diode. The IRLML2502 has a gate threshold of 1.1V or so and a Rds(on) of 0.045mOhm. So the voltage drop is neglectible.
I use the same MOSfet for shunting.
Each module has a SMD fuse. Why are those fuses so expensive?

Regarding data transfer: 
My serial interface will be custom, one wire. I think I made it clever and fast:
There are two buses. One going through the capacitors, attiny by attiny... The other goes from each attiny directly to the masterboard via optocouplers.
I had this idea: The masterboard sends a short signal to the first attiny. This attiny then sends the 10Bit ADC value of the cell voltage through the optocoupler (6n136 are fast optocouplers). After that, the attiny sends a short signal to the next attiny via the capacitor. This one will send it's cell voltage through the optocouplers and so on...

Why a green LED? I have them laying around here. Voltage drop is 2.2V. My lifepo4 battery will be discharged to 2.5, no less. I will test how bright the LEDs will shine. I might change to RED LEDs with 1.8V voltage drop or so.


Did I forget something in the design? Does someone has experience with attiny BMS?


----------



## Chuechco (Aug 18, 2012)

Ah, the fuse should not be placed where the high current of the power resistor flows. This is a mistake of course.

Edit: I checked the current and the brightness of the green LED. It's good. At 2,5V supply and 100 current-restricting resistor, there is only a voltage drop of 2V on the LED, the current is 5mA. At 3.7V supply, which should be the maximum, the current is 15mA.


----------



## PStechPaul (May 1, 2012)

I'm not sure you really need the fuses, but I found some 100 mA 125 VDC SMT fuses for about $0.50 in 100 qty:
http://www.mouser.com/ProductDetail/Littelfuse/0466125NR/?qs=sGAEpiMZZMtxU2g%2f1juGqdRmCQF0%252bT4VnMnYhWXRvWo%3d

Or you could use 1A automotive fuses rated 32 VDC for about $0.20 each:
http://www.mouser.com/ProductDetail...=sGAEpiMZZMsh2y49K8ANrXgtX8Cl56UG1el2IeqaNSU=

Another idea is to use PTC circuit protection devices. Here is a 1.5-3.0 amp 20V device for less than $0.20 each:
http://www.mouser.com/ProductDetail...GAEpiMZZMsxR%2bBXi4wRUDSdQXJeZb9ObZ5zHmezIlI=

[edit]Adequate reverse voltage protection can be obtained with just a standard silicon diode across the input after the protection device. The greatest challenge is to protect against a cell open circuit, where the entire pack voltage will be imposed on the BMS. With, say, a 150V 100Ah pack pushing as much as 500A into an inductive load, all bets are off. The only hope would be that the condition can be detected quickly enough to open the main contactor. If each BMS unit had another optocoupler just for such catastrophic events, it may be able to act upon the condition if it occurs slowly enough. A large capacitor across each unit would help by slowing the voltage transient, but it would need to be able to hold the cell voltage to a safe level at the pack current for long enough to trip the contactor, which might be 30 mSec. So at 100A and, say, 12V, that would be about 100*12*0.03 = 36 watt-seconds. Since a capacitor's energy is 0.5*C*V^2, this would be 0.5F. It is possible to assemble a 0.47F 11V capacitor from 4 supercapacitors for a total of about $8 per cell. This would also give the battery pack some extra energy storage, but for 50 cells it would add only 1800 watt-seconds or 0.5 watt-hour.

I don't have experience with the ATTiny but I have used similar Microchip parts extensively. Your ATTiny44 is about $0.64 in 100 qty. The similar Microchip PIC12F1840 and the PIC16F1823 are about $1.

You might consider using a red and a green LED in series across the PIC power supply and connect the center tap to one of the I/O lines with like a 100-200 ohm resistor. If the battery voltage will be no greater than 3.8V it will not be enough to light them, but you can drive the I/O pin high or low for red or green, or a red/green flash. You can limit the overall current draw by using a low duty cycle flash.

I like the communication concept. It is essentially the same as that detailed in another thread about BMS design. My idea was to use one optocoupler per unit and have commands and responses passed on from each unit to the next. The 6N135 is rather costly at about $1. Consider the PS2561 which is only about $0.20:
http://www.mouser.com/ProductDetail...=sGAEpiMZZMteimceiIVCB3jXI8xWDSGFFqhoJHEM/aM=

It's not as fast but with 5 uSec max rise/fall it should be able to handle 57.6 kB and you really don't need super fast communication. For 50 units in a chain, a four byte command/data word might take 1 mSec and a complete send/receive would be in the order of 100 mSec. 

For my immediate needs I plan to make 12V SLA or FLA BMS units, which will use a voltage regulator for the PIC and a voltage divider for the measurement. I'd be interested in collaborating and maybe sharing the expense of the PCBs if you plan to make a quantity purchase. I have used www.pcbcart.com (in China) with great success and a board of this size would probably cost about $1.50 each for an order of 100 pieces (including tooling and shipping in 8 days). It might be possible to make the boards so they can be built for either version.


----------



## Chuechco (Aug 18, 2012)

I would also like to get rid of the fuse. Some here in the forum were using them in their BMS design, so I thought it might be a good idea to have one. However they are pricey.
Those PTC resettable fuses do not cost so much. What is their drawback? I have no experience with them, I need to google them to get some information.

Sorry, I did not understand what you are saying about the open-circuit protection. What is the problem you are talking about? 

The idea with the LED is good. I might consider adding a red one.

The 6n136 costs 0.53€, the Attiny44a 1.00€. 
I experimented with another optocoupler, the CYN17-1. It has a connection for the base of the output-transistor. I could get fast switching speeds by tweaking the base-resistor and the load-resistor. I think I will use the CYN17 in my design. It costs 0.32€.

I'm located in Germany, a collaboration would be difficult. This BMS will be for my electric bike with 16s headway cells. So I don't need many of the units.

I've read another thread about BMS. And I came across this design. I think it's yours, right?
http://enginuitysystems.com/files/BMS_NonOpto.pdf
You added some components I don't have in my design. Can you explain why you used them?
For example: 
You used a shottky diode for reverse voltage protection. After this, you have a 10 Ohm resistor going to VCC of the uC. What is this for? To reduce current consumption?
Why so high values for the LEDs? 1kOhm? Does the green LED still shine on 2.5V Vcc?
What are the shottky diodes for on the left?
Don't misunderstand me. I'm not criticizing you, I'm just curious.

Did you go on and made a PCB?

with regards,

Johannes


----------



## PStechPaul (May 1, 2012)

Yes, that was an early design idea, where I tried to use the very cheap PIC10F320 (about $0.50). You raised some good points about some of the components. The 10 ohm resistor to Vdd is just to reduce noise because the cell is very low impedance. Probably not necessary, but good design practice. However, it will make Vdd more sensitive to output current from the PIC. The 1k resistors should be 100 ohms. I'm not sure if the green LED will light on 2.5V, but the red one should. D2 and D3 were for reverse protection, but they also lower the supply voltage. 

The larger Schottky diodes D1 and D4 were to provide a path for current flow in the case of cell depletion and reversal, but they won't carry anywhere near the full pack current so they are not needed. C1, R7, and R8 are not really correct. I had thought I might use the PWM to generate a smooth DC voltage to the MOSFET to use it in linear mode and share dissipation with the shunt resistor, but it is better to use it in switching mode and the larger MOSFET costs much than than a larger resistor.

The communication in this case was to use one open collector NPN transistor on the lower module to turn on a PNP transistor on the upper module to send signals from a master module through all units and then back to the master with an optocoupler on the top (highest voltage) module. Transistors cost less than optocouplers and use less current, and can operate at very high speed.

I was trying to see just how much I could do with the limited I/O of the PIC10F320, which has only six active pins and thus only 3 GPIO pins and one (MCLR/Vpp) that can be used as an input. But something like the PIC12F1840 has a lot more capability for only about $0.50 more, and it might even be wise to go to the 14 pin PIC16F1823/4/5 which is still just a little more than a dollar. 

I have found that there are some important differences in the architecture of these PICs that make it difficult to program and port code from one to another, so it may be best to standardize on a higher-end PIC for most applications rather than cherry-picking for a slightly smaller footprint and lower component cost. I can buy a lot of PICs at a premium of $0.50 each for the cost of a couple of hours of coding and debugging, and I'm not considering quantities in the 1000+ where it will be significant. 

At this point I am concentrating my efforts on a lead-acid 12V BMS because that is what I will be using on my tractor projects where it has more advantages than disadvantages. There are also many off-the-shelf solutions for lithium BMS and it's hard to beat the cost and performance unless you have special requirements or plan to go into mass production with something that will appeal to DIYers.

This is what you're competing with:
http://www.ebay.com/itm/48V-60A-LiF...S-16x-3-2V-eBike-Battery-16x-3V-/321048911039

However, this does not have any communications ability and it requires long connections to the pack. It is about $3/cell, so it might still be viable to make something for twice the cost with the safety, convenience, and performance of a distributed system. The MiniBMS is about $14/module:
http://www.electriccarinternational...-management-system-lithium-car-ev-battery.php


----------



## Chuechco (Aug 18, 2012)

Thanks for the answer.

I already have some experience with electric vehicles. I once built an electric bicycle with lead-acid batteries. 36V 12Ah. I intended to use them for a 1000W motor, but this was not possible. Lead acid cannot give the current that is need for that power. So I changed to lithium.

Regarding to my design, I know that this will not be cheaper than buying one in China. I have been interested in electronics since two years. I am going to start study Electronics in one month. At the moment it is a hobby that keeps me happy. That's why I am doing this.

By the way, I need to communicate with the master board, because I have the plan to connect an LCD to the mainboard to give updates on charge voltage, cell voltages, current consumption...


----------



## Chuechco (Aug 18, 2012)

I worked on the mainboard today and made some progress.

The mainboard is equipped with an Atmega16. Right now it is capable of doing the following:
- Communication with the 16 attinys to receive all individual cell voltages
- Recognizing when charger is connected
- Enabling charging
- Measuring charging current
- Measuring total battery voltage
- Measuring battery current(in both directions, so that regen. current can also be measured)
- Measuring motor speed and therefore also vehicle speed
- Measure temperature
- LVC with buzzer
- SerialPeripheralInterface-connection for LCD

The heart is the Atmega16:








It has a precise crystal oscillator. I'm not sure about the frequency, 8Mhz could be enough. The atmega will be capable of calculating the battery state of charge by reading the battery voltage and current and multiplying it by time to get the Wh consumed. So the oscillator must be accurate.
Below are the connections. I will make an LCD module to display data like battery SOC, current, voltage... Basically everything what the atmega16 finds out will be displayed.
I plan to communicate with the attinys by using a custom one-wire-interface. I won't use the integrated TWI (I2C).

The power comes from a DC/DC Converter module that I already have. 








It is rated for up to 60V input voltage. The output voltage is adjustable by a small 10-turn potentiometer. It can handle up to 3A and 15W. I will connect lights on it and other stuff that needs 12V. 

The Charging: 








It looks a bit complicated. I don't really have a charger for 16s lifepo4. I only have a 900W DC power supply with up to 60V output voltage and 15A. The current can be regulated. Any power supply, that is delivering a higher voltage than the battery voltage is accepted by the BMS. The BMS can shut the charging current.
Charger+ is connected to Battery+ all the time.
To make sure the charging current is always flowing into the battery, not the other way around, you could use a powerful diode. I used two N-channel MOSfets acting as a low-voltage-drop diode and as a switch to stop charging.
The LM393 comparator checks whether the power supply is connected the right way around and is also putting out a higher voltage than the battery's voltage. This can be seen as the prerequisite for charging. The AVR controlls charging via the I/O-pin "CHARGE_ENABLE"
The AVR knows checks every few seconds wheter a charger has been connected. If it is connected the LM393 output goes from GND to no voltage(it has an open collector output). The atmega pulls CHARGE_ENABLE high for a short moment and both the npn and the pnp transistor will switch on, the gate of the MOSfets go high and via the voltage divider R3 and R28(converting 12V to 5V) the ATmega will know if a charger is connected.

The 10mOhm resistor is used to measure the charging current. On some ADC-ports, the ATmega16 has an integrated x10 and x200 gain, so I don't need any amplifier to do the job.

Battery current measurement:








The BMS will not have a shunt resistor on board. My controller has one. It is an infineon 12Fet controller modified by Lyen. (from endless-sphere forum). 60V and 45A. I am building an electric bicycle to remind you.
It has a 6-pin connector for the Cycle Analyst. The shunt is between the two pins SHUNT- and SHUNT+. The differential amplifier is connected so that the amplified voltage is offset 2V ground. This is important as I also want to measure negative current which would normalle result in negative output voltage on the amplifier. The 2V reference voltage does not need to be accurate. It is created by a voltage divider and a buffer. The 2V refrence is read by the ATmega also, so it knows exactly the voltage when 0A is flowing.
The amplifier needs a negative supply voltage, because the inputs will fall to less than 0V during regen.
I get the -5V from a charge pump.

Some miscellaneous circuitry:








The leds, the buzzer, the temperature sensor, the accurate 4V reference for the ADCs of the ATmega and the battery voltage divided so that the ADC can read it.
I haven't yet decided which IC to use for the 4V reference.

The design is not finished yet. Maybe someone can take a look at the schematics and say what mistakes I made.


----------



## PStechPaul (May 1, 2012)

I don't really understand what you are doing with the 10 mOhm shunt unless that is also what you are using for the SHUNT- and SHUNT+ for current measurement using IC4A. And the capacitor directly on the output of IC4 may cause problems. It would be more effective to put it in the inverting feedback loop pin 1 to 2, or use a resistor between pin 1 and C13. You might also consider using an instrumentation amplifier such as the AD620, INA118, INA126, or INA332.

It is generally good practice to add a resistor to the (+) input of IC2A rather than a direct GND connection, with a value similar to that at the (-) input. Also the zener D2 will allow a 0.6V level below GND when the charger is connected to the battery.

You show a 2V reference and a 4.5V reference.

There should be a capacitor across the B+ and B- terminals.

You probably don't need a separate clock oscillator for accuracy. You can usually get 20-50 PPM by using a good crystal with proper trimming capacitors.

The BJTs probably should have resistors from base-emitter.

The resistors to the microcontroller inputs might need to be lower value, and all the ADC inputs probably should have resistors and capacitors.

That's all I see, and some may be nit-picking. Better to be too critical than omit something.


----------

