Battery life calculator
Battery life in hours is the usable capacity divided by the average current: hours = mAh × usable share ÷ mA. A 2,000 mAh battery at 80% usable powering a 100 mA load lasts 2,000 × 0.8 ÷ 100 = 16 hours.
hours = mAh × usable ÷ mAaverage mA = active × share + sleep × (1 − share)| Battery life | 16.0 hours |
|---|---|
| Average current | 100 mA |
| Energy in the battery | 7.40 Wh |
Worked example
An ESP32 sensor on a 2,000 mAh Li-ion cell draws 100 mA for 2% of the time and 0.15 mA asleep. Its average is 100 × 0.02 + 0.15 × 0.98 = 2.15 mA, so the battery lasts 2,000 × 0.8 ÷ 2.147 = 745 hours, about a month. Awake all the time it would last 16 hours.
Questions
Why not use the full mAh rating?
A battery delivers less than its rating at high current, in the cold and as it ages, and devices stop before it is fully empty. 70 to 85% is a realistic share; use the lower end for alkaline cells at high current.
How do I find my project's current?
Measure it with a multimeter in series with the battery, or add up the datasheet currents. Microcontrollers draw far less asleep than awake, which is why the sleep inputs matter.
What is mAh?
Milliamp-hours: a 2,000 mAh battery can supply 2,000 mA for one hour, or 100 mA for 20 hours, before allowing for the usable share.
Does voltage matter?
For runtime from mAh, only the current counts. The voltage gives the energy in watt-hours (mAh × V ÷ 1,000), which matters when comparing batteries of different voltages or using a regulator.
More calculators
- Resistor color code calculator
- LED resistor calculator
- Voltage divider calculator
- RC time constant calculator
- Ohm's law calculator
- Series and parallel resistor calculator
- Transistor base resistor calculator
- 555 timer calculator (astable)
- PCB trace width calculator
- RC filter calculator (low-pass)
- Capacitor code calculator
Want a whole circuit rather than one value? Describe it and the AI designs and simulates it.