Sub topic 10
Building a Current Budget for Your Project
A current budget is a table of every part in your project and how much current each part draws. You build it before choosing a battery or regulator. Its two results are the average current, which sets battery life, and the peak current, which sets what the battery and regulator must be able to supply.
This chapter assumes you know Ohm's law and power (P = V × I). It also assumes you know the difference between a battery's capacity in mAh and its maximum discharge current, and that you have measured current with a multimeter at least once. The next chapter turns the average current from this budget into a runtime estimate.
Step 1: List Every Load
Write down every part that draws current from the supply, including the ones that are easy to forget:
- The microcontroller board itself, including its power LED and USB-serial chip.
- Sensors, displays, and radios.
- Indicator LEDs and their resistors.
- Motors, servos, relays, and buzzers.
- Pull-up resistors that conduct while a button is held or a line is low.
- The regulator's own overhead (covered in Step 5).
Group the loads by the voltage rail they sit on. A 5 V rail and a 3.3 V rail are budgeted separately, because the current on each rail is converted differently from the battery.
Step 2: Find a Realistic Number for Each Load
Use these sources in this order of preference:
- Your own measurement of the actual part, in the actual circuit.
- The datasheet's typical current at your supply voltage.
- The datasheet's maximum current, for the peak column.
Datasheets often list several states, such as sleep, idle, measuring, and transmitting. Record each state you will use. The figures below are rough, typical values for common hobby parts. Treat them as starting points, because they vary with part version, supply voltage, and clone quality.
| Load | Typical state | Approx. current |
|---|---|---|
| Arduino Uno board, idle | Running a simple sketch | 40 to 50 mA |
| LED with 330 ohm resistor on 5 V | On | about 9 mA |
| HC-SR04 ultrasonic sensor | Measuring | about 15 mA |
| Small hobby servo | Moving under light load | 100 to 250 mA |
| Small hobby servo | Stalled | 500 mA or more |
| ESP8266 module | Wi-Fi transmitting | 170 mA or more |
The LED figure comes from Ohm's law: with about 2 V across the LED, the resistor drops about 3 V, and 3 V / 330 ohm is about 9 mA.
Step 3: Separate Average Current from Peak Current
These two numbers answer different questions.
- Average current is the current drawn over a long period, with every load weighted by how often it is on. It decides how long the battery lasts.
- Peak current is the highest current drawn at any moment, usually when several loads are active together. It decides whether the battery voltage holds up and whether the regulator can keep up.
A project can have a small average and a large peak. A sensor node that sleeps most of the time and transmits for 200 ms every minute is a typical case. The average may be a few milliamps, but the radio burst still needs a source that can deliver hundreds of milliamps without its voltage sagging. A battery chosen only from the average can fail at the peak, and a battery chosen only from the peak will be oversized for runtime.
Step 4: Weight Each Load by Its Duty Cycle
Duty cycle is the fraction of time a load spends in its active state. A servo that moves for 3 seconds out of every 60 has a duty cycle of 3 / 60 = 0.05. The load's contribution to the average is its active current multiplied by its duty cycle:
average contribution = active current × duty cycle
Add the contributions of all loads to get the total average. To keep the estimate honest, include the idle current of each part in its off time as well. A sensor that "turns off" in software may still draw several hundred microamps.
Step 5: Convert to Battery-Side Current
The loads draw current at the regulated voltage, but the battery supplies current at its own voltage. How the two relate depends on the regulator type.
- Linear regulator: the battery current equals the load current plus the regulator's own ground (quiescent) current. A linear regulator drops the extra voltage as heat, so a 9 V battery feeding a 5 V load at 60 mA still delivers 60 mA or slightly more from the battery.
- Switching regulator: the converter preserves power, not current. Battery current is approximately load current × (Vout / Vin) / efficiency. A 5 V, 60 mA load fed from 9 V through an 85% efficient buck converter draws about 41 mA from the battery.
At a higher input voltage a buck converter draws less current from the battery, so it can look better than a linear regulator by a wide margin. At very light loads, the converter's own quiescent current can cancel that advantage. Check the regulator datasheet for light-load efficiency.
A Budget Calculator
This script keeps the budget in one place. You can change a number and see the effect on both totals. It is the same arithmetic as the steps above.
# name, active current (mA), duty cycle (fraction of time active)
LOADS = [
("Arduino Uno board", 45.0, 1.00),
("Status LED with 330 ohm", 9.0, 0.10),
("HC-SR04 sensor", 15.0, 0.20),
("SG90 servo moving", 200.0, 0.05),
("ESP-01 Wi-Fi transmit", 170.0, 0.02),
]
def average_ma(loads):
"""Duty-cycle-weighted average current."""
return sum(current * duty for _, current, duty in loads)
def peak_ma(loads):
"""Worst case: every load active at the same moment."""
return sum(current for _, current, _ in loads)
def battery_current_ldo(load_ma, quiescent_ma=5.0):
"""A linear regulator passes the load current plus its own ground current."""
return load_ma + quiescent_ma
def battery_current_buck(load_ma, v_out, v_in, efficiency=0.85):
"""A buck converter conserves power, so input current is lower at higher V_in."""
return load_ma * v_out / (v_in * efficiency)
avg = average_ma(LOADS)
peak = peak_ma(LOADS)
print(f"Average load: {avg:.1f} mA")
print(f"Worst-case peak: {peak:.1f} mA")
print(f"Battery current via LDO (9 V in): {battery_current_ldo(avg):.1f} mA")
print(f"Battery current via buck (9 V in): {battery_current_buck(avg, 5.0, 9.0):.1f} mA")Running it prints:
Average load: 62.3 mA
Worst-case peak: 439.0 mA
Battery current via LDO (9 V in): 67.3 mA
Battery current via buck (9 V in): 40.7 mAThe average of 62.3 mA is what a runtime estimate would use. The 439 mA peak is a different matter. A small 9 V alkaline battery has high internal resistance and will sag badly at that current, even though its capacity looks adequate for the average.
Common Errors
- Budgeting only the sensors. The microcontroller board often draws more than the parts attached to it. Include the board, its power LED, and its USB-serial chip.
- Using the datasheet maximum as the average. Maximum figures belong in the peak column. Using them for the average makes runtime look much shorter than it is.
- Ignoring idle current. A load with a low duty cycle can still dominate the budget if its off-state current is large. Include the off-state current of every part.
- Forgetting the supply voltage. Datasheet currents are given at a stated voltage. A part measured at 5 V does not draw the same at 3.3 V.
- Adding currents from different rails. Currents on a 3.3 V rail and a 5 V rail cannot simply be summed. Convert each rail to battery-side current first.
- Treating the servo stall current as a rarity. A mechanical jam or a servo pushing against a stop draws stall current, and the supply must survive it. Budget it in the peak column if it can happen.
Checking the Budget by Measurement
Estimates are only as good as the figures behind them, so measure the finished circuit.
- Set the multimeter to the current range and put it in series with the battery's positive lead.
- Start on the highest current range, such as the 10 A input, then step down to a more sensitive range. Hold the same input only if the reading stays in range.
- Record the reading while the project idles, during each activity, and during the worst case, such as the radio transmitting while a servo moves.
A multimeter measures current by adding a small resistance, called burden, into the circuit. On the most sensitive ranges this resistance can be large enough to drop the supply voltage and make the project misbehave. If the board resets while you measure, switch to a less sensitive range.
If your meter is too coarse for a project that sleeps at a few microamps, measure the voltage across a small known resistor placed in series with the supply. Calculate the current from Ohm's law, and keep the resistor small enough that the voltage it drops does not starve the load.
Exercise
A project runs from a 9 V battery through a buck converter that is 80% efficient, producing 5 V. The loads are: a board at 40 mA continuously, a sensor drawing 20 mA for 25% of the time, and a buzzer drawing 30 mA for 5% of the time. What is the average load current at 5 V, and what is the average current drawn from the battery? What is the worst-case peak at 5 V?
Show answer
Average load = 40 + (20 × 0.25) + (30 × 0.05) = 40 + 5 + 1.5 = 46.5 mA at 5 V. Battery current = 46.5 × 5 / (9 × 0.80) = 232.5 / 7.2 = about 32.3 mA. The worst-case peak at 5 V is 40 + 20 + 30 = 90 mA.
Exercise
A node sleeps at 0.2 mA, and every 60 seconds it wakes for 2 seconds at 120 mA. What is its average current, ignoring the regulator? Why is the 120 mA figure still important when choosing the battery?
Show answer
Active time per cycle is 2 s and sleep time is 58 s. Average = (2 × 120 + 58 × 0.2) / 60 = (240 + 11.6) / 60 = about 4.19 mA. The 120 mA is the peak. The battery must supply it without its voltage sagging below what the regulator needs, which depends on the battery's internal resistance and discharge limit, not on its capacity.