Since LiPo batteries are potentially dangerous, they can not be just put into garbage. They have to be properly handled, utilized, before they can be safely thrown out. I will write more on this topic later. Here is only a picture of my magical LiPo tree. Knife, electrical connector, 12V halogen lightbulb, some sand, a flowerpot and LiPo discharger ready.
Battery capacity measurement can be useful in many situations. And it is not hard, only requires enough time to discharge battery completely with know resistance and a way to measure voltage in the circuit. Ohm’s law will to the rest:
I = U / R
Let’s say, we want to measure standard AA 1.5V alkaline battery capacity. Why 1.5V? They are common, made by many manufacturers and sold for different prices. And not always more expensive is better. To do this, we will need:
- AA 1.5V battery
- resistor to discharge it. We need high current to discharge battery in reasonable time, so low resistance is suggested. On the other hand, high current means o lot of heat, so we need a resistor that can survive this. I suggest using 2.2Ohm 5W ceramic resistors.
- Arduino to measure voltage in circuit. Any Arduino or plain ATmega or ATtiny with A/D converter will do.
So, first a simple electrical circuit:
And some code that will be run every second:
voltage = 5.0 * ((float) analogRead(V_METER)) / 1024.0; float current = voltage / R_LOAD; joules += voltage * current; float wattHours = (joules / 3600.0) * 1000.0;
And here how it work:
- We need to measure voltage in circuit. This is why, in first step, we read 10bit A/D converter and scale output to 5V. Why 5V? Arduino Uno works on 5V, and it is the reference voltage here,
- Next, lets compute current using Ohm’s law
I = U/R,
- With know current current we can compute work using
P = U * Iand store it in joules variable,
- Last step is to change joules to Watt hours.
If instead of Watt hours we want Ampere hours, there is no need to count joules. Instead of that, sum current and final value divide by 3600 (there are 3600 seconds in one hour). Like this:
voltage = 5.0 * ((float) analogRead(V_METER)) / 1024.0; float current = voltage / R_LOAD; ampereSeconds += current; float ampereHours = ampereSeconds / 3600.0;
Full code is available here
- this circuit allows to measure batteries with voltage up to 5V. Anything above it will damage A/D converter
- to measure higher voltages, voltage divider will be required
- with higher voltage, power loss on resistor will increase. It will get very hot and might burn
It is true what internet writes: LiPo batteries can be dangerous. This is how ended one of my buddy’s batteries during indoor FPV session. Small crash, 2 seconds later cloud of white smoke and flames.
Reason was pretty simple. During crash battery got loose and still spinning propeller has cut 2 cells. Good thing, besides dead LiPo, no damage. We were lucky enough to get that thing outside before it damaged quadcopter or got anything else on fire.