electrician.wiki

Boards and modules

ESP32 pinout and pin diagram

Pin diagrams for the official ESP32-DevKitC V4 and the 30-pin DOIT DevKit V1: which GPIO are safe to use, which are input-only, and which will stop the board booting.

Safe for input and output

GPIO4 · GPIO13 · GPIO14 · GPIO16 · GPIO17 · GPIO18 · GPIO19 · GPIO21 · GPIO22 · GPIO23 · GPIO25 · GPIO26 · GPIO27 · GPIO32 · GPIO33

Input only (no pull-ups)

GPIO34 · GPIO35 · GPIO36 · GPIO39

Use with care

GPIO0 · GPIO2 · GPIO5 · GPIO12 · GPIO15 strapping

GPIO1 · GPIO3 USB serial

Never use

GPIO6 · GPIO7 · GPIO8 · GPIO9 · GPIO10 · GPIO11 internal flash

3V3 EN VP VN GPIO34 GPIO35 GPIO32 GPIO33 GPIO25 GPIO26 GPIO27 GPIO14 GPIO12 GND GPIO13 D2 D3 CMD 5V GND GPIO23 GPIO22 TX RX GPIO21 GND GPIO19 GPIO18 GPIO5 GPIO17 GPIO16 GPIO4 GPIO0 GPIO2 GPIO15 D1 D0 CLK J2-1J2-2J2-3J2-4J2-5J2-6J2-7J2-8J2-9J2-10J2-11J2-12J2-13J2-14J2-15J2-16J2-17J2-18J2-19J3-1J3-2J3-3J3-4J3-5J3-6J3-7J3-8J3-9J3-10J3-11J3-12J3-13J3-14J3-15J3-16J3-17J3-18J3-19

ESP32-DevKitC V4 (official Espressif board, 38 pins: headers J2 and J3)

PowerConfigurationAnalogDigital I/OGroundSpecialData

Tap or hover any pin to see what it does.

ESP32 development boards bring out most of the chip’s GPIO, but not every pin is free to use. GPIO6 to 11 belong to the on-board flash, GPIO34 to 39 are input-only, and five strapping pins (0, 2, 5, 12, 15) are read at reset to choose the boot mode, so wiring them carelessly can stop the board from starting.

The first tab of the pin diagram is Espressif’s official 38-pin ESP32-DevKitC V4. The second is the widely sold 30-pin “DOIT DevKit V1” layout, which Espressif doesn’t publish; clones vary, so check the silkscreen on your board. Tap any pin to see all of its functions.

ESP32-DevKitC V4 (official Espressif board, 38 pins: headers J2 and J3): every pin

PinNameFunction
J2-13V33.3 V rail (output from the on-board LDO, or a 3.3 V input)Power the board from exactly one source: micro-USB, the 5V pin, or the 3V3 pin.
J2-2ENCHIP_PU - chip enable / reset (high = run)Pulled up on the board and wired to the EN (reset) button. Never leave CHIP_PU floating on a bare module.
J2-3VP (GPIO36)ADC1_CH0; RTC_GPIO0 (usable in deep sleep / ULP); SENSOR_VP (label VP)Input only: cannot drive an output and has no internal pull-up or pull-down. Good for analog with Wi-Fi (ADC1). Avoid using its interrupt while the ADC or Wi-Fi/Bluetooth with sleep is active (ESP32 errata 3.11).
J2-4VN (GPIO39)ADC1_CH3; RTC_GPIO3 (usable in deep sleep / ULP); SENSOR_VN (label VN)Input only: cannot drive an output and has no internal pull-up or pull-down. Good for analog with Wi-Fi (ADC1). Avoid using its interrupt while the ADC or Wi-Fi/Bluetooth with sleep is active (ESP32 errata 3.11).
J2-5GPIO34ADC1_CH6; RTC_GPIO4 (usable in deep sleep / ULP); VDET_1Input only: cannot drive an output and has no internal pull-up or pull-down. Good for analog with Wi-Fi (ADC1).
J2-6GPIO35ADC1_CH7; RTC_GPIO5 (usable in deep sleep / ULP); VDET_2Input only: cannot drive an output and has no internal pull-up or pull-down. Good for analog with Wi-Fi (ADC1).
J2-7GPIO32ADC1_CH4; Capacitive touch TOUCH9 (T9); RTC_GPIO9 (usable in deep sleep / ULP); 32K_XP - 32.768 kHz crystal input
J2-8GPIO33ADC1_CH5; Capacitive touch TOUCH8 (T8); RTC_GPIO8 (usable in deep sleep / ULP); 32K_XN - 32.768 kHz crystal output
J2-9GPIO25ADC2_CH8 - unavailable while Wi-Fi is on; DAC1 (8-bit); RTC_GPIO6 (usable in deep sleep / ULP); EMAC_RXD0
J2-10GPIO26ADC2_CH9 - unavailable while Wi-Fi is on; DAC2 (8-bit); RTC_GPIO7 (usable in deep sleep / ULP); EMAC_RXD1
J2-11GPIO27ADC2_CH7 - unavailable while Wi-Fi is on; Capacitive touch TOUCH7 (T7); RTC_GPIO17 (usable in deep sleep / ULP); EMAC_RX_DV
J2-12GPIO14ADC2_CH6 - unavailable while Wi-Fi is on; Capacitive touch TOUCH6 (T6); RTC_GPIO16 (usable in deep sleep / ULP); MTMS - JTAG TMS; HSPICLK - HSPI SCK; HS2_CLK; SD_CLK; EMAC_TXD2
J2-13GPIO12ADC2_CH5 - unavailable while Wi-Fi is on; Capacitive touch TOUCH5 (T5); RTC_GPIO15 (usable in deep sleep / ULP); MTDI - JTAG TDI; HSPIQ - HSPI MISO; HS2_DATA2; SD_DATA2; EMAC_TXD3Strapping pin. MTDI selects the flash supply voltage: low at reset = 3.3 V (correct for most modules), high = 1.8 V. Pulling GPIO12 high at power-up makes 3.3 V-flash boards fail to boot. Internal pull-down.
J2-14GNDGround
J2-15GPIO13ADC2_CH4 - unavailable while Wi-Fi is on; Capacitive touch TOUCH4 (T4); RTC_GPIO14 (usable in deep sleep / ULP); MTCK - JTAG TCK; HSPID - HSPI MOSI; HS2_DATA3; SD_DATA3; EMAC_RX_ER
J2-16D2 (GPIO9)SPI flash data 2 (SD_DATA2 / SPIHD); U1RXD (IO_MUX default)Connected to the module's SPI flash. Do not use - touching it crashes or corrupts the flash.
J2-17D3 (GPIO10)SPI flash data 3 (SD_DATA3 / SPIWP); U1TXD (IO_MUX default)Connected to the module's SPI flash. Do not use - touching it crashes or corrupts the flash.
J2-18CMD (GPIO11)SPI flash command (SD_CMD / SPICS0)Connected to the module's SPI flash. Do not use - touching it crashes or corrupts the flash.
J2-195V5 V rail (USB 5 V, or a 5 V input to the regulator)Use only one power source at a time (USB, 5V pin or 3V3 pin).
J3-1GNDGround
J3-2GPIO23VSPID - VSPI MOSI (Arduino default MOSI); HS1_STROBE
J3-3GPIO22I2C SCL (Arduino default Wire); VSPIWP; U0RTS; EMAC_TXD1
J3-4TX (GPIO1)U0TXD - UART0 transmit (TX0); CLK_OUT3; EMAC_RXD2Connected to the USB-to-UART bridge; used for flashing and the serial console. Prints boot messages at power-up.
J3-5RX (GPIO3)U0RXD - UART0 receive (RX0); CLK_OUT2Connected to the USB-to-UART bridge; used for flashing and the serial console. Prints boot messages at power-up.
J3-6GPIO21I2C SDA (Arduino default Wire); VSPIHD; EMAC_TX_EN
J3-7GNDGround
J3-8GPIO19VSPIQ - VSPI MISO (Arduino default MISO); U0CTS; EMAC_TXD0
J3-9GPIO18VSPICLK - VSPI SCK (Arduino default SCK); HS1_DATA7
J3-10GPIO5VSPICS0 - VSPI SS (Arduino default SS); HS1_DATA6; EMAC_RX_CLKStrapping pin. SDIO-slave timing (together with GPIO15). Internal pull-up; leave high at reset unless you use SDIO slave.
J3-11GPIO17U2TXD - UART2 transmit (IO_MUX default pin); HS1_DATA5; EMAC_CLK_OUT_180Free on WROOM/SOLO modules; reserved for PSRAM on WROVER modules.
J3-12GPIO16U2RXD - UART2 receive (IO_MUX default pin); HS1_DATA4; EMAC_CLK_OUTFree on WROOM/SOLO modules; reserved for PSRAM on WROVER modules.
J3-13GPIO4ADC2_CH0 - unavailable while Wi-Fi is on; Capacitive touch TOUCH0 (T0); RTC_GPIO10 (usable in deep sleep / ULP); HSPIHD; HS2_DATA1; SD_DATA1; EMAC_TX_ER
J3-14GPIO0ADC2_CH1 - unavailable while Wi-Fi is on; Capacitive touch TOUCH1 (T1); RTC_GPIO11 (usable in deep sleep / ULP); CLK_OUT1; EMAC_TX_CLKStrapping pin. Boot mode: low at reset (with GPIO2 low/floating) enters serial download mode; high = normal SPI-flash boot. Internal pull-up. Wired to the BOOT button on dev kits.
J3-15GPIO2ADC2_CH2 - unavailable while Wi-Fi is on; Capacitive touch TOUCH2 (T2); RTC_GPIO12 (usable in deep sleep / ULP); HSPIWP; HS2_DATA0; SD_DATA0Strapping pin. Boot mode: must be low or floating to enter serial download mode. Internal pull-down.
J3-16GPIO15ADC2_CH3 - unavailable while Wi-Fi is on; Capacitive touch TOUCH3 (T3); RTC_GPIO13 (usable in deep sleep / ULP); MTDO - JTAG TDO; HSPICS0 - HSPI SS; HS2_CMD; SD_CMD; EMAC_RXD3Strapping pin. MTDO: low at reset silences the ROM boot messages on TX0; also sets SDIO-slave timing with GPIO5. Internal pull-up.
J3-17D1 (GPIO8)SPI flash data 1 (SD_DATA1 / SPID)Connected to the module's SPI flash. Do not use - touching it crashes or corrupts the flash.
J3-18D0 (GPIO7)SPI flash data 0 (SD_DATA0 / SPIQ)Connected to the module's SPI flash. Do not use - touching it crashes or corrupts the flash.
J3-19CLK (GPIO6)SPI flash clock (SD_CLK / SPICLK)Connected to the module's SPI flash. Do not use - touching it crashes or corrupts the flash.

ESP32 DEVKIT V1: every pin

PinNameFunction
L1ENCHIP_PU - enable / resetWired to the EN button.
L2GPIO36ADC1_CH0; RTC_GPIO0 (usable in deep sleep / ULP); SENSOR_VP (label VP)Input only: cannot drive an output and has no internal pull-up or pull-down. Good for analog with Wi-Fi (ADC1). Avoid using its interrupt while the ADC or Wi-Fi/Bluetooth with sleep is active (ESP32 errata 3.11).
L3GPIO39ADC1_CH3; RTC_GPIO3 (usable in deep sleep / ULP); SENSOR_VN (label VN)Input only: cannot drive an output and has no internal pull-up or pull-down. Good for analog with Wi-Fi (ADC1). Avoid using its interrupt while the ADC or Wi-Fi/Bluetooth with sleep is active (ESP32 errata 3.11).
L4GPIO34ADC1_CH6; RTC_GPIO4 (usable in deep sleep / ULP); VDET_1Input only: cannot drive an output and has no internal pull-up or pull-down. Good for analog with Wi-Fi (ADC1).
L5GPIO35ADC1_CH7; RTC_GPIO5 (usable in deep sleep / ULP); VDET_2Input only: cannot drive an output and has no internal pull-up or pull-down. Good for analog with Wi-Fi (ADC1).
L6GPIO32ADC1_CH4; Capacitive touch TOUCH9 (T9); RTC_GPIO9 (usable in deep sleep / ULP); 32K_XP - 32.768 kHz crystal input
L7GPIO33ADC1_CH5; Capacitive touch TOUCH8 (T8); RTC_GPIO8 (usable in deep sleep / ULP); 32K_XN - 32.768 kHz crystal output
L8GPIO25ADC2_CH8 - unavailable while Wi-Fi is on; DAC1 (8-bit); RTC_GPIO6 (usable in deep sleep / ULP); EMAC_RXD0
L9GPIO26ADC2_CH9 - unavailable while Wi-Fi is on; DAC2 (8-bit); RTC_GPIO7 (usable in deep sleep / ULP); EMAC_RXD1
L10GPIO27ADC2_CH7 - unavailable while Wi-Fi is on; Capacitive touch TOUCH7 (T7); RTC_GPIO17 (usable in deep sleep / ULP); EMAC_RX_DV
L11GPIO14ADC2_CH6 - unavailable while Wi-Fi is on; Capacitive touch TOUCH6 (T6); RTC_GPIO16 (usable in deep sleep / ULP); MTMS - JTAG TMS; HSPICLK - HSPI SCK; HS2_CLK; SD_CLK; EMAC_TXD2
L12GPIO12ADC2_CH5 - unavailable while Wi-Fi is on; Capacitive touch TOUCH5 (T5); RTC_GPIO15 (usable in deep sleep / ULP); MTDI - JTAG TDI; HSPIQ - HSPI MISO; HS2_DATA2; SD_DATA2; EMAC_TXD3Strapping pin. MTDI selects the flash supply voltage: low at reset = 3.3 V (correct for most modules), high = 1.8 V. Pulling GPIO12 high at power-up makes 3.3 V-flash boards fail to boot. Internal pull-down.
L13GPIO13ADC2_CH4 - unavailable while Wi-Fi is on; Capacitive touch TOUCH4 (T4); RTC_GPIO14 (usable in deep sleep / ULP); MTCK - JTAG TCK; HSPID - HSPI MOSI; HS2_DATA3; SD_DATA3; EMAC_RX_ER
L14GNDGround
L15VINInput to the on-board 3.3 V regulator (supply about 5 V)Not an official Espressif design: the exact regulator and USB diode arrangement varies between clone makers.
R1GPIO23VSPID - VSPI MOSI (Arduino default MOSI); HS1_STROBE
R2GPIO22I2C SCL (Arduino default Wire); VSPIWP; U0RTS; EMAC_TXD1
R3GPIO1U0TXD - UART0 transmit (TX0); CLK_OUT3; EMAC_RXD2Connected to the USB-to-UART bridge; used for flashing and the serial console. Prints boot messages at power-up.
R4GPIO3U0RXD - UART0 receive (RX0); CLK_OUT2Connected to the USB-to-UART bridge; used for flashing and the serial console. Prints boot messages at power-up.
R5GPIO21I2C SDA (Arduino default Wire); VSPIHD; EMAC_TX_EN
R6GPIO19VSPIQ - VSPI MISO (Arduino default MISO); U0CTS; EMAC_TXD0
R7GPIO18VSPICLK - VSPI SCK (Arduino default SCK); HS1_DATA7
R8GPIO5VSPICS0 - VSPI SS (Arduino default SS); HS1_DATA6; EMAC_RX_CLKStrapping pin. SDIO-slave timing (together with GPIO15). Internal pull-up; leave high at reset unless you use SDIO slave.
R9GPIO17U2TXD - UART2 transmit (IO_MUX default pin); HS1_DATA5; EMAC_CLK_OUT_180Silkscreened RX2/TX2 (UART2's native pins). Arduino-ESP32 core 2.x used GPIO16/17 as the Serial2 default, but core 3.x defaults Serial2 to GPIO4 (RX) / GPIO25 (TX) - pass 16 and 17 to Serial2.begin() explicitly. Free on WROOM/SOLO modules; reserved for PSRAM on WROVER modules.
R10GPIO16U2RXD - UART2 receive (IO_MUX default pin); HS1_DATA4; EMAC_CLK_OUTSilkscreened RX2/TX2 (UART2's native pins). Arduino-ESP32 core 2.x used GPIO16/17 as the Serial2 default, but core 3.x defaults Serial2 to GPIO4 (RX) / GPIO25 (TX) - pass 16 and 17 to Serial2.begin() explicitly. Free on WROOM/SOLO modules; reserved for PSRAM on WROVER modules.
R11GPIO4ADC2_CH0 - unavailable while Wi-Fi is on; Capacitive touch TOUCH0 (T0); RTC_GPIO10 (usable in deep sleep / ULP); HSPIHD; HS2_DATA1; SD_DATA1; EMAC_TX_ER
R12GPIO2ADC2_CH2 - unavailable while Wi-Fi is on; Capacitive touch TOUCH2 (T2); RTC_GPIO12 (usable in deep sleep / ULP); HSPIWP; HS2_DATA0; SD_DATA0; On-board blue LED on most DOIT-style boards (Arduino LED_BUILTIN = 2)Strapping pin. Boot mode: must be low or floating to enter serial download mode. Internal pull-down.
R13GPIO15ADC2_CH3 - unavailable while Wi-Fi is on; Capacitive touch TOUCH3 (T3); RTC_GPIO13 (usable in deep sleep / ULP); MTDO - JTAG TDO; HSPICS0 - HSPI SS; HS2_CMD; SD_CMD; EMAC_RXD3Strapping pin. MTDO: low at reset silences the ROM boot messages on TX0; also sets SDIO-slave timing with GPIO5. Internal pull-up.
R14GNDGround
R153V33.3 V rail

How to read the ESP32 pin diagram

An ESP32 pin diagram shows two kinds of label. The GPIO number (GPIO23, for example) is the chip’s own name for the pin and is what your code uses: pinMode(23, OUTPUT) in Arduino, GPIO_NUM_23 in ESP-IDF. The silkscreen label printed on the board varies by maker: Espressif’s DevKitC prints IO23, the DOIT board prints D23, and the flash pins carry their bus names (CLK, SD0, CMD). The ESP32 chip has 34 GPIO, of which 32 reach the pins of the WROOM-32 module on these boards (GPIO37 and 38 stay inside). The 38-pin DevKitC brings out all 32; the 30-pin DOIT board brings out 25 and leaves the flash pins off.

Four pins are not GPIO at all:

  • 3V3: the 3.3 V rail from the on-board regulator. It can also feed the board from a regulated 3.3 V supply.
  • 5V on the DevKitC, VIN on the DOIT board: the input to the 3.3 V regulator, about 5 V. It is the same rail that USB power feeds, so don’t use both at once.
  • GND: several, all common.
  • EN: chip enable. Pulled high to run; the EN button pulls it low to reset the chip.

Which ESP32 pins are safe to use?

15 pins are free for any job: 4, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33. Four more, 34, 35, 36, 39, are good inputs, especially for analog sensors, but cannot drive anything. The five strapping pins (0, 2, 5, 12, 15) work as normal GPIO after boot, as long as nothing connected to them forces the wrong level at reset. GPIO1 and GPIO3 are the serial port you flash through, and GPIO6 to GPIO11 belong to the flash chip. The full list, from the chip’s datasheet and Espressif’s DevKitC guide:

Every ESP32 GPIO on the DevKitC V4, sorted by number.
GPIOBoard labelStatusWhy
GPIO0IO0StrappingRead at reset (internal pull-up); keep its boot level during power-up
GPIO1TXSerialUART0 to the USB bridge: flashing and the serial monitor
GPIO2IO2StrappingRead at reset (internal pull-down); keep its boot level during power-up
GPIO3RXSerialUART0 to the USB bridge: flashing and the serial monitor
GPIO4IO4FreeInput and output, no boot role
GPIO5IO5StrappingRead at reset (internal pull-up); keep its boot level during power-up
GPIO6CLKDo not useWired to the module’s SPI flash
GPIO7D0Do not useWired to the module’s SPI flash
GPIO8D1Do not useWired to the module’s SPI flash
GPIO9D2Do not useWired to the module’s SPI flash
GPIO10D3Do not useWired to the module’s SPI flash
GPIO11CMDDo not useWired to the module’s SPI flash
GPIO12IO12StrappingRead at reset (internal pull-down); keep its boot level during power-up
GPIO13IO13FreeFree; also a JTAG pin if you debug over JTAG
GPIO14IO14FreeFree; also a JTAG pin if you debug over JTAG
GPIO15IO15StrappingRead at reset (internal pull-up); keep its boot level during power-up
GPIO16IO16FreeFree on WROOM modules; used by PSRAM on WROVER
GPIO17IO17FreeFree on WROOM modules; used by PSRAM on WROVER
GPIO18IO18FreeInput and output, no boot role
GPIO19IO19FreeInput and output, no boot role
GPIO21IO21FreeInput and output, no boot role
GPIO22IO22FreeInput and output, no boot role
GPIO23IO23FreeInput and output, no boot role
GPIO25IO25FreeInput and output, no boot role
GPIO26IO26FreeInput and output, no boot role
GPIO27IO27FreeInput and output, no boot role
GPIO32IO32FreeInput and output, no boot role
GPIO33IO33FreeInput and output, no boot role
GPIO34IO34Input onlyNo output driver and no internal pull resistors; ADC1, so analog works with Wi-Fi on
GPIO35IO35Input onlyNo output driver and no internal pull resistors; ADC1, so analog works with Wi-Fi on
GPIO36VPInput onlyNo output driver and no internal pull resistors; ADC1, so analog works with Wi-Fi on
GPIO39VNInput onlyNo output driver and no internal pull resistors; ADC1, so analog works with Wi-Fi on

ESP32 ADC pins: ADC1 vs ADC2

The ESP32 has two 12-bit analog-to-digital converters with 16 channels between them. ADC1 is always available. ADC2 is shared with the Wi-Fi driver and cannot be read while Wi-Fi is on, which is the usual reason an analog sensor reads nothing in a Wi-Fi project. Put analog inputs on ADC1.

ADC1: works with Wi-Fi
ChannelGPIO
ADC1_CH0GPIO36
ADC1_CH3GPIO39
ADC1_CH4GPIO32
ADC1_CH5GPIO33
ADC1_CH6GPIO34
ADC1_CH7GPIO35
ADC2: not with Wi-Fi
ChannelGPIO
ADC2_CH0GPIO4
ADC2_CH1GPIO0
ADC2_CH2GPIO2
ADC2_CH3GPIO15
ADC2_CH4GPIO13
ADC2_CH5GPIO12
ADC2_CH6GPIO14
ADC2_CH7GPIO27
ADC2_CH8GPIO25
ADC2_CH9GPIO26

The input range depends on the attenuation setting. At the highest setting the calibrated useful range is roughly 150 to 2,450 mV, and accuracy falls off towards both ends, so scale a sensor to sit in the middle. Chips differ by several percent before calibration; use the calibrated millivolt functions rather than raw counts when the number matters.

Touch, DAC and PWM pins

  • Capacitive touch: T0 on GPIO4, T1 on GPIO0, T2 on GPIO2, T3 on GPIO15, T4 on GPIO13, T5 on GPIO12, T6 on GPIO14, T7 on GPIO27, T8 on GPIO33, T9 on GPIO32. A wire or a copper pad on the pin becomes a touch button.
  • DAC: two 8-bit outputs, DAC1 on GPIO25 and DAC2 on GPIO26, for a true analog voltage between 0 and 3.3 V.
  • PWM: the LED PWM controller (LEDC) has 16 channels and can drive any output-capable pin, so every pin in the “free” list can dim an LED or drive a servo.
  • Deep sleep wake-up: only RTC GPIO keep working in deep sleep: 0, 2, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, 39.

I2C, SPI and UART pins

The ESP32’s GPIO matrix can route most peripherals to almost any pin, so these are defaults, not limits. Using them keeps libraries and wiring diagrams simple:

BusSignalGPIONote
I2C (Wire)SDA / SCL21 / 22Arduino default; add pull-ups if the module has none
SPI (VSPI)MOSI / MISO / SCK / SS23 / 19 / 18 / 5Arduino default SPI; GPIO5 is a strapping pin
SPI (HSPI)MOSI / MISO / SCK / SS13 / 12 / 14 / 15GPIO12 and GPIO15 are strapping pins
UART0TX / RX1 / 3USB serial: flashing and Serial
UART2TX / RX17 / 16Native pins; Arduino-ESP32 3.x defaults Serial2 to other pins unless you pass them to begin()
JTAGTDI / TCK / TMS / TDO12 / 13 / 14 / 15Only if you debug over JTAG

Strapping pins and boot modes

At reset the ESP32 samples five strapping pins to decide how to start. Each has an internal pull resistor that sets the normal level, so the board boots correctly when nothing is connected. Trouble starts when a sensor, a pull resistor or an LED on one of these pins holds it at the wrong level during power-up.

GPIOInternal pull at resetWhat its level selects
GPIO0pull-upBoot mode: low at reset (with GPIO2 low/floating) enters serial download mode; high = normal SPI-flash boot. Internal pull-up. Wired to the BOOT button on dev kits.
GPIO2pull-downBoot mode: must be low or floating to enter serial download mode. Internal pull-down.
GPIO5pull-upSDIO-slave timing (together with GPIO15). Internal pull-up; leave high at reset unless you use SDIO slave.
GPIO12pull-downMTDI selects the flash supply voltage: low at reset = 3.3 V (correct for most modules), high = 1.8 V. Pulling GPIO12 high at power-up makes 3.3 V-flash boards fail to boot. Internal pull-down.
GPIO15pull-upMTDO: low at reset silences the ROM boot messages on TX0; also sets SDIO-slave timing with GPIO5. Internal pull-up.

The one that catches most people is GPIO12: pulled high at power-up, it switches the flash supply to 1.8 V and a board with 3.3 V flash will not boot. If an upload fails with the board stuck in a reset loop, disconnect whatever is on GPIO12, GPIO0, GPIO2, GPIO5 and GPIO15 and try again. To enter the bootloader by hand, hold BOOT (GPIO0 low), tap EN, then release BOOT.

Powering an ESP32 board

Use one source at a time: USB, the 5V/VIN pin with about 5 V, or the 3V3 pin with a regulated 3.3 V. Wi-Fi transmit bursts draw a few hundred milliamps for short periods, so a weak supply or a long thin USB cable causes brownout resets that look like software crashes. A supply rated for 500 mA or more, and a capacitor of a few hundred microfarads near the board on battery projects, keeps it stable.

Driving LEDs, relays and 5 V signals

  • LEDs. A red LED with a 2 V forward drop at 10 mA from a 3.3 V pin needs (3.3 − 2) ÷ 0.01 = 130 Ω; the next standard value up, 150 Ω, gives 8.7 mA. The LED resistor calculator handles other colours and supplies.
  • Current limits. Most pins can source about 40 mA at full drive strength and sink about 28 mA, with an absolute maximum of 1,200 mA for all I/O together. Keep each pin to a few milliamps and drive relays, motors and LED strips through a transistor or MOSFET.
  • 5 V signals. The pins are not 5 V tolerant. A divider of 1.8 kΩ over 3.3 kΩ turns a 5 V signal into 3.24 V and draws 0.98 mA; check other values with the voltage divider calculator. Fast or bidirectional buses need a proper level shifter.

ESP32 DevKitC vs the 30-pin DOIT board

ESP32-DevKitC V4DOIT DevKit V1 (30-pin)
Made byEspressif (reference design)Third-party makers; layouts vary
Header pins3830
GPIO brought out32, flash pins included25, no flash pins
Power input pin5VVIN
On-board LEDPower LED onlyUsually a blue LED on GPIO2 (a strapping pin)

Both run the same chip, so code is interchangeable; only the physical positions differ. Compare the silkscreen on your board with the diagram before wiring, because 36- and 38-pin clones of the DOIT layout also exist.

Common ESP32 wiring mistakes

  • Wiring an output to GPIO34 to 39 and wondering why nothing happens: they are input-only.
  • Expecting a pull-up on GPIO34 to 39 for a button: add an external resistor.
  • Reading an analog sensor on an ADC2 pin while Wi-Fi is on.
  • A pull-up or a sensor holding GPIO12 high, so the board will not boot.
  • Connecting anything to GPIO6 to 11 on the DevKitC.
  • Feeding 5 V signals straight into a pin, or powering the board from USB and the 5V pin at the same time.

Key facts

  • All ESP32 GPIO run at 3.3 V and are not 5 V tolerant: an input must stay below the I/O supply + 0.3 V. Use a level shifter for 5 V signals.
  • Input-only pins: GPIO34, 35, 36 (VP) and 39 (VN). They cannot drive outputs and have no internal pull-up or pull-down resistors.
  • GPIO6-11 (labelled CLK, SD0-SD3/D0-D3, CMD) connect to the module's SPI flash - never use them. On WROVER modules with PSRAM, GPIO16 and 17 are also taken.
  • Strapping pins are read at reset, then become ordinary GPIO: GPIO0 (internal pull-up), GPIO2 (pull-down), GPIO5 (pull-up), GPIO12/MTDI (pull-down), GPIO15/MTDO (pull-up). Do not let external circuits force them to the wrong level during power-up.
  • Boot modes: GPIO0 high = run from flash; GPIO0 low with GPIO2 low or floating = serial download (the BOOT button pulls GPIO0 low).
  • GPIO12 (MTDI) high at reset switches the flash supply to 1.8 V, which stops boards with 3.3 V flash (most WROOM-based kits) from booting. GPIO15 (MTDO) low at reset silences the ROM boot log on TX0; GPIO15 and GPIO5 together set SDIO-slave timing.
  • ADC: two 12-bit SAR converters, 18 channels. ADC1 is on GPIO32-39; ADC2 is on GPIO0, 2, 4, 12-15 and 25-27. ADC2 cannot be used while Wi-Fi is running - put analog sensors on ADC1 pins in Wi-Fi projects.
  • The ADC range depends on attenuation; at the highest setting the calibrated useful range is about 150-2450 mV, and readings get less accurate toward the ends. Chips differ by about ±6 % before calibration.
  • DAC: two 8-bit outputs, DAC1 on GPIO25 and DAC2 on GPIO26.
  • Capacitive touch: T0 GPIO4, T1 GPIO0, T2 GPIO2, T3 GPIO15, T4 GPIO13, T5 GPIO12, T6 GPIO14, T7 GPIO27, T8 GPIO33, T9 GPIO32.
  • UART0 (GPIO1 TX0, GPIO3 RX0) is wired to the USB-serial bridge for flashing and the console. UART2's native pins are GPIO16 (RX2) and GPIO17 (TX2); note that Arduino-ESP32 core 3.x defaults Serial2 to GPIO4/GPIO25 and Serial1 to GPIO26/GPIO27 unless you pass pins to begin().
  • Default buses in the Arduino core: I2C SDA GPIO21, SCL GPIO22; SPI (VSPI) MOSI 23, MISO 19, SCK 18, SS 5. The second SPI (HSPI) native pins are MOSI 13, MISO 12, SCK 14, SS 15. The GPIO matrix can route most peripherals to almost any pin.
  • JTAG: GPIO12 TDI, GPIO13 TCK, GPIO14 TMS, GPIO15 TDO.
  • Pins usable in deep sleep (RTC GPIO): 0, 2, 4, 12-15, 25-27, 32-39.
  • Drive capability at maximum drive strength: about 40 mA source per pin on most pins (about 20 mA on VDD_SDIO-domain pins), about 28 mA sink; the per-pin figure drops toward 29 mA as more pins source current at once. Absolute-maximum total for all I/O: 1200 mA. Internal pull resistors are about 45 kΩ.
  • EN is the chip-enable/reset line (CHIP_PU): high = running. Dev kits pull it up and connect it to the EN button.
  • ESP32-DevKitC V4 power: use exactly one source - micro-USB, the 5V pin, or the 3V3 pin. Feeding two at once can damage the board or the supply.
  • ESP32-DevKitC V4 is Espressif's reference board (header pinout published by Espressif). The 30-pin 'ESP32 DEVKIT V1 / DOIT' layout comes from third-party makers; its common pin order is shown here, but clones vary, and it has VIN instead of a 5V pin and no flash pins broken out.
  • Most DOIT-style boards have a blue LED on GPIO2 (Arduino LED_BUILTIN = 2) - remember GPIO2 is also a strapping pin.
  • GPIO32 and GPIO33 can host an external 32.768 kHz crystal for the RTC.

Sources

Pin assignments were checked against these references on 2026-10-14. The diagram is our own drawing.

Questions people ask

Which ESP32 pins should I avoid?
GPIO6–11 (flash) always, and take care with the strapping pins 0, 2, 5, 12 and 15. GPIO12 pulled high at reset stops most boards from booting. GPIO1 and 3 are the USB serial port.
Which ESP32 pins are safe to use?
GPIO 4, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33 work as inputs and outputs with no boot role (16 and 17 are taken by PSRAM on WROVER modules). GPIO 34, 35, 36, 39 are safe as inputs only.
How many GPIO pins does the ESP32 have?
The chip has 34 GPIO, numbered 0 to 39 with gaps, and 32 of them reach the WROOM-32 module’s pins. The 38-pin DevKitC brings out all 32, including the six flash pins you must not use; the 30-pin DOIT board brings out 25.
Why does analogRead not work on some ESP32 pins with Wi-Fi?
Those pins are on ADC2, which the Wi-Fi driver uses. Put analog sensors on ADC1 (GPIO32–39) instead.
Are ESP32 pins 5 V tolerant?
No. They are 3.3 V only; use a level shifter or a voltage divider for 5 V signals.
Which pins are input-only on the ESP32?
GPIO34, 35, 36 (VP) and 39 (VN). They can’t drive outputs and have no internal pull-up or pull-down resistors.
Which pin is the built-in LED on an ESP32 board?
On most 30-pin DOIT-style boards it is GPIO2 (LED_BUILTIN = 2 in Arduino). Espressif’s DevKitC has only a power LED.