When you're thinking about a project that will be battery powered, one of your first questions will be "how big a battery do I need?" or maybe, "I have a battery, how long will it last?"

This guide is an intermediate introduction to calculating the energy budget for battery-powered projects. There's math, but nothing hard: mostly multiplication and addition, with a little division here and there.

The bigger challenge is remembering what the numbers mean. That involves learning some vocabulary, and working with the ideas until they stop feeling new and strange.

An energy budget starts with a specific battery's rated storage, which is measured in **milliamp-hours:** weird units that don't actually measure energy.

Milliamps measure current, and current is defined as the motion of charge (usually electrons) over time. 1 Ampere is 1 Coulomb (6.24e18) electrons per second, so multiplying current by time tells you how many electrons you sent from one place to another. 1 hour is 3600 seconds, so 1 milliamp-hour actually means 3.6 Coulombs of charge (about 22.5 billion-squared electrons).

Energy is measured in Joules, which don't have any direct relationship to numbers of electrons.

When we put the two ideas together -- Joules and Coulombs -- we get Volts (defined as Joules per Coulomb).

A battery (or any power source) is kind of like an escalator for electrons: the electrons enter through the positive end, the battery pumps Joules of energy into them, then they leave through the negative end. The energy leaves the battery with the electrons:

*(yeah, that sounds backwards.. electrons have negative charge, so they move in the opposite direction from what we call 'conventional current'. It's a long story that involves Benjamin Franklin A: being very persuasive, and B: getting it backwards. To be fair, it was 100 years before anyone said, "hey...")*

So a battery's milliamp-hour rating really means "this battery holds enough energy to raise X-many Coulombs of charge to a higher voltage".

That's a mouthful, and doesn't seem to answer "how long will my battery last?" any better than milliamp-hours, but stay tuned.

For simple circuits, like lighting an LED, morphing a battery's stored energy to milliamp-hours makes battery life calculations easier: a 100mAh coin cell can power a 10mA LED for 100mAh/10mA=10 hours.

Things get more complicated when you have an ESP8266 microcontroller that wakes up every ten minutes, takes some measurements (using 5mA), opens a WiFi connection to the Internet (80mA), posts data to Adafruit.IO, then goes back to sleep again.

Or say you're doing some cosplay, taking LiPo power to 5V through a PowerBoost, and using it to run a NeoPixel strip with the LEDs at a 60% duty cycle.

Milliamp-hours don't make those problems noticeably easier.

For those kinds of calculations, you need an **energy budget**.

## By the way -

I'm not just throwing around units for the sheer joy of saying 'Coulombs' (at least, not entirely). The process I'm using is called **dimensional analysis**: a way to rearrange problems so they're easier to think about and to solve.

For the payoff, we need two more players:

When we multiply voltage by current, we get Joules/Coulomb x Coulombs/second. That simplifies to Joules/second, or **Power: the rate at which energy moves from one thing to another**. The official unit of power is the Watt, named in honor of the man who put the steam in Steampunk.

If we multiply power by time, we get **Work: the amount of energy that did move from one thing to another**. There are an appalling number of units for work, including the Watt-hour, foot-pound, newton-meter, and erg, but I'm going to stick with Joules.

Energy budgets are easier to do when you arrange things in terms of power and work.

Guide image source: Microsoft PowerPoint clipart