Skip to content
Circuits Playground
Menu

ESP32 Analog Pins: ADC1 vs ADC2 and Wi-Fi

Updated

Why analogRead() fails on some ESP32 pins when Wi-Fi is on, and which pins to use for sensors.

Two ADC units

The original ESP32 has two analog-to-digital converters. ADC1 is on GPIO32–39. ADC2 is on GPIO0, 2, 4, 12–15 and 25–27.

The Wi-Fi driver uses ADC2, so reading an ADC2 pin while Wi-Fi is active fails. For any project that uses Wi-Fi, put analog sensors on ADC1 pins.

Good pins for analog sensors on the ESP32 DevKit

  • GPIO32 and GPIO33, ADC1, also usable as outputs.
  • GPIO34, GPIO35, GPIO36 (VP), GPIO39 (VN), ADC1, input-only, no internal pull-ups. Ideal for analog sensors.

Range and accuracy

The input must stay between 0 V and 3.3 V. The ESP32's ADC is not perfectly linear, especially near the ends of its range, so average several samples and calibrate against known values. analogReadMilliVolts() uses factory calibration where available.

Related