Power is the quiet cause of most first-robot failures — the board that resets randomly, the motors that stall, the robot that dies in ten minutes. This lesson demystifies it: how to read a battery's voltage and capacity, why logic and motors want separate supplies, how a regulator gives you a clean voltage, and the wiring rules that keep the smoke inside the chips. None of it is hard once you see the picture, and getting it right turns a flaky robot into a reliable one.
- Read a battery's voltage, capacity (mAh) and C-rating and estimate run time
- Explain why motors and logic should draw from separate supplies
- Use a regulator to turn a battery voltage into a clean logic voltage
- Apply the grounding and wiring rules that prevent resets and damage
Reading a battery
Three numbers describe a battery. Voltage (like 3.7 V for one lithium cell, 7.4 V for two in series) must match what your motors and regulator expect. Capacity in milliamp-hours (mAh) is how much charge it holds: a 2000 mAh pack can in theory supply 2000 mA for one hour, or 1000 mA for two — so run time is roughly capacity divided by average current draw. C-rating is how fast it can safely deliver that charge; a motor that briefly pulls several amps needs a battery whose C-rating allows it, or the voltage sags. For a first robot, a common choice is a rechargeable lithium pack or a holder of AA cells; know the three numbers and you can predict whether it will run your robot and for how long.
Quick run-time estimate: run_time_hours ≈ capacity_mAh ÷ average_current_mA. Motors dominate the current, so a robot that draws 500 mA average on a 2000 mAh pack runs roughly four hours — less under heavy driving.
Two supplies: logic and motors
The most important power idea in robotics: separate the motor power from the logic power. Motors are electrically noisy — when they start, stall, or change direction they yank current and inject voltage spikes. If your microcontroller shares that same rail, those spikes and dips make it reset or behave randomly, which is the number-one cause of 'my robot keeps rebooting.' The fix is to power the motors from one source (through the driver) and the logic from a clean source, and to join their grounds so the control signals have a common reference. Two supplies, one shared ground — that is the pattern behind a stable robot.
In practice this can be two separate batteries, or one battery feeding the motor driver directly and also feeding a regulator that produces a clean voltage for the board. The point is that the logic never sees the raw, spiky motor rail.
Regulators: making a clean voltage
Your battery rarely sits at exactly the voltage your board wants, and it droops as it discharges. A voltage regulator takes a varying higher input and produces a steady lower output — for example turning a 7.4 V pack into a rock-steady 5 V for logic. There are two kinds worth knowing. A linear regulator is simple and cheap but wastes the difference as heat, so it is fine for small loads only. A switching regulator (a buck converter) is far more efficient and the right choice when current is significant, which is most robots. Many microcontroller boards have an onboard regulator for the board itself, but it is weak — never use it to power motors or several servos.
Do not power motors or multiple servos through the microcontroller board's onboard regulator or its 5V pin. It is sized for the chip, not for actuators, and will overheat or brown out. Feed actuators from the battery or a dedicated buck converter.
Wiring rules that prevent smoke
A handful of habits prevent almost all electrical damage. Check polarity before connecting — reversing plus and minus can instantly kill a board; many modules have no reverse protection. Match voltages — a 5 V sensor on a 3.3 V board's line, or the reverse, can damage one of them; know your board's logic level. Size your wires and connectors for the current — thin wires to a motor get hot and drop voltage. Add a fuse or a switch on the main battery lead so you can cut power fast and protect against a short. And never hot-plug the motor supply while everything is live. These are boring rules, and they are exactly what separates a robot that works from one that releases smoke.
- Confirm plus and minus before every connection; reverse polarity kills boards.
- Know your logic level (3.3 V vs 5 V) and match sensors to it.
- Use thick enough wire to motors; thin wire heats up and drops voltage.
- Put a switch or fuse on the main battery lead to cut power fast.
- Join all grounds — battery, driver, board — to one common ground.
Knowing when power is the problem
When a robot misbehaves, suspect power early. The tell-tale signs are specific: the board resets or the lights flicker exactly when a motor starts (the supply is sagging under the motor's inrush); the robot slows down over minutes (the battery is discharging); a servo jitters only under load (its current is dipping the rail). A cheap multimeter is your friend here — measure the battery under load, not at rest, because a battery that reads fine idle can collapse the moment motors pull current. Learning to reach for the multimeter instead of rewriting code will save you hours.
// Read approximate battery voltage through a divider on an analog pin.
// Two equal resistors halve the battery voltage so it fits 0-5V.
const int VBAT = A0;
void setup() { Serial.begin(9600); }
void loop() {
int raw = analogRead(VBAT); // 0-1023
float pinV = raw * (5.0 / 1023.0); // volts at the pin
float battV = pinV * 2.0; // undo the /2 divider
Serial.println(battV); // watch it sag under load
delay(500);
}