ESP32 pinout diagram showing GPIO, power, analog, PWM, and communication pins

ESP32 Pinout: Everything You Need to Know About ESP32 Pins

IEM Robotics

Table of Content

The ESP32 is a widely used microcontroller in robotics, Internet of Things (IoT), home automation, and embedded systems. Its built-in Wi-Fi and Bluetooth capabilities allow developers to connect sensors, control electronic devices, and exchange data wirelessly without requiring separate communication modules.

Before starting an ESP32 project, it is important to understand the ESP32 pinout. The pinout identifies the location and function of each pin, helping users connect components correctly and avoid hardware problems.

Whether you are building a line-following robot, a smart home device, or a sensor-based monitoring system, knowing the ESP32 pin configuration makes circuit design easier.

This guide explains the ESP32 pin diagram, GPIO functions, power connections, communication pins, analog inputs, and practical pin selection for electronics and robotics projects.

What Is an ESP32 Pinout?

An ESP32 pinout is a diagram or reference chart that describes the physical pins available on an ESP32 chip or development board. It identifies which pins can be used for digital input and output, analog sensing, communication, power supply, and other hardware functions.

The original ESP32 is developed by Espressif Systems. It uses a flexible GPIO system, which means many pins can perform different functions depending on how they are configured in software.

For example, GPIO21 can work as a general-purpose digital pin or as the SDA line for I2C communication. Similarly, GPIO18 can function as a digital output or an SPI clock pin.

The ESP32 is available in different variants, including ESP32-WROOM-32, ESP32-S2, ESP32-S3, ESP32-C3, and ESP32-C6. Each variant has different hardware capabilities and pin arrangements.

The following sections focus primarily on the original ESP32-WROOM-32 and commonly used ESP32 DevKit development boards. Always check the documentation for your particular board before connecting components.

ESP32 GPIO Pins and Functions

GPIO stands for General-Purpose Input/Output. GPIO pins allow the ESP32 to receive information from external components and send control signals to other devices.

The classic ESP32 supports up to 34 GPIOs at the chip level, but not all of them are available for general use. Some are connected to internal flash, and others are limited to input operations.

Digital Input and Output Pins

Digital GPIO pins operate using HIGH and LOW logic states. They can read the output of a push button, detect a digital sensor signal, or control an LED through an appropriate resistor.

Common digital pins include GPIO4, GPIO13, GPIO14, GPIO16–19, GPIO21–23, GPIO25–27, GPIO32, and GPIO33.

This is a simple way to understand how ESP32 digital pins work before using them for more complex robotics or automation tasks.

Analog Input Pins

Analog pins allow the ESP32 to measure varying voltage levels from sensors. The microcontroller uses an Analog-to-Digital Converter (ADC) to convert these signals into digital readings. The original ESP32 includes two ADC units:

●       ADC1: GPIO32–GPIO39.

●       ADC2: GPIO0, GPIO2, GPIO4, GPIO12–GPIO15, GPIO25–GPIO27.

ADC1 is generally preferred when Wi-Fi is enabled because ADC2 access on the original ESP32 conflicts with Wi-Fi operation. GPIO34, GPIO35, GPIO36, and GPIO39 are particularly useful for analog measurements because they are input-only.

For example, an LDR module or analog temperature sensor can provide a varying voltage that the ESP32 reads through an ADC pin, provided the sensor output stays within the permitted input voltage.

This program reads the analog signal on GPIO34 and prints the ADC value to the Serial Monitor. The default reading is a digital value, not a direct voltage measurement; calibration and ADC settings affect its accuracy.

PWM Pins

Pulse Width Modulation (PWM) is used to control the average power delivered to a component by switching a digital signal on and off rapidly. The classic ESP32 supports LED PWM on multiple output-capable GPIOs. It is commonly used for controlling LED brightness, generating motor-driver control signals, and producing servo control pulses with suitable libraries.

For example, an ESP32 can generate PWM signals to control a motor driver's speed input. The motor itself must be powered through the driver rather than directly from the GPIO. The ESP32's flexible GPIO matrix allows peripheral signals to be routed to supported pins, although some pins have hardware restrictions.

ESP32 Pin Description: Power and Communication

Understanding the ESP32 pin description is essential when connecting external devices. Power pins supply the board, while communication pins transfer data between the ESP32 and peripherals.

Power and Ground Pins

The ESP32 operates using 3.3V logic. Its GPIO pins are not 5V tolerant, so connecting a 5V output directly to a GPIO can damage the microcontroller. A suitable voltage divider or logic-level shifter should be used when interfacing with 5V devices. Also, check the board's power documentation before connecting an external supply. The ESP32-DevKitC supports different power options, but multiple power sources should not be connected simultaneously unless the board documentation explicitly permits it.

UART (Universal Asynchronous Receiver-Transmitter) is used for serial communication and is commonly used to upload firmware and debug ESP32 programs.

I2C Pins

I2C is a two-wire communication protocol commonly used for connecting displays, sensors, and other electronic modules. On many classic ESP32 Arduino configurations, the default I2C assignments are:

●       GPIO21 – SDA (Serial Data)

●       GPIO22 – SCL (Serial Clock)

Multiple I2C devices can share these two lines when their addresses are compatible, and the bus is wired correctly.

SPI Pins

SPI (Serial Peripheral Interface) is used for high-speed communication with displays, memory cards, and other peripherals. These are common default assignments, not fixed requirements for every SPI device. Supported peripheral signals can be routed to other suitable GPIOs through software.

ESP32 Pins to Avoid and Important Precautions

Some ESP32 pins have special hardware functions that can cause problems if used incorrectly. Checking these restrictions before building a circuit can prevent startup failures and hardware damage. GPIO0 is particularly important because holding it LOW during reset selects the serial download boot mode. GPIO12 can also affect the flash supply configuration, so an incorrect external signal may prevent the ESP32 from starting correctly.

For most beginner projects, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23, GPIO25, GPIO26, GPIO27, GPIO32, and GPIO33 are useful choices, provided they are not already required by another peripheral. These restrictions apply to the classic ESP32; other ESP32 variants have different pin limitations.

Applications of ESP32 Pins in Robotics and IoT

The ESP32 pin configuration makes it suitable for projects that combine sensors, actuators, and wireless communication. Some common applications include:

●       Robotics: Connecting IR sensors, ultrasonic sensors, motor drivers, and control circuits.

●       Home automation: Controlling lights, relays, and smart devices through Wi-Fi.

●       IoT monitoring: Reading temperature, humidity, and environmental sensors.

●       Embedded systems: Interfacing displays, communication modules, and electronic components.

For example, a robot can use GPIO34 to read a digital sensor output, GPIO21 and GPIO22 to communicate with an I2C sensor, and GPIO25 and GPIO26 to provide control signals to a motor driver. The actual pin assignments depend on the circuit, peripheral requirements, and board specifications.

Frequently Asked Questions

1. How many pins does an ESP32 have?

The original ESP32 chip supports up to 34 GPIOs, although the number of usable pins depends on the development board and module.

2. Which ESP32 pins support analog input?

The original ESP32 supports ADC1 on GPIO32–GPIO39 and ADC2 on selected GPIOs, including GPIO0, GPIO2, GPIO4, GPIO12–GPIO15, and GPIO25–GPIO27.

3. Can ESP32 GPIO pins handle 5V?

No. ESP32 GPIOs use 3.3V logic and are not 5V tolerant. Use appropriate voltage-level conversion when connecting 5V signals.

4. Which pins are used for I2C on ESP32?

GPIO21 is commonly used for SDA, and GPIO22 is commonly used for SCL in classic ESP32 Arduino configurations.

5. Which ESP32 pins should beginners avoid?

Avoid GPIO6–GPIO11 because they are generally connected to flash memory. Be cautious with strapping pins and remember that GPIO34–GPIO39 are input-only.

Conclusion

Understanding the ESP32 pinout helps beginners and electronics enthusiasts connect sensors, displays, motors, and communication modules correctly. Knowing the functions of GPIO pins, analog inputs, PWM, UART, I2C, and SPI makes it easier to design circuits for robotics and IoT applications. Before wiring any component, verify the ESP32 pin diagram for your exact board, check voltage compatibility, and consider the special restrictions of each GPIO.

Binita Barman

By: Binita Barman

I’m a technical and SEO content writer specializing in creating engaging content across technology, AI, and current affairs. I focus on simplifying complex topics into clear, easy-to-understand narratives. With experience in content writing, scriptwriting, and digital marketing, I blend storytelling with strategy to drive engagement. 

I aim to educate and inspire readers through my blogs while keeping them informed about the latest and most exciting developments in the digital world, so they can make confident decisions in an ever-evolving landscape.

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.