ESP32 Pinout Reference

One of the great things about ESP32 is that it has a lot more GPIOs than ESP8266. You won’t have to juggle or multiplex your IO pins. There are a few things to watch out for so please read the pinout carefully.

Note:

Please note that the following pinout reference is for the popular ESP32 devkit v1 development board with 30 pins.

30pin esp32 dev board

Not all pins are broken out in all ESP32 development boards, but each specific pin works the same way regardless of the development board you are using.

ESP32 Peripherals and I/O

Although the ESP32 has total 48 GPIO pins, only 25 of them are broken out to the pin headers on both sides of the development board. These pins can be assigned to all sorts of peripheral duties, including:

15 ADC channels15 channels of 12-bit SAR ADC’s. The ADC range can be set, in firmware, to either 0-1V, 0-1.4V, 0-2V, or 0-4V
2 UART interfaces2 UART interfaces. One is used to load code serially. They feature flow control, and support IrDA too!
25 PWM outputs25 channels of PWM pins for dimming LEDs or controlling motors.
2 DAC channels8-bit DACs to produce true analog voltages.
3 SPI & 1 I2C interfacesThere are 3 SPI and 1 I2C interfaces to hook up all sorts of sensors and peripherals.
9 Touch Pads9 GPIOs feature capacitive touch sensing.

Thanks to the ESP32’s pin multiplexing feature (Multiple peripherals multiplexed on a single GPIO pin). Meaning a single GPIO pin can act as an ADC input/DAC output/Touch pad.

You can get extensive information about ESP32 from the datasheet.

ESP32 Pinout

The ESP32 development board has total 30 pins that interface it to the outside world. For the sake of simplicity, pins with similar functionality are grouped together. The connections are as follows:

esp32 pinout

Let us analyze the ESP32 pins and their functions in more detail one by one.

ESP32 Power Pins

There are two power pins viz. VIN pin & 3.3V pin. The VIN pin can be used to directly supply the ESP32 and its peripherals, if you have a regulated 5V voltage source. The 3.3V pin is the output of an on-board voltage regulator. This pin can be used to supply power to external components. GND is a ground pin of ESP32 development board.

esp32 power pins

ESP32 Enable Pin

EN Pin is used to enable ESP32. The chip is enabled when pulled HIGH. When pulled LOW the chip works at minimum power.

esp32 enable pin

ESP32 GPIO Pins

ESP32 development board has 25 GPIO pins which can be assigned to various functions programmatically. Each digital enabled GPIO can be configured to internal pull-up or pull-down, or set to high impedance.

esp32 gpio pins

Input Only GPIOs

Pin D34, D35, VP and VN cannot be configured as outputs; they can be used as either digital inputs, analog inputs, or for other unique purposes. Also note that they do not have internal pull-up or pull-down resistors, like the other GPIO pins.

Also GPIO pins VP and VN are an integral part of the ultra-low-noise pre-amplifier for the ADC, which help to configure the sampling time and noise of the pre-amp.

ESP32 Interrupt Pins

All GPIOs can be configured as interrupts.

ESP32 ADC Pins

The ESP32 has fifteen 12-bit ADC input channels. These are GPIOs that can be used to convert the analog voltage on the pin to a digital number.

esp32 adc pins

The ADC on the ESP32 is a 12-bit ADC meaning it has the ability to detect 4096 (2^12) discrete analog levels. In other words, it will map input voltages between 0 and the operating voltage 3.3V into integer values between 0 and 4095. For example, this yields a resolution between readings of: 3.3 volts / 4096 units or, 0.0008 volts (0.8 mV) per unit.

You also have the ability to set the ADC resolution and ADC range of your channels in code.

ESP32 DAC Pins

The ESP32 features two 8-bit DAC channels that can be used to convert digital signals into true analog voltages. It can be used as a “digital potentiometer” to control analog devices.

esp32 dac pins

This dual-DAC on the ESP32 has 8-bit resolution, which means that values between 0 and 256 will produce an analog voltage somewhere between 0 and 3.3V.

ESP32 Touch Pins

ESP32 has 9 capacitive touch-sensing GPIOs. When a capacitive load (such as a human finger) is in close proximity to the GPIO, the ESP32 detects the change in capacitance.

esp32 touch pins

These pins can be easily turned into a touchpad by connecting them to any conductive object such as wire, thread, foil, cloth, conductive paint, etc. If an object conducts electricity, it will become touch sensitive! The low-noise nature of the design and the high sensitivity of the circuit allow relatively small pads to be used.

These capacitive touch pins can also be used to wake the ESP32 from deep sleep.

ESP32 SPI Pins

SPI Pins ESP32 features three SPIs (SPI, HSPI and VSPI) in slave and master modes. These SPIs also support the following general-purpose SPI features:

  • 4 timing modes of the SPI format transfer
  • Up to 80 MHz and the divided clocks of 80 MHz
  • Up to 64-Byte FIFO
esp32 spi pins

All SPIs can also be used to connect to the external Flash/SRAM and LCD.

HSPI vs. VSPI

Sometimes HSPI is misinterpreted as “Hardware” SPI and VSPI as “Virtual” or “Software” SPI. Although in reality they all work the same way!

ESP32 I2C Pins

The ESP32 has one I2C bus that allows you to hook up all kinds of sensors and peripherals. The SDA and SCL pins are assigned, by default, to following pins.

esp32 i2c pins

ESP32 UART Pins

ESP32 has 2 UART interfaces, i.e. UART0 and UART2, which provide asynchronous communication (RS232 and RS485) and IrDA support, and communicate at up to 5 Mbps.

esp32 uart pins

UART provides hardware management of the CTS and RTS signals and software flow control (XON and XOFF) as well.

ESP32 PWM Pins

The board has 25 channels (Nearly All GPIO pins) of PWM pins controlled by Pulse Width Modulation (PWM) controller. The PWM output can be used for driving digital motors and LEDs.

esp32 pwm pins

The controller consists of PWM timers and the PWM operator. Each timer provides timing in synchronous or independent form, and each PWM operator generates the waveform for one PWM channel.