How do we make our own rechargeable battery capacity gauge measuring it in mAh in 2-3% tolerance giving output to the simplest 4 digit LCD?
The first step is to be able to read the time from an external clock module in order to count the time of charge and the time of discharge.
Then you need to measure the current, both into the battery and out of the battery. Then compute the net current in and out and subtract that from the listed capacity of the battery.
You picked a tough project. What you are trying to do is called Coulomb Counting. There is a lot of information online about this listing the pitfalls but very little on the solution. Let us know how you do.
The charge discharge cycle is not 100% efficient- you put more mAh in than you can take out
You'll never get 2-3% tolerance in the real world for charge remaining. Aging, temperature changes and differing discharge/charge rates will all be more than 10% variations typically. Battery electrochemistry is complex and imperfect.
You can measure the charge accurately, but not predict the exact charge left in a
cell or battery, rough indications only.
For some cell chemistries the cell voltage is a useful guide to state of charge, more so than the charge history. For other chemistries the voltage is all but useless.
One problem is how to measure current if this has a large dynamic range - tricky.
The LTC3337 coulomb counter developed by Analog Devices measure the state-of-charge (SoH) of a primary (non-rechargeable) battery by assessing charge flow from the cell. Following is a link. It was published June 2, in electronic design.
And don’t forget discharge rate has an effect on capacity ;
( “power” = wrongly labelled here , really energy )
“ You may be wondering why it is that a battery provides more power when it runs longer, rather than less power. It would be natural to think that a battery running for 100 hours should provide fewer amp hours than a battery that only runs for five, because the battery must preserve power to make it last. The truth is that rapidly discharging batteries causes them to produce a lot of heat. This heat negatively affects the battery’s efficiency. Thus, when you rapidly discharge a battery with a C-5 rating, you are losing some of its available power just because the battery gets hot. Meanwhile, the C-100 battery is discharging at a much gentler pace and will be far more efficient.”
And should the remaining capacity % be the % of the current capacity of the battery (which will fall with use) or the % of the capacity when new ?