When working with the generic ESP32 DevKit V1 (38-pin variant), guessing pin functions leads to boot loops, fried modules, and WiFi dropouts. Below is the exact esp32 38 pin pinout reference, followed by the critical hardware constraints and external wiring standards you need to wire sensors safely.
The Complete ESP32 38-Pin Pinout Reference Table
The 38-pin layout features 19 pins per side. Note that physical pin numbering (1-38) is rarely printed on the board; designers rely on the GPIO and function silkscreen. This table maps the physical left/right layout to the internal Espressif ESP32 Datasheet definitions.
| Left Pin | GPIO / Label | Right Pin | GPIO / Label | Function & Restrictions |
|---|---|---|---|---|
| 1 | 3V3 | 38 | GND | Power (3.3V out) / Ground |
| 2 | EN | 37 | IO23 | Enable (Active High) / Digital I/O |
| 3 | VP (IO36) | 36 | IO22 | ADC1_CH0, Input Only / Digital I/O, Default I2C SCL |
| 4 | VN (IO39) | 35 | TX (IO1) | ADC1_CH3, Input Only / UART0 TX (Debug Serial) |
| 5 | IO34 | 34 | RX (IO3) | ADC1_CH6, Input Only / UART0 RX (Debug Serial) |
| 6 | IO35 | 33 | IO21 | ADC1_CH7, Input Only / Digital I/O, Default I2C SDA |
| 7 | IO32 | 32 | GND | ADC1_CH4, Touch9 / Ground |
| 8 | IO33 | 31 | IO19 | ADC1_CH5, Touch8 / VSPI MISO |
| 9 | IO25 | 30 | IO18 | ADC2_CH8, DAC1 / VSPI SCK |
| 10 | IO26 | 29 | IO5 | ADC2_CH9, DAC2 / VSPI SS, Strapping Pin |
| 11 | IO27 | 28 | IO17 | ADC2_CH7, Touch7 / UART2 TX |
| 12 | IO14 | 27 | IO16 | ADC2_CH6, Touch6, HSPI SCK / UART2 RX |
| 13 | IO12 | 26 | IO4 | ADC2_CH5, Touch5, HSPI MISO, Strapping Pin / ADC2_CH0, Touch0 |
| 14 | GND | 25 | IO2 | Ground / ADC2_CH2, Touch2, Strapping Pin, Onboard LED |
| 15 | IO13 | 24 | IO15 | ADC2_CH4, Touch4, HSPI MOSI / ADC2_CH3, Touch3, HSPI SS, Strapping Pin |
| 16 | IO9 | 23 | IO8 | HSPI MISO, Flash SPI / Flash SPI (Do Not Use) |
| 17 | IO10 | 22 | IO7 | HSPI SCK, Flash SPI / Flash SPI (Do Not Use) |
| 18 | IO11 | 21 | IO6 | HSPI SS, Flash SPI / Flash SPI (Do Not Use) |
| 19 | 5V (VIN) | 20 | RST | 5V Input (USB or external) / Reset (Active Low) |
Rows People Get Wrong: Strapping Pins, ADC2, and Flash SPI
The ESP-IDF GPIO API Reference explicitly warns about pins that control boot behavior or share hardware buses. If your project fails to boot or drops WiFi, you likely violated one of these rules:
Strapping Pin Boot Failures
Strapping pins are sampled during reset to determine boot mode. If external circuitry forces them to the wrong state, the ESP32 enters flash download mode or fails to boot.
- GPIO 0: Must be HIGH for normal boot. If pulled LOW (e.g., by a button wired directly to ground without a pull-up resistor), it enters serial bootloader mode.
- GPIO 2: Must be LOW or floating to boot from internal flash. Do not attach a pull-up resistor here.
- GPIO 12 (MTDI): Must be LOW. If pulled HIGH, the ESP32 shifts the internal flash voltage regulator to 1.8V (instead of 3.3V), causing immediate brownouts and boot failures on standard WROOM modules.
- GPIO 15: Must be LOW for normal boot output. If HIGH, it outputs debug logs from the ROM bootloader at 74880 baud, which can confuse attached UART peripherals.
The ADC2 vs. WiFi Conflict
If you are using WiFi or Bluetooth, you cannot use ADC2 (GPIO 0, 2, 4, 12, 13, 14, 15, 25, 26, 27). The WiFi radio driver claims the ADC2 hardware interrupt. If your project requires analog reads while WiFi is active, you must strictly use ADC1 (GPIO 32, 33, 34, 35, 36, 39).
External Wiring Color Codes: IEC vs NEC vs Legacy Standards
When wiring external sensors (I2C, SPI, power) to the ESP32, standardizing your jumper wire colors prevents catastrophic 5V-to-3.3V shorts. Regional electrical standards dictate DC low-voltage color codes. Choose the standard that matches your region or lab environment.
| Function | IEC 60446 (EU / Global / CE) | US NEC (North America) | Old UK (Pre-2004 Legacy) |
|---|---|---|---|
| DC Positive (V+ / 3.3V / 5V) | Brown | Red | Red |
| DC Negative (GND / V-) | Blue | Black | Black |
| Earth / Shield Ground | Green/Yellow Stripe | Green or Bare Copper | Green |
| Signal / Data (I2C, SPI) | Black, White, or Grey | Yellow, Orange, or Blue | Yellow or White |
Faded Silkscreen? How to Safely Probe Unmarked 38-Pin Boards
Cheap clone boards from overseas marketplaces frequently suffer from faded, misaligned, or entirely missing silkscreen pin labels. Guessing the pinout by counting from the USB port is dangerous because some manufacturers mirror the layout or shift the 5V/GND pins.
Follow this safe interpretation protocol to map an unmarked 38-pin board:
- Identify Ground: Set your multimeter to continuity mode. Probe the metal shield of the micro-USB/USB-C port. One probe stays on the shield; sweep the other across the header pins. The pins that beep are your GND pins (usually 4 to 6 of them on a 38-pin board).
- Identify 5V (VIN): Power the board via USB. Set the multimeter to DC Voltage. Black probe on a known GND. Red probe sweeps the remaining power pins. The pin reading 4.8V–5.2V is VIN.
- Identify 3.3V: Locate the AMS1117-3.3 voltage regulator (the small SOT-223 IC near the USB port). Pin 3 of this regulator is the 3.3V output. Probe the header pins to find which one shares continuity with Pin 3.
- Map the GPIOs: For the remaining pins, upload a simple "pin sweep" sketch that sets each GPIO HIGH for 500ms in sequence while you monitor with a logic analyzer or an LED+resistor probe. Cross-reference the physical pin that lights up with the software GPIO number.
Decision Tree: Selecting the Right GPIO for Your Sensor
Stop guessing which pin to use. Use this decision path to terminate on the exact, safest GPIO for your specific peripheral requirement.
| If your application requires... | Then select these GPIOs | Why? (The Hardware Reason) |
|---|---|---|
| I2C Bus (Sensors, OLEDs) | SDA: 21, SCL: 22 | Default hardware I2C pins; no internal pull-up conflicts. |
| SPI Bus (SD Cards, TFTs) | SCK: 18, MISO: 19, MOSI: 23, SS: 5 | Default VSPI bus; avoids the fatal Flash SPI pins (6-11). |
| Analog Input (with WiFi ON) | 32, 33, 34, 35, 36, 39 | ADC1 bus only. ADC2 is disabled by the WiFi radio driver. |
| PWM / LED Control | 4, 16, 17, 18, 19, 25, 26, 27 | High-drive capable, no boot-strapping conflicts. |
| Capacitive Touch | 2, 4, 12, 13, 14, 15, 27, 32, 33 | Routed to the internal touch sensor controller. |






