# How can I calculate remaining battery life time with arduino [closed]

I want to display a 3.7V battery's remaining life time on LCD screen using arduino. Like a laptop does. 1h 23m remaining or others. Do I need any kind of module to measure the thing? Can anyone tell the method please?

you may use ADC(analogRead) to measure Li-Ion Cell voltage. unlike Ni-Cd or Ni-Mh batteries, a Li-Ion Cell Voltage is a good measure for battery status. the discharge cycle of an usual Li-Ion cell Starts at 4.2v(full charged, better avoid that!) which quickly comes down to 3.7v. it remains about 3.7 volts most of the cycle and at the end, comes down again to about 2v which battery protector circuit cuts battery off circuit.

but if the Arduino itself is powered from li-ion battery, it can't measure the battery voltage as the ADC Reference is the current varying cell voltage itself. in this case you need to set VREF of Arduino to a lower internal constant reference(1.1v):

https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/

and implement a voltage divider

simulate this circuit – Schematic created using CircuitLab

now you can measure cell voltage compared to a fixed reference. a full battery of 4.2 will be read in ADC as about 1000 (4.2* (1/1+3.3) * 1024). 3.7 should be read about 880 and 2.2v (if the Arduino is still ON!) will be read 500 in ADC unit.

• Note that the discharge curve of a lithium battery isn't linear. So you'd have to do some additional math to convert the battery voltage to a percentage-of-charge. Also, don't discharge a battery to as low as 2.2V, as that will degrade the battery. Sep 13 '18 at 9:35
• but sir this is the method for getting the battery voltage I guess... I need to print the remaining time of the battery life... Sep 20 '18 at 15:12
• @Shojib the cell voltage for "Lithium" cells is a good representation of the battery status.(unlike NiMH) many applications like mobile phones use this method of calculation. Sep 20 '18 at 16:21