ESP32 ADC Guide: Advanced Functions, Accuracy & Calibration

Added:

Limitations of Internal Calibration and the Shift to External ADCs

While polynomial calibration and attenuation adjustments can improve the ESP32's internal ADC performance, many embedded systems engineers argue that these software fixes cannot overcome the hardware's fundamental limitations. The ESP32's internal ADC is notorious for high electrical noise, poor reference voltage stability, non-linearity at the extreme ends of the voltage range, and significant unit-to-unit variance. Consequently, the leading alternative perspective is to avoid internal calibration altogether for precision applications, opting instead for dedicated external ADC chips (such as the ADS1115 or MCP3008) connected via I2C or SPI. External ADCs provide superior resolution (up to 16-bit or higher), integrated precision voltage references, and active noise filtering, offering a much more robust, accurate, and time-efficient solution for analog measurements than struggling to calibrate the ESP32's inherently noisy silicon.

Basic understanding of analog versus digital signals, including voltage, noise, and how microcontrollers interface with physical environments.
Fundamental concepts of Analog-to-Digital Conversion (ADC), including resolution (bit depth), sampling rates, and reference voltages.
Familiarity with the ESP32 microcontroller architecture, GPIO pin mapping, and basic programming using Arduino IDE or ESP-IDF.
Elementary mathematical understanding of linear equations and polynomial curve fitting for calibration purposes.
Implementation of software-based digital signal filtering techniques, such as moving average or Kalman filters, to mitigate high-frequency noise on ESP32 ADC channels.
Utilizing the ESP32's Direct Memory Access (DMA) controller to achieve high-speed, non-blocking continuous ADC sampling.
Programming the ESP32's Ultra-Low-Power (ULP) co-processor to monitor analog sensors while the main CPU remains in deep sleep.
Applying advanced calibration techniques to non-linear analog sensors (such as NTC thermistors or pH probes) using the calibrated ESP32 ADC.
76.5K views1.3Klikes6:52@G6EJDOriginal Release: 2017-11-14

The ESP32 microcontroller features a versatile 12-bit analog-to-digital converter (ADC) with configurable parameters including resolution (9-12 bits), attenuation settings (0dB, 2.5dB, 6dB, 11dB), and sample averaging, allowing developers to optimize trade-offs between input range, accuracy, and conversion speed; however, due to inherent non-linearity in the ADC response, particularly at the extremes of the input range, a polynomial correction function can improve measurement accuracy to less than 1% error by mapping raw ADC readings to corrected voltage values.