← All projects
Basics Beginner

Breadboard and an LED: Without Burning the LED or the ESP32

How a breadboard is wired inside, why an LED needs a resistor and how to size it. We build the first circuit GPIO → resistor → LED → GND and look at how much current an ESP32 pin can give.

Difficulty
Beginner
Time
20 min
Category
Basics
Updated

About the project

A breadboard lets you build circuits without a soldering iron: parts simply plug into its holes. In this lesson we connect an external LED to the ESP32 and sort out two things almost every beginner trips over: how the breadboard holes are connected, and why the LED needs a resistor.

What you need

  • ESP32 DevKit
  • Breadboard (half-size or full-size)
  • 5 mm LED (any colour)
  • 220 Ω resistor (red-red-brown)
  • Male-to-male jumper wires

How a breadboard is connected

  • Terminal strips. Every short column of five holes (a–e, and separately f–j) is connected inside. A part plugged into column 5 is connected to everything else in column 5 of the same half.
  • Power rails along the edges (red "+" and blue "−") run the full length. On some large breadboards the rail is split in the middle, so check with a multimeter.
  • Never put both legs of one part into the same column: they would be shorted together.

Wiring

GPIO26 ── col 5 ──[ 220 Ω ]── col 9 ──▶|── col 10 ── "−" rail ── GND
                              (anode, long leg)  (cathode, short)
  1. Jumper from GPIO26 to column 5.
  2. 220 Ω resistor from column 5 to column 9.
  3. LED: long leg (anode) in column 9, short leg (cathode) in column 10.
  4. Jumper from column 10 to the "−" rail.
  5. Jumper from the ESP32 GND to the same "−" rail.

Why the resistor

An LED is not a light bulb. Once the voltage passes its turn-on point (~2 V for red and green, ~3 V for blue and white), its resistance drops sharply, and only whatever sits in series limits the current. Without a resistor only the pin's internal resistance does. That means tens of milliamps, and either the LED or the ESP32 output dies.

The calculation is Ohm's law:

R = (3.3 V − V(LED)) / I = (3.3 − 2.0) / 0.006 ≈ 220 Ω → ~6 mA.

The recommended current per ESP32 pin is up to 20 mA, the absolute maximum is 40 mA. 5–10 mA is plenty for a bright indicator.

Code

// External LED on GPIO26 through a 220 Ω resistor
const int LED_PIN = 26;

void setup() {
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_PIN, HIGH);   // long flash
  delay(700);
  digitalWrite(LED_PIN, LOW);
  delay(300);
}

Experiments in the simulator

  • Change the resistor to 10 Ω: the LED "burns out", and the simulator shows the current and the overloaded pin.
  • Remove the resistor entirely by putting a jumper in its place.
  • Turn the LED around: in reverse it does not light.
  • Try 1 kΩ: it is dimmer, but often enough for an indicator in a dark room.

What next

Add a button to switch the LED by hand, or a potentiometer to change its brightness smoothly with PWM.