TINKER PiEDESIGN IN INDIA

Why LEDs need a resistorTinkerPieCircuit tutorial 14 of 24 · Beginner · 10 minutes

See what happens when an LED is connected without a resistor, and fix it. Learn about current and safe circuits.

Open this circuit in TinkerPieCircuit (free, runs in your browser)

What you will learn

Parts

TinkerPie V1 board1 LED1 resistor, 220 Ω (for the fix)

Steps

  1. Build the unsafe circuit

    Wire S1 straight to the LED (+) and the LED (−) to GND. No resistor!

  2. Predict

    Ask: what will happen? An LED has almost no resistance when it is on, so a lot of current will flow.

  3. Press Start

    The program turns S1 on. The LED shows a ✕ and the warning says it burnt out. In real life it would be ruined.

  4. Fix it

    Press ■ Stop. Remove the wire from S1 to the LED. Add a 220 Ω resistor between S1 and the LED (+).

  5. Run again

    Press ▶ Start. The LED now glows safely. Hover a pin while running to see its voltage.

The code

function setup() {
  pinMode(S1, OUTPUT);
  digitalWrite(S1, HIGH);
}

function loop() {
}

Copy this into the Code tab. It is Arduino-style JavaScript. The real board uses the same pin names (S1, P10…) in TinkerPie Studio.

How it works

Current = (3.3 V − LED voltage) ÷ resistance. With 220 Ω that is about 6 mA for a red LED, which is safe and bright. With nothing in the way, the current is around 40 mA or more.

Challenge: Try 1 kΩ and 10 kΩ resistors. What happens to the brightness? Which value gives about 5 mA?

← Play a melody with a buzzer · All 24 circuit tutorials · Traffic light →