For those looking to add wireless connectivity to embedded projects or to build IoT devices, the ESP32 is arguably the most popular choice. It offers a dual-core option for processor intensive applications, while built-in WiFi and Bluetooth simplify designs. It also has plenty of I/O, memory, and interoperability to meet the needs of most applications.
Espressif, the company behind the ESP-32 chip, also manufactures modules and development boards. If you intend to design a custom PCB with an ESP32, the ESP32-WROOM-32 module is an excellent choice. Opting the module over the bare chip has several advantages. Notably, the module is already FCC-approved, which means you won�t need to take any extra measures to achieve FCC compliance. This simplifies the manufacturing process considerably.
When it comes to custom PCB design, understanding the pinout of the ESP32-WROOM-32 becomes crucial. This article will go over the ESP32-WROOM-32 pinout in great detail.
ESP32-WROOM-32 Pinout
The ESP32-WROOM-32 module has 38 pins in total. The pinout is as follows:
Let�s take a closer look at the ESP32 pins and their functions one by one.
ESP32-WROOM-32 GPIO Pins
The ESP32-WROOM-32 module has 32 GPIO pins that can be assigned different functions by programming the appropriate registers. There are several kinds of GPIOs: digital-only, analog-enabled, capacitive-touch-enabled, etc. Most of the digital GPIOs can be configured with internal pull-up or pull-down, or set to high impedance.
Which GPIOs are safe to use?
Although the module has a lot of pins with various functions, some of them may not be suitable for your projects. The table below shows which pins are safe to use and which pins should be used with caution.
- � Your top priority pins. They are perfectly safe to use.
- � Pay close attention because their behavior, particularly during boot, can be unpredictable. Use them only when absolutely necessary.
- � It is recommended that you avoid using these pins.
��Pin�� | ��Pin�Label�� | ��GPIO�� | ��Safe�to�use?�� | Reason |
4 | SENSOR_VP | GPIO36 | Input only GPIO, cannot be configured as output | |
5 | SENSOR_VN | GPIO39 | Input only GPIO, cannot be configured as output | |
6 | IO34 | GPIO34 | Input only GPIO, cannot be configured as output | |
7 | IO35 | GPIO35 | Input only GPIO, cannot be configured as output | |
8 | IO32 | GPIO32 | ||
9 | IO33 | GPIO33 | ||
10 | IO25 | GPIO25 | ||
11 | IO26 | GPIO26 | ||
12 | IO27 | GPIO27 | ||
13 | IO14 | GPIO14 | ||
14 | IO12 | GPIO12 | must be LOW during boot | |
16 | IO13 | GPIO13 | ||
17 | SHD/SD2 | GPIO9 | Connected to Flash memory | |
18 | SWP/SD3 | GPIO10 | Connected to Flash memory | |
19 | SCS/CMD | GPIO11 | Connected to Flash memory | |
20 | SCK/CLK | GPIO6 | Connected to Flash memory | |
21 | SDO/SD0 | GPIO7 | Connected to Flash memory | |
22 | SDI/SD1 | GPIO8 | Connected to Flash memory | |
23 | IO15 | GPIO15 | must be HIGH during boot, prevents startup log if pulled LOW | |
24 | IO2 | GPIO2 | must be LOW during boot and also connected to the on-board LED | |
25 | IO0 | GPIO0 | must be HIGH during boot and LOW for programming | |
26 | IO4 | GPIO4 | ||
27 | IO16 | GPIO16 | ||
28 | IO17 | GPIO17 | ||
29 | IO5 | GPIO5 | must be HIGH during boot | |
30 | IO18 | GPIO18 | ||
31 | IO19 | GPIO19 | ||
33 | IO21 | GPIO21 | ||
34 | RXD0 | GPIO3 | Rx pin, used for flashing and debugging | |
35 | TXD0 | GPIO1 | Tx pin, used for flashing and debugging | |
36 | IO22 | GPIO22 | ||
37 | IO23 | GPIO23 |
The image below shows which GPIO pins can be used safely.
Input Only GPIOs
Pins 4, 5, 6 and 7 cannot be configured as outputs. They can be used as digital or analog inputs, or for other purposes. They also lack internal pull-up and pull-down resistors, unlike the other GPIO pins.
ESP32 Interrupt Pins
All GPIOs can be configured as interrupts. For more information, please refer to this tutorial.
ESP32-WROOM-32 ADC Pins
The ESP32-WROOM-32 module has two ADC (Analog to Digital Converter) blocks; ADC1 and ADC2. Each block has multiple channels:
- ADC1: contains 6 channels (labeled as ADC1_CH0 and ADC1_CH3 to ADC1_CH7).
- ADC2: contains 10 channels (labeled as ADC2_CH0 to ADC2_CH9).
The resolution of the ADCs on the ESP32 can be configured up to 12 bits. This means that the ADC can detect 4096 (2^12) discrete analog levels. This results in a resolution of 3.3 V (operating voltage) / 4096 units, or 0.0008 volts (0.8 mV) per unit.
Warning:
When Wi-Fi is enabled, the ADC2 pins cannot be used. If you need Wi-Fi, consider using the ADC1 pins instead.
ESP32-WROOM-32 DAC Pins
The ESP32-WROOM-32 module contains two 8-bit Digital-to-Analog Converters (DACs). These DACs are useful for converting digital signals into analog voltages.
ESP32-WROOM-32 Touch Pins
The ESP32-WROOM-32 module has ten capacitive touch-enabled GPIOs labeled TOUCH0 through TOUCH9. These pins work by measuring the change in capacitance when a finger or conductive object is near the surface of the pin.
They can be used for various applications, such as touch buttons, touch sliders, or even basic gesture recognition. They can also be used to wake the ESP32 from deep sleep, which is particularly useful in power-sensitive applications.
ESP32-WROOM-32 I2C Pins
The ESP32-WROOM-32 module has two I2C bus interfaces, but no dedicated I2C pins. Instead, it allows for flexible pin assignment, meaning any GPIO pin can be configured as I2C SDA (data line) and SCL (clock line).
However, GPIO21 (SDA) and GPIO22 (SCL) are commonly used as the default I2C pins to make it easier for people using existing Arduino code, libraries, and sketches.
ESP32-WROOM-32 SPI Pins
The ESP32-WROOM-32 module features three SPIs (SPI, HSPI, and VSPI). HSPI and VSPI are commonly used for general purposes, while the third one is used for interfacing with the SPI flash memory integrated on the module.
Similar to I2C, the ESP32 allows flexible pin assignment for SPI. This means that any GPIO pin can be configured as SPI pins.
ESP32-WROOM-32 UART Pins
The ESP32-WROOM-32 module has three UART interfaces: UART0, UART1, and UART2. These interfaces enable serial communication with various peripherals or for logging and debugging purposes.
Please note that the UART1 pins (GPIO 9 and GPIO 10) are used for interfacing with the SPI flash memory integrated on the module, so you can�t use them. However, you can still use UART1 by bit-banging the UART protocol on other GPIO pins.
Besides the basic TX and RX pins, UART interfaces on the ESP32 also support RTS (Request To Send) and CTS (Clear To Send) for hardware flow control, though these are less commonly used.
ESP32-WROOM-32 PWM Pins
Almost all GPIO pins on the module can be configured to generate PWM output.
The PWM on the ESP32 can be configured with high resolution, typically up to 16 bits, allowing for fine control over the PWM signals. PWM frequency can also be adjusted, with a typical range from a few Hz to tens of MHz, making it suitable for a wide range of applications, from controlling motors to dimming LEDs.
ESP32-WROOM-32 RTC GPIO Pins
Some GPIOs are routed to the RTC low-power subsystem and are known as RTC GPIOs. These GPIOs can be used for waking up the ESP32 from deep sleep and for interfacing with RTC peripherals.
ESP32-WROOM-32 Strapping Pins
There are five strapping pins on the ESP32: GPIO0, GPIO2, GPIO5, GPIO12, and GPIO15. The state of these pins determines whether the ESP32 enters BOOT mode (to run the program stored in flash memory) or FLASH mode (to upload a program to flash memory) upon power-up.
Be aware that if peripherals are connected to these pins, you might face issues when trying to flash the ESP32 with new firmware. This is because these peripherals could prevent the ESP32 from entering the correct mode.
ESP32-WROOM-32 Power Pins
The power pins provide the necessary voltage to the module to operate:
3V3 is the main supply voltage pin. It should be provided with a stable 3.3V power supply.
GND is the ground pin.
ESP32-WROOM-32 Enable Pin
The EN pin is the enable pin for the ESP32. When pulled HIGH, the chip is enabled and operational; when pulled LOW, the chip is disabled.