Battery Life Calculator — mAh to Hours Formula & Runtime Estimator
This battery life calculator estimates how many hours, days, or weeks your device will run on a given battery capacity. Useful for Arduino, ESP32, IoT sensors, and any portable electronics project.
How to Calculate Battery Life
Battery capacity is measured in milliampere-hours (mAh) or ampere-hours (Ah). A 2000 mAh battery can theoretically deliver:
- 2000 mA for 1 hour, or
- 1000 mA for 2 hours, or
- 100 mA for 20 hours
In practice, batteries lose capacity due to internal resistance, temperature, and discharge rate effects. A real-world efficiency factor accounts for this.
Battery Life Formula
Where:
- Capacity — rated battery capacity in mAh
- Current draw — average current consumed by the device in mA
- η (efficiency factor):
- 0.70 — alkaline batteries (conservative, recommended for design)
- 0.80–0.85 — Li-ion / LiPo cells at room temperature
- 0.90+ — high-quality LiPo cells with good BMS
Step-by-Step Example
Project: IoT temperature sensor (Arduino + ESP32 in light sleep), powered by an 18650 Li-ion cell (2600 mAh). Average current draw: 45 mA. Efficiency factor: 0.80.
The sensor runs for about 1.9 days before recharging.
Current Draw Reference for Common Devices
| Device / Mode | Typical Current |
|---|---|
| Arduino Uno (active) | 40–50 mA |
| Arduino Uno (sleep) | ~6 mA |
| ESP32 (WiFi active) | 80–240 mA |
| ESP32 (light sleep) | ~0.8 mA |
| ESP32 (deep sleep) | ~10 µA |
| Raspberry Pi Zero 2W | 100–350 mA |
| HC-SR04 ultrasonic | ~15 mA |
| DHT11 sensor | ~2.5 mA |
| SG90 servo (idle) | ~6 mA |
| LED (standard) | 10–20 mA |
| 4G/LTE module (transmit) | 500–2000 mA |
How to Extend Battery Life
The biggest gains come from reducing average current draw, not from using larger batteries:
- Deep sleep — ESP32 drops from 80 mA to 10 µA in deep sleep. With a 5-minute wake cycle, average current ≈ 0.03 mA → battery life from hours to months.
- Duty cycling — Power sensors only when measuring. A DHT11 measuring once per minute uses 0.004 mA average vs. 2.5 mA continuous.
- Lower clock speed — Halving CPU frequency roughly halves dynamic power consumption.
- Switch regulators — LDO regulators (like LM7805) waste input-output voltage as heat. Buck converters (like LM2596) are 85–95% efficient.
- Remove LEDs — Indicator LEDs draw 10–20 mA constantly. For field devices, disable them.
Battery Types Comparison
| Type | Energy Density | Rechargeable | Best For |
|---|---|---|---|
| Alkaline AA | ~2500–3000 mAh | ❌ | Low-drain devices, disposable |
| NiMH AA | ~2000–2800 mAh | ✅ | Medium drain, rechargeable |
| 18650 Li-ion | ~2500–3500 mAh | ✅ | High drain, compact projects |
| LiPo (flat) | ~100–10000 mAh | ✅ | Drones, wearables, slim devices |
| LiFePO4 | ~1500–3000 mAh | ✅ | Long cycle life, safer chemistry |
| 9V alkaline | ~565 mAh | ❌ | Low-power only (misleading "big" appearance) |
9V batteries are often a poor choice for Arduino projects. Their actual mAh is low (~565 mAh), the LDO on the Arduino wastes voltage as heat, and effective runtime is much shorter than a single AA battery.
Frequently Asked Questions
How do I measure the actual current draw of my device?
Use a multimeter in series with the power supply — set it to mA or µA range. For accurate average current on duty-cycled devices, use a Nordic PPK2 (Power Profiler Kit) or a μCurrent adapter with a scope.
What is the Peukert effect?
At high discharge rates, batteries deliver less total energy than their rated capacity suggests. A battery rated at 2000 mAh at a 0.2C rate (400 mA) may only deliver 1700 mAh at a 1C rate (2000 mA). The efficiency factor η in the formula partially accounts for this.
Does cold temperature affect battery life?
Yes significantly. Li-ion capacity can drop 20–40% at 0°C and 50%+ at −20°C. Alkaline batteries are worse — they can lose 75% capacity at freezing temperatures. For cold environments, insulate the battery or use LiFePO4 chemistry, which is more temperature-stable.
How many mAh does an 18650 cell actually have?
Quality cells (Samsung, LG, Panasonic/Sanyo) deliver 2500–3500 mAh. Cheap unbranded cells claiming 9800 mAh are counterfeit — typically contain 800–1200 mAh actual capacity. Stick to name-brand cells from reputable suppliers.