The ESP-WROOM-32 module features 38 physical pins, but when mounted on the ubiquitous 30-pin DevKit V1 breakout board, you get 25 usable GPIOs plus power, ground, and enable pins. Below is the exact mapping for the 30-pin layout, the fatal strapping pin conflicts you must avoid, and the external mains wire color codes required when your ESP32 switches high-voltage loads via relays.
The Complete ESP-WROOM-32 Pinout Reference (30-Pin DevKit)
Most hobbyists use the 30-pin ESP32 DevKit V1. The table below categorizes the exposed pins by their functional constraints. For the full 38-pin raw module layout, refer to the official Espressif ESP32 Datasheet.
| Category | GPIO / Pin | Function & Constraints | Strapping Pin? |
|---|---|---|---|
| Power & Boot | VIN (5V), 3V3, GND, EN | VIN accepts 5V via onboard regulator. EN must be HIGH to run. Do not feed 5V into the 3V3 pin. | No |
| Input-Only (ADC) | GPIO 34, 35, 36 (VP), 39 (VN) | Input only. No internal pull-up/pull-down resistors. Excellent for analog reading, but requires external resistors for digital buttons. | No |
| Boot Strapping | GPIO 0, 2, 12 (MTDI), 15 (MTDO) | Dictate boot mode and flash voltage. Must be left unconnected or pulled to specific states during power-on. (See 'Rows People Get Wrong' below). | YES |
| Flash SPI (Do Not Use) | GPIO 6, 7, 8, 9, 10, 11 | Connected to the internal SPI flash memory on the WROOM module. Using these will crash the ESP32 instantly. | No |
| General Purpose (Safe) | GPIO 4, 5, 13, 14, 16-23, 25-27, 32, 33 | Fully usable for I2C, SPI, PWM, and digital I/O. Note: GPIO 16/17 are tied to UART0 by default but can be remapped. | GPIO 5 & 15 are strapping, but generally safe if not pulled incorrectly. |
| Default UART (Serial) | GPIO 1 (TX0), 3 (RX0) | Connected to the USB-to-UART bridge. Used for Serial Monitor and flashing. Avoid using for external sensors if you need debug output. | No |
Rows People Get Wrong: Strapping Pins and Hidden Limits
When debugging an ESP-WROOM-32 that refuses to boot or drops WiFi connections, the culprit is almost always a misunderstood pin constraint. Here are the most common bench mistakes:
- GPIO 12 (MTDI) Boot Failures: GPIO 12 determines the flash voltage at boot. If it is pulled HIGH during power-on, the ESP32 expects a 1.8V flash chip. Since the WROOM-32 uses a 3.3V flash chip, the boot sequence fails with a continuous reset loop. Fix: Never connect a pull-up resistor to GPIO 12, and ensure any attached sensor defaults to LOW at startup.
- ADC2 vs. WiFi Conflict: Pins mapped to ADC2 (GPIO 0, 2, 4, 12, 13, 14, 15, 25, 26, 27) cannot be used for analog reads while WiFi is active. The WiFi driver monopolizes the ADC2 hardware. Fix: Use ADC1 pins (GPIO 32-39) for analog sensors in IoT projects.
- GPIO 34-39 Floating Inputs: These pins lack internal pull-up resistors. If you wire a simple push-button to GPIO 34 without an external 10kΩ pull-up resistor, the pin will float, generating phantom interrupts and erratic readings.
- Touch Pins on Deep Sleep: GPIO 0, 2, 4, 12, 13, 14, 15, 27, 32, and 33 are capacitive touch pins. If you use them to wake the ESP32 from deep sleep, ensure the external circuit doesn't introduce parasitic capacitance, or the wake threshold will never be met.
External Wiring Standards: NEC vs IEC vs Old UK
The ESP32 operates at 3.3V logic, but it is frequently used to trigger relay modules or solid-state contactors that switch 120V/230V AC mains. When wiring the load side of your relay to mains-powered devices, you must follow your region's electrical color codes. Mixing these up when interfacing microcontrollers with mains is a severe fire and shock hazard.
| Wire Function | US / Canada (NEC) | EU / Global (IEC 60446) | Old UK (Pre-2004) |
|---|---|---|---|
| Line (Hot / Phase) | Black (or Red for 2nd phase) | Brown | Red |
| Neutral | White (or Grey) | Blue | Black |
| Earth / Ground | Green, Green/Yellow, or Bare | Green/Yellow | Green |
Safe Interpretation When Markings are Faded or Missing:
If you are retrofitting an ESP32 smart-switch into an older junction box where wire colors are faded, painted over, or missing, never trust the insulation color. In old UK wiring, a black wire could be Neutral, or it could be a switched Line. In the US, a white wire might have been wrapped in black tape to indicate it's a hot traveler in a 3-way switch setup.
The only safe protocol: Use a non-contact voltage tester to identify the live feed, then use a multimeter in continuity mode (with power OFF) to trace the neutral and ground paths back to the panel. Label the wires with fresh heat-shrink tubing or electrical tape before connecting your relay module.
ESP-WROOM-32 Pinout FAQ
Can I use all 38 pins on the ESP-WROOM-32 for GPIO?
No. While the raw ESP-WROOM-32 silicon module has 38 physical pads, 8 of those (GPIO 6 through 11) are hardwired to the onboard SPI flash memory and are completely inaccessible for user code. Furthermore, on the standard 30-pin DevKit V1 breakout board, several module pins (like GPIO 20 and 24) are not broken out to the header pins at all. You effectively have 25 usable GPIOs on a 30-pin board, and 33 usable GPIOs on a 36-pin board.
Why does my ESP-WROOM-32 fail to boot when GPIO 12 is connected?
GPIO 12 (MTDI) is a critical strapping pin that dictates the internal flash voltage regulator output. If GPIO 12 is pulled HIGH during the boot sequence, the ESP32 configures the flash voltage to 1.8V. Because the WROOM-32 module uses a 3.3V SPI flash chip, the flash memory fails to initialize, resulting in a continuous boot loop (often showing 'flash read err, 1000' in the serial monitor). To fix this, ensure GPIO 12 is either left floating or pulled LOW via a 10kΩ resistor at startup.
How do I safely read faded wire colors on an old sensor connected to the ESP32?
When integrating legacy 4-20mA or 0-10V industrial sensors where the wire jacket colors have faded or been obscured by grease, do not rely on legacy color charts. First, disconnect the sensor from the ESP32's ADC pins. Power the sensor independently and use a multimeter to measure the voltage between the suspected signal wire and the ground wire. A reading between 0-3.3V (or scaled down via a voltage divider) confirms the signal line. Always verify the ground reference with a continuity test to the sensor's chassis or power supply negative terminal before connecting it to the ESP32 GND, as grounding a floating industrial sensor incorrectly can destroy the ESP32's ADC circuitry.






