We've already shown that 1 milliamp-hour is 3.6 Coulombs. We also know than 1 Volt applies 1 Joule of energy to each Coulomb of charge. Putting those together, we can calculate the actual energy storage for some of the common battery sizes:

 Battery type   1.5V AAA cell 1.5V AA cell 1.5V C cell 1.5V D cell   3V CR1220 coin cell 3V CR1620 coin cell 3V CR2032 coin cell   3.7V LiPo pack 3.7V 18650 LiPo Joules per mAh   5.4J 5.4J 5.4J 5.4J   10.8J 10.8J 10.8J   13.7J 13.7J Normal rating   1,200mAh 2,700mAh 8,000mAh 12,000mAh   40mAh 80mAh 240mAh   100mAh 2,200mAh Stored energy   6,480J 14,580J 42,300J 64,800J   432J 864J 2,592J   1,370J 30,140J

When you put cells in series, the Joules per millamp-hour add together. Each cell in a 4.5V 3xAA pack adds 5.4J, for a total of 16.2J per milliamp-hour. The total energy stored in the pack is 43,740J.

A 4.5V circuit that uses 10mA consumes 45mW of power, or 0.045J per second. A quick comparison with the pack's stored energy shows that the pack should last a little less than a million seconds, or about 270 hours.

It's okay to put alkaline cells or coin cells in series, but DO NOT PUT LIPO CELLS IN SERIES OR PARALLEL. LiPos are much more likely to damage each other, and their common failure modes include 'catching on fire' and 'exploding'. Only carefully selected and tested LiPo cells can work together safely.

Putting the units to work

Now let's go back to that example of an ESP8266 that wakes up once every ten minutes, uses 5mA to read a sensor for maybe 100ms, then makes a Wifi connection that uses 80mA for an average of, say, 12 seconds before shutting down again.

The ESP8266 runs at 3.3V, and let's assume that the sensor does too. 5mA @ 3.3V consumes 16.5mW or 0.016.5 Joules per second. The sensor is active for 100ms, so it uses a total of 0.00165 Joules during that time:

 Item Sensor Voltage 3.3V Current 5mA Power 16.5mW Time 0.1s Work 0.00165J Amortized -

The Wifi connection uses 80mA @ 3.3V, which comes to 264mW or 0.264J/s. Running the connection for 12 seconds consumes 3.168 Joules.

Adding the two together, let's call the average work 3.17 Joules each time the ESP8266 wakes up:

 Item Sensor Wifi   Awake Voltage 3.3V 3.3V   - Current 5mA 80mA   - Power 16.5mW 264mW   - Time 0.1s 12s   - Work 0.00167J 3.168J   3.17J Amortized - -   3.17J/cycle

The ESP8266 spends the rest of its time sleeping, and let's say it draws 70uA during that time.

70uA @ 3.3V is 231uW, or 231 millionths of a Joule per second.

The ESP8266 spends 12.1 seconds awake per 10-minute cycle, and sleeps the remaining 587.9 seconds. That means the ESP8266 uses 0.136 Joules per cycle sleeping.

Its total energy consumption per cycle is about 3.3 Joules:

 Item Sensor Wifi   Awake Asleep Sum Voltage 3.3V 3.3V   - 3.3V - Current 5mA 80mA   - 70uA - Power 16.5mW 264mW   - 231uW - Time 0.1s 12s   - 587.9s - Work 0.00165J 3.168J   3.17J 0.136J 3.3J Amortized - -   3.17J/cycle 0.136J/cycle 3.3J/cycle

Now it's time to convert what we have into values that are more convenient to work with.

Each cycle is 600 seconds long and consumes 3.3 Joules of energy. If we just divide the energy by the time we get 0.0055 Joules per second, or an average power of 5.5mW.

If we divide 5.5mW by 3.3V, we get an average current of 1.67mA.

(running that through Ohm's Law, the system consumes about the same amount of energy as a 2k resistor that's always connected between 3.3V and GND)

We can also scale the 5.5mW up to an average rate of 19.8 Joules per hour:

 Item Sensor Wifi   Awake Asleep Sum   Equivalent Voltage 3.3V 3.3V   - 3.3V -   3.3V Current 5mA 80mA   - 70uA -   1.67mA Power 16.5mW 264mW   - 231uW -   5.5mW Time 0.1s 12s   - 587.9s -   3600s Work 0.00165J 3.168J   3.17J 0.136J 3.3J   19.8J Amortized - -   3.17J/cycle 0.136J/cycle 3.3J/cycle   19.8J/hr

If we want to power the ESP8266 from the 3xAA battery pack that holds 43,740 Joules of energy, it's tempting to use that value of 19.8J/hr and think we can get more than 2,000 hours of battery life.

That's wrong though: the battery pack's voltage is 4.5V, while we've done all of our other calculations for a circuit running at 3.3V.

The difference in voltage has to be burned off as heat in the 3.3V regulator, and that's another kind of work.

That's where calculating the average current comes in:

The difference between 4.5V and 3.3V is 1.2V, and if we multiply that by the 1.67mA calculated above, we get 2mW of power consumption in the regulator.

Multiplying 0.002J/s by 3600 seconds tells us the voltage regulator uses about 7.2J per hour.

Adding that to the 19.8J/hr the ESP8266 uses gives us a total power consumption of 27J/hr from a 4.5V power source:

 Item Sensor Wifi   Awake Asleep Sum   Equivalent Regulator Sum Voltage 3.3V 3.3V   - 3.3V -   3.3V 1.2V 4.5V Current 5mA 80mA   - 70uA -   1.67mA 1.67mA 1.67mA Power 16.5mW 264mW   - 231uW -   5.5mW 2mW 7.5mW Time 0.1s 12s   - 587.9s -   3600s 3600s 3600s Work 0.00165J 3.168J   3.17J 0.136J 3.3J   19.8J 7.2J 27J Amortized - -   3.17J/cycle 0.136J/cycle 3.3J/cycle   19.8J/hr 7.2J/hr 27J/hr

Based on that estimate, we can expect the 3xAA pack to last around 1620 hours (about 67 days):

 Item Sensor Wifi   Awake Asleep Sum   Equivalent Regulator Sum   Project 3 x AA pack Voltage 3.3V 3.3V   - 3.3V -   3.3V 1.2V 4.5V   4.5V 4.5V Current 5mA 80mA   - 70uA -   1.67mA 1.67mA 1.67mA   - - Power 16.5mW 264mW   - 231uW -   5.5mW 2mW 7.5mW   - - Time 0.1s 12s   - 587.9s -   3600s 3600s 3600s   1620hr - Work 0.00165J 3.168J   3.17J 0.136J 3.3J   19.8J 7.2J 27J   43,740J 43,740J Amortized - -   3.17J/cycle 0.136J/cycle 3.3J/cycle   19.8J/hr 7.2J/hr 27J/hr   27J/hr -

Learning from the results

The most interesting thing all that tells us is that we're wasting a lot of energy in the voltage regulator.. almost 40% of the total.

If we switch to a 2200mAh 3.7V 18650 LiPo, the 3.3V voltage regulator will only have to drop 0.4V.

Using the same 1.67mA estimate for the average current, that reduces the regulator's power consumption to 670uW, which scales up to about 2.4J/hr.

Adding that to the ESP8266's consumption of 19.8J/hr gives us a total of 22.2J/hr:

 Item Sensor Wifi   Awake Asleep Sum   Equivalent Regulator Sum   Project 18650 LiPo Voltage 3.3V 3.3V   - 3.3V -   3.3V 0.4V 3.7V   3.7V 3.7V Current 5mA 80mA   - 70uA -   1.67mA 1.67mA 1.67mA   - - Power 16.5mW 264mW   - 231uW -   5.5mW 668uW 6.168mW   - - Time 0.1s 12s   - 587.9s -   3600s 3600s 3600s   1357hr - Work 0.00165J 3.168J   3.17J 0.136J 3.3J   19.8J 2.4J 22.2J   30,125J 30,135J Amortized - -   3.17J/cycle 0.136J/cycle 3.3J/cycle   19.8J/hr 2.4J/hr 22.2J/hr   22.2J/hr -

The 18650 holds 30,140J, so we can expect it to last around 1357 hours (about 56 days)

We still lose energy in the voltage regulator, but only about 11% of the total.

The LiPo doesn't last quite as long as the 3xAA pack, but the 3xAA pack wastes almost four times as much energy as the LiPo.

This guide was first published on Jun 12, 2019. It was last updated on Mar 08, 2024.

This page (Now a sample energy budget) was last updated on Mar 08, 2024.