The ESP32 DevKit V1 is the workhorse of IoT prototyping, but its physical pinout varies frustratingly between the 30-pin (NodeMCU-32S style) and 38-pin (generic DevKit V1) layouts. While the underlying ESP32-WROOM-32 silicon remains identical, the breakout board routing changes which physical header hole corresponds to which GPIO. Below is the definitive functional reference for mapping your code to the physical headers, followed by critical strapping pin rules and external wiring standards.
The Complete ESP32 DevKit Pinout Reference
Because clone manufacturers frequently swap physical pin positions on the 38-pin headers, relying on physical pin numbers (e.g., "Pin 14") is a recipe for fried boards. Always map by the silkscreen GPIO label. The table below categorizes the functional pinout for the standard ESP32-WROOM-32 module found on both 30-pin and 38-pin DevKits.
| GPIO / Label | Function & Constraints | ADC / Touch / Special | Boot Strapping State |
|---|---|---|---|
| GPIO0 | General I/O, PWM | Touch1 | Must be HIGH to boot normally; LOW enters flash mode. |
| GPIO2 | General I/O, PWM | Touch2, ADC2_CH2 | Must be LOW or floating to boot. Do not pull HIGH. |
| GPIO4 | General I/O, PWM | Touch0, ADC2_CH0 | None (Safe for general use) |
| GPIO5 | VSPI SS, General I/O | None | Outputs PWM signal at boot (can cause relay chatter). |
| GPIO12 | General I/O, HSPI MISO | Touch5, ADC2_CH5 | CRITICAL: Dictates flash voltage. Must be LOW for 3.3V flash. |
| GPIO13 | General I/O, HSPI MOSI | Touch4, ADC2_CH4 | None |
| GPIO14 | General I/O, HSPI SCK | Touch6, ADC2_CH6 | Outputs PWM signal at boot. |
| GPIO15 | General I/O, HSPI SS | Touch3, ADC2_CH8 | Outputs PWM signal at boot. |
| GPIO16 | General I/O (No ADC) | None | None |
| GPIO17 / 18 | General I/O | None | None (Safe for general use) |
| GPIO19 / 23 | VSPI MISO / MOSI | None | None |
| GPIO21 / 22 | Default I2C SDA / SCL | None | None (Standard I2C bus pins) |
| GPIO25 / 26 | General I/O | DAC1 / DAC2, ADC2 | None (True analog output capable) |
| GPIO27 | General I/O | Touch7, ADC2_CH7 | None |
| GPIO32 / 33 | General I/O, PWM | ADC1_CH4/5, Touch8/9 | None (Safe, includes internal RTC) |
| GPIO34 - 39 | INPUT ONLY | ADC1_CH6/7/0/3 | None (No internal pull-ups, require external) |
| TX (1) / RX (3) | Default UART0 to USB | None | Outputs serial debug at boot. Avoid for relays. |
| EN (CHIP_PU) | Enable / Reset | None | Must be HIGH to run. Pull LOW to reset. |
| 5V / 3V3 / GND | Power Rails | Max 3.3V logic. 5V is VBUS in. | N/A |
On the bare ESP32-WROOM-32 module, GPIO6 through GPIO11 are connected to the integrated SPI flash memory. While some 38-pin DevKit clone boards physically break these out to the outer header rows, you must never use them. Driving these pins will corrupt the flash and brick the board. If your silkscreen labels them as standard GPIOs, the board manufacturer has made a dangerous error.
Rows People Get Wrong & Strapping Pin Hazards
The most common bench failures with the ESP32 stem from ignoring the boot strapping pins. The ESP32 reads specific GPIO states during the first few milliseconds of power-up to determine its boot mode and operating voltage. If you wire a sensor or relay to these pins without understanding the electrical implications, the board will either fail to boot or permanently damage its internal voltage regulator.
GPIO12 (The Flash Voltage Killer): This is the most misunderstood pin on the board. GPIO12 dictates the internal flash memory operating voltage. If GPIO12 is pulled HIGH during boot, the ESP32 assumes the flash requires 1.8V. Because the WROOM-32 module uses a 3.3V flash chip, pulling GPIO12 HIGH will cause the internal regulator to output 1.8V to a 3.3V chip, resulting in boot loops, erratic behavior, or permanent silicon damage. Never use GPIO12 for a relay or a switch that might be closed during power-up.
GPIO34 through GPIO39 (Input-Only Trap): Beginners frequently attempt to use these pins to drive LEDs or buzzers, only to find them completely dead. These pins are physically hardwired as inputs on the silicon level. Furthermore, they lack internal pull-up or pull-down resistors. If you are using GPIO34 for a push-button, you must provide an external 10kΩ pull-down or pull-up resistor, or the pin will float and trigger phantom interrupts.
GPIO5, 14, 15, TX, and RX (The Boot Noise Makers): These pins output PWM or serial debug signals during the boot sequence. If you connect a relay module to GPIO5, the relay will rapidly chatter on and off every time the ESP32 resets or wakes from deep sleep. Always use "safe" pins like GPIO4, 16, 17, 18, 21, 22, 23, 27, 32, or 33 for relays and actuators.
Interfacing External Loads: Regional Wire Color Standards
When your ESP32 project graduates from a breadboard to a permanent enclosure—especially when switching mains-powered loads via relay modules or contactors—the low-voltage DC pinout meets high-voltage AC wiring. While the ESP32's internal logic is universal, the external wire color codes you use to connect your relays to the load and mains supply are strictly governed by regional standards. Mixing these up can create lethal shock hazards or cause an inspector to fail your installation.
| Function | IEC 60446 (EU, UK, AU, Asia) | NEC / NFPA 70 (US, Canada) | Old UK (Pre-2004 Legacy) |
|---|---|---|---|
| Line / Hot (L1) | Brown | Black (or Red for 2nd phase) | Red |
| Neutral (N) | Blue | White (or Gray) | Black |
| Earth / Ground (PE) | Green/Yellow Stripe | Green, Green/Yellow, or Bare | Green (or Bare) |
| Switched Leg (to Load) | Brown (with Blue sleeve) | Black (with Red tape) | Red |
Safe Interpretation When Markings are Faded or Missing: If you are retrofitting an existing ESP32-controlled relay box and the external AC wire colors are faded, painted over, or use conflicting legacy standards (e.g., a mix of old UK Red/Black and modern IEC Brown/Blue in the same conduit), never trust the insulation color. You must de-energize the circuit, lock out the breaker, and use a non-contact voltage tester followed by a calibrated multimeter to verify dead. Once safe, use a continuity tester to trace the physical path from the relay's COM (Common) and NO (Normally Open) terminals to the terminal block. Re-label every wire at both ends with heat-shrink tubing or high-quality electrical tape (e.g., 3M Super 33+) matching your current regional standard before re-energizing. For authoritative guidance on US wiring color codes and safety clearances, refer to the NFPA National Electrical Code (NEC) guidelines.
Tracing Faded or Missing Silkscreen Markings
Cheap 38-pin DevKit clones often suffer from poor silkscreen printing that rubs off after a few breadboard insertions, or they ship with completely blank PCBs. If you cannot read the GPIO labels, you can reliably map the physical headers using the ESP32-WROOM-32 module's physical anchors and a digital multimeter (DMM).
Step 1: Locate the EN (CHIP_PU) Pin.
On almost all 30-pin and 38-pin layouts, the EN pin is located on the top left or top right of the header bank, immediately adjacent to the 3V3 pin. It is physically connected to a 10kΩ pull-up resistor and a 10µF capacitor near the reset button. Use your DMM in continuity mode; find the pin that shows continuity to the capacitor leg closest to the reset switch.
Step 2: Map the Power and Ground Rails.
Set your DMM to continuity. Probe the metal shield of the USB-Micro or USB-C port. This is your chassis ground. Now probe the header pins; the pins that beep are your GND pins. The 5V pin will show continuity to the center pin of the USB port's power input (or the output of the onboard AMS1117-3.3 voltage regulator's input capacitor).
Step 3: Identify the I2C Defaults (GPIO 21 & 22).
If you need to find the default I2C pins without a USB connection, look for the pins routed to the header with 4.7kΩ pull-up resistors on the PCB. On standard DevKit V1 boards, GPIO21 (SDA) and GPIO22 (SCL) are the only pins with physical pull-up resistors populated on the breakout board to support immediate I2C sensor use.
By anchoring your mapping to the EN pin, the USB ground, and the physical passives on the PCB, you can reconstruct the entire Espressif ESP32 Hardware Design Guidelines pinout on a blank board in under five minutes, ensuring your code matches the physical hardware before you apply power and risk shorting a 3.3V logic pin to the 5V rail.






