Embedded

ESP32 Pin Diagram

By CourseTron Team ·  7 min read ·  Updated Oct 2026 💬 𝕏 in f
Table of Contents
    ? Print / Save as PDF

    In short: On an ESP32 DevKit, GPIO34-39 are input-only with no pull resistors, GPIO6-11 belong to the flash and must never be touched, GPIO0/2/5/12/15 are strapping pins that are read at reset, and ADC2 stops working while Wi-Fi is active, so use ADC1 pins (32-39) for analog reads.

    Most ESP32 boards fail in the same boring ways: a sensor wired to GPIO12 that makes the board refuse to boot, a button on GPIO34 that floats because nobody told you it has no pull-up, an ADC reading that works on the bench and dies when Wi-Fi turns on. All of these come from the pin map. This guide walks the classic ESP32 (ESP32-WROOM-32 / 30-pin and 38-pin DevKit) pin by pin and explains why each restriction exists. The newer S2, S3 and C3 parts use different numbers, so always check your exact chip's datasheet.

    The big picture: 34 GPIOs, but not all equal

    The ESP32 chip exposes GPIO0-19, 21-23, 25-27 and 32-39. That is up to 34 pads, yet a typical DevKit gives you roughly 25 safe ones. The IO MUX lets most peripherals (UART, SPI, I2C, I2S, PWM) be routed to nearly any pin through the GPIO matrix, so the real constraints are physical: which pins are wired to flash, which are sampled at reset, and which connect to the analog blocks.

    ESP32 GPIO families at a glance DO NOT USE GPIO6, 7, 8, 9, 10, 11 Wired to SPI flash (CLK, SD0-3, CMD) STRAPPING GPIO0, 2, 5, 12, 15 Sampled when EN rises Set boot mode and voltage INPUT ONLY GPIO34, 35, 36, 39 No output driver No pull-up / pull-down SAFE GENERAL PURPOSE GPIO4, 13, 14, 16, 17, 18, 19 GPIO21 (SDA), 22 (SCL), 23 GPIO25, 26, 27, 32, 33 CAREFUL: UART0 CONSOLE GPIO1 (TX0), GPIO3 (RX0) Toggle during boot log and flashing Shared with the USB-UART bridge CourseTron · coursetron.com
    Every classic ESP32 GPIO falls into one of five buckets. Memorise this map before you wire anything.

    Input-only pins: GPIO34, 35, 36 and 39

    GPIO34-39 are input-only, which means there is no output driver in the pad. GPIO36 and GPIO39 are labelled VP and VN on most boards (sensor positive and negative), and GPIO37/38 exist on the chip but are rarely broken out on DevKits. Two consequences catch beginners every time: you cannot drive an LED from them, and they have no internal pull-up or pull-down. A push-button on GPIO34 needs an external 10 kOhm resistor, otherwise the pin floats and the reading is noise.

    Key fact: pinMode(34, INPUT_PULLUP) compiles without error but does nothing. The hardware simply has no pull resistor on GPIO34-39.

    These pins are the natural home for analog sensors, because they are ADC1 channels and stay usable while Wi-Fi runs.

    Flash pins: GPIO6 to GPIO11

    On a WROOM module, six pins connect the chip to the integrated SPI flash that holds your firmware. Reading code from flash happens continuously through the cache, so toggling these pins as GPIO crashes the CPU with a cache or watchdog fault. Many 38-pin DevKits do print them as SD0, SD1, SD2, SD3, CMD and CLK. Treat them as if they were not there. (Modules with PSRAM, such as WROVER, additionally consume GPIO16 and GPIO17.)

    Strapping pins and what to avoid at boot

    When EN (reset) rises, the chip latches the level of five pins into the GPIO_STRAP register and uses it to choose its boot behaviour. After that moment they are ordinary GPIOs, but an external circuit that holds them the wrong way at power-up changes how the chip starts.

    PinDefaultWhat it controlsDanger
    GPIO0Pull-up (high)Low at reset = serial download mode; high = run from flashA circuit pulling it low on power-up never runs your program
    GPIO2Pull-downMust be low or floating to enter download modeDrives the on-board LED on many boards; keep it unloaded
    GPIO12 (MTDI)Pull-downSelects flash voltage: low = 3.3 V, high = 1.8 VHigh at boot on a 3.3 V flash module causes a boot loop
    GPIO5Pull-upSDIO slave timingMostly harmless for normal designs
    GPIO15 (MTDO)Pull-upLow silences the ROM boot log on UART0Pulled low means missing boot messages

    Key fact: GPIO12 is the nastiest. It sets VDD_SDIO, the supply for the flash. If a sensor or pull-up holds it high while the module has 3.3 V flash, the flash is under-powered and the board fails to boot with a flash read error. You can burn the VDD_SDIO eFuse to make this permanent, but wiring around it is easier.

    What the ROM bootloader decides at reset EN goes high Latch strapping pins 0, 2, 5, 12, 15 GPIO0 level? LOW HIGH Download mode waits for esptool Run app from flash In parallel: GPIO12 picks flash supply low = 3.3 V (normal) high = 1.8 V (boot loop on 3.3 V flash) CourseTron · coursetron.com
    The strapping decision tree: GPIO0 picks the boot mode, while GPIO12 independently picks the flash voltage.

    Practical rules: do not hang relays, motor drivers or pull-ups on these five pins, and if you must, make sure the external level at reset matches the default. Auto-reset circuits on DevKits use DTR and RTS through two transistors to pulse EN and GPIO0 for you, which is why uploads work without pressing BOOT.

    ADC, touch and DAC channels

    The ESP32 has two 12-bit SAR ADCs. ADC1 has eight channels on GPIO36, 37, 38, 39, 32, 33, 34 and 35. ADC2 has ten channels on GPIO4, 0, 2, 15, 13, 12, 14, 27, 25 and 26, but the Wi-Fi driver owns ADC2, so analogRead() on those pins returns errors whenever Wi-Fi is started. The rule is simple: for any connected project, use ADC1.

    Two more caveats from real measurements. The default 0 dB attenuation measures only up to about 1.1 V; 11 dB extends the range to roughly 3.1 V. The transfer curve is also nonlinear near the rails, so production designs use the factory eFuse calibration (the esp_adc_cal / calibration API in ESP-IDF) rather than a straight value*3.3/4095 formula.

    The two 8-bit DACs live on GPIO25 (DAC1) and GPIO26 (DAC2), giving a step of about 3.3/256 = 12.9 mV. Ten capacitive touch channels sit on GPIO4, 0, 2, 15, 13, 12, 14, 27, 33 and 32 (T0-T9). Notice that touch reuses three strapping pins, so a finger resting on a touch pad at reset can alter boot behaviour.

    Animation: strapping pins are read only at the EN rising edge EN GPIO12 (held low = safe) sample point Time moves left to right: the marker latches state at the dashed line After this, pins are normal GPIO CourseTron · coursetron.com
    The moving marker shows time passing; the level on each strapping pin matters only at the dashed sampling instant.

    A safe pin plan you can reuse

    • Analog sensors: GPIO32-39 (ADC1). Add an external pull for 34-39 if used digitally.
    • I2C: GPIO21 (SDA) and GPIO22 (SCL), the default Arduino mapping.
    • SPI sensors/displays: VSPI on GPIO23 (MOSI), 19 (MISO), 18 (SCK), 5 (CS) - pick another CS if you worry about GPIO5.
    • Relays and LEDs: GPIO16, 17, 25, 26, 27 are free of boot side effects.
    • Deep-sleep wake: only RTC-capable pins (0, 2, 4, 12-15, 25-27, 32-39) can wake the chip via ext0/ext1.

    This is the same discipline we teach for any microcontroller: read the reset-time behaviour before assigning peripherals. For a deeper look at the electrical behaviour of each pad, see our companion piece ESP32 GPIO pins explained, and for what happens when firmware talks to those peripherals read the ESP32 ADC calibration guide. If you are moving from boards to custom silicon, Avecas design services handle full SoC and PCB bring-up, while ChipXpert VLSI training covers the chip-level view of why pads and straps exist.

    Ready to design real hardware instead of guessing at pinouts? Explore the embedded and VLSI tracks in the CourseTron course catalogue and build projects with hands-on labs.

    Frequently asked questions

    Which ESP32 pins are safe to use at boot?

    GPIO4, 13, 14, 16-19, 21-23, 25-27, 32 and 33 have no boot-time function, so they are the safest outputs. Avoid GPIO0, 2, 5, 12 and 15 unless the default levels are respected, and never use GPIO6-11.

    Why does my ESP32 not boot when a sensor is connected?

    Most often the sensor or a pull-up is driving GPIO12 high or GPIO0 low during reset. Move the signal to a non-strapping pin or add a series resistor or buffer that only conducts after boot.

    Can I use ADC2 pins with Wi-Fi?

    No. The Wi-Fi driver takes ADC2, so reads fail while Wi-Fi is active. Use ADC1 pins (GPIO32-39) instead.

    Do GPIO34-39 have internal pull-ups?

    No. They are input-only and lack both pull-up and pull-down resistors, so add an external one for buttons and switches.

    Advertisement