ESP32 LED Blink Tutorial: Circuit, Breadboard Wiring and Code
BUILD & LEARN · BEGINNER PROJECT
Make an external LED blink with your ESP32 Development Board, then change its timing with just one line of code. This small circuit teaches the essentials behind status indicators, alarms and many larger electronics projects: choosing an output pin, limiting LED current and completing a ground connection.
Project: external red LED · Board: classic ESP32-WROOM-32 development board · Time: about 20–30 minutes after software installation · Software: Arduino IDE
You will build a circuit that lights an LED for one second, switches it off for one second and repeats. No Wi-Fi account or cloud service is needed.
In this tutorial
- How the circuit works
- Components required
- Circuit schematic and connections
- Breadboard wiring
- Set up Arduino IDE
- Complete code and explanation
- Upload and expected output
- Troubleshooting and next steps
How the ESP32 LED circuit works
The ESP32 uses GPIO23 as a digital output. When the program sets it HIGH, current flows through the resistor and LED to GND. When the output is LOW, the LED turns off. The resistor limits current; it must remain in series with the LED.
For an illustrative red LED forward voltage of 2.0 V, the estimated current is (3.3 V − 2.0 V) ÷ 330 Ω ≈ 3.9 mA. Actual current depends on your LED and the output voltage. A ¼ W resistor has ample power margin for this small circuit. Check your LED's datasheet if using a different type.
Components required
| Component | Specification | Quantity |
|---|---|---|
| ESP32 Development Board | Classic ESP32-WROOM-32 board with GPIO23 exposed | 1 |
| Red LED (1,000-piece bulk pack) | Standard low-current indicator LED, 3 mm or 5 mm | 1 |
| 330 Ω resistor (10-piece pack) | 330 Ω, ¼ W | 1 |
| Solderless breadboard | Standard a–e / f–j terminal strips | 1 |
| Male-to-female jumper wires (40-piece pack) | Suitable for your board headers and breadboard | 2 |
| USB data cable | Connector matching your development board | 1 |
Linked component names go to matching Anu Electronics products. The quantities in the table are the number needed for this circuit; the linked LEDs, resistors and jumper wires are sold in packs. Use female-to-male wires between the board's male headers and the breadboard. This pin assignment is for the classic ESP32, and should not be assumed to apply to ESP32-C3, S2 or S3 boards.
Prefer one box instead of separate parts?
The IoT Smart Starter Kit bundles an ESP32 board, a solderless breadboard, sensors and components, so you can build this project and move straight on to sensor and IoT projects.
Circuit schematic and pin connections
Disconnect USB before wiring. Power the development board through its USB connector after checking the circuit. ESP32 GPIO uses 3.3 V logic; do not connect a 5 V supply to GPIO23.

| From | To |
|---|---|
| ESP32 GPIO23 | One end of the 330 Ω resistor |
| Other resistor end | LED anode A (+) |
| LED cathode K (−) | ESP32 GND |
On many new through-hole LEDs, the longer leg is the anode and the shorter leg is the cathode. A flat edge on the body commonly marks the cathode. If the legs have been trimmed or the package differs, confirm polarity from its datasheet.
Breadboard wiring, step by step

- Find the pins marked 23 (GPIO23) and GND on the board.
- Connect GPIO23 to breadboard hole a2, using the yellow wire shown.
- Insert the resistor between b2 and b4. Resistors have no polarity.
- Insert the LED anode in d4 and its cathode in d6. Gently bend the leads to fit; keep the metal leads from touching.
- Connect a6 to ESP32 GND using the ground wire.
- Check that the LED legs are in different numbered rows. On a standard breadboard, a–e share a connection within each row, while f–j form a separate group across the centre gap.
Your breadboard may have more rows than the simplified drawing. The same three-node arrangement still applies: GPIO23/resistor, resistor/anode, and cathode/GND.
Set up Arduino IDE
- Install Arduino IDE from Arduino's official website.
- In Preferences, add this stable ESP32 package URL to Additional Boards Manager URLs:
https://espressif.github.io/arduino-esp32/package_esp32_index.json - Open Boards Manager and install esp32 by Espressif Systems.
- Select the board profile matching your classic ESP32 development board. For a generic ESP32-WROOM DevKit without a dedicated profile, use ESP32 Dev Module.
- Connect the board with a USB data cable and select its port. No extra sensor libraries are needed.
See Espressif's installation guide for package setup and platform-specific details.
Complete ESP32 LED blink code
Create a new sketch, replace its contents with the following program and save it as esp32_led_blink.ino.
// Anu Electronics: external red LED on a classic ESP32-WROOM board.
// GPIO23 -> 330 ohm resistor -> LED anode; LED cathode -> GND.
#include <Arduino.h>
constexpr uint8_t LED_PIN = 23;
constexpr unsigned long BLINK_INTERVAL_MS = 1000;
void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
}
void loop() {
digitalWrite(LED_PIN, HIGH);
delay(BLINK_INTERVAL_MS);
digitalWrite(LED_PIN, LOW);
delay(BLINK_INTERVAL_MS);
}
Download the complete code as a text file; copy it into Arduino IDE or save it with the .ino extension.
What the code does
-
LED_PIN = 23matches the GPIO23 connection in both diagrams. -
setup()runs once and configures that pin as an output, initially LOW. -
loop()repeatedly sets the pin HIGH, waits 1000 milliseconds, then sets it LOW and waits again. -
BLINK_INTERVAL_MScontrols both phases. Change 1000 to 250 for faster blinking.
The GPIO calls follow Espressif's Arduino GPIO documentation. delay() is easy to understand here, but pauses execution of the sketch's next instructions. For a later project that must handle buttons or sensors continuously, use timing based on millis().
Upload and check the output
- Click Verify in Arduino IDE and resolve any compile errors.
- Confirm the board and port, then click Upload.
- If uploading remains at “Connecting…”, hold the board's BOOT button briefly while the upload begins, then release it.
- After upload, the external red LED should turn on for roughly one second and off for roughly one second. Press EN/RESET once if needed.

A full blink cycle takes about two seconds, so the frequency is approximately 0.5 Hz. The board's power LED may remain on throughout; watch the external LED connected to GPIO23.
Validation note: Connections and GPIO calls have been reviewed against the referenced documentation. This sample has not been compiled with the ESP32 toolchain or tested on physical hardware.
Troubleshooting
| Symptom | What to check |
|---|---|
| LED never lights | Disconnect USB, check LED polarity, confirm GPIO23 and GND, and ensure the resistor is 330 Ω rather than 330 kΩ. |
| LED stays on | Confirm the signal wire is on GPIO23 rather than 3V3. Check that the updated sketch uploaded successfully. |
| No board port appears | Try a known USB data cable and another USB port. If a driver is needed, identify the board's USB-to-serial chip and get its driver from the manufacturer. |
| Upload fails | Check the selected board and port, close other programs using that port, and try the BOOT-button procedure. |
| Board gets hot or resets repeatedly | Unplug it and inspect for short circuits before reconnecting. |
Frequently asked questions
Can I skip the resistor?
No. Keep the 330 Ω resistor in series to limit current through the LED and GPIO.
Can I use the onboard LED?
Onboard LED wiring differs between boards. This tutorial uses an external LED so its pin and connections are explicit.
Can I use another LED colour?
Check its forward voltage first. Some LEDs need more voltage than this circuit provides for useful brightness. A standard red indicator LED is the intended starting point.
Build the next version
Try a 250 ms interval, then return to 1000 ms. Once the basic circuit works, add a button in a separate project and use it to control the LED.
Start with the Anu Electronics ESP32 Development Board, or get the IoT Smart Starter Kit with ESP32 to keep building with sensors. To learn more about the board, read our introduction to ESP32.