Header Ads Widget

Why to Avoid ESP32 ADC2 Pins while using WiFi?

Congratulations on choosing the versatile ESP32 for your embedded projects! As you embark on your journey of hardware development, it's crucial to make informed decisions to ensure the smooth functioning of your devices. Today, we'll shed light on a specific aspect of ESP32 GPIO pins — the ADC2 pins — and why it's advisable to avoid using them in certain situations.

Understanding ADC2 Pins:

The ESP32 microcontroller comes equipped with a wealth of features, including Analog-to-Digital Converters (ADC) for reading analog signals. The ADC pins are divided into two groups: ADC1 and ADC2. While both groups offer ADC capabilities, ADC2 pins have some unique characteristics that make them less flexible in certain scenarios.

As per the ESP-IDF documentation:

Since the ADC2 module is also used by the Wi-Fi, only one of them could get the preemption when used together, which means the adc2_get_raw() may get blocked until Wi-Fi stops, and vice versa.

The Catch with ADC2 Pins:

Unlike ADC1 pins, ADC2 pins are subject to certain restrictions when it comes to simultaneous Wi-Fi operation. The ESP32 is a powerful device that supports both Wi-Fi and Bluetooth communication. However, ADC2 pins are tied to the Wi-Fi subsystem's operation, and using them during specific Wi-Fi operations can lead to inaccuracies in ADC readings.

Why Avoid ADC2 Pins?

Wi-Fi Coexistence Issues:

ADC2 pins share the same channel as the Wi-Fi radio, creating potential conflicts during simultaneous Wi-Fi and ADC2 operations. This interference can result in erratic ADC readings and negatively impact the performance of your application.

Reduced ADC Precision:

When ADC2 pins are used during Wi-Fi transmissions, the ADC precision may be compromised due to the shared resources. This can lead to inaccuracies in analog readings, affecting the reliability of your sensor data.

Best Practices:

To ensure optimal performance and accurate analog readings, it's recommended to avoid using ADC2 pins in situations where simultaneous Wi-Fi and ADC operations are crucial. Instead, opt for ADC1 pins, which do not face the same constraints and provide more reliable results.

This implies that the ADC on ADC2 channels is unavailable when WiFi is active, specifically on GPIO4, GPIO0, GPIO2, GPIO15, GPIO13, GPIO12, GPIO14, GPIO27, GPIO25, and GPIO26.

However, ADC1 remains accessible and utilizes pins GPIO36, GPIO37, GPIO38, GPIO39, GPIO32, GPIO33, GPIO34, and GPIO35.


As you harness the capabilities of the ESP32 for your projects, understanding the intricacies of GPIO pin usage is essential. By steering clear of ADC2 pins in scenarios involving simultaneous Wi-Fi and ADC operations, you can enhance the reliability and accuracy of your analog measurements. Make informed choices, and may your ESP32-powered creations thrive!

Post a Comment