The ESP32 microcontroller features an Analog-to-Digital Converter (ADC) that converts analog signals into digital values.
Here’s a detailed overview of the ESP32 ADC resolution:
ADC Specifications
The ESP32 is equipped with two ADCs: ADC1 and ADC2, each with multiple channels. The resolution of the ESP32 ADCs is configurable and can be set to a maximum of 12 bits. Here’s what you need to know about the ADC resolution:
- Maximum Resolution: The ESP32 ADC supports a maximum resolution of 12 bits.
- 12-bit resolution means that the ADC converts the analog input into one of 4096 discrete digital values (212 = 4096).
- This provides a digital output range from 0 to 4095.
- Configurable Resolutions: The ADC resolution on the ESP32 can be configured to different values (e.g., 9, 10, 11, or 12 bits) using software. This allows for flexibility depending on the application’s accuracy and speed requirements.
- 9-bit: 512 discrete values
- 10-bit: 1024 discrete values
- 11-bit: 2048 discrete values
- 12-bit: 4096 discrete values
ESP32 ADC Resolution Calculator
Use the tool below to calculate the resolution depending on the number of bits used:
Example Calculations
The table below shows the voltage resolution as a function of number of bits (Vref = +3.3 V)
Number of Bits | ADC Voltage Resolution (mV) |
---|---|
9 | 6.45 |
10 | 3.22 |
11 | 1.61 |
12 | 0.81 |
ADC Characteristics:
ADC Channels
- ADC1: 8 channels (GPIO32 to GPIO39).
- ADC2: 10 channels (GPIO0, GPIO2, GPIO4, GPIO12 to GPIO15, GPIO25 to GPIO27).
Voltage Range
- The default ADC input voltage range is 0 to 3.3V. This range corresponds to the digital values from 0 to 4095 at 12-bit resolution.
- The input voltage range can be altered using an internal reference voltage and calibration techniques, which may affect the accuracy and linearity of the ADC readings.
Sampling Rate
- The sampling rate is influenced by the ADC resolution, with higher resolutions generally reducing the maximum achievable sampling rate.
- At the maximum resolution of 12 bits, the sampling rate is lower compared to lower resolutions due to the increased time required for more precise conversion.
Non-Linearity and Noise
- The ESP32 ADCs may exhibit non-linear characteristics and noise, especially near the extremes of the voltage range.
- Proper calibration and filtering are recommended for applications requiring high precision.
Practical Considerations
- Resolution vs. Precision: While the ESP32 ADC supports up to 12 bits of resolution, actual precision can be lower due to noise and non-linearities in the ADC circuitry.
- Calibration: Calibration is essential for achieving accurate measurements, especially when using the ADC at its maximum resolution.
- Power Supply and Grounding: Proper power supply decoupling and grounding practices are critical to minimize noise and improve ADC performance.
Summary
The ESP32’s ADC offers flexible resolution settings up to 12 bits, making it suitable for a wide range of applications that require varying levels of accuracy and sampling speed.
References
- Espressif Systems – ESP32 Technical Reference Manual
- Espressif Systems – ESP-IDF ADC Driver API
- Arduino – analogReadResolution()