The standard ESP32-WROOM-32 DevKit v1 exposes 30 to 38 physical pins depending on the breakout board, but only a subset are safe for general-purpose I/O. Below is the definitive reference matrix for the most common 30-pin layout, detailing GPIO capabilities, 5V tolerance, and strapping pin hazards. Do not wire 5V sensors directly to these pins without a level shifter; the ESP32 is strictly a 3.3V logic device.
The Complete ESP32 Pinout and GPIO Matrix
This table maps the physical silkscreen labels on a standard 30-pin ESP32 DevKit v1 to the internal ESP32-WROOM-32 GPIO numbers. Use this to verify your wiring before applying power.
| Silkscreen Label | Internal GPIO | Primary Function / Restrictions | 5V Tolerant? | Internal Pull-up/down |
|---|---|---|---|---|
| D23 / MOSI | GPIO 23 | General I/O, SPI MOSI | No | None |
| D22 / SCL | GPIO 22 | General I/O, I2C SCL (Default) | No | Pull-up |
| D21 / SDA | GPIO 21 | General I/O, I2C SDA (Default) | No | Pull-up |
| D19 / MISO | GPIO 19 | General I/O, SPI MISO | No | None |
| D18 / SCK | GPIO 18 | General I/O, SPI SCK | No | None |
| D5 / SS | GPIO 5 | General I/O, SPI SS, PWM | No | Pull-up |
| D4 | GPIO 4 | General I/O, ADC2_CH0, Touch0 | No | None |
| D2 | GPIO 2 | Strapping Pin, Onboard LED, ADC2_CH2 | No | Pull-down |
| D15 | GPIO 15 | Strapping Pin, ADC2_CH3, Touch3 | No | Pull-down |
| D0 | GPIO 0 | Strapping Pin, Boot Mode, ADC2_CH1 | No | Pull-up |
| D35 | GPIO 35 | Input Only, ADC1_CH7 | No | None |
| D34 | GPIO 34 | Input Only, ADC1_CH6 | No | None |
| VP / D36 | GPIO 36 | Input Only, ADC1_CH0, Hall Sensor | No | None |
| VN / D39 | GPIO 39 | Input Only, ADC1_CH3, Hall Sensor | No | None |
| EN | CHIP_EN | Enable (High=Run, Low=Deep Sleep) | No | Pull-up |
The ESP32 operates at 3.3V logic. Feeding 5V into any GPIO pin (including RX/TX) will degrade the silicon over time or instantly destroy the input buffer. Use a bidirectional logic level shifter (like the BSS138-based Adafruit 4-channel shifter) or a simple resistor voltage divider when interfacing with 5V modules like the HC-SR04 ultrasonic sensor.
The Rows People Get Wrong: Strapping Pins and Input-Only Traps
Even experienced makers routinely misconfigure specific ESP32 pins because the silkscreen labels do not warn you about the silicon-level boot behaviors. According to the Espressif Hardware Design Guidelines, these pins dictate how the chip boots and must be treated with extreme care.
GPIO 12 (MTDI): The Silent Boot Killer
While not always broken out on 30-pin DevKits, GPIO 12 is a critical strapping pin that selects the VDD_SDIO voltage. If GPIO 12 is pulled HIGH during boot, the internal voltage regulator switches from 3.3V to 1.8V. Because the external SPI flash requires 3.3V, the ESP32 will fail to read its own firmware, resulting in a continuous brownout reset loop. Rule: Never attach a pull-up resistor or a sensor that defaults HIGH to GPIO 12.
GPIO 34, 35, 36, and 39: The Floating Inputs
These pins are physically disconnected from the output drivers and lack internal pull-up or pull-down resistors. If you configure them as outputs in your Arduino code, nothing happens. If you use them as inputs (e.g., for a pushbutton) without an external 10kΩ resistor, they will float and trigger false interrupts from ambient electromagnetic noise. Rule: Always use external pull-down or pull-up resistors when wiring switches to these pins.
GPIO 0 and GPIO 2: The Boot Mode Gatekeepers
GPIO 0 must be HIGH to boot from flash (normal operation) and LOW to enter the serial bootloader. If you wire a relay or a low-impedance sensor to GPIO 0 that pulls it to ground on startup, your ESP32 will hang in download mode. GPIO 2 must be LOW or floating to boot; an external pull-up on GPIO 2 will also prevent normal booting.
Interfacing to the Real World: Low-Voltage vs. Regional Mains Color Codes
When your ESP32 project leaves the breadboard and interfaces with relays, sensors, or mains-adjacent hardware, wire color standards become a critical safety and compliance issue. The low-voltage side (3.3V/5V) follows hobbyist conventions, but the moment you wire the load side of a relay to 120V or 230V AC, you must adhere to your regional electrical code. Local AHJs (Authorities Having Jurisdiction) have final authority on code compliance.
| Standard / Region | VCC / Line (Hot) | GND / Neutral | Earth / Shield | Application Context |
|---|---|---|---|---|
| DIY / Breadboard (Global) | Red (VCC) | Black (GND) | N/A (Yellow=Signal) | ESP32 to 3.3V/5V sensors |
| NEC (US / Canada) | Black (Line) | White (Neutral) | Bare / Green | Relay load to 120V AC mains |
| IEC 60446 (EU / Global) | Brown (Line) | Blue (Neutral) | Green/Yellow Stripe | Relay load to 230V AC mains |
| Old UK (Pre-2006) | Red (Line) | Black (Neutral) | Green/Yellow Stripe | Retrofitting older UK installations |
Which standard applies to you? If you are building a smart home relay box in the US, the National Electrical Code (NEC) dictates Black/White/Green for the mains side. If you are in Europe, IEC 60446 mandates Brown/Blue/Green-Yellow. Never mix these standards on the same terminal block, and never use red for a 230V line in a modern EU installation, as red is reserved for DC or specific phase configurations.
Safe Interpretation When Silkscreen Markings Are Faded or Missing
Cheap clone boards from overseas marketplaces often suffer from poor silkscreen printing. If your pin labels are faded, scraped off, or misprinted (a common issue where GPIO 23 and 19 are swapped on counterfeit boards), do not guess. Guessing leads to shorting the 3.3V LDO regulator and permanently bricking the board. Use this systematic multimeter approach to map the pins safely.
- Identify the Ground Plane: Set your digital multimeter (DMM) to continuity mode. Place the black probe on the metal RF shield of the ESP32 module. Probe the header pins with the red probe. Any pin that beeps is GND. This is your anchor point.
- Locate the 3.3V Rail: Look for the voltage regulator (usually an AMS1117-3.3 or similar SOT-223 package) near the USB port. The output pin of this regulator connects directly to the 3V3 header pin. Trace it with your DMM in continuity mode (board unpowered) or measure 3.2V-3.4V with power applied.
- Find TX and RX: Trace the copper traces from the D+ and D- pins of the USB connector to the USB-UART bridge chip (CP2102 or CH340). The TX pin of the bridge connects to the RX0 pin of the ESP32 (GPIO 3), and the RX pin of the bridge connects to TX0 (GPIO 1).
- Verify the Strapping Pins: Once you have identified GND and 3V3, you can map the remaining pins by process of elimination against the official ESP32-WROOM-32 Datasheet pinout diagram, confirming with a logic analyzer or oscilloscope during the boot sequence to see which pins toggle.
By treating the ESP32 pinout not just as a list of numbers, but as a matrix of electrical constraints, boot behaviors, and safety boundaries, you eliminate the most common hardware bugs before you even write a line of C++.






