Projects / Button and LED wiring fault hunt

Button and LED wiring fault hunt

Beginner50 minGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANO8.7 mA

    Wire the working circuit

    Button to D2 and GND, LED with 220 ohms on D8.

  2. NANO8.7 mA

    Upload and test

    The LED lights while you press and the monitor shows 0.

  3. NANO

    Look away while the helper plants a fault

    Something stops working.

  4. NANO

    Open the serial monitor and press

    Does the value change to 0?

  5. NANO8.8 mA

    Decide which half is at fault

    Button side or LED side.

  6. NANO

    Fix and repeat

    Write the checklist as you go.

In short

How do you build a button and LED wiring fault hunt?

A Nano sketch is right but the board does nothing useful once a helper plants wiring faults: the LED reversed, the button with no ground and one wire one hole off. Print the pin value to the serial monitor and use a jumper to find each fault. You need Arduino Nano, Tactile push button 6 mm, LED 5 mm red, Resistor 220 Ω, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 50 minutes.

Level
Beginner
Time
About 50 min
Parts
6

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Button leg 1Nano D2Button input
Button leg 2Nano GNDPressing connects D2 to ground
LED long legNano D8 through a 220 ohm resistorLED output
LED short legNano GNDReturn path

Code

The sketch uses the Nano's internal pull-up, so the button pin reads 1 when idle and 0 while the button joins it to ground, and the LED should light while you press. Build it working first. Then ask a helper to plant one fault at a time while you look away. Safe faults are turning the LED round, lifting the button's ground wire, and moving the button wire one hole along the breadboard. The code never changes, so the serial monitor tells you which half is at fault. If the printed value never changes to 0 when you press, the problem is on the button side. If it changes to 0 but the LED stays dark, the problem is on the LED side, and touching the LED's resistor end briefly to 5 volts through the resistor shows whether the LED itself works. Fix each fault and then write a short checklist of what to check first next time.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

const uint8_t BUTTON_PIN = 2;
const uint8_t LED_PIN = 8;

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);   // reads 1 when idle, 0 when pressed
  pinMode(LED_PIN, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int value = digitalRead(BUTTON_PIN);
  digitalWrite(LED_PIN, value == LOW ? HIGH : LOW);   // LED on while pressed
  Serial.print("Button pin reads ");
  Serial.println(value);
  delay(200);
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

Button pin reads 1

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Working circuitLED lights while pressed, monitor shows 1 then 0
LED reversedThe monitor changes to 0 but the LED stays dark
Button ground liftedThe monitor stays at 1 when you press
Button wire one hole offThe monitor stays at 1
Checklist writtenIt lists power, ground, pin, then part

If it does not work

Nothing prints

Set 9600 baud in the serial monitor.

Upload fails

Choose the Old Bootloader option and the right port.

LED always on

Check the LED wire is not on 5V.

Monitor always 0

The button leg may be shorted to ground.

Wires keep falling out

Push them in firmly.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the button and LED wiring fault hunt?

Arduino Nano, Tactile push button 6 mm, LED 5 mm red, Resistor 220 Ω, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).

How long does the button and LED wiring fault hunt take to build?

About 50 minutes for a beginner maker, in 6 steps.

How do I know the button and LED wiring fault hunt works?

Working circuit: LED lights while pressed, monitor shows 1 then 0. LED reversed: The monitor changes to 0 but the LED stays dark. Button ground lifted: The monitor stays at 1 when you press.

Nothing prints: what should I check?

Set 9600 baud in the serial monitor.

Upload fails: what should I check?

Choose the Old Bootloader option and the right port.

LED always on: what should I check?

Check the LED wire is not on 5V.

Monitor always 0: what should I check?

The button leg may be shorted to ground.