Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.
  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.
Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.

ESP32 Pinout Reference: GPIO, ADC, PWM & Communication

Meta:Complete ESP32 Pinout Reference covering GPIO, ADC, DAC, PWM, and communication interfaces. Includes safe pin recommendations, strapping pins, and wiring tips.

The ESP32 Pinout Reference is essential knowledge for anyone serious about building reliable embedded projects. After years of designing PCBs with this chip, I’ve learned that understanding which pins to use—and which to avoid—can mean the difference between a project that works flawlessly and one that frustrates endlessly.

This guide provides a complete reference for ESP32 GPIO pins, covering analog-to-digital conversion, PWM generation, and all communication interfaces. Whether you’re transitioning from Arduino boards or diving straight into ESP32 development, this pinout reference will help you make informed design decisions.

Understanding ESP32 GPIO Architecture

The ESP32 microcontroller features 48 GPIO pins total, though typical development boards expose only 25-36 of these. What makes the ESP32 remarkable is its GPIO matrix—a flexible routing system that allows most peripheral functions to be assigned to almost any pin through software configuration.

Unlike traditional microcontrollers where SPI must use specific pins, the ESP32 lets you route SPI, I2C, UART, and PWM signals to your preferred GPIO pins. This flexibility simplifies PCB routing and allows creative solutions when pins conflict.

However, this flexibility comes with important caveats. Some pins have specific boot-time requirements. Others connect to internal flash memory and cannot be used. Understanding these restrictions separates successful ESP32 designs from problematic ones.

ESP32 DevKit V1 Pin Categories

CategoryPin CountDescription
General Purpose GPIO25Available for digital I/O
Input-Only GPIO4GPIO34-39, cannot output
ADC Channels18Analog input measurement
DAC Channels2Analog voltage output
Touch Sensors10Capacitive touch detection
PWM Channels16Pulse width modulation
Strapping Pins5Affect boot behavior

Complete ESP32 Pinout Reference Table

This comprehensive table covers the 30-pin ESP32 DevKit V1, one of the most common development boards. Pin behavior remains consistent across different manufacturers, though physical layouts vary.

Full GPIO Pin Mapping

GPIOBoard PinADCTouchDefault FunctionSafe to Use
GPIO0D0ADC2_CH1T1Boot mode select⚠️ Caution
GPIO1TX0UART0 TX⚠️ Serial
GPIO2D2ADC2_CH2T2Boot mode, LED⚠️ Caution
GPIO3RX0UART0 RX⚠️ Serial
GPIO4D4ADC2_CH0T0General I/O✅ Safe
GPIO5D5VSPI CS0⚠️ Strapping
GPIO12D12ADC2_CH5T5HSPI MISO⚠️ Strapping
GPIO13D13ADC2_CH4T4HSPI MOSI✅ Safe
GPIO14D14ADC2_CH6T6HSPI CLK✅ Safe
GPIO15D15ADC2_CH3T3HSPI CS0⚠️ Strapping
GPIO16D16UART2 RX✅ Safe
GPIO17D17UART2 TX✅ Safe
GPIO18D18VSPI CLK✅ Safe
GPIO19D19VSPI MISO✅ Safe
GPIO21D21I2C SDA✅ Safe
GPIO22D22I2C SCL✅ Safe
GPIO23D23VSPI MOSI✅ Safe
GPIO25D25ADC2_CH8DAC1✅ Safe
GPIO26D26ADC2_CH9DAC2✅ Safe
GPIO27D27ADC2_CH7T7General I/O✅ Safe
GPIO32D32ADC1_CH4T9General I/O✅ Safe
GPIO33D33ADC1_CH5T8General I/O✅ Safe
GPIO34D34ADC1_CH6Input only✅ Input
GPIO35D35ADC1_CH7Input only✅ Input
GPIO36VPADC1_CH0Input only✅ Input
GPIO39VNADC1_CH3Input only✅ Input

Pins to Avoid

GPIOReasonNotes
GPIO6-11SPI FlashConnected to internal flash memory
GPIO0Boot modeMust be HIGH for normal boot
GPIO2Boot modeShould be LOW or floating at boot
GPIO12Flash voltageHIGH at boot causes boot failure
GPIO15Debug outputOutputs debug data at boot

ESP32 ADC Pinout Reference

The ESP32 features two 12-bit SAR (Successive Approximation Register) ADCs with 18 channels total. This provides excellent analog measurement capability, but several important limitations affect real-world usage.

ADC Channel Distribution

ADC UnitChannelsGPIO PinsWiFi Compatible
ADC1832, 33, 34, 35, 36, 37, 38, 39✅ Yes
ADC2100, 2, 4, 12, 13, 14, 15, 25, 26, 27❌ No

ADC1 Pin Details (WiFi Safe)

ChannelGPIOAvailable on DevKitNotes
ADC1_CH0GPIO36YesInput only, VP pin
ADC1_CH3GPIO39YesInput only, VN pin
ADC1_CH4GPIO32YesGeneral purpose
ADC1_CH5GPIO33YesGeneral purpose
ADC1_CH6GPIO34YesInput only
ADC1_CH7GPIO35YesInput only

Critical ADC Limitations

The most important restriction: ADC2 cannot be used while WiFi is active. The WiFi driver exclusively claims ADC2 hardware, making those pins unavailable for analog readings during wireless operation.

For any project using WiFi, plan your analog sensors exclusively on ADC1 pins (GPIO32-39). This single design decision eliminates countless hours of debugging mysterious ADC failures.

The ESP32 ADC also exhibits non-linearity at voltage extremes. Readings below 100mV and above 3.2V become unreliable. For precision measurements, consider external ADCs or implement calibration routines using the ESP32’s eFuse calibration data.

ADC Resolution and Attenuation

AttenuationVoltage RangeUse Case
0 dB0 – 1.1VPrecision low-voltage
2.5 dB0 – 1.5VExtended range
6 dB0 – 2.2VMedium range
11 dB0 – 3.3VFull range (default)

ESP32 DAC Pinout Reference

The ESP32 includes two 8-bit Digital-to-Analog Converter channels for generating true analog voltage outputs. While limited in resolution, these DAC channels prove useful for many applications.

DAC Channel Assignment

ChannelGPIOVoltage RangeResolution
DAC1GPIO250 – 3.3V8-bit (256 levels)
DAC2GPIO260 – 3.3V8-bit (256 levels)

DAC applications include generating reference voltages, simple audio output, analog control signals, and creating waveforms for testing purposes. The 8-bit resolution limits audio quality, but works acceptably for basic tones and alerts.

For high-fidelity audio applications, use an external I2S DAC. The ESP32’s I2S interface supports professional audio DACs with 24-bit resolution and sample rates exceeding 192kHz.

ESP32 PWM Pinout Reference

The ESP32’s LED Control (LEDC) peripheral provides 16 independent PWM channels with impressive flexibility. Unlike some microcontrollers that dedicate specific pins to PWM, the ESP32 can generate PWM on any output-capable GPIO.

PWM Channel Specifications

FeatureSpecification
Total Channels16
Independent Frequencies8 (shared pairs)
Resolution1-16 bits configurable
Maximum Frequency40 MHz (at 1-bit)
Typical Frequency5 kHz (at 13-bit)

PWM-Capable GPIO Pins

All GPIO pins capable of output can generate PWM signals. This excludes only the input-only pins (GPIO34-39). In practice, avoid using strapping pins and serial pins for PWM unless absolutely necessary.

Recommended PWM pins: GPIO4, GPIO13, GPIO14, GPIO16, GPIO17, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23, GPIO25, GPIO26, GPIO27, GPIO32, GPIO33

PWM Configuration Example

// ESP32 PWM Configuration

const int pwmChannel = 0;

const int pwmFrequency = 5000;

const int pwmResolution = 8;

const int pwmPin = 18;

void setup() {

  ledcSetup(pwmChannel, pwmFrequency, pwmResolution);

  ledcAttachPin(pwmPin, pwmChannel);

}

void loop() {

  ledcWrite(pwmChannel, 128);  // 50% duty cycle

}

ESP32 Communication Interface Pinout

The ESP32’s GPIO matrix enables remarkable flexibility in assigning communication peripherals to GPIO pins. While default pins exist for convenience, you can reassign most interfaces to alternative pins through software configuration.

I2C Interface Pins

The ESP32 supports two I2C bus interfaces, both configurable to any output-capable GPIO pins.

InterfaceDefault SDADefault SCLMax Speed
I2C0GPIO21GPIO22400 kHz
I2C1ConfigurableConfigurable400 kHz

I2C works through software bit-banging on the ESP32, allowing any GPIO pin combination. The default pins (GPIO21 SDA, GPIO22 SCL) remain the most commonly used and best documented.

SPI Interface Pins

The ESP32 provides four SPI controllers, though only two are available for general use (SPI0 and SPI1 connect to internal flash).

InterfaceMOSIMISOCLKCSMax Speed
HSPIGPIO13GPIO12GPIO14GPIO1580 MHz
VSPIGPIO23GPIO19GPIO18GPIO580 MHz

For maximum SPI performance (80 MHz), use the default pin assignments. Remapped pins pass through the GPIO matrix, limiting speeds to approximately 40 MHz.

UART Interface Pins

Three UART interfaces provide serial communication capability.

InterfaceDefault TXDefault RXNotes
UART0GPIO1GPIO3USB Serial, debugging
UART1GPIO10GPIO9Flash pins, remap required
UART2GPIO17GPIO16General use

UART0 connects to the USB-to-serial converter on most development boards. Reserve this for debugging and programming. UART1 defaults to pins used by the internal flash, requiring remapping before use. UART2 provides the cleanest option for connecting external serial devices.

Remapping UART1 Example

#include <HardwareSerial.h>

HardwareSerial MySerial(1);  // UART1

void setup() {

  MySerial.begin(9600, SERIAL_8N1, 26, 27);  // RX=26, TX=27

}

ESP32 Touch Sensor Pinout

The ESP32 integrates 10 capacitive touch sensors, enabling button-free user interfaces. These sensors detect proximity and touch through changes in pin capacitance.

Touch Sensor Pin Assignment

TouchGPIOADCNotes
T0GPIO4ADC2_CH0Safe to use
T1GPIO0ADC2_CH1Strapping pin
T2GPIO2ADC2_CH2Strapping pin
T3GPIO15ADC2_CH3Strapping pin
T4GPIO13ADC2_CH4Safe to use
T5GPIO12ADC2_CH5Strapping pin
T6GPIO14ADC2_CH6Safe to use
T7GPIO27ADC2_CH7Safe to use
T8GPIO33ADC1_CH5Safe to use
T9GPIO32ADC1_CH4Safe to use

Touch sensors T8 and T9 on GPIO32 and GPIO33 offer the best combination—they work with WiFi active (ADC1 pins) and have no boot-time restrictions.

ESP32 Strapping Pins Reference

Five GPIO pins determine ESP32 boot behavior. Incorrect states on these pins during power-up cause boot failures or unexpected operation modes.

Strapping Pin Requirements

GPIORequired StateEffect if Wrong
GPIO0HIGHEnters download mode
GPIO2LOW/FloatingBoot may fail
GPIO5HIGHSDIO timing issues
GPIO12LOWBoot failure (3.3V flash)
GPIO15HIGHSuppresses boot messages

Most development boards include circuitry ensuring correct strapping pin states. Problems arise when external circuits pull these pins to incorrect levels during power-up.

If you must use strapping pins, ensure your external circuits don’t override the required boot states. Adding series resistors (1K-10K) between the ESP32 and external devices often resolves conflicts.

Useful Resources and Downloads

ResourceDescriptionURL
ESP32 DatasheetOfficial Espressif documentationespressif.com/documentation
ESP32 Technical ReferenceDetailed peripheral informationespressif.com
Arduino-ESP32 CoreGitHub repositorygithub.com/espressif/arduino-esp32
ESP-IDF DocumentationOfficial development frameworkdocs.espressif.com
Random Nerd TutorialsESP32 project tutorialsrandomnerdtutorials.com
Last Minute EngineersDetailed pinout guideslastminuteengineers.com

Frequently Asked Questions

Which ESP32 GPIO pins are safe to use for any purpose?

GPIO4, GPIO13, GPIO14, GPIO16, GPIO17, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23, GPIO25, GPIO26, GPIO27, GPIO32, and GPIO33 are generally safe for any application. These pins have no special boot requirements and don’t conflict with internal peripherals. GPIO34-39 are safe but limited to input-only operation.

Can I use ADC2 pins while WiFi is enabled?

No. The WiFi driver exclusively controls ADC2 hardware during wireless operation. Any attempt to read ADC2 channels while WiFi is active returns unreliable results. Design your analog inputs around ADC1 pins (GPIO32-39) for projects requiring WiFi connectivity.

Why won’t my ESP32 boot when I connect a device to GPIO12?

GPIO12 is a strapping pin that determines flash voltage at boot. If GPIO12 reads HIGH during power-up, the ESP32 attempts to use 1.8V flash voltage, causing boot failure on boards with 3.3V flash. Ensure GPIO12 stays LOW during reset, or use a different pin for your device.

How many PWM outputs can the ESP32 generate simultaneously?

The ESP32 can generate 16 independent PWM outputs using the LEDC peripheral. However, only 8 different frequencies are available—channels share timers in pairs. For most applications requiring LED dimming, motor control, or servo signals, 16 channels with 8 frequencies provides ample flexibility.

What’s the maximum I2C or SPI speed on remapped pins?

SPI through the GPIO matrix (non-default pins) limits to approximately 40 MHz versus 80 MHz on default pins. I2C performance remains similar regardless of pin assignment since it uses software implementation. For maximum SPI throughput, stick with HSPI or VSPI default pins.

Conclusion

This ESP32 Pinout Reference covers the essential information needed for successful hardware design. The ESP32’s flexibility creates tremendous opportunities, but also demands careful pin selection to avoid boot conflicts and peripheral limitations.

Remember these key principles: use ADC1 pins for analog inputs with WiFi, respect strapping pin requirements, and leverage the GPIO matrix for routing flexibility. Document your pin assignments thoroughly—future you will appreciate the clarity.

The ESP32 remains one of the most capable and cost-effective microcontrollers available. Master its pinout, and you’ll build projects that work reliably from prototype through production.


Suggested Meta Descriptions:

Option 1 (155 characters): Complete ESP32 Pinout Reference covering GPIO, ADC, DAC, PWM, and communication interfaces. Includes safe pin recommendations, strapping pins, and wiring tips.

Option 2 (152 characters): Master the ESP32 pinout with this detailed GPIO reference guide. Covers ADC channels, PWM configuration, I2C, SPI, UART pins, and boot mode requirements.

Option 3 (158 characters): ESP32 Pinout Reference for developers and engineers. Comprehensive guide to GPIO pins, analog inputs, PWM outputs, communication interfaces, and safe pin usage.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Sales & After-Sales Service

Contact & Quotation

  • Inquire: Call 0086-755-23203480, or reach out via the form below/your sales contact to discuss our design, manufacturing, and assembly capabilities.

  • Quote: Email your PCB files to Sales@pcbsync.com (Preferred for large files) or submit online. We will contact you promptly. Please ensure your email is correct.

Drag & Drop Files, Choose Files to Upload You can upload up to 3 files.

Notes:
For PCB fabrication, we require PCB design file in Gerber RS-274X format (most preferred), *.PCB/DDB (Protel, inform your program version) format or *.BRD (Eagle) format. For PCB assembly, we require PCB design file in above mentioned format, drilling file and BOM. Click to download BOM template To avoid file missing, please include all files into one folder and compress it into .zip or .rar format.