IoT Battery Runtime calculator
Estimate battery life when designing Internet Of Things projects
How to use it
- Measure the average active current of your project: that is the current used when it is fully powered up, using WiFi/bluetooth/etc. Enter this above, along with an estimate of how many seconds per day it is active.
- Measure the average sleep current of your project: that is the current used when it is dormant, perhaps with the microcontroller in deep-sleep mode, waiting for an input or timer. Enter this current above. The sleep time is calculated for you.
- Choose a voltage regulator. This determines how much of the battery capacity your project can actually use, because once the battery voltage drops below the min input of the regulator, the regulator can no longer work. The current version only has a small selection of step-down regulators, but you can choose “Other” and type in the min input from your regulator’s datasheet.
- Choose different batteries to compare the runtimes. Each battery has a default capacity (in mAh) but you can type any capacity. e.g. for a specific 18650 or LiPo cell. The current version has a small selection of rechargeable batteries that can output at least 3V and 80mA, suitable for ESP32 and ESP8266 microcontrollers.
You can measure currents with a multimeter placed between a power supply and the voltage regulator, using the nominal voltage for your battery. e.g. 3.6V or 3.7V for most lithium rechargeables. I use the budget Aneng AN870 which has a resolution of 0.01�A (10nA). If you want to record & graph current changes over time, the Nordic Power Profiler Kit II measures up to 1A with 0.1µA resolution.
(If you buy the Aneng AN870 and are new to AliExpress, you can get a £19 / €23 / US$26 discount with my AliExpress referral, and I'll get something towards my next open hardware project
)
Note that if you change voltage regulator then you’ll want to re-measure the active & sleep currents drawn by your project.
How it works
The only ‘clever’ part of this simple calculator is that it uses the discharge curves for different battery chemistries, rather than assuming you can use 100% of the battery capacity. These were converted from published 0.2C (that is, low current) discharge graphs to numeric data using the rather nifty WebPlotDigitizer web tool. You might notice the NiMH and LiFePO4 batteries have over 100% of the rated capacity: this is because the manufacturer rating assumes a higher discharge current.
A project drawing a measured 10mA @ 3.7V from a 100mAh battery won't last for exactly 10 hours (even with 100% battery capacity) because the battery voltage isn't a constant, so neither will be the current. A fully charged battery that outputs 4.2V means the voltage regulator draws a lower current to power your project versus when the battery output is only 3.5V. Wrong! This calculation is included in the estimated life above, but only adds a few percent.
Future improvements
I wrote this javascript run-time calculator for use when designing my own hardware projects, but others may find it useful. Please Contact Me if you have any comments or suggestions.
- Fix incorrect assumption about linear regulator efficiency
- Add regulator min input vs current curves? eg, 0.178V @ 250mA but only 0.04V @ 50mA
- Limit estimated life to a maximum of the self-discharged time of that battery?
- Add more regulators, including step-up regulators or no regulator at all (would need min working voltage for the project)
- Add more battery types & sizes, but rechargeable batteries only (on environmental grounds)
- Support more than one active or sleep current, for projects that operate in multiple modes
Nikki Smith, August 2020. Last updated January 2022.