The Ultimate Guide to ESP32 Dev Module Pins

The Ultimate Guide to ESP32 Dev Module Pins

Updated

The ESP32 has a lot of pins, and not all of them are equal.

Some are safe for anything. Some are read at boot and can stop your board starting. Some only do input. Some are wired to the flash chip and must never be touched. Pick the wrong one and you get a board that will not boot, will not upload, or crashes at random.

This guide sorts every pin on the ESP32 Dev Module into four simple categories, then covers the special functions (touch, analog, I2C, SPI, serial) and how to choose pins for wearables and fabric projects. It follows Episode 6 of the Foundations series, Reading a Pinout Diagram.

The board used throughout is our ESP32 Development Board 30-Pin (USB-C), an ESP32-WROOM-32 dev module. The pin categories apply to every ESP32 Dev Module, including the 38-pin version. The only difference is how many of the pins are broken out to the headers.

Quick reference: the pin cheat sheet

If you remember nothing else, remember this table. Start every project from the safe pins and only move to the others when you know why.

Category GPIO Use for
Safe 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33 Anything: LEDs, buttons, sensors, fabric connections
Strapping (use with caution) 0, 2, 5, 12, 15 Avoid in prototypes. If you must, disconnect the load while uploading
Input only 34, 35, 36 (VP), 39 (VN) Sensors and analog inputs. No output, no internal pull-ups
Reserved (flash) 6, 7, 8, 9, 10, 11 Never use
USB serial 1 (TX0), 3 (RX0) Leave for uploading and the serial monitor
Touch, wearable-safe 4, 13, 14, 27, 32, 33 Conductive fabric touch pads
Analog with WiFi on (ADC1) 32, 33, 34, 35, 36, 39 Analog sensors in WiFi projects

Category 1: the safe pins

GPIO 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32 and 33.

No boot straps, no flash connection, no input-only restriction. These pins can be inputs or outputs, support internal pull-ups, and behave the way you expect. Wire LEDs, buttons, sensors and fabric connections here first.

Several of them also have a default job, which is useful to know before you plan a build:

  • I2C: SDA on 21, SCL on 22
  • SPI (VSPI): MOSI on 23, MISO on 19, CLK on 18
  • Serial 2: RX on 16, TX on 17
  • DAC (true analog output): 25 and 26

These defaults can be remapped in software for most peripherals, but staying with the defaults keeps libraries and examples working without changes.

ESP32 safe GPIO pins highlighted on the pinout

Category 2: strapping pins

GPIO 0, 2, 5, 12 and 15. Use with caution.

When the ESP32 powers up, it reads the state of these pins to decide how to boot. If something connected to a strapping pin pulls it the wrong way at that moment, the board will not start or will not accept an upload. Once the board is running they behave like normal pins, which is why they cause so much confusion: the project works, then fails after a reset.

  • GPIO 0 selects upload mode. It is tied to the BOOT button, and on most 30-pin boards it is not on the header at all.
  • GPIO 2 is often wired to the on-board LED.
  • GPIO 12 sets the flash voltage. A load holding it high at boot can stop some modules from starting.
  • GPIO 5 and 15 affect boot messages and timing.

The simple rule: avoid them in prototypes. If you must use one, disconnect the load while uploading and test a full power cycle.

ESP32 strapping pins highlighted on the pinout

Category 3: input-only pins

GPIO 34, 35, 36 (VP) and 39 (VN). Sensors only.

These pins cannot output anything. They also have no internal pull-up or pull-down resistors, so a button needs an external resistor. They are ideal for reading analog sensors, which is exactly what they are best at. Never try to drive an LED from them. The code will run, and nothing will happen.

ESP32 input-only pins highlighted on the pinout

Category 4: reserved pins

GPIO 6, 7, 8, 9, 10 and 11. Never touch.

These are connected to the flash chip that stores your program. Connect anything to them and the board crashes. Many 30-pin boards do not break them out at all, which is the safest design. If your board does expose them, treat them as if they were not there.

ESP32 reserved flash pins highlighted on the pinout

Touch pins: wire fabric straight in

This is the feature that makes the ESP32 such a good board for wearables and e-textiles. Ten pins (T0 to T9) can sense capacitance directly, so a piece of conductive fabric, thread or foil connected to the pin becomes a touch sensor with no extra components.

ESP32 capacitive touch pins highlighted on the pinout

Four of those channels sit on strapping pins (0, 2, 12 and 15). For wearables, use 4, 13, 14, 27, 32 and 33. You get six reliable touch inputs without risking your boot.

A minimal PlatformIO example that reads a fabric touch pad on GPIO 14:

// platformio.ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200

// src/main.cpp
#include <Arduino.h>

const int TOUCH_PIN = 14;   // T6
const int THRESHOLD = 30;   // tune this for your fabric

void setup() {
  Serial.begin(115200);
}

void loop() {
  int value = touchRead(TOUCH_PIN);
  Serial.println(value);
  if (value < THRESHOLD) {
    Serial.println("Touched");
  }
  delay(100);
}

On the classic ESP32, the reading drops when you touch the pad. Open the serial monitor, note the value untouched and touched, then set the threshold between the two. Different fabrics, sizes and wire lengths give different readings, so always calibrate for your own build. Our conductive fabrics are a good place to experiment.

Analog inputs: ADC1 versus ADC2

The ESP32 has two analog-to-digital converters, and this catches many people out.

  • ADC1 (GPIO 32 to 39) works at all times.
  • ADC2 (GPIO 0, 2, 4, 12 to 15, 25 to 27) cannot be used while WiFi is running.

If your project uses WiFi, read analog sensors on ADC1 pins. This is another good reason to keep 34, 35, 36 and 39 for sensors.

Pins to leave alone: GPIO 1 and 3

GPIO 1 (TX0) and GPIO 3 (RX0) are the USB serial connection. They are used for uploading code and for the serial monitor. You can use them, but your serial output will fight with whatever you connect. For beginners, treat them as reserved.

Power and voltage: three things to know

  • 3.3 V logic. The pins are not 5 V tolerant. Connecting a 5 V signal directly can damage the chip.
  • Keep the current low. Drive small loads such as an LED with a resistor directly. Use a transistor or driver for anything bigger, such as motors or long LED strips.
  • 3V3 and VIN. The 3V3 pin gives regulated power for small sensors. VIN gives you the 5 V from USB for things that need it.

30-pin versus 38-pin boards

Both boards use the same ESP32 chip, and every category above applies to both. The 38-pin board brings out a few more pins, including GPIO 0 and the reserved flash pins, which is why the cheat sheet includes them. On a 30-pin board, those are hidden, which makes it a little harder to make a mistake. Always check the silkscreen on your own board, because manufacturers vary the layout slightly.

How to choose a pin in 10 seconds

  1. Need an output or a general sensor? Choose from the safe pins.
  2. Need a fabric touch sensor? Use 4, 13, 14, 27, 32 or 33.
  3. Reading an analog sensor with WiFi on? Use 32 to 39.
  4. Reading a sensor only? Input-only pins are fine.
  5. Using a strapping pin? Disconnect it before upload and test a power cycle.
  6. Never touch 6 to 11.

Watch the full episode

Episode 6 of Foundations, Reading a Pinout Diagram, walks through the diagram step by step, so you can read any pinout and know what is safe.

Watch Foundations EP.06 on YouTube, and see the ESP32 pinout and touch pin guide for every board we sell for the S3 and C3 boards.

Get the board

Ready to try it? Pick up the ESP32 Development Board 30-Pin (USB-C), or the 38-pin version with USB-C. Need a cable? We have a USB-C data cable too.

Back to blog

Leave a comment