Robots stop for one reason more than any other: the battery ran down. A power budget tells you how long it will last before you build.
Key idea
Add up the current of every part on the battery. Battery life is about $\dfrac{\text{usable capacity (mAh)}}{\text{average current (mA)}}$ hours. Count only part of the capacity as usable, such as 80%: lithium packs should not be run completely flat.
| Part | Typical current |
|---|---|
| Microcontroller board | 20 to 80 mA |
| Raspberry Pi computer | 300 to 700 mA, more under load |
| Two small drive motors | 300 mA to over 1 A; much more when stalled |
| Hobby servo | 100 to 500 mA moving; more when straining |
| Camera | about 150 to 250 mA |
Why it works
Motors usually use most of the power, and their draw jumps when they climb or stall. A budget made with average numbers is a first guess; measure the real current with a multimeter or a current sensor, and plan on less run time than the math says.
Worked example: Run time
Board 50 mA, motors 600 mA, sensor 20 mA, from a 2,000 mAh pack using 80%.
- Total 670 mA.
- $0.8 \times 2000 = 1600\ \text{mAh}$.
- $1600/670 \approx 2.4$ hours.
Answer: About 2.4 hours.
Common mistake
Forgetting the motors' current, or running a lithium battery right down to empty.
Battery safety reminder. Use the right lithium charger, never charge unattended, charge on a surface that will not burn, and retire any pack that is swollen or damaged. See A Safe Electronics Bench.