Home / Reference

ESP32 pinout: which pins are safe to use (ESP32-DevKitC)

An ESP32 development board with two rows of 19 pins, the metal-shielded module and antenna at the top and the USB socket at the bottom
Beginner

The ESP32 is the favourite chip for Wi-Fi and Bluetooth projects, but its pins come with more catches than most boards. Some are wired to the flash memory, some decide how the chip boots, some are input only, and one whole bank of analogue inputs stops working when Wi-Fi is on. This page covers Espressif's own ESP32-DevKitC V4 board with the original ESP32 chip, and the rules apply to most ESP32 boards built on the same chip.

Logic level: 3.3 V. The ESP32's pins work at 3.3 V. Don't connect 5 V signals directly. Use a level shifter or a voltage divider for slow signals.

The pins

The board has two 19-pin headers, J2 and J3. Pin 1 of each is at the antenna end, away from the USB socket. Each row of the table shows the two pins opposite each other across the board.

Power Ground GPIO / signal Control

J2 notesFunctionPinPinFunctionJ3 notes
3.3 V in or out3V311GND
Reset when pulled lowEN22GPIO23SPI MOSI (Arduino default)
VP. Input only. ADC1_0GPIO3633GPIO22I²C SCL (Arduino default)
VN. Input only. ADC1_3GPIO3944GPIO1TX0: USB serial
Input only. ADC1_6GPIO3455GPIO3RX0: USB serial
Input only. ADC1_7GPIO3566GPIO21I²C SDA (Arduino default)
ADC1_4, touch 9GPIO3277GND
ADC1_5, touch 8GPIO3388GPIO19SPI MISO (Arduino default)
DAC 1, ADC2_8GPIO2599GPIO18SPI SCK (Arduino default)
DAC 2, ADC2_9GPIO261010GPIO5Strapping. SPI SS (Arduino default)
ADC2_7, touch 7GPIO271111GPIO17WROOM and SOLO modules only
ADC2_6, touch 6GPIO141212GPIO16WROOM and SOLO modules only
Strapping (MTDI): keep low at boot. ADC2_5GPIO121313GPIO4ADC2_0, touch 0
GND1414GPIO0Strapping: BOOT button. ADC2_1
ADC2_4, touch 4GPIO131515GPIO2Strapping: low or floating for flashing. ADC2_2
Don't use: SPI flashFLASH GPIO91616GPIO15Strapping (MTDO). ADC2_3
Don't use: SPI flashFLASH GPIO101717FLASH GPIO8Don't use: SPI flash
Don't use: SPI flashFLASH GPIO111818FLASH GPIO7Don't use: SPI flash
5 V in (or USB 5 V)5V1919FLASH GPIO6Don't use: SPI flash

The flash pins are shaded like ground pins because you should treat them as unusable. The "Arduino default" notes are the defaults in Espressif's Arduino core. Almost any output-capable GPIO can be used for I²C, SPI, UART or PWM through the chip's pin matrix.

Pins to avoid or use with care

  • GPIO6 to GPIO11 connect to the module's SPI flash memory. Using them will crash the board. Espressif says to avoid them.
  • Strapping pins: GPIO0, GPIO2, GPIO5, GPIO12 and GPIO15. The chip reads these at reset to decide how to start. GPIO0 low selects download mode, which is what the BOOT button does. GPIO2 must be low or floating to flash new code. GPIO12 must be low at power-up on modules with 3.3 V flash, such as the ESP32-WROOM-32, or the chip sets its flash voltage to 1.8 V and won't boot. GPIO15 low at boot silences the boot messages. They're fine to use after boot, as long as whatever you connect doesn't hold them at the wrong level during reset.
  • GPIO34 to GPIO39 are input only and have no internal pull-up or pull-down resistors. Use them for sensors and buttons with an external resistor.
  • ADC2 doesn't work while Wi-Fi is on. Espressif's documentation says ADC2 pins can't be used when Wi-Fi is in use. For analogue readings in a Wi-Fi project, use the ADC1 pins: GPIO32 to GPIO39.
  • GPIO1 and GPIO3 are the serial port to the USB chip, used for uploading code and the serial monitor.
  • GPIO16 and GPIO17 are only available on boards with WROOM or SOLO modules. On WROVER modules they connect to the extra PSRAM.

That leaves a comfortable set of general-purpose pins: GPIO4, 13, 14, 16 to 19, 21 to 23, 25 to 27, 32 and 33, plus the input-only pins.

Powering the board

Espressif lists three ways to power the DevKitC: the USB socket, the 5V and GND pins, or the 3V3 and GND pins. Use only one at a time. Connecting more than one can damage the board or your power source. The module's datasheet asks for a supply that can deliver at least 500 mA, because Wi-Fi transmissions draw short bursts of current, though the average is far lower. Weak USB cables and hubs are a common cause of random resets.

Current limits

The ESP32-WROOM-32 datasheet gives typical figures at maximum drive strength of about 40 mA sourced and 28 mA sunk per pin. Those are typical maximums, not a comfortable working current. Run LEDs at a few milliamps and switch anything bigger with a transistor. Our transistor switch simulator shows how.

Analogue: ADC and DAC

The ESP32 has two 12-bit ADCs. Its readings are less linear than many microcontrollers', especially near 0 V and the top of the range, so calibrate if accuracy matters. Our ADC guide explains why. GPIO25 and GPIO26 are 8-bit DAC outputs, handy for simple audio and test signals.

Other ESP32 chips

Newer chips such as the ESP32-S3, C3 and C6 have different pin numbers and rules. The ESP32-S3, for example, has native USB and more GPIOs. Always check the pinout for your exact board and chip.

Sources

The main references behind this guide. Numbers we worked out ourselves, such as the code outputs, come from running the code.