# Calculating battery percentage after voltage drops

I would like to display a battery percentage based on the remaining charge in the battery. I do not know if there is a better way of doing it other than measuring the voltage across the batteries.

How do i accommodate the sudden voltage drop of loads that are switched on. For example assuming a single lipo battery with a 100% at 4.2 volts and a 0% at 3.5volts. With the logic circuits total resistance, the voltage will drop a little bit by lets say 0.05 volts, which is then read i can display the battery is at 94%. seems straight forward. Now if we add lets say a high power motor and upon turning it on (lets ignore the voltage drop over time) the battery voltage will drop by lets say 0.25 volts(due to added resistance) which mean that my microcontroller will read 3.95 volts or 64% (assuming linear voltage curve which is NEVER the case in batteries). But if we turned the motor back to off the voltage drop of the battery will go back to only 0.05 so i have to display 94% again.

I do not like displaying battery percentage that is going up and down, it will lead to confusion. Also i know that proper battery indicators do not go up and down, so i can conclude that there is something they have done to accommodate switched loads.

• Measuring voltage is one of the least accurate ways of assessing the state of charge (SOC), particularly with Lithium cells. ESR is slightly better, but coulomb counting is the only really accurate way. Battery management ICs can help you with this. – Cristobol Polychronopolis Jan 20 '20 at 21:29
• I see, so i should ditch the resistors and opt for a coulomb counting IC. I will to to look for a basic one. Reading on a coulomb counting ic' so far i see it being good when you know the charge of the battery initialy, i do not see how it handles battery that are not fully charged. like if the battery is plugged in 50% charge left i should be able to display 50%(or something close) too – Jake quin Jan 20 '20 at 21:44
• @Jakequin You would need to discharge the battery to a state that you are willing to define as "empty" and then charge it up to a state you are willing to define as "full" with the coloumb counting keep tracking of everything the entire time. That's why they are usually for system with a permanent battery or on a board mounted to the battery. It won't be able to immediately ascertain the charge of some random battery. Unlike a gas tank, obtaining battery state of charge is a pain. – DKNguyen Jan 20 '20 at 22:01
• @DKNguyen the circuit has no onboard charging, and is the battery is ment to be replacable. my application demands that when the battery is drained it can be replaced quickly and continue on. I now understand why videos phone battery manufacturing process always involves a last step of power cycling the battery. It would seem that coulomb counting does not fit the application what would be the next best thing? – Jake quin Jan 20 '20 at 22:08
• @Jakequin I don't know if there is a solution. Better battery chemistries (like lithium-based chemistries) are characterized by a discharge curve where voltage remains relatively constant as the battery drains which is directly counterproductive for trying to measure voltage to determine state of charge. I didn't realize they power cycled smartphone batteries. I thought they assembled the battery materials so it starts with some state of charge and just program that initial point into the firmware. – DKNguyen Jan 20 '20 at 22:09