ESP32 Pinout: Everything You Need to Know

ESP32 is a dual-core SoC with two powerful Xtensa LX6 CPUs that run at up to 240 MHz. It comes with integrated Wi-Fi and Bluetooth connectivity, making it suitable for a wide range of IoT applications that require wireless connectivity. ESP32 is the successor of the popular ESP8266 chip, and it offers a lot more capabilities and functionality.

ESP32 also includes various peripherals such as SPI, I2C, UART, ADC, DAC, PWM, and GPIO, which makes it highly adaptable and suitable for a wide range of projects ranging from low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming and MP3 decoding.

One of the most significant advantages of ESP32 is its low power consumption. It has a deep-sleep mode that can reduce the power consumption to as low as 5 microamps, which is ideal for battery-powered applications. ESP32 also has a built-in voltage regulator that can operate on a wide range of power supplies, from 2.2V to 3.6V, which makes it easy to power and use.

Does ESP32 have digital pins?

Yes, the ESP32 has digital pins, also known as General Purpose Input/Output (GPIO) pins. These pins are used for digital input and output and can be configured as either inputs or outputs depending on the needs of the project. The ESP32 has a total of 36 GPIO pins that can be used for various purposes, including interfacing with sensors, controlling LEDs, and communicating with other devices.

ESP32 Pinout

  • 18 Analog-to-Digital Converter (ADC) channels
  • 3 SPI interfaces
  • 3 UART interfaces
  • 2 I2C interfaces
  • 16 PWM output channels
  • 2 Digital-to-Analog Converters (DAC)
  • 2 I2S interfaces
  • 10 Capacitive sensing GPIOs

NOTE: not all GPIOs are accessible in all development boards, but each specific GPIO works in the same way regardless of the development board you’re using. For ESP32 DEVKIT V1 board, GPIO6 to GPIO11 are connected to the integrated SPI flash and are not recommended for other uses.

Is ESP32 3.3 or 5V?

The ESP32 is a 3.3V device, which means that all of its input and output pins are designed to operate with a maximum voltage of 3.3 volts. Connecting the ESP32 to a voltage source greater than 3.3 volts can damage the device, so it's important to use level shifters or voltage dividers when interfacing with higher voltage devices.

It's also important to note that the power supply for the ESP32 should be 3.3V DC. Some development boards or modules may have built-in voltage regulators that can accept a higher input voltage (such as 5V) and regulate it down to 3.3V for the ESP32, but it's always best to check the specifications of the specific device you are using to ensure proper voltage supply.

What are GPIO in ESP32?

| GPIO | Input | Output | Notes | | :=== | :=== | :=== | :=== | | GPIO0 | Pulled up | OK | Outputs PWM signal at boot, must be LOW to enter flashing mode | | GPIO1 | TX pin | OK | debug output at boot | | GPIO2 | OK | OK | connected to on-board LED, must be left floating or LOW to enter flashing mode | | GPIO3 | OK | RX pin | HIGH at boot | | GPIO4 | OK | OK | | | GPIO5 | OK | OK | outputs PWM signal at boot, strapping pin | | GPIO6 | x | x | connected to the integrated SPI flash | | GPIO7 | x | x | connected to the integrated SPI flash | | GPIO8 | x | x | connected to the integrated SPI flash | | GPIO9 | x | x | connected to the integrated SPI flash | | GPIO10 | x | x | connected to the integrated SPI flash | | GPIO11 | x | x | connected to the integrated SPI flash | | GPIO12 | OK | OK | boot fails if pulled high, strapping pin | | GPIO13 | OK | OK | | | GPIO14 | OK | OK | outputs PWM signal at boot | | GPIO15 | OK | OK | outputs PWM signal at boot, strapping pin | | GPIO16 | OK | OK | | | GPIO17 | OK | OK | | | GPIO18 | OK | OK | | | GPIO19 | OK | OK | | | GPIO20 | OK | OK | | | GPIO21 | OK | OK | | | GPIO22 | OK | OK | | | GPIO23 | OK | OK | | | GPIO25 | OK | OK | | | GPIO26 | OK | x | | | GPIO27 | OK | OK | | | GPIO32 | OK | OK | | | GPIO33 | OK | OK | | | GPIO34 | OK | | input only | | GPIO35 | OK | | input only | | GPIO36 | OK | | input only | | GPIO39 | OK | | input only |

Input Only GPIO Pins

  • GPIO 34
  • GPIO 35
  • GPIO 36
  • GPIO 39

These pins don’t have internal pull-up or pull-down resistors. They can’t be used as outputs, so use these pins only as inputs:

ESP32 GPIO pins with internal pull (INPUT_PULLUP)

  • GPIO14
  • GPIO16
  • GPIO17
  • GPIO18
  • GPIO19
  • GPIO21
  • GPIO22
  • GPIO23

ESP32 GPIO pins WITHOUT internal pull

  • GPIO13
  • GPIO25
  • GPIO26
  • GPIO27
  • GPIO32
  • GPIO33

To utilize these pins in Arduino IDE,  and you want to make GPIO 22 as input and GPIO 23 as output:

pinMode(22,INPUT_PULLUP);
pinMode(23,OUTPUT);
digitalWrite(23,HIGH);

ESP32 Serial

There are three serial ports on the ESP32 known as U0UXD, U1UXD and U2UXD all work at 3.3V TTL Level. There are three hardware supported serial interfaces on the ESP32 known as UART0, UART1 and UART2. Like all peripherals, the pins for the UARTs can be logically mapped to any of the available pins on the ESP32. However, the UARTs can also have direct access which marginally improves performance. The pin mapping table for this hardware assistance is as follows.

| UART | RX IO | TX IO | CTS | RTS | | :--- | :--- | :--- | :--- | :--- | | UART0 | GPIO3 | GPIO1 | N/A | N/A | | UART 1 | GPIO9 | GPIO10 | GPIO6 | GPIO11 | | UART 2 | GPIO16 | GPIO17 | GPIO8 | GPIO7 |

ESP32 Strapping Pins

| Strapping Pin | Function | | :--- | :--- | | GPIO0 | Must be LOW to enter boot mode| | GPIO2 | Must be floating or LOW during boot mode| | GPIO4 | | | GPIO5 | Must be HIGH during boot | | GPIO12 | Must be LOW during boot | | GPIO15 | Must be HIGH during boot |

Strapping pins are used to put the ESP32 into bootloader or flashing mode. On most development boards with built-in USB to SERIAL, you don't need to worry about the state of these pins. The board itself puts the pins in the right state prior to flashing or when on boot mode.

Why some ESP32 pins are default HIGH during Boot?

Some GPIOs change their state to HIGH or output PWM signals at boot or reset. This means that if you have outputs connected to these GPIOs you may get unexpected results when the ESP32 resets or boots.

  • GPIO 1
  • GPIO 3
  • GPIO 5
  • GPIO 6 to GPIO 11 (connected to the ESP32 integrated SPI flash memory – not recommended to use).
  • GPIO 14
  • GPIO 15

NOTE: If you have peripherals connected to these pins, you may encounter issues with trying to upload new code, flashing the ESP32 with new firmware, or resetting the board, it may be because those peripherals are preventing the ESP32 from entering the right mode.

How many I2C pins ESP32 has?

The ESP32 has two I2C channels and any pin can be set as SDA or SCL. When using the ESP32 with the Arduino IDE, the default I2C pins are:

  • GPIO 21 (SDA)
  • GPIO 22 (SCL)

You can use the wire library to use other pins for I2C, you just need to call:

Wire.begin(SDA, SCL);

What are the SPI pins of ESP32?

These are the default pin mapping for SPI

| SPI | MOSI | MISO | CLK | CS | | :--- | :--- | :--- | :--- | :--- | | VSPI | GPIO23 | GPIO19 | GPIO18 | GPIO5 | | HSPI | GPIO13 | GPIO12 | GPIO14 | GPIO15 |

GPIO 6 to GPIO 11 are exposed in some ESP32 development boards. However, these pins are connected to the integrated SPI flash on the ESP-WROOM-32 chip and are not recommended for other uses. So, don’t use these pins in your projects:

  • GPIO 6 (SCK/CLK)
  • GPIO 7 (SDO/SD0)
  • GPIO 8 (SDI/SD1)
  • GPIO 9 (SHD/SD2)
  • GPIO 10 (SWP/SD3)
  • GPIO 11 (CSC/CMD)

Does ESP32 have Interrupts Pins?

Goodnews. All ESP32 GPIO pins are interrupt-capable (interrupts) pins. You can enable the interrupt functionality to any GPIO input pin using this function from the Arduino Core.

attachInterrupt(GPIO_pin, ISR, Event);

What is Enable pin (EN) on ESP32?

Enable (EN) is the 3.3V regulator’s enable pin. It’s pulled up, so connect to ground to disable the 3.3V regulator. This means that you can use this pin connected to a pushbutton to restart your ESP32, for example.

ESP32 Analog to Digital Converter ADC Input Pins

The ESP32 has built-in Analog to Digital Converters (ADC) that allow it to convert analog signals into digital values that can be processed by the digital circuits on the chip. The ESP32 has a total of 18 ADC channels, which can be used to read analog signals from various sensors, such as temperature sensors, light sensors, and other types of sensors that output analog signals.

The ESP32's ADC has a resolution of 12 bits, which means that it can measure the analog signal and convert it into a digital value between 0 and 4095. The ADC can also be configured to sample the analog signal at different rates and can be programmed to read multiple channels simultaneously.

The ESP32 has 18 x 12 bits ADC input channels (while the ESP8266 only has 1x 10 bits ADC). These are the GPIOs that can be used as ADC and respective channels: 

  • ADC1_CH0 (GPIO 36)
  • ADC1_CH1 (GPIO 37)
  • ADC1_CH2 (GPIO 38)
  • ADC1_CH3 (GPIO 39)
  • ADC1_CH4 (GPIO 32)
  • ADC1_CH5 (GPIO 33)
  • ADC1_CH6 (GPIO 34)
  • ADC1_CH7 (GPIO 35)
  • ADC2_CH0 (GPIO 4)
  • ADC2_CH1 (GPIO 0)
  • ADC2_CH2 (GPIO 2)
  • ADC2_CH3 (GPIO 15)
  • ADC2_CH4 (GPIO 13)
  • ADC2_CH5 (GPIO 12)
  • ADC2_CH6 (GPIO 14)
  • ADC2_CH7 (GPIO 27)
  • ADC2_CH8 (GPIO 25)
  • ADC2_CH9 (GPIO 26)

ESP32 Digital to Analog Converter DAC Input pins

There are 2 x 8 bits DAC channels on the ESP32 to convert digital signals into analog voltage signal outputs. These are the DAC channels:

  • DAC1 (GPIO25)
  • DAC2 (GPIO26)

ESP32 Capacitive Touch Sensor Sensitive GPIOs

The ESP32 has 10 capacitive touch GPIOs. These GPIOs can sense variations in anything that holds an electrical charge, like the human skin. So they can detect variations induced when touching the GPIOs with a finger.

These pins can be easily integrated into capacitive pads, and replace mechanical buttons. Additionally, the touch pins can also be used as a wake up source when the ESP32 is in deep sleep.

  • T0 (GPIO 4)
  • T1 (GPIO 0)
  • T2 (GPIO 2)
  • T3 (GPIO 15)
  • T4 (GPIO 13)
  • T5 (GPIO 12)
  • T6 (GPIO 14)
  • T7 (GPIO 27)
  • T8 (GPIO 33)
  • T9 (GPIO 32)

To use the ESP32 touch sensor in Arduino:

Reading the touch sensor is straightforward. You use the touchRead() function, that accepts as argument, the GPIO you want to read.

touchRead(GPIO);

This example arduino sketch reads the touch pin 0 and displays the results in the Serial Monitor.

// ESP32 Touch Test
// Just test touch pin - Touch0 is T0 which is on GPIO 4
void setup() {  
Serial.begin(115200);
// give me time to bring up serial monitor  
delay(1000); 
Serial.println("ESP32 Touch Test");
}

void loop() {  
// get value of Touch 0 pin = GPIO 4
Serial.println(touchRead(4));  
delay(1000);
}

ESP32 RTC GPIOs

There is RTC GPIO support on the ESP32. The GPIOs routed to the RTC low-power subsystem can be used when the ESP32 is in deep sleep. These RTC GPIOs can be used to wake up the ESP32 from deep sleep when the Ultra Low Power (ULP) co-processor is running. The following GPIOs can be used as an external wake up source.

  • RTC_GPIO0 (GPIO36)
  • RTC_GPIO3 (GPIO39)
  • RTC_GPIO4 (GPIO34)
  • RTC_GPIO5 (GPIO35)
  • RTC_GPIO6 (GPIO25)
  • RTC_GPIO7 (GPIO26)
  • RTC_GPIO8 (GPIO33)
  • RTC_GPIO9 (GPIO32)
  • RTC_GPIO10 (GPIO4)
  • RTC_GPIO11 (GPIO0)
  • RTC_GPIO12 (GPIO2)
  • RTC_GPIO13 (GPIO15)
  • RTC_GPIO14 (GPIO13)
  • RTC_GPIO15 (GPIO12)
  • RTC_GPIO16 (GPIO14)
  • RTC_GPIO17 (GPIO27)

ESP32 PWM pins

The ESP32 pulse width modulation PWM controller has 16 independent channels that can configured to generate PWM signals with different configuration and properties that can be used for controlling the intensity of digital signals, such as LEDs and Motors. PWM is a technique that allows the duty cycle of a digital signal to be varied, which in turn changes the average voltage and current delivered to the load.

The PWM frequency can be set using the ledcSetup() and ledcAttachPin() functions, which allow you to configure the PWM frequency and attach the PWM pin to a specific output.

ledcSetup();
ledcAttachPin();
| PWM Pin | GPIO Pin | | :=== | :=== | | 0 | 25 | | 1 | 26 | | 2 | 27 | | 3 | 14 | | 4 | 12 | | 5 | 13 | | 6 | 15 | | 7 | 2 | | 8 | 0 | | 9 | 4 | | 10 | 16 | | 11 | 17 | | 12 | 5 | | 13 | 18 | | 14 | 19 | | 15 | 21 |

In addition to the 16 hardware PWM pins, the ESP32 also supports software-based PWM, which can be used to control additional PWM channels on any GPIO pin. The ESP32's software PWM uses a technique called bit-banging, which allows the duty cycle of a digital signal to be varied by software.

Check out ESP32 Datasheet

If this sounds interesting to you and you'd like to request a demo or learn more, please contact sales.

Contact Sales
Profile avatar of the blog author

Jharwin Barrozo

Jharwin is an electronics engineer mainly focused on satellites. He built his own ground station using Flux to monitor RF activities on the International Space Station. Find him on Flux @jharwinbarrozo

Go 10x faster from idea to PCB
Flux is an all-in-one EDA. Use re-usable blocks, scripting, and a library you don’t have to manage to dramatically reduce the time it takes to go from idea to prototype.
Illustration of sub-layout. Several groups of parts and traces hover above a layout.Illustration of sub-layout. Several groups of parts and traces hover above a layout.
Flux is a better way to build PCBs
Go 10x faster from idea to PCB by reducing busy work, never starting from scratch, and keeping your team in sync. All from the browser.
Screenshot of the Flux app showing a PCB in 3D mode with collaborative cursors, a comment thread pinned on the canvas, and live pricing and availability for a part on the board.
Flux is a better way to build PCBs
Go 10x faster from idea to PCB by reducing busy work, never starting from scratch, and keeping your team in sync. All from the browser.
Screenshot of the Flux app showing a PCB in 3D mode with collaborative cursors, a comment thread pinned on the canvas, and live pricing and availability for a part on the board.
Flux is a better way to build PCBs
Go 10x faster from idea to PCB by reducing busy work, never starting from scratch, and keeping your team in sync. All from the browser.
Screenshot of the Flux app showing a PCB in 3D mode with collaborative cursors, a comment thread pinned on the canvas, and live pricing and availability for a part on the board.
Flux for Enterprise
Join leading Fortune 500s and over 300k hardware engineers revolutionizing the way they build PCBs with AI
Flux for Enterprise
Join leading Fortune 500s and over 300k hardware engineers revolutionizing the way they build PCBs with AI
Flux for Enterprise
Join leading Fortune 500s and over 300k hardware engineers revolutionizing the way they build PCBs with AI