Battery life: how long will it run?
Battery life is the usable capacity divided by the average current. The arithmetic is easy; the two things people get wrong are the average (a sensor node that bursts to 80 mA for two seconds and sleeps at 20 µA has an average nowhere near 80 mA) and the usable part of the rating (you never get all of it). This calculator does both, adds the battery's self-discharge, and tells you how many batteries a target runtime needs.
How to use the battery life calculator
- Pick a battery from the list to fill in a typical capacity, voltage, usable share and self-discharge, then correct the capacity to the one on your cell (in mAh).
- Type the load current in mA. For a circuit that sleeps, add how long it is awake and how often (2s and 5min) and the sleep current (20uA); leave those blank for a steady load.
- Optional: a target runtime (30d, 1h, 365d) gives the capacity you would need and how many of this battery that is.
- The drawing shows the battery with its usable share, the load's pulse, the runtime on a ruler from an hour to ten years, and where the drain goes. The What-if table varies the sleep current and the wake-up period (or the battery, for a steady load).
The formula
t (hours) = C (mAh) × usable / I̅ (mA)
A milliamp-hour is a milliamp for an hour: a 2500 mAh cell gives 25 mA for 100 hours, or 250 mA for 10, in a perfect world. The world is not perfect, hence the usable share; and the current must be the true average, including everything that draws from the battery, not just the chip.
Pulsed loads: the average is what counts
I̅ = (Ion ton + Isleep (T − ton)) / T
A microcontroller that wakes every five minutes for two seconds is awake 0.67% of the time. At 80 mA awake and 20 µA asleep the average is about 0.55 mA, so the battery sees a quarter of a milliamp-hour per wake-up and a trickle between. Two consequences: the sleep current often matters more than the active current, and waking less often is the cheapest saving of all. Measure the sleep current with a meter; regulators, pull-up resistors, LEDs and leaky capacitors add to the data-sheet figure, often by more than the chip itself.
Usable capacity
The rating is measured at a slow, steady discharge all the way down to a cut-off voltage your circuit may not tolerate. An alkaline AA rated 2500 mAh at 25 mA gives perhaps 1500 mAh at 250 mA and 800 mAh at 500 mA; a lead-acid battery should not be taken below half charge if it is to last; a lithium cell with a protection circuit stops at 3 V. The usable share (80–90% for most chemistries at modest current, 50% for lead-acid) is a simple way to keep that in hand. Cold cuts further: at 0 °C expect 20–50% less from alkaline and lead-acid.
Self-discharge
Every battery slowly discharges itself. Alkaline and lithium primaries lose a fraction of a percent a month and keep for ten years; low-self-discharge NiMH about 2%; Li-ion 2–3%; plain NiMH 15–20%, which can beat the load entirely. The calculator turns the monthly rate into an equivalent current, capacity × rate / 730 hours, and adds it to the drain. For a node meant to run for years it is the self-discharge, not the microamps, that sets the limit.
Common batteries
| Battery | Capacity | Voltage | Usable | Self-discharge |
|---|---|---|---|---|
| Alkaline AA | 2500 mAh | 1.5 V | 80% | 0.3% / month |
| Alkaline AAA | 1000 mAh | 1.5 V | 80% | 0.3% / month |
| Alkaline 9 V | 550 mAh | 9 V | 75% | 0.3% / month |
| NiMH AA (low self-discharge) | 2000 mAh | 1.2 V | 85% | 2% / month |
| Li-ion 18650 | 3000 mAh | 3.7 V | 90% | 2% / month |
| LiPo 1000 mAh | 1000 mAh | 3.7 V | 90% | 2% / month |
| LiFePO4 18650 | 1500 mAh | 3.2 V | 90% | 2% / month |
| CR2032 coin cell | 220 mAh | 3 V | 80% | 1% / month |
| Lead-acid 7 Ah (12 V) | 7000 mAh | 12 V | 50% | 4% / month |
Your battery, step by step
- Average load: (80 mA × 2 s + 20 µA × 4.97 min) / 5 min = 553 µA.
- Self-discharge: 2500 mAh × 0.3% / 730.5 h = 10.3 µA; total drain 563 µA.
- Usable: 2500 mAh × 80% = 2000 mAh.
- Runtime: 2000 mAh / 563 µA = 4.9 months (3,549 h).
Worked example: an ESP32 sensor node on two AA cells
Two alkaline AA cells in series (2500 mAh, 3 V) feed a node that wakes for 2 s every 5 min, drawing 80 mA while awake and 20 µA asleep. The average is (80 mA × 2 s + 20 µA × 298 s) / 300 s = 553 µA. Self-discharge at 0.3% a month adds 10.3 µA, for 563 µA in all. With 80% of the rating usable, 2000 mAh / 563 µA = 4.9 months. Waking every 15 minutes instead would give 13.2 months; a 200 µA sleep current (a linear regulator left on) would cut it to 3.7 months.
Questions
Do cells in series add capacity?
No: two AA cells in series give 3 V at 2500 mAh, not 5000 mAh. In parallel they give 1.5 V at 5000 mAh. Watt-hours add either way.
Why does my battery last less than calculated?
The sleep current is almost always higher than the data sheet (regulators, pull-ups, a status LED), the cut-off voltage of the circuit is higher than the rating's, pulses cost extra through internal resistance, and it is colder than 25 °C. Measure the current and allow a margin.
Does a boost converter change the runtime?
Yes: it draws more current from the battery than it delivers, by the voltage ratio over the efficiency. A 5 V 50 mA load through an 85% boost from a 3.7 V cell draws about 80 mA from the cell. Enter the battery-side current.
What about a 9 V battery for a microcontroller?
A 9 V alkaline holds only about 550 mAh, and a linear regulator throws most of the 9 V away as heat: an always-on Arduino lasts about half a day. Three AA cells hold five times the energy.