Breadboard and wiring
Most "my code is wrong" problems with the Arduino are actually wiring. This page explains how a breadboard connects things and how to check a circuit.
How a breadboard is connected inside
+ + + + + + + + + + + + <- power rail: the whole row is connected
- - - - - - - - - - - - <- ground rail: the whole row is connected
a b c d e f g h i j
o-o-o-o-o o-o-o-o-o 1 <- each row of 5 (a-e) is connected
o-o-o-o-o o-o-o-o-o 2 a-e and f-j are NOT connected to each other
o-o-o-o-o o-o-o-o-o 3 (the gap in the middle separates them)
- The 5 holes a–e in one numbered row are connected. So are f–j. The middle gap separates the two halves.
- The long + and − rails along the edges are connected along their length.
- On many long breadboards the rails are split in the middle (look for a gap in the red/blue line). Power on the left half does not reach the right half until you bridge it with a wire.
Power rails
Connect the Uno's 5V to a + rail and GND to a − rail once, then take power for every component from the rails. That keeps wires short and tidy.
Every part must share GND with the Arduino. A sensor powered from somewhere else with no common ground gives random readings.
Components that only work one way round
| Part | Which way |
|---|---|
| LED | Long leg (+, anode) toward the pin/5V, short leg (flat side of the rim) toward GND |
| Push button (4 legs) | Legs on the same side are always connected; the button connects one side to the other. Place it across the middle gap. |
| Electrolytic capacitor | The stripe marks the − leg |
| Grove modules | Grove cable only fits one way |
Grove cable colours
| Colour | Wire |
|---|---|
| Red | VCC (5V) |
| Black | GND |
| Yellow | Signal (SIG). On I2C modules: SCL |
| White | Second signal or not used. On I2C modules: SDA |
For the Grove LCD (I2C): yellow → A5 (SCL), white → A4 (SDA).
Resistor colour codes you will meet
| Value | Bands |
|---|---|
| 220 Ω | red, red, brown |
| 330 Ω | orange, orange, brown |
| 1 kΩ | brown, black, red |
| 10 kΩ | brown, black, orange |
(followed by gold for ±5%). An LED always needs a resistor of about 220–330 Ω in series.
Checking a circuit
- Unplug the USB before changing wires.
- Follow each wire with your finger from the Arduino pin to the part. Say out loud where it goes.
- Check the part sits in different rows for each leg (an LED with both legs in the same row is shorted).
- Check the pin number in the code matches the pin the wire is in.
- Test the part on its own with the simplest sketch (blink, or the library example).
- Swap the jumper wire: broken jumpers are common.
Danger signs
Unplug the USB immediately if:
- the Uno's power LED goes off or dims when you plug something in,
- a part gets hot,
- the PC says "USB device has malfunctioned" / "power surge on the USB port".
These mean a short circuit: usually 5V wired straight to GND, often through a misplaced jumper on the rails.