Breadboard, LEDs, Resistors & Buttons
By the end of this lesson you will be able to place parts on a breadboard correctly, find the positive leg of an LED, read a resistor's value from its colour bands, and understand how buttons and potentiometers are wired inside. You will finish by building your first LED circuit.
These five parts appear in almost every project in this course, so a few minutes here will save hours of confusion later.
The breadboard
A breadboard is a plastic board full of holes that lets you build circuits without soldering. Under the holes are metal strips that connect certain holes together. Once you know the pattern, you can read any circuit.
Think of a breadboard as a housing society. Each short row is one small house where everyone shares the same kitchen: anything plugged into that row is connected. The long lines at the edges are the main water pipelines that run past every house.
| Area | How the holes are connected | Used for |
|---|---|---|
| Terminal strips (the middle) | Each short row of 5 holes (a to e, or f to j) is connected | Part legs and wires |
| Centre gap | Nothing crosses it | Separating the two sides of a chip or button |
| Power rails (the long lines at the edges) | Each long line is connected along its length | 5V (red line, +) and GND (blue line, -) |
Two facts catch every beginner:
- The two halves of each row (a to e and f to j) are not connected to each other. The centre gap separates them.
- On some long breadboards, the power rails are split in the middle. If the far half of your circuit is dead, add a short jumper across the split.
Jumper wires are short wires with pins on the ends. Male-to-male wires go from the Arduino header to the breadboard. Use red for 5V or 3.3V and black for GND, so you can check your wiring at a glance.
LEDs
An LED (light-emitting diode) gives light when current flows through it in the right direction. A diode is a part that lets current flow one way only, like a one-way gate at a metro station.
An LED has two legs:
| Leg | Name | How to spot it | Connects towards |
|---|---|---|---|
| Longer leg | Anode (+) | Longer; the rim of the LED body is round on this side | The positive supply or the Arduino pin |
| Shorter leg | Cathode (-) | Shorter; the rim of the LED body is flat on this side | GND |
If you put an LED in backwards, it simply stays off. That does not damage it at 5 V. But an LED with no resistor takes too much current and can burn out, and it can damage the Arduino pin driving it. Every LED needs a resistor in series, as you calculated in Ohm's Law & Power.
Resistors and colour bands
Resistors have no polarity: either way round works. Their value is printed as coloured bands. On the common 4-band resistor:
- Band 1: first digit.
- Band 2: second digit.
- Band 3: multiplier, the number of zeros to add.
- Band 4: tolerance, how accurate it is (gold means within 5%).
| Colour | Digit | Colour | Digit |
|---|---|---|---|
| Black | 0 | Green | 5 |
| Brown | 1 | Blue | 6 |
| Red | 2 | Violet | 7 |
| Orange | 3 | Grey | 8 |
| Yellow | 4 | White | 9 |
A popular memory line is "BB ROY of Great Britain had a Very Good Wife": black, brown, red, orange, yellow, green, blue, violet, grey, white. Hold the resistor so the gold band is on the right, then read from the left.
Here is the rule as a small Python program. You can run it on your computer to check resistors from your kit:
# Decode a 4-band resistor: digit, digit, multiplier, tolerance
DIGITS = ["black", "brown", "red", "orange", "yellow",
"green", "blue", "violet", "grey", "white"]
def decode(band1, band2, band3):
value = (DIGITS.index(band1) * 10 + DIGITS.index(band2)) * 10 ** DIGITS.index(band3)
if value >= 1000:
return f"{value / 1000:g} kΩ"
return f"{value} Ω"
print(decode("red", "red", "brown")) # 22 x 10
print(decode("yellow", "violet", "brown")) # 47 x 10
print(decode("brown", "black", "red")) # 10 x 100
print(decode("brown", "black", "orange")) # 10 x 1000220 Ω 470 Ω 1 kΩ 10 kΩ
Colours can be hard to see in yellow tube light, and some resistors have 5 bands. When in doubt, measure with a multimeter on the Ω setting.
Push buttons
A push button (tactile switch) connects two points only while you press it. The common 4-leg breadboard button looks confusing, but inside it is simple: the legs come in two pairs that are always connected, and pressing the button joins the pairs.
Place the button so it straddles the centre gap. Then the two legs on the left side and the two legs on the right side sit in different rows, and the button connects those rows only while pressed. If a button seems "always pressed", it is probably rotated 90 degrees. Turn it a quarter turn.
You will read buttons with code in Digital Input & Buttons.
Potentiometers
A potentiometer (often called a "pot") is a resistor with a knob. It has three legs:
- The two outer legs connect to the ends of a resistive track. Connect one to 5V and the other to GND.
- The middle leg, the wiper, slides along the track as you turn the knob.
Together they form an adjustable voltage divider. The middle leg gives anything from 0 V to 5 V depending on the knob position, like the volume knob on an old radio. You will read it in Analog Input & Potentiometers.
Build it: your first LED circuit
This circuit needs no code. The Arduino only provides 5 V power, like a battery.
| Part | Pin or leg | Connects to |
|---|---|---|
| Arduino | 5V | Breadboard + rail |
| Arduino | GND | Breadboard - rail |
| 470 Ω resistor | Leg 1 | Breadboard + rail |
| 470 Ω resistor | Leg 2 | Row 10, column a |
| Red LED | Anode (long leg) | Row 10, column e |
| Red LED | Cathode (short leg) | Row 11, column e |
| Jumper wire | One end | Row 11, column a |
| Jumper wire | Other end | Breadboard - rail |
- Step 1: With the USB cable unplugged, connect 5V and GND to the rails.
- Step 2: Add the resistor from the + rail to row 10.
- Step 3: Add the LED with its long leg in row 10 and its short leg in row 11.
- Step 4: Join row 11 to the - rail. Check every connection against the table.
- Step 5: Plug in the USB cable. The LED should glow steadily. If it does not, turn the LED around.
Now control it with code
Move the resistor's top leg from the + rail to a jumper wire from Arduino pin 9. Now the pin decides whether the LED gets 5 V. This tiny sketch switches it on and reports what it did. You will learn each line properly in Your First Sketch.
const int LED_PIN = 9;
void setup() {
pinMode(LED_PIN, OUTPUT); // pin 9 will drive the LED
digitalWrite(LED_PIN, HIGH); // 5 V on pin 9: LED on
Serial.begin(9600);
while (!Serial && millis() < 3000) { }
Serial.print("LED on pin ");
Serial.print(LED_PIN);
Serial.println(" is ON");
}
void loop() {
}LED on pin 9 is ON
Common mistakes
- LED legs in the same row. Both legs are then connected together, so no current flows through the LED. Put the legs in different rows.
- Button not across the centre gap. It will act as if always pressed, or never.
- Forgetting the split power rail on long breadboards.
- No resistor with the LED. Always add one, even "just for a quick test".
Key points
- Breadboard rows of five holes are connected; the centre gap and the two halves are not.
- The power rails run the length of the board; some are split in the middle.
- An LED's long leg (anode) goes towards +, the short leg (cathode) towards GND, always with a series resistor.
- Resistor colour bands give digit, digit, multiplier; a multimeter confirms the value.
- Buttons straddle the centre gap; potentiometers give a variable voltage on their middle leg.
Exercise
Your kit has three resistors with these bands: orange-orange-brown, blue-grey-brown, and yellow-violet-red. Use the colour table to work out each value by hand, then check them with the Python decoder.
Show solution
DIGITS = ["black", "brown", "red", "orange", "yellow",
"green", "blue", "violet", "grey", "white"]
def decode(band1, band2, band3):
value = (DIGITS.index(band1) * 10 + DIGITS.index(band2)) * 10 ** DIGITS.index(band3)
if value >= 1000:
return f"{value / 1000:g} kΩ"
return f"{value} Ω"
for bands in [("orange", "orange", "brown"), ("blue", "grey", "brown"), ("yellow", "violet", "red")]:
print(", ".join(bands), "=", decode(*bands))orange, orange, brown = 330 Ω blue, grey, brown = 680 Ω yellow, violet, red = 4.7 kΩ
Orange-orange is 33, and brown adds one zero: 330 Ω. Yellow-violet is 47, and red adds two zeros: 4,700 Ω, which is 4.7 kΩ.
Quick Quiz
1. Which holes on a breadboard are connected together?
Each short row of five is one connected strip. The centre gap separates the two halves.
2. Which LED leg connects towards GND?
The cathode is the shorter leg on the flat side of the rim. It goes towards GND.
3. What value is a resistor with bands brown, black, red?
Brown-black is 10, and red adds two zeros: 1,000 Ω.
4. What does the middle leg of a potentiometer give?
The wiper slides along the track, so the middle leg gives a variable voltage between the two ends.
Learn IoT & Arduino with a mentor
Free lessons get you started. Our IoT & Embedded Systems training adds real projects and code reviews from working developers.
- Project-based learning
- Mentor code reviews
- Free counselling call
