Greetings. This instructable lists a charging lithium cell capacity. Other testers I've found work by discharging the cell completely, but I wanted to have ready to use cells with a standarized voltage. The monitor works by Ohm's Law, and measures voltage across a shunt resistor to infer flowing current. The project can be simplified to 4 main blocks:
Low Dropout Regulator: Charges the battery with a constant current until 4.1V, then changes to constant voltage mode until current drops bellow 10% of reference value. Why? Lithium-ion cells are sensible, and a bad control may result in reduced cell life or even a flame hazard.
Shunt resistor: offers a small voltage drop proportional to flowing current, as of V=R*I. Low values of R will incur in smaller voltage readings, and to easily measure it we will need a larger gain on our next block. Can be either High-side (near voltage supply) or Low-side (grounded). On this set-up, I'll use a High-side 200mOhm shunt resistor.
Instrumentation amplifier: Our measure block, whose function is to amplify the shunt resistor voltage to a readable level. On this set-up, I've used an off the shelf LM324 (low offset quad input operational amplifier), and setted it to a gain of 10. This way, I get 2V output for a flowing current of 1A on the input. A better option would be a Maxim MAX4208 or MAX4209, if you have access to these components.
Arduino: Used as data logger. I've added a simple to read code to sum the current reads over time to calculate cell capacity
TP4056 charging module or proper circuit
Shunt resistor with value between 0.01 and 0.5, any one you could get. This inst uses 5 of 1ohm in parallel.
Other resistors: 10k, 100k, 2 pair of equal value resistors (precision recomended) 2x 50k and 2x 4.7k used.
IC: LM324 or LM322 or any dual/quad channel operational amplifier with lowest offset possible (MAX4208 recommended)
ATX power supply (This circuit uses +5V, +12V and -12V because I designed it with what I had laying around. Should you have some expertise, a 5V 1A power suply will do)
Arduino (any model)
Breadboard or PCB material
Optional: LCD display
Step 1: Charging Circuit
For didactical reasons, I've chosen easy access components in two versions. The first one uses a TP4056 Li-ion charging module, ready to use, and the other is a low dropout regulator with limited current.
TP4056: Really cheap charging module (goes for about US$2,00) and easy to use, close to plug&play. Works by providing a constant charging current to the cell if under 4.1V output, then as a constant voltage source when Vo>=4.1V, untill the output current goes bellow 10% of setted charging current. Usually has a 1.2kOhm set resistor that limits its output to 1A. Recomended setup.
LDO regulator: same idea as before, but with discret components. You may use an LM328 or one of the spare outputs of the LM324 (in this case, just remember to adjust limiting resistors). Downside: discret, perhaps more costly than a ready module and a certain expertise needed to adjust values.
Why an LDO or dedicated charger? Lithium-ion cells can be DC modelled as a high value capacitor in series with a low value resistor (as in this model, 2000F and 100mOhm, respectively). If you apply a constant voltage, the only limiting factor will be internal resistance, and you get a really high current. High current leads to heating by Joule effect, equals to R*I². We want to avoid this before 4.1V. When the cell reaches 4.1V, it actualy has a lower open circuit voltage due to a voltage drop on the internal resistor. We can keep charging it with a decreasing exponential current (see added graph on circuit) untill it reaches its full charge.
Step 2: Shunt Resistor
This resistor should be as low as possible, to minimize power loss and voltage drop beffore the regulator. A smaller shunt leads to smaller voltage reading, so we adjust the gain of the amplifier occordingly.
On this exemple, I only had 1Ohm resistors laying around. My voltage supply is 5V, and this resistor would dissipate 1W and drop 1V or my regulator at 1A, going bellow operating voltage (4.5V minimum). So I put 5 of them in parallel to reduce to 200mOhm equivalent, leading to 200mV drop and 200mW power loss (yay).
The ideal setup uses a 10mΩ (0.01Ω) or 100mΩ (0.1Ω)
Step 3: DC Gain Block
A DC gain block works by multiplying a voltage value to a higher one (usually). My circuit reads the voltage over the charging circuit, subtracts from the input voltage (as reference) to get voltage drop over the shunt, then multyplies by a factor of 10. This way, for a 1A charging current, I have 200mV voltage drop as input and 2V output.
If you use an Instrumentation Amplifier, just put V+ and V- connected to the shunt and adjust gain.
Why low offset: DC offset appers when the inputs of our amplifier aren't perfect copies on the silicon chip. The higher our circuit gain, the higher the error added to our output. Our typical amplifier, LM741 (yeah, I love Texas Instruments) has a max input offset voltage of 5mV. Seems low, but on a 10mV reading this is a 50% added error.
The lower your shunt resistor, the worse your added error will be. Using an LM324 (typical offset 2mV) and a 200mΩ shunt (200mV @1A) we can say it does matter, but only adds a 10% measure error.
Step 4: Data Logging
A simple voltage reader on our arduino, paired with our computer or an LCD display can get your log done.
A battery capacity is expressed in mAh (milli Ampere hour). To get this value, we will read our instant current every second, and add it to our last values, getting a mAs reading. We then divide it by 3600 to converto to mAh. Example:
sense is our read data, wich I've multiplyed by 2.35 to normalize it to mA. capAs is our accumulated charge, in milliAmps second. To avoid overflow, everytime capAs goes over 3600 I subtract 3600 from it and add 1 to capAh.
Since we are storing our data on a float, we could leave it just as is, but I've chosen no to.
Step 5: Board Layout
You could just assemble it on a protoboard. I intend to keep using this circuit to catalog dozens of cells, so I made a board using diptrace.
Rs1 to Rs5: 1ohm
R3, R4: 4.7k
R5, R6: 50k
R3 and R4 can be any value, as long as they are equal. Same goes to R5 and R6. Precision resistors are recomended. Shunt resistor should be precision if you are using just one. In case of 5-10 parallel resistors, they can be normal ones, because deviation decreases significantly (insert big long boring proof here)
C1 and C2 are just bypass capacitors to avoid noise on the amplifier
H1 is my DC power supply, H2 is my Cell output and H3 is the amplifier output. In case you want to add a voltage monitor, simply duplicate H2 or attach a wire.
Step 6: Conclusions and Future Updates
This circuit achieves a certain degree of confiability, enough for our common use.
For the next version, I'll switch amplifiers to a rail-to-rail operational amplifier to avoid simetrical 12V supply, allowing a single USB charger to power the circuit
Big thanks goes to all the teachers and professors that taught me circuits, the annonymous people that teach circuits online, the chinese for selling a so cheap charger, and you for reading :D
Extra thanks goes to deba168, because his instructable inspired me on publish my results