Set up the ESP32 in the Arduino IDE

Add ESP32 support to the Arduino IDE, upload your first sketch to the ESP32-DevKitC and blink an LED.
  • Level:Beginner
  • Duration: 40 min
  • Ages 12+
  • Platform: ESP32

What you'll need

Set up the ESP32 in the Arduino IDE – EEMENTOR STEM lesson

The ESP32 is a powerful microcontroller with built-in Wi-Fi and Bluetooth. You program it with the same Arduino IDE as the UNO, after adding the ESP32 board package.

What you'll learn

  • How to add the ESP32 board package to the Arduino IDE
  • How to select the board and port
  • Which ESP32 pins are safe to use for your first projects

What you need

  • ESP32-DevKitC V4 board and USB cable
  • Breadboard
  • 1 LED
  • 1 resistor, 220 Ω
  • 2 jumper wires

Step 1: Add the ESP32 board package

  1. Install the Arduino IDE from arduino.cc/en/software if you haven't already.
  2. Open File → Preferences (on a Mac: Arduino IDE → Settings).
  3. In Additional boards manager URLs, paste: https://espressif.github.io/arduino-esp32/package_esp32_index.json
  4. Open Tools → Board → Boards Manager, search for esp32 and install esp32 by Espressif Systems.
  5. Choose Tools → Board → esp32 → ESP32 Dev Module, then select the port under Tools → Port.

If no port appears, install the USB driver for the chip on your board (CP210x or CH340, printed near the USB socket) and reconnect it.

Step 2: Wire the LED

The ESP32 board is too wide to leave free holes on a single breadboard. Plug it into the ESP32 expansion board included in the kit, or place it next to the breadboard, and connect the pins with jumper wires as in the diagram.

Breadboard wiring diagram: Set up the ESP32 in the Arduino IDE
Breadboard view. Check each connection against the wiring table below.
From To
ESP32 GPIO 26 Resistor, then the LED's long leg
LED short leg ESP32 GND

Step 3: Upload

const int LED_PIN = 26;

void setup() {
  Serial.begin(115200);
  pinMode(LED_PIN, OUTPUT);
  Serial.println("ESP32 is running!");
}

void loop() {
  digitalWrite(LED_PIN, HIGH);
  delay(500);
  digitalWrite(LED_PIN, LOW);
  delay(500);
}

Click Upload. Open the Serial Monitor at 115200 baud and press the board's EN button to see the welcome message.

Good to know: ESP32 pins

  • ESP32 pins work at 3.3 V, not 5 V. Never connect a 5 V signal directly to a GPIO pin.
  • GPIO 0, 2, 5, 12 and 15 affect how the board starts up. Avoid them for your first projects.
  • GPIO 34 to 39 are inputs only.
  • Good general-purpose pins: 4, 13, 14, 16 to 19, 21 to 23, 25 to 27, 32 and 33.

Try this next

  • Print a counter to the Serial Monitor every time the LED turns on.
  • Make the LED fade with analogWrite(LED_PIN, value) in a loop from 0 to 255 (needs a recent ESP32 board package).

Troubleshooting

  • "Failed to connect to ESP32": hold the BOOT button while the IDE shows "Connecting…", then release it.
  • Garbled text in the Serial Monitor: set the speed to 115200 baud.

Build it yourself

Everything used in this lesson comes in one kit, with parts tested by our engineers.

ESP32 IoT Starter Kit | Arduino IDE Compatible | Free Tutorials $49.00

Shop the kit