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
ESP32-DevKitC V4 (official Espressif board, 38 pins: headers J2 and J3)
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
| Pin | Name | Function |
|---|---|---|
| J2-1 | 3V3 | 3.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-2 | EN | CHIP_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-3 | VP (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-4 | VN (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-5 | GPIO34 | ADC1_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-6 | GPIO35 | ADC1_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-7 | GPIO32 | ADC1_CH4; Capacitive touch TOUCH9 (T9); RTC_GPIO9 (usable in deep sleep / ULP); 32K_XP - 32.768 kHz crystal input |
| J2-8 | GPIO33 | ADC1_CH5; Capacitive touch TOUCH8 (T8); RTC_GPIO8 (usable in deep sleep / ULP); 32K_XN - 32.768 kHz crystal output |
| J2-9 | GPIO25 | ADC2_CH8 - unavailable while Wi-Fi is on; DAC1 (8-bit); RTC_GPIO6 (usable in deep sleep / ULP); EMAC_RXD0 |
| J2-10 | GPIO26 | ADC2_CH9 - unavailable while Wi-Fi is on; DAC2 (8-bit); RTC_GPIO7 (usable in deep sleep / ULP); EMAC_RXD1 |
| J2-11 | GPIO27 | ADC2_CH7 - unavailable while Wi-Fi is on; Capacitive touch TOUCH7 (T7); RTC_GPIO17 (usable in deep sleep / ULP); EMAC_RX_DV |
| J2-12 | GPIO14 | ADC2_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-13 | GPIO12 | ADC2_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-14 | GND | Ground |
| J2-15 | GPIO13 | ADC2_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-16 | D2 (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-17 | D3 (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-18 | CMD (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-19 | 5V | 5 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-1 | GND | Ground |
| J3-2 | GPIO23 | VSPID - VSPI MOSI (Arduino default MOSI); HS1_STROBE |
| J3-3 | GPIO22 | I2C SCL (Arduino default Wire); VSPIWP; U0RTS; EMAC_TXD1 |
| J3-4 | TX (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-5 | RX (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-6 | GPIO21 | I2C SDA (Arduino default Wire); VSPIHD; EMAC_TX_EN |
| J3-7 | GND | Ground |
| J3-8 | GPIO19 | VSPIQ - VSPI MISO (Arduino default MISO); U0CTS; EMAC_TXD0 |
| J3-9 | GPIO18 | VSPICLK - VSPI SCK (Arduino default SCK); HS1_DATA7 |
| J3-10 | GPIO5 | VSPICS0 - 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-11 | GPIO17 | U2TXD - UART2 transmit (IO_MUX default pin); HS1_DATA5; EMAC_CLK_OUT_180Free on WROOM/SOLO modules; reserved for PSRAM on WROVER modules. |
| J3-12 | GPIO16 | U2RXD - UART2 receive (IO_MUX default pin); HS1_DATA4; EMAC_CLK_OUTFree on WROOM/SOLO modules; reserved for PSRAM on WROVER modules. |
| J3-13 | GPIO4 | ADC2_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-14 | GPIO0 | ADC2_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-15 | GPIO2 | ADC2_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-16 | GPIO15 | ADC2_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-17 | D1 (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-18 | D0 (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-19 | CLK (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
| Pin | Name | Function |
|---|---|---|
| L1 | EN | CHIP_PU - enable / resetWired to the EN button. |
| L2 | 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). |
| L3 | 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). |
| L4 | GPIO34 | ADC1_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). |
| L5 | GPIO35 | ADC1_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). |
| L6 | GPIO32 | ADC1_CH4; Capacitive touch TOUCH9 (T9); RTC_GPIO9 (usable in deep sleep / ULP); 32K_XP - 32.768 kHz crystal input |
| L7 | GPIO33 | ADC1_CH5; Capacitive touch TOUCH8 (T8); RTC_GPIO8 (usable in deep sleep / ULP); 32K_XN - 32.768 kHz crystal output |
| L8 | GPIO25 | ADC2_CH8 - unavailable while Wi-Fi is on; DAC1 (8-bit); RTC_GPIO6 (usable in deep sleep / ULP); EMAC_RXD0 |
| L9 | GPIO26 | ADC2_CH9 - unavailable while Wi-Fi is on; DAC2 (8-bit); RTC_GPIO7 (usable in deep sleep / ULP); EMAC_RXD1 |
| L10 | GPIO27 | ADC2_CH7 - unavailable while Wi-Fi is on; Capacitive touch TOUCH7 (T7); RTC_GPIO17 (usable in deep sleep / ULP); EMAC_RX_DV |
| L11 | GPIO14 | ADC2_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 |
| L12 | GPIO12 | ADC2_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. |
| L13 | GPIO13 | ADC2_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 |
| L14 | GND | Ground |
| L15 | VIN | Input 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. |
| R1 | GPIO23 | VSPID - VSPI MOSI (Arduino default MOSI); HS1_STROBE |
| R2 | GPIO22 | I2C SCL (Arduino default Wire); VSPIWP; U0RTS; EMAC_TXD1 |
| R3 | 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. |
| R4 | 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. |
| R5 | GPIO21 | I2C SDA (Arduino default Wire); VSPIHD; EMAC_TX_EN |
| R6 | GPIO19 | VSPIQ - VSPI MISO (Arduino default MISO); U0CTS; EMAC_TXD0 |
| R7 | GPIO18 | VSPICLK - VSPI SCK (Arduino default SCK); HS1_DATA7 |
| R8 | GPIO5 | VSPICS0 - 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. |
| R9 | GPIO17 | U2TXD - 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. |
| R10 | GPIO16 | U2RXD - 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. |
| R11 | GPIO4 | ADC2_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 |
| R12 | GPIO2 | ADC2_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. |
| R13 | GPIO15 | ADC2_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. |
| R14 | GND | Ground |
| R15 | 3V3 | 3.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:
| GPIO | Board label | Status | Why |
|---|---|---|---|
| GPIO0 | IO0 | Strapping | Read at reset (internal pull-up); keep its boot level during power-up |
| GPIO1 | TX | Serial | UART0 to the USB bridge: flashing and the serial monitor |
| GPIO2 | IO2 | Strapping | Read at reset (internal pull-down); keep its boot level during power-up |
| GPIO3 | RX | Serial | UART0 to the USB bridge: flashing and the serial monitor |
| GPIO4 | IO4 | Free | Input and output, no boot role |
| GPIO5 | IO5 | Strapping | Read at reset (internal pull-up); keep its boot level during power-up |
| GPIO6 | CLK | Do not use | Wired to the module’s SPI flash |
| GPIO7 | D0 | Do not use | Wired to the module’s SPI flash |
| GPIO8 | D1 | Do not use | Wired to the module’s SPI flash |
| GPIO9 | D2 | Do not use | Wired to the module’s SPI flash |
| GPIO10 | D3 | Do not use | Wired to the module’s SPI flash |
| GPIO11 | CMD | Do not use | Wired to the module’s SPI flash |
| GPIO12 | IO12 | Strapping | Read at reset (internal pull-down); keep its boot level during power-up |
| GPIO13 | IO13 | Free | Free; also a JTAG pin if you debug over JTAG |
| GPIO14 | IO14 | Free | Free; also a JTAG pin if you debug over JTAG |
| GPIO15 | IO15 | Strapping | Read at reset (internal pull-up); keep its boot level during power-up |
| GPIO16 | IO16 | Free | Free on WROOM modules; used by PSRAM on WROVER |
| GPIO17 | IO17 | Free | Free on WROOM modules; used by PSRAM on WROVER |
| GPIO18 | IO18 | Free | Input and output, no boot role |
| GPIO19 | IO19 | Free | Input and output, no boot role |
| GPIO21 | IO21 | Free | Input and output, no boot role |
| GPIO22 | IO22 | Free | Input and output, no boot role |
| GPIO23 | IO23 | Free | Input and output, no boot role |
| GPIO25 | IO25 | Free | Input and output, no boot role |
| GPIO26 | IO26 | Free | Input and output, no boot role |
| GPIO27 | IO27 | Free | Input and output, no boot role |
| GPIO32 | IO32 | Free | Input and output, no boot role |
| GPIO33 | IO33 | Free | Input and output, no boot role |
| GPIO34 | IO34 | Input only | No output driver and no internal pull resistors; ADC1, so analog works with Wi-Fi on |
| GPIO35 | IO35 | Input only | No output driver and no internal pull resistors; ADC1, so analog works with Wi-Fi on |
| GPIO36 | VP | Input only | No output driver and no internal pull resistors; ADC1, so analog works with Wi-Fi on |
| GPIO39 | VN | Input only | No 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.
| Channel | GPIO |
|---|---|
| ADC1_CH0 | GPIO36 |
| ADC1_CH3 | GPIO39 |
| ADC1_CH4 | GPIO32 |
| ADC1_CH5 | GPIO33 |
| ADC1_CH6 | GPIO34 |
| ADC1_CH7 | GPIO35 |
| Channel | GPIO |
|---|---|
| ADC2_CH0 | GPIO4 |
| ADC2_CH1 | GPIO0 |
| ADC2_CH2 | GPIO2 |
| ADC2_CH3 | GPIO15 |
| ADC2_CH4 | GPIO13 |
| ADC2_CH5 | GPIO12 |
| ADC2_CH6 | GPIO14 |
| ADC2_CH7 | GPIO27 |
| ADC2_CH8 | GPIO25 |
| ADC2_CH9 | GPIO26 |
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:
| Bus | Signal | GPIO | Note |
|---|---|---|---|
| I2C (Wire) | SDA / SCL | 21 / 22 | Arduino default; add pull-ups if the module has none |
| SPI (VSPI) | MOSI / MISO / SCK / SS | 23 / 19 / 18 / 5 | Arduino default SPI; GPIO5 is a strapping pin |
| SPI (HSPI) | MOSI / MISO / SCK / SS | 13 / 12 / 14 / 15 | GPIO12 and GPIO15 are strapping pins |
| UART0 | TX / RX | 1 / 3 | USB serial: flashing and Serial |
| UART2 | TX / RX | 17 / 16 | Native pins; Arduino-ESP32 3.x defaults Serial2 to other pins unless you pass them to begin() |
| JTAG | TDI / TCK / TMS / TDO | 12 / 13 / 14 / 15 | Only 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.
| GPIO | Internal pull at reset | What its level selects |
|---|---|---|
| GPIO0 | pull-up | 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. |
| GPIO2 | pull-down | Boot mode: must be low or floating to enter serial download mode. Internal pull-down. |
| GPIO5 | pull-up | SDIO-slave timing (together with GPIO15). Internal pull-up; leave high at reset unless you use SDIO slave. |
| GPIO12 | pull-down | 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. |
| GPIO15 | pull-up | MTDO: 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 V4 | DOIT DevKit V1 (30-pin) | |
|---|---|---|
| Made by | Espressif (reference design) | Third-party makers; layouts vary |
| Header pins | 38 | 30 |
| GPIO brought out | 32, flash pins included | 25, no flash pins |
| Power input pin | 5V | VIN |
| On-board LED | Power LED only | Usually 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.
- Espressif - ESP32-DevKitC V4 User Guide (esp-dev-kits)
- Espressif - ESP32-DevKitC pin layout figure (esp32_devkitC_v4_pinlayout.png)
- Espressif - ESP32 Series Datasheet v5.3
- Espressif - ESP-IDF Programming Guide: GPIO & RTC GPIO (ESP32)
- Espressif arduino-esp32 core - variants/esp32 and variants/doitESP32devkitV1 pins_arduino.h
- Espressif arduino-esp32 core - cores/esp32/HardwareSerial.h (3.x) and HardwareSerial.cpp (2.0.x)
- Wokwi elements - esp32-devkit-v1-element.ts
- Mischianti - DOIT ESP32 DEV KIT v1 high resolution pinout and specs