ESP32 ADC Pins: Complete Analog Input Guide

The ESP32 has 18 Analog-to-Digital Converter (ADC) channels spread across two independent ADC blocks: ADC1 and ADC2. Understanding the difference between them β€” especially the Wi-Fi conflict on ADC2 β€” is critical for reliable analog sensor readings in ESP32 projects.

This guide covers every ESP32 ADC pin, explains the ADC1 vs ADC2 conflict, shows you how to read analog values in Arduino, and helps you choose the right pins for your sensors.

πŸ’‘ Quick Tip Use ADC1 pins (GPIO32–GPIO39) whenever your project uses Wi-Fi. ADC2 becomes unreliable when the Wi-Fi driver is active.

ESP32 ADC Pin Table

Here is the complete list of all 18 ADC channels on the classic ESP32 (ESP-WROOM-32):

ADC Block Channel GPIO Pin Notes
ADC1CH0GPIO36Input-only (SENSOR_VP)
ADC1CH3GPIO39Input-only (SENSOR_VN)
ADC1CH6GPIO34Input-only
ADC1CH7GPIO35Input-only
ADC1CH4GPIO32Also TOUCH9, RTC
ADC1CH5GPIO33Also TOUCH8, RTC
ADC1CH0GPIO36Also SENSOR_VP
ADC1CH1GPIO37Not broken out on most dev boards
ADC1CH2GPIO38Not broken out on most dev boards
ADC2CH0GPIO4Also TOUCH0
ADC2CH1GPIO0Strapping pin
ADC2CH2GPIO2Strapping pin
ADC2CH3GPIO15Strapping pin
ADC2CH4GPIO13Also TOUCH4
ADC2CH5GPIO12Strapping pin (MTDI)
ADC2CH6GPIO14Also TOUCH6, HSPI_CLK
ADC2CH7GPIO27Also TOUCH7
ADC2CH8GPIO25Also DAC_1
ADC2CH9GPIO26Also DAC_2
⚠️ Important GPIO37 and GPIO38 are ADC1 channels that are not broken out on most ESP32 development boards (DevKit V1, NodeMCU-32S, etc.). Only the ESP32 bare chip exposes these.

ADC1 vs ADC2: The Wi-Fi Conflict

Both ADC1 and ADC2 are 12-bit successive-approximation ADCs with the same resolution (0–4095). However, there is one critical difference:

  • ADC1 is independent and works reliably whether Wi-Fi is on or off.
  • ADC2 is shared with the Wi-Fi subsystem. When the Wi-Fi driver is active, ADC2 measurements become unreliable or fail entirely.

This is a hardware limitation documented by Espressif. The Wi-Fi driver uses the ADC2 hardware for its own signal detection. If your project uses any Wi-Fi functionality (HTTP, MQTT, WebSockets, OTA, etc.), you must avoid ADC2 pins for analog sensors.

🚫 Critical Rule If Wi-Fi is enabled in your project, only use ADC1 pins (GPIO32–GPIO39) for analog input. ADC2 pins will give garbage readings when Wi-Fi is transmitting or receiving.

Input-Only ADC Pins

Four ADC1 pins β€” GPIO34, GPIO35, GPIO36, and GPIO39 β€” are input-only. They lack output drivers and cannot drive LEDs, relays, or other output loads. They can only read analog or digital input signals.

These pins are excellent choices for dedicated analog sensors, as there is no risk of accidentally configuring them as outputs.

Arduino Code: Reading ESP32 ADC

Here is a simple Arduino sketch to read analog values from an ADC1 pin:

// ESP32 ADC1 Example - Read analog from GPIO34
const int adcPin = 34;  // GPIO34 is ADC1_CH6

void setup() {
    Serial.begin(115200);
    // Optional: set ADC resolution (default is 12-bit)
    analogReadResolution(12);
    // Optional: set ADC attenuation for higher voltage range
    analogSetAttenuation(ADC_11db);  // 0-3.3V range
}

void loop() {
    int adcValue = analogRead(adcPin);
    float voltage = adcValue * (3.3 / 4095.0);
    
    Serial.print("ADC Value: ");
    Serial.print(adcValue);
    Serial.print("  Voltage: ");
    Serial.println(voltage);
    
    delay(500);
}

ADC Attenuation Settings

The ESP32 ADC has configurable attenuation that changes the measurable voltage range:

AttenuationMeasurable RangeTypical Use
ADC_0db0–1.1VLow-voltage sensors
ADC_2_5db0–1.5VMedium range
ADC_6db0–2.2VGeneral purpose
ADC_11db0–3.3VMost common (default)

Reading Multiple ADC Channels

Here is an example that reads all available ADC1 pins:

// ESP32 Read All ADC1 Channels
const int adcPins[] = {32, 33, 34, 35, 36, 39};
const int numPins = 6;

void setup() {
    Serial.begin(115200);
    analogReadResolution(12);
    analogSetAttenuation(ADC_11db);
}

void loop() {
    for (int i = 0; i < numPins; i++) {
        int val = analogRead(adcPins[i]);
        Serial.print("GPIO");
        Serial.print(adcPins[i]);
        Serial.print(": ");
        Serial.print(val);
        Serial.print("  ");
    }
    Serial.println();
    delay(1000);
}

ESP32 ADC Accuracy and Calibration

The ESP32 ADC is known for non-linearities across its range. For precise measurements, Espressif provides an ADC calibration API (esp_adc_cal) that uses factory-programmed eFuse values to improve accuracy.

Key accuracy facts:

  • Typical uncalibrated error: Β±2% to Β±6% depending on voltage range
  • With eFuse calibration: Β±1% to Β±2%
  • For precise measurements, use an external ADC (e.g., ADS1115) or the calibration API

Best ADC Pins for Common Sensor Types

Sensor TypeRecommended PinsNotes
Potentiometer / Voltage DividerGPIO34 GPIO35Input-only, safe, no conflicts
Temperature Sensor (LM35, TMP36)GPIO32 GPIO33Also usable as GPIO
Light Sensor (LDR + resistor)GPIO36 GPIO39Input-only but detectable via ADC
Soil Moisture SensorGPIO34Input-only, dedicated analog
Hall Effect SensorGPIO32Also supports touch sensing

πŸ”§ Try Our Interactive ESP32 Pinout Tool

Click on any pin in our interactive tool to see its full ADC configuration, alternate functions, and hardware notes.

Open Interactive Pinout

Frequently Asked Questions

Can I use ADC2 pins if I don't use Wi-Fi?

Yes. If your project does not enable Wi-Fi or Bluetooth, ADC2 pins work identically to ADC1. This is common in battery-powered deep-sleep sensor nodes that wake, read sensors, process data, and sleep without connecting to Wi-Fi.

What is the maximum ADC sampling rate?

The ESP32 ADC can sample at up to 6 kHz (6,000 samples/second) with 12-bit resolution in continuous mode. For most sensor applications, this is more than sufficient.

Why are my ADC readings noisy?

ESP32 ADC noise is common due to the chip's internal switching. Mitigation strategies include: using the ADC calibration API, averaging multiple readings, adding a 100nF capacitor between the analog pin and ground, and using shielded wires for sensitive measurements.

Related Guides