Electronics basics before your first robot
Voltage, current, Ohm's law, breadboards and safe power for beginners, with a worked calculation for the resistor that protects an LED.
In short
You wire an LED straight to a battery, and it flashes brightly once and dies. Or you wire a motor and the controller keeps resetting. Both are electronics basics you can learn in an afternoon. Knowing three quantities and one equation saves most parts and most evenings.
In short
- Voltage is the push, current is the flow, resistance is what limits it, and Ohm's law connects them: V = I × R.
- An LED needs a resistor in series, and you can calculate its value from the supply voltage, the LED's forward voltage and the current you want.
- Build on a breadboard with the power off, use low-voltage batteries or USB, and never work on anything connected to mains power.
Who this is for
This is for beginners new to robotics who have not studied electronics. You need to be comfortable with multiplying and dividing, and with units like volts and milliamps.
The plan at a glance
- Learn the three quantities: voltage (V, volts), current (I, amps) and resistance (R, ohms).
- Learn Ohm's law:
V = I × R, and its two rearrangements. - Learn how a breadboard connects things.
- Learn the rules of safe power.
- Put it together with one project: an LED and a resistor.
Step by step
1. Picture water in a pipe
Voltage is like water pressure, current is how much water flows, and resistance is how narrow the pipe is. It is an analogy and it breaks down at the edges, but it helps you guess the direction of a change: more pressure or a wider pipe means more flow.
2. Use Ohm's law
V = I × R. Rearranged,I = V ÷ RandR = V ÷ I. With V in volts and R in ohms, I comes out in amps. 1 amp is 1000 milliamps (mA).3. Understand a breadboard
Holes in the same short row (five holes, labeled a to e or f to j) are connected underneath. The long power rails along the sides are connected end to end, though on some boards the rail is split in the middle, so check with a meter. The gap in the middle separates the two halves of each row.
4. Keep the power safe
Use USB or a small battery pack of AA cells. Never connect a project to a wall outlet or open a device that is plugged in. Do not short a battery by touching its two ends with a wire, because it can get hot fast. Treat lithium polymer packs as a separate topic and follow the maker's instructions.
5. Wire with power off
Plug in the battery last, and unplug it first. Look at the circuit before you connect power.
Worked example: a resistor for an LED
An LED does not limit its own current. Once the voltage across it passes a threshold, called the forward voltage, current rises steeply, so you must add a resistor in series. For this example, take a red LED with a forward voltage of about 2.0 V (check your LED's datasheet), a 5 V supply and a target current of 10 mA, which is a comfortable brightness for many small LEDs.
- The resistor has to drop the rest of the voltage:
5.0 V − 2.0 V = 3.0 V. - Use Ohm's law with 10 mA = 0.010 A:
R = V ÷ I = 3.0 ÷ 0.010 = 300 Ω. - 300 Ω is not a standard value, so pick the next one up from the common series, 330 Ω. Going up makes the current a little lower, which is the safe direction.
- Check the real current:
I = 3.0 ÷ 330 = 0.0091 A = 9.1 mA. That is close to the target and below it. - Check the resistor's power:
P = I² × R = 0.0091² × 330 = 0.027 W. A common quarter-watt resistor (0.25 W) handles this easily.
Now test it the other way, to see why the resistor matters. With no resistor, the only thing limiting the current is the LED's own tiny resistance and the battery, so the current can be many times what the LED can take, and it burns out. That is the one-flash story from the start.
On a breadboard, place the resistor and LED in the same row path so they are in series: supply positive to the resistor, the resistor to the LED's longer leg (the anode), and the shorter leg to ground. Resistor and LED can go in either order, because current is the same all the way around. Connect the battery last.
Measure it
A multimeter set to DC volts, placed across the resistor, should read close to 3 V. If it reads much less, the LED is dropping more than you expected, or the battery is weak. Never use the current setting of a meter on a supply you have not thought through, because it acts like a wire.
If something goes wrong
- The LED does not light. Try flipping it. LEDs conduct in one direction only.
- The LED is dim. The resistor may be too large, or the battery may be low. Re-check the color bands or measure it.
- Something feels hot. Disconnect the battery, wait for it to cool and look for a short.
- Nothing on the breadboard works. Check that you did not bridge the center gap, and that the rails are connected where you think.
- You cannot read the resistor bands. Measure it with the meter's resistance setting, with the resistor out of the circuit.
Keep it going
Repeat the calculation with a different supply, say 3.3 V, and see how the resistor changes. Then move on to a push button and a coding path, and learn soldering when you want your circuit to last. If a datasheet table is confusing, DuckyHelper can look at it on your screen and talk it through, and you should still check the numbers with your own calculation.
Frequently asked questions
- Why not use a bigger resistor to be safe?
- A bigger resistor makes the LED dimmer. Too large and it will not light at all. Use the calculation to pick a value close to what you need.
- Does the order of the resistor and LED matter?
- No. In a series circuit the same current passes through both, so either order gives the same result.