What the calculator does
A battery-powered device spends nearly all of its life asleep and a small fraction of it awake: measuring, thinking and sending. Its battery life is fixed by one number, the average current, which is the sleep floor that runs all the time plus the short bursts weighted by how often they happen, plus what the regulator wastes and what the battery loses to itself on the shelf. The calculator turns those pieces into one average current in milliamps and divides the usable capacity by it.
It also shows where the charge goes, split among the sleep floor, the active time, the transmit time and the self-discharge, and it tries two changes for you, doubling the events per hour and halving the sleep current, because those are the two levers a designer usually has. It is the arithmetic for a LoRa or NB-IoT sensor node, a GPS tracker, a wireless switch, a data logger on a tube well, or anything else that has to run for months on a cell.
Formula
Events per hour Qevents = n × q (mAh/h) Sleep Qsleep = Isleep ÷ 1 000 (mAh/h, with µA)
Load at the battery Iload = (Qsleep + Qevents) ÷ η (mA)
Self-discharge Iself = C × s ÷ 100 ÷ 730 (mA, with s in % per month and 730 h per month)
Average drain Iavg = Iload + Iself
Life t = C × u ÷ 100 ÷ Iavg (h) days = t ÷ 24 months = t ÷ 730 years = t ÷ 8 760
where C is the rated capacity in mAh, u the usable share in per cent, n the events per hour and η the conversion efficiency. The shares of the drain are each component as a fraction of Iavg, with the converter loss spread over the load components in proportion, so the four add up to 100 %.
The model works in charge (mAh), not energy, which is why an LDO counts as 100 %: it passes the load current straight through and only adds its own quiescent current, which belongs in the sleep figure. A switching converter changes the current, and the ratio of battery current to load current is Vload ÷ (Vbattery × ηpower). For a 3.7 V Li-ion feeding a 3.3 V rail through a 90 % buck that ratio is 0.99, so entering 90 % is 10 % conservative; for a boost from two AA cells at 2.4 V to 3.3 V at 85 % it is 1.62, so the battery current is much higher than the load current and the usable share, not the efficiency field, is where that belongs. If you measured the currents at the battery terminals with a power profiler, enter 100 %.
Worked example
A LoRa temperature and humidity node on an orchard near Multan, sending six readings an hour: a single 18650 Li-ion cell rated 2 000 mAh with 85 % usable and 2 % a month self-discharge; 20 µA sleeping; 60 mA for 1 500 ms to wake, read the sensor and pack the message; 120 mA for 200 ms to transmit at 20 dBm; a buck converter at 90 %.
- Charge per event: active 60 mA × 1 500 ms ÷ 3 600 000 = 0.0250 mAh; transmit 120 × 200 ÷ 3 600 000 = 0.0067 mAh; together 0.0317 mAh.
- Six events an hour: 6 × 0.0317 = 0.190 mAh/h (0.150 active, 0.040 transmit). The sleep floor adds 20 µA = 0.020 mAh/h. At the load, 0.210 mAh/h.
- Through the 90 % converter the battery supplies 0.210 ÷ 0.9 = 0.233 mA for the load.
- Self-discharge: 2 000 mAh × 2 % ÷ 730 h = 0.055 mA, as if it were a load.
- Average drain 0.233 + 0.055 = 0.288 mA (288 µA). Usable capacity 2 000 × 85 % = 1 700 mAh. Life = 1 700 ÷ 0.288 = 5 900 h = 246 days, about 8.1 months.
- Where it goes: active time 57.8 %, self-discharge 19.0 %, transmit 15.4 %, sleep 7.7 %.
- Sensitivity: twelve events an hour instead of six cuts the life to 4.7 months; halving the sleep current to 10 µA only stretches it to 8.4 months, because the floor was never the problem here.
The lesson in this example is the 1 500 ms awake. The radio looks expensive at 120 mA but it is on for a fifth of a second; the microcontroller at 60 mA is on for seven times as long. Cutting the wake to 500 ms (a sensor that settles faster, a lower clock, no busy-waiting on the radio) would take the active share from 0.167 mA to 0.056 mA and the life to 13.2 months on the same cell.
Typical currents
| Part | Sleep or standby | Active or transmitting | Note |
|---|---|---|---|
| Cortex-M0+ microcontroller (STM32L0, SAMD21 class) | 1–5 µA in deep sleep with the RTC running | 3–10 mA at 16–48 MHz | the RTC and a low-power timer are what make timed sleep possible |
| ESP32 module | about 10 µA in deep sleep | 150–300 mA during Wi-Fi transmission; 40–100 mA with the radio idle | a Wi-Fi association and DHCP take one to three seconds of that |
| LoRa transceiver (SX1276 class) | 0.2–1 µA in sleep | 120 mA transmitting at 20 dBm, about 90 mA at 17 dBm; 10–12 mA receiving | receive windows after each uplink count as active time |
| NB-IoT / LTE-M module | a few µA in power-saving mode, tens of µA in eDRX | 100–250 mA during transmission, higher peaks | a cold attach to the network can take tens of seconds |
| Bluetooth Low Energy SoC (nRF52 class) | 1–3 µA with the RTC | 5–15 mA peaks at 0 to +8 dBm | connection events are hundreds of µs each |
| BME280 temperature, humidity, pressure sensor | under 1 µA in sleep | about 0.3–0.7 mA for a few ms per reading; 3.6 µA average at one reading a second | many I²C sensors are similar; some MEMS gas and light sensors are not |
| General-purpose LDO regulator | 50–100 µA quiescent; 1117-type parts on many modules about 5 mA | low-quiescent LDOs (MCP1700, XC6206, TPS7A02 class) 0.03–2 µA | |
| Power or debug LED behind 1 kΩ at 3.3 V | 1–2 mA, continuously | more than the whole rest of a well-designed board asleep | |
| I²C pull-up of 4.7 kΩ held low, or a divider of 10 kΩ across the battery | 0.3–0.7 mA | switch dividers and pull-ups off in sleep, or make them 1 MΩ |
Battery chemistries
| Battery | Nominal voltage | Capacity | Self-discharge | Temperature | Bursts |
|---|---|---|---|---|---|
| CR2032 lithium coin cell (LiMnO₂) | 3.0 V | 220–235 mAh | about 1 % a year | −30 to +60 °C | poor: internal resistance of 10–40 Ω, rising with age; a 15 mA pulse already sags it, a 100 mA radio burst collapses it without a capacitor |
| 2 × AA alkaline, in series | 3.0 V, falling to about 1.8 V at the end | 2 500–2 800 mAh at drains under 25 mA; far less at high drain | 0.2–0.3 % a month, several times faster at 40 °C+ | −18 to +55 °C | moderate: hundreds of mA possible, but every pulse costs capacity |
| AA lithium primary (LiFeS₂, "Ultimate Lithium" class) | 1.5 V | about 3 000 mAh | about 0.1 % a month; 20-year shelf life | −40 to +60 °C | good: low internal resistance, 2 A continuous |
| 18650 Li-ion (NMC, NCA) | 3.6–3.7 V (4.2 V full, 3.0 V cut-off) | 2 500–3 500 mAh | 2–3 % a month, plus the protection circuit's own few µA | charge 0 to +45 °C; discharge −20 to +60 °C | excellent: amps |
| LiFePO₄ (18650 or 26650) | 3.2 V (3.6 V full, 2.5 V cut-off) | 1 500–3 300 mAh | 1–3 % a month | charge 0 to +45 °C; discharge −20 to +60 °C | excellent; the voltage range suits 3.3 V logic almost without a regulator |
| LiSOCl₂ bobbin cell (lithium thionyl chloride) | 3.6 V | AA 2 400 mAh; D 19 000 mAh | about 1 % a year | −55 to +85 °C | poor: made for a few mA; a cell that has sat idle passivates and its voltage dips on the first pulse; pair it with a hybrid layer capacitor for radio bursts |
Assumptions and limitations
- It is an average-current model. A burst of 120 mA is spread evenly over the hour as if it were a steady 6.7 µA. That is right for the charge, but not for the voltage: during the burst the cell's internal resistance drops the terminal voltage, and a high-resistance cell (a coin cell, an old alkaline, a passivated LiSOCl₂) can hit the regulator's cut-off in the middle of a transmission while it still holds most of its charge. A CR2032 under a 100 mA radio burst needs a capacitor sized for the burst's charge (Q = I × t, C = Q ÷ the droop you can accept): about 100 µF for a millisecond Bluetooth connection event, but tens of millifarads, a supercapacitor, for a 200 ms LoRa packet, which is why coin cells and LoRa do not mix. The calculator flags the case and estimates the capacitor for 0.3 V of droop.
- Capacity depends on the discharge rate and the cut-off. Datasheet capacities are measured at a low, steady current down to a low end voltage. The usable share is where you allow for the regulator giving up early, for cold weather (alkaline and Li-ion lose a large fraction of their capacity below 0 °C) and for ageing. 85 % is a fair default for a Li-ion cell in a temperate cabinet; use less for a coin cell driving pulses or for anything outdoors in winter in the north.
- Self-discharge is taken as a constant fraction per month. In reality it roughly doubles for every 10 °C, so a battery in a metal box on a pole in Sindh in June self-discharges several times faster than the datasheet figure at 20 °C.
- Radios retry and listen. A LoRaWAN uplink is followed by two receive windows; an NB-IoT module may search for the network for tens of seconds after a poor attach; Wi-Fi has to associate before it can send. Add the receive and waiting time to the active time, at the receive current, and take the retry rate from a real deployment, not from the bench.
- Firmware faults dominate real failures. A device that fails to enter sleep once in a hundred cycles because a peripheral was left on, an interrupt was missed or the radio stayed in receive will die in weeks regardless of the arithmetic. The calculator describes the intended behaviour; only a measurement over days describes the real one.
- No energy harvesting. A solar cell, a thermoelectric generator or a vibration harvester adds a source the model does not have. For a small solar cell the solar system sizing calculator gives the daily energy per watt-peak for a Pakistani city; convert it to mAh at the battery voltage and compare it with the daily drain.
- The efficiency is a charge ratio, not a power ratio. See the note under the formula. For a boost converter running from cells whose voltage is far below the rail, the battery current is higher than the load current by more than the efficiency suggests.
Frequently asked questions
Why is my device dying in weeks when the sums said a year?
Almost always the sleep current, and almost always something other than the microcontroller. A power LED behind 1 kΩ is 1–2 mA, which is a hundred times the floor in the example; an 1117-type regulator on a module draws 5 mA doing nothing; a voltage divider across the battery for the ADC, a pull-up held low, a sensor left in continuous mode, a serial-to-USB chip still powered, a brown-out detector or an unused peripheral clock all add up. Measure the sleeping board with a meter that can read microamps before changing anything; the number is usually a surprise, and it names the culprit.
Should I use an LDO or a buck converter?
At the currents a sleeping node draws, the converter's own quiescent current matters more than its efficiency. A buck at 90 % saves nothing over an LDO if it draws 50 µA to idle on a 20 µA board; a low-quiescent LDO (a few µA or less) is often the better choice from a Li-ion cell to a 3.3 V rail, because the 3.7 V to 3.3 V step wastes only 11 % of the energy anyway. A buck earns its place when the step is large (a 12 V battery to 3.3 V wastes 72 % in an LDO), when the active current is high for long, or when it is a modern part with a quiescent under 1 µA and a pulse-skipping light-load mode. A boost is unavoidable from 1.5 V cells, and its efficiency at light load is the figure to read on the datasheet, not the headline.
How do I measure a sleep current of a few microamps?
A standard multimeter on its µA range has a burden voltage of hundreds of millivolts and will reset the board when a burst comes; and an ammeter on the mA range cannot resolve 20 µA. Three approaches work. A dedicated low-burden meter (the µCurrent design and its relatives) gives a clean reading of the floor. A power profiler (Nordic PPK2, Joulescope, Otii Arc) logs from microamps to hundreds of milliamps with the time resolution to see each burst, which is the tool for the whole budget. Or a 1 kΩ shunt in the supply lead with a scope across it: 20 µA reads as 20 mV, and a pair of Schottky diodes in anti-parallel across the shunt limits the drop to 0.3 V during bursts so the board keeps running. Whatever you use, log a full day: the floor between events is what you are looking for.
Alkaline or lithium in Pakistani heat?
Lithium. Alkaline cells lose capacity to self-discharge several times faster at 45 °C than at 20 °C, their high-drain capacity is poor, and they leak when left flat in a sealed enclosure, which is the failure that destroys the board. AA lithium primary (LiFeS₂) cells cost more per cell but hold 3 000 mAh at 1.5 V, work from −40 to +60 °C, keep for years and deliver pulses cleanly. For anything that must run five years or more, or in an enclosure that sees 70 °C on a roof, LiSOCl₂ with a hybrid layer capacitor is the industrial answer, at a price. Rechargeable Li-ion needs its charging stopped above 45 °C, which a solar-charged node on a pole in June will exceed.
What does "usable" mean when there is a boost converter?
The usable share is the part of the rated capacity you get before the regulator gives up. An LDO making 3.3 V from three AA cells needs about 3.5 V in, or 1.17 V per cell, and gives up while the cells still hold perhaps a fifth of their capacity; from two cells it never works at all. A boost converter can run down to 0.9 V a cell and takes nearly everything, so its usable share is high, 90 % or more, but two things go the other way: its efficiency falls as the input voltage sags, and the input current rises as the input voltage falls, so the last part of the capacity is delivered at a poorer rate. Put the first effect in the usable share and the second in the efficiency, and expect the two to roughly cancel the boost's advantage on paper.
References
- Texas Instruments, ultra-low-power design application notes (the SLAA-series "ULP Advisor" rules for MSP430 and similar) — sleep modes, peripherals, clocks and the habits that keep a microcontroller asleep
- Nordic Semiconductor, Online Power Profiler — a comparable event-based current model for BLE, Thread and LTE-M devices; useful to cross-check radio figures
- Energizer and Duracell technical datasheets and application manuals for alkaline and lithium cells — capacity against drain rate and temperature, pulse behaviour, self-discharge
- IEC 60086-2, Primary batteries — Part 2: Physical and electrical specifications — standard cell sizes, minimum average durations and test conditions
- IEC 60086-1, Primary batteries — Part 1: General — the designation system (CR2032, LR6 for AA alkaline, FR6 for AA lithium) also used by ANSI C18
- Semtech, SX1276/77/78/79 datasheet — transmit current against output power, receive and sleep currents used in the table