What is the correct way of measuring remaining battery capacity?

• Wrichik Basu
• Featured
In summary, a battery monitor measures voltage and amps to get watts. A solar panel can be hooked up directly to a lead acid battery without a charge controller.
Wrichik Basu
Gold Member
I was searching for a way to measure the remaining charge of a battery using Arduino. Most (almost all) of the tutorials are simply measuring the battery voltage using the ADC on the Arduino. The calculations are pretty straightforward after that — ##5 V## is mapped to ##1023## and ##0## is mapped to ##0## by the ADC. Thereafter, one can easily get the voltage at the terminals of the battery, which can be converted to a fraction of ##5 V##, and that gives the charge remaining in the battery.

I think this strategy is flawed from some aspects. First, one cannot directly use this method for batteries whose voltages are ##> 5 V## (one way to circumvent this is to use a voltage divider). Second, this method relies on the fact that the voltage of the battery will decrease as its charge decreases. But, there are batteries (LiPo, for instance) which have the capability to hold the voltage constant at its terminals even if its capacity decreases.

Is there any better method of measuring the remaining battery capacity that does not use the voltage at the terminals as a reference? (The solution does not have to use an Arduino.)

You must start with a nonlinear discharge curve similar to this one for a LIPO battery. Note that voltage versus discharge is nearly flat, not exactly flat.

WWGD, ohwilleke, Kelly23 and 2 others
Wrichik Basu said:
Is there any better method of measuring the remaining battery capacity that does not use the voltage at the terminals as a reference?
There are "battery fuel gauge" ICs that monitor the charge and discharge of a battery and can be read (via SPI or whatever interface) to get the current battery charge state.

shonuff, WWGD, DaveE and 1 other person
In general every chemical battery voltage is described by a Nernst equation - it shows how the voltage depends on concentrations of reacting species. While its direct application is rarely possible, and while most batteries use tricks to minimize the concentration changes, there is no practical way to completely avoid them and in effect there is no battery with a completely flat response.

ohwilleke, Wrichik Basu and berkeman
Borek said:
... there is no practical way to completely avoid them and in effect there is no battery with a completely flat response.
Useful information. Though it doesn't really address the OP's question directly, it will surely help to avert some obvious pitfalls in theoretical solutions.

Wrichik Basu
You have to have a basic idea of the voltage from what is considered discharged (which is not zero volts) and full voltage. Using op amps multiply and offset this range to 0-5 volts to be read by an A/D.

Wrichik Basu
Inverse problem to battery charging, no ? Without going into 'smart' load-sharing etc etc, the 'trick' was to nimbly navigate that load-curve, avert wasteful over-charging and scary over-heating...

For the little 2 Amp-hour lead acid battery on my boat, I wanted a simple charge indicator. Lead acid have the similar, flat, discharge characteristic as shown. You can cheaply buy an analogue voltmeter with markings showing "empty" or "full", and this is used with a Zener diode in series so that it reads "empty" at about 12 volts and "full" at about 13 volts. If using an ordinary milliameter for this task, you can also use a series resistor to set the max reading.

Wrichik Basu
tech99 said:
For the little 2 Amp-hour lead acid battery on my boat, I wanted a simple charge indicator.
I used to have a battery monitor on my boat. It measures volts and amps, to get watts, then it integrates watts versus time. But the owner enters the parameter how many watt hours is 100%. The monitor knows nothing about battery physics.

By the way, 2 Amp-hours lead acid? That must be wrong. Maybe 200?

ohwilleke and Wrichik Basu
This is a very small boat! 2 A-h is enough for an LED nav light and occasional bilge pump in rough weather.

tech99 said:
This is a very small boat! 2 A-h is enough for an LED nav light and occasional bilge pump in rough weather.
But lead acid? Not lithium? You are in the same range as 8 AAs.

Regardless of chemistry, they all say to measure the voltage after there has been zero current for 15 minutes. Charging or discharging can change the voltage. Many battery monitors do coulomb counting with you setting an arbitrary full condition and fudge in some numbers for self-discharge, temperature, and loss. I just went to lithium and the only thing I can tell is it is not dead from just the voltage. Looking at the current also gives a much better idea.

ohwilleke
anorlunda said:
But lead acid? Not lithium? You are in the same range as 8 AAs.
Lithium and Metal Hydride batteries require a special charger, whereas with lead acid I can hook the battery direct to a solar panel without a charge controller. This is more reliable and robust.

tech99 said:
whereas with lead acid I can hook the battery direct to a solar panel without a charge controller. This is more reliable and robust.
Yes, but be careful about overcharge. Lead acid batteries can tolerate a "trickle charge" current indefinitely. How much is that? About 1 amp for smaller sizes.

If the max voltage from the solar panel is 12V, then you're intrinsically protected from overcharge and there is no need for a charge indicator. On the other hand, charge controllers start at around $10. anorlunda said: Yes, but be careful about overcharge. Lead acid batteries can tolerate a "trickle charge" current indefinitely. How much is that? About 1 amp for smaller sizes. If the max voltage from the solar panel is 12V, then you're intrinsically protected from overcharge and there is no need for a charge indicator. On the other hand, charge controllers start at around$10.
I just use a very small panel so it can trickle indefinitely without a charge controller. I do enjoy this forum but otherwise I try to avoid digital electronics around me, except in the workplace, where I have to.

The voltage is the easiest way to estimate the capacity. That's why the tutorials do that. For voltages greater than VCC you can measure the fixed internal reference voltage (1.1V) with the battery voltage as the ADC reference. With batteries that have flattish discharge curves the estimate is less accurate. I use AA disposible lithiums sometimes and the voltage is pretty darn constant for a long time.

Coulomb counting chips provide a more sophisticated way to measure what has been used. But you'll still end up with an estimate because the actual battery capacity depends on current draw and temperature. If you're using rechargeable batteries then their history affects capacity.

Good luck! :-)

Wrichik Basu
I just got a 12V lithium battery and the manual said it can be connected directly to a solar panel. These batteries have an internal BMS which will disconnect it over a certain voltage or current. Devices you have connected to it may not like seeing 21V when the battery disconnects. All battery chemistries need a lot of care if you want to get a long life out of them. There is this phenonium where everything with a digital readout is considered the absolute truth. Battery monitors are certainly better than nothing, still just a guess. Who tests their battery to see what the real capacity is?

Opera said:
Who tests their battery to see what the real capacity is?
It is more a question of battery lifetime. When I lived on a boat, I used solar + batteries. I limited discharge to 40% of the advertised capacity. (60% remaining). But in a pinch, I might have been able to take out twice as much.

ohwilleke
Opera said:
Devices you have connected to it may not like seeing 21V when the battery disconnects.
You could use a 3-terminal series regulator to keep the load voltage below 12V.
The electronics distributors have the LM7812 for under US $2 in singles and Amazon has them at$7 for 20pcs. or $0.35 each. A potential problem would be keeping them cool at high input voltage with high load currents, but the solar cell impedance may help there. I "googled" on the query: "How does a cell phone measure state of charge ?" Uncle Google replied per this link. I would guess that any serious project aimed at measuring battery state of charge (SOC) will need one to write programs for something like Texas Instruments INA219 amps/volts/watts measuring chip. In https://www.researchgate.net/publication/342070965_Real_time_monitoring_state-of-charge_battery_using_internal_resistance_measurements_for_remote_applications/link/5ef293b792851cba7a45f730/download, the author proposes using the acquired data to determine internal resistance of the battery whereby SOC is determined from a lookup table. Wrichik Basu Please keep in mind that batteries are correctly tested under a substantial load for that battery. Car repair shops have a meter that draws a substantial percentage of current and then measures voltage. You cannot conclude that your battery is good by measuring voltage while drawing microamps by your test circuit. .Scott and Wrichik Basu KurtLudwig said: Please keep in mind that batteries are correctly tested under a substantial load for that battery. Car repair shops have a meter that draws a substantial percentage of current and then measures voltage. You cannot conclude that your battery is good by measuring voltage while drawing microamps by your test circuit. The INA219 has a built in shunt resistor ##(0.1 \Omega)## which limits current measurement to about 3.2 amps. But that can be replaced with a much lower value resistor enabling much higher currents to be measured. I have in mind a project for monitoring DC current draw from 2 large gel batteries (in parallel) driving an inverter. Here I will need to measure about 60 amps. Wrichik Basu neilparker62 said: I have in mind a project for monitoring DC current draw from 2 large gel batteries (in parallel) driving an inverter. Then you are trying to reinvent a battery monitor similar to those listed in #9, correct? The monitor illustrated in #9 lists for less than$19 on Amazon. So you won't save money. Perhaps you are looking for the learning experience of a DIY project

anorlunda said:
Then you are trying to reinvent a battery monitor similar to those listed in #9, correct?

The monitor illustrated in #9 lists for less than \$19 on Amazon. So you won't save money. Perhaps you are looking for the learning experience of a DIY project
Yes I'm interested in doing this as a DIY project. All the same if I may ask what's the maximum amps measurable by the monitor you mention in post #9 ? For a very high current range there's this:

https://www.victronenergy.com/battery-monitors/smart-battery-shunt

but it's pretty expensive. I would guess it uses INA219.

neilparker62 said:
Yes I'm interested in doing this as a DIY project. All the same if I may ask what's the maximum amps measurable by the monitor you mention in post #9 ? For a very high current range there's this:

https://www.victronenergy.com/battery-monitors/smart-battery-shunt

but it's pretty expensive. I would guess it uses INA219.
The description says:

bayite DC 6.5-100V 0-100A LCD Display Digital Current Voltage Power Energy Meter Multimeter Ammeter Voltmeter with 100A Current Shunt​

anorlunda said:
The description says:

bayite DC 6.5-100V 0-100A LCD Display Digital Current Voltage Power Energy Meter Multimeter Ammeter Voltmeter with 100A Current Shunt​

Cool - might buy one. But good to get to grips with programming INA219 anyway I think.

Along with synced household clocks and instant-on hot water - accurate battery indicators are among the set of things that really ought not be still a thing in the 21st century.

Wrichik Basu and Averagesupernova
DaveC426913 said:
Along with synced household clocks and instant-on hot water - accurate battery indicators are among the set of things that really ought not be still a thing in the 21st century.
Wow. That's pretty insightful, I think. But you could elaborate.

anorlunda said:
Wow. That's pretty insightful, I think. But you could elaborate.
When I think of all the cool things the 21st century brought to us - I mean, we're living in the future for Pete's Sake! **

And yet every clock in my house tells a different time. I have to run the tap for a minute just to get warm water. I have a mountain of suspect batteries that may or may not still be usable. These just feel like they should be "soo last century".

** George Jetson was born last Sunday.

Wrichik Basu and anorlunda
A major issue here is the definition of a discharged or uncharged battery. ... And I am really surprised at the way that battery discharge is being described now compared to how it was described 30 years ago.

Traditionally, batteries were considered "discharged" when they could not longer power the device they were powering. So whether a battery is "discharged" or "fully discharged" isn't exclusively depended on the internal battery state - the load it is expected to support is also part of the "discharge" condition.

Playing with Google for a few minutes hasn't turned up that definition for me - but it use to be topic one in any discussion of battery life or battery charge condition. Certainly part of this change reflects that modern rechargeable batteries are often used in devices with very wide load ranges. If you're running GPS apps on you cell phone, the battery drain and the discharge point will both be higher than if you only are playing sudoku.

Still, if you are expecting your device to continue functioning until your battery meter goes to zero, don't expect any off-the-shelf solution to work. You will need to match your meter to your whole device - not just the battery.

Last edited:
Wrichik Basu
There are also methods based on measuring the AC impedance of the batery. The AC impedance relates to the state of charge while the frequency where the impedance is measured is still a degree of freedom.

What is the correct way of measuring remaining battery capacity?

The correct way of measuring remaining battery capacity is by using a battery tester or a multimeter. These devices can accurately measure the voltage and current of the battery, which can then be used to calculate the remaining capacity.

Why is it important to measure remaining battery capacity?

Measuring remaining battery capacity is important because it allows us to know how much power is left in the battery and when it needs to be recharged. This information is crucial for devices that rely on batteries, such as smartphones, laptops, and other electronic devices.

What factors can affect the accuracy of measuring remaining battery capacity?

The accuracy of measuring remaining battery capacity can be affected by various factors, such as temperature, age of the battery, and the type of battery. Extreme temperatures can affect the chemical reactions inside the battery, leading to inaccurate readings. Older batteries may also have reduced capacity, which can affect the accuracy of measurements.

Can I use my device's battery indicator to measure remaining battery capacity?

While most devices have a battery indicator that shows the remaining battery life, it is not always the most accurate way to measure remaining battery capacity. These indicators are based on estimates and can be affected by various factors, such as usage patterns and battery health.

How often should I measure the remaining battery capacity?

The frequency of measuring remaining battery capacity depends on your usage and the type of battery. For devices that are used frequently, it is recommended to measure the remaining capacity at least once a week. For devices that are used less frequently, it is recommended to measure the remaining capacity every few months.

Replies
11
Views
834
Replies
8
Views
2K
Replies
2
Views
1K
Replies
4
Views
101
Replies
7
Views
1K
Replies
8
Views
1K
Replies
7
Views
2K
Replies
8
Views
1K
Replies
14
Views
5K
Replies
10
Views
1K