ESP32 Pinout Explained: Safe Pins, Wiring Rules and Example

de nov. 25 2025
Source: DiGi-Electronics
Browse: 2374

The ESP32’s pinout is one of its greatest strengths, and one of the most common sources of confusion. With heavy multiplexing, strict boot-mode dependencies, and sensitive analog behavior, correct pin selection is important for stable operation. This article organizes every major pin group clearly so you can avoid conflicts, prevent boot failures, and design reliable ESP32-based hardware.

Figure 1. ESP32 Pinout

Understanding the ESP32 Pinout

The ESP32 is a powerful and flexible microcontroller widely used in IoT, automation, and smart devices. Its advanced capabilities come from a highly multiplexed pinout system in which many functions share the same physical pins. These include digital I/O, ADC channels, capacitive touch sensors, communication buses, RTC-domain pins, and internal connections for SPI flash and boot configuration. Because many functions share pins, improper wiring can cause failed boots, noisy ADC readings, or disabled peripherals.

ESP32 DevKit Pin Layout

Figure 2. ESP32 DevKit Pin Layout

ESP32 development boards typically come in 30-pin and 38-pin versions, both exposing the same core functions, but with minor differences in available GPIOs.

Pin Groups on ESP32 Dev Boards

GroupDescription
Power PinsVIN (5 V), 3.3 V output, GND
Control PinsEN (reset), IO0 (boot mode)
GPIO PinsDigital I/O with multiplexing
Analog PinsADC1 and ADC2 channels
Communication PinsSPI, I2C, UART, I2S
Input-Only PinsGPIO34–GPIO39
Flash-Reserved PinsGPIO6–GPIO11

Common Header Arrangement

Left Header

• EN, GPIO36–39, GPIO34–35

• GPIO32–33, 25–27

• VIN, GND, 3.3V

Right Header

• GPIO0–23

• Boot-strapping pins (0, 2, 5, 12, 15)

Understanding the physical layout makes it easier to avoid mistakes and plan wiring efficiently.

ESP32 GPIO Overview

Figure 3. ESP32 GPIO

ESP32 GPIOs are flexible thanks to the internal I/O Matrix, which allows peripherals like UART, SPI, I2C, and PWM to be mapped almost anywhere. GPIOs support digital input/output with built-in pull-up/down resistors, edge-triggered interrupts, and reliable switching at high speeds. Typical continuous drive current is 12–16 mA (peaks up to ~20–40 mA), so external drivers are required for motors or relays.

Input-Only Pins

These pins cannot drive output and are ideal for sensors and analog inputs:

PinTypeRecommended Use
GPIO34Input onlyADC1 / sensors
GPIO35Input onlyADC1
GPIO36 (VP)Input onlyADC1 / Hall sensor
GPIO39 (VN)Input onlyADC1

Safe ESP32 Pins to Use and Pins to Avoid

Figure 4. Safe ESP32 Pins to Use and Pins to Avoid

Not all ESP32 pins behave equally. Some are safe, while others influence boot mode or are tied to internal flash memory.

Safe Pins (Recommended for All Users)

GPIOsNotes
4, 13–19, 21–27, 32, 33No boot impact, ideal for most peripherals

Caution Pins (Affect Boot Mode)

GPIOBoot FunctionAvoid During Boot
GPIO0Flash/Boot modeKeep HIGH (input) during normal boot
GPIO2Boot voltageMust be HIGH
GPIO5Optional boot modeAvoid pulling low
GPIO12Flash voltage modeMust stay LOW
GPIO15SPI modeMust stay LOW

These pins are safe to use in normal operation, but external components must not pull them to invalid logic levels during reset. Their detailed boot roles are explained in Section 9.

Restricted Pins (Do Not Use)

GPIOReason
GPIO6–11Connected to SPI flash memory

Using these may freeze or crash the ESP32.

ESP32 ADC Pins

Figure 5. ESP32 ADC Pins

The ESP32 integrates two SAR ADC units with different operational behavior:

• ADC1 — Always available and recommended for all sensor inputs

• ADC2 — Shared with the Wi-Fi subsystem and becomes unavailable whenever Wi-Fi is active

This is one of the key limitations of the ESP32, making ADC1 the reliable choice for measurements in wireless applications.

ADC UnitChannelsGPIOsNotes
ADC1CH0–CH7GPIO32–39Best choice for sensors
ADC2CH0–CH90, 2, 4, 12–15, 25–27Unusable during Wi-Fi

Voltage Range & Accuracy

The ADCs support a default 0–1.1 V input range, extendable to about 3.3 V with attenuation. Both ADC units are non-linear and benefit from calibration. Analog performance can be affected by internal RF activity, so routing sensor lines away from the antenna and adding simple RC filters can greatly improve stability. For Wi-Fi-enabled projects, always place analog sensors on ADC1 to ensure continuous and noise-free operation.

ESP32 DAC, PWM, and Touch Pins

The ESP32 includes onboard analog-style outputs and touch sensors that simplify waveform generation, dimming, motor control, and user interfaces.

DAC Overview

Figure 6. ESP32 DAC

Two 8-bit DAC channels output true analog voltages:

DACGPIO
DAC1GPIO25
DAC2GPIO26

Common uses include simple audio, analog waveforms, LED fading, and bias voltages. Output range is typically 0–3.3 V.

PWM (LEDC)

Figure 7. ESP32 PWM

The LEDC module provides high-resolution, flexible PWM:

• 16 channels

• Up to 40 MHz timer base

• Up to 20-bit resolution

• Fully remappable GPIOs

Used for LED dimming, motor control, servo signals, audio tones, and general modulation. Any GPIO can host a PWM output via the GPIO Matrix.

Touch Sensor Pins

Figure 8. ESP32 Touch Sensor Pins

The ESP32’s 10 capacitive touch pads detect finger proximity and are useful for touch buttons, sliders, and wake-up triggers.

Touch PadGPIO
T0–T9GPIO4, 0, 2, 15, 13, 12, 14, 27, 33, 32

These sensors include noise filtering and work well for low-power wake events.

ESP32 Communication Pins

The ESP32 includes a rich set of communication peripherals, each capable of being routed to multiple pins through the flexible GPIO Matrix. This allows interfaces such as I2C, SPI, and UART to be assigned almost anywhere, enabling highly customizable board layouts and peripheral combinations.

I2C (Default and Custom Pins)

Figure 9. ESP32 I2C Pins

The ESP32 includes two I2C controllers, with full flexibility over pin selection. Although most development boards use the default pins, both SDA and SCL can be reassigned to nearly any GPIO.

SignalDefault GPIONotes
SDAGPIO21Fully remappable
SCLGPIO22Fully remappable

Any two digital GPIOs can act as SDA and SCL. Supports both standard-mode (100 kHz), fast-mode (400 kHz), and fast-mode plus (1 MHz depending on board). Supports internal pull-ups on some boards, but external 4.7 kΩ resistors are recommended for stable communication. This flexibility makes the ESP32 ideal for systems requiring multiple sensors or unconventional pin routing.

The ESP32 includes multiple SPI buses, with HSPI and VSPI available for user devices. Both support remapping through the GPIO matrix, but most boards and libraries use the following default VSPI configuration, which avoids conflicts with internal flash connections:

Default VSPI Mapping

• SCK → GPIO18

• MISO → GPIO19

• MOSI → GPIO23

• CS → GPIO5

VSPI is typically preferred for displays, SD cards, and high-speed peripherals. While pins are remappable, using the defaults ensures maximum compatibility and reduces timing issues without repeating restrictions already covered in earlier sections.

UART (Serial)

Figure 10. ESP32 UART Pins

The ESP32 includes three UART controllers, with flexible routing that allows any UART pins to move to nearly any GPIO.

UARTTX PinRX PinPrimary Purpose
UART0GPIO1GPIO3Flashing, boot messages, serial logging
UART1GPIO10GPIO9Available for user applications
UART2GPIO17GPIO16Available for user applications

ESP32 Deep-Sleep & RTC Pins

The ESP32 includes an Ultra-Low-Power (ULP) subsystem and a dedicated Real-Time Clock (RTC) domain that remain powered even when the main CPU and peripherals are turned off. This architecture enables extremely low power consumption, often in the microampere range, making the ESP32 suitable for long-term battery-operated applications.

Deep sleep allows the chip to shut down the main cores, most internal clocks, and the Wi-Fi/Bluetooth radios, while still monitoring selected pins and sensors through the RTC peripherals.

Figure 11. ESP32 RTC Pins

The ESP32 can wake from deep sleep through several independent triggers. Each wake source operates inside the RTC domain, which is designed to stay active with minimal power consumption.

Wake TypeGPIOs / Notes
External RTC GPIOGPIO32, GPIO33, GPIO25, GPIO26, GPIO27 — support edge or level wake-up
Capacitive Touch PadsT0–T9 — detects finger proximity or touch during deep sleep
Timer Wake-UpRTC timer can wake the device after a programmed interval
ULP Co-Processor(Optional) Custom low-power code can run to check sensors before waking the main CPU

These pins belong to the RTC domain and remain active even when CPU and regular GPIOs are powered down. They support wake-up via rising/falling edges or simple level detection. Commonly used for wake-on-motion, magnetic switches, and low-power triggers.

ESP32 Boot, Strapping, and EN Pin Functions

Figure 12.ESP32 Strapping Pins

The ESP32 uses several strapping pins that determine key system configurations during reset or power-up. These pins are sampled only at boot and then return to normal GPIO function. Ensuring they are not driven to invalid levels during reset is useful for consistent startup behavior.

Strapping Pin Table

PinBoot RoleRequired State at Boot
GPIO0Selects bootloader / flash modeLOW = enter flash mode; HIGH = normal startup
GPIO2Defines internal boot voltage levelMust remain HIGH
GPIO5SPI boot configurationMust remain HIGH
GPIO12Selects flash voltage (3.3 V / 1.8 V)Must remain LOW for 3.3 V flash
GPIO15Sets SPI communication mode during bootMust remain LOW

This section provides the authoritative reference for strapping behavior. Earlier sections summarize only the practical effects; use this table when assigning pins on custom PCBs or integrating buttons and sensors.

EN Pin (Enable / Reset)

The EN (Enable) pin acts as the master reset input for the ESP32.

EN Pin Behavior:

• Pulling EN LOW resets the chip immediately.

• Releasing it back to HIGH powers up the internal circuits and restarts the boot sequence.

• On development boards (e.g., ESP32-DevKitC, NodeMCU-ESP32), EN is tied to the USB-to-serial interface to allow auto-reset during flashing.

ESP32 Power Pins

Figure 13. ESP32 Power Pins

The ESP32 is sensitive to power quality because its Wi-Fi and Bluetooth radios draw short, high-amplitude current pulses. Stable power delivery ensures reliable booting, reduced brownout resets, and consistent wireless performance.

Power Pin Summary

PinVoltageUse
VIN5 V inputFeeds the onboard regulator (typically AMS1117 or ME6211) to generate 3.3 V
3V33.3 V outputRegulated output from the onboard LDO; used to power external low-current logic and sensors
GNDElectrical reference and return path for all subsystems

Recommended ESP32 Pins & Wiring Examples

Choosing the right pins on the ESP32 is needed for stable operation, clean signal routing, and avoiding conflicts with boot-strapping or internal flash connections. The following recommendations highlight the most reliable, conflict-free pins for common functions.

Pin Choices

FunctionBest PinsNotes
I2C21 (SDA), 22 (SCL)Default hardware-tested pair; works in most boards.
SPI18 (SCK), 19 (MISO), 23 (MOSI), 5 (CS)These pins map cleanly to VSPI and avoid flash-connected pins.
UART16 (RX), 17 (TX)Dedicated UART2 pins, safe for boot and debugging.
PWM (LEDC)4, 16–19, 21–27, 32–33High-flexibility range; PWM can be routed to almost any GPIO.
ADC32–39 (ADC1)ADC1 channels remain usable even when Wi-Fi is active.

Conclusion

Mastering the ESP32 pinout removes guesswork and prevents many of the problems that appear in actual builds, from noisy ADC readings to endless boot loops. By understanding safe pins, strapping behavior, power integrity, and deep-sleep routing, you can design circuits that remain stable, predictable, and wireless-ready. Use the pin maps and guidelines above as your foundation for trouble-free ESP32 projects.

Frequently Asked Questions [FAQ]

How do I configure PlatformIO for the Freenove ESP32-S3 Breakout Board?

Use the standard ESP32-S3 dev module settings. In your platformio.ini, add:

[env:esp32s3]

platform = espressif32

board = esp32-s3-devkitc-1

framework = arduino

This matches the Freenove pinout, allowing normal compiling and uploading via USB.

How many peripherals can the ESP32 run at the same time?

Because of the GPIO Matrix, the ESP32 can run multiple I²C, SPI, UART, PWM, and ADC functions simultaneously, as long as you avoid restricted pins and stay within CPU and timing limits. The main bottlenecks are ADC2 during Wi-Fi and power supply quality, not the pin count.

Why does my ESP32 reboot when connecting sensors or modules?

Unexpected resets usually come from voltage dips caused by Wi-Fi bursts, motors, or poorly regulated supplies. Using a 1 A or higher 5 V source, adding 10–100 µF bulk capacitors, and isolating noisy loads prevents brownouts.

Can I use the ESP32’s 3.3 V pin to power external modules?

Yes, but only for low-current devices (typically under 300–500 mA, depending on the onboard LDO). High-draw peripherals like motors, servos, and large LED strips must use a separate power supply to avoid resets and overheating.

How do I choose the best ESP32 pins when using multiple peripherals?

Prioritize non-strapping pins, avoid GPIO6–11, place analog sensors on ADC1, and use default VSPI/I²C/UART pins when possible. This reduces conflicts and ensures that all peripherals can operate together without remapping issues.