ESP32 ADC Calibration & Noise Reduction: Improve Analog Reading Accuracy
May 21th, 2026

ESP32 ADC Calibration & Noise Reduction
ESP32 ADC Calibration is an important topic for makers and engineers using the ESP32, one of the most versatile microcontrollers available today.Along with Wi-Fi, Bluetooth, and a powerful dual-core processor, it includes built-in Analog-to-Digital Converters (ADCs). These converters allow the ESP32 to measure analog voltages from sensors such as potentiometers, temperature probes, batteries, and light sensors.
At first glance, reading analog values on the ESP32 seems straightforward. Connect a sensor, call analogRead(), and use the result. In practice, however, many users notice that the readings fluctuate or do not match the actual voltage measured with a multimeter, creating concerns about ESP32 analog reading accuracy. This is especially common when using long jumper wires, noisy USB power supplies, or Wi-Fi-enabled ESP32 projects.
This happens because the ESP32 ADC is not perfectly linear and is sensitive to electrical noise. Fortunately, calibration and filtering techniques can greatly improve accuracy and are essential for effective ESP32 ADC noise reduction.
In this guide, you will learn how the ESP32 ADC works, why measurements can be inaccurate, and how to obtain cleaner and more reliable analog readings.
What Is the ESP32 ADC?
For any ESP32 analog input, an Analog-to-Digital Converter translates an analog voltage into a digital number.
The ESP32 ADC uses a 12-bit resolution by default, which means:
•0 V corresponds to 0
•Maximum input voltage corresponds to 4095
This provides 4096 possible measurement levels.
The ESP32 includes two ADC peripherals. If you are new to the platform, this comprehensive ESP32 tutorial provides a useful introduction to ESP32 hardware and development basics.
•ADC1
•ADC2
ADC1 is the preferred choice for most projects because ADC2 shares resources with the Wi-Fi subsystem, making ESP32 ADC1 vs ADC2 an important consideration for wireless applications.If your project uses Wi-Fi, always select ADC1 pins such as GPIO32 to GPIO39. For a detailed explanation of ADC-capable pins and their functions, refer to this ESP32 pinout guide.
Why ESP32 ADC Readings Are Not Perfect
Unlike precision measurement devices, the ESP32 ADC was designed for general-purpose sensing. Several factors affect its accuracy.
Non-Linearity
The relationship between input voltage and digital output is not perfectly straight.Errors tend to increase near the lower and upper ends of the measurement range, affecting overall ESP32 ADC voltage measurement performance.
Reference Voltage Variation
The internal reference voltage differs slightly from chip to chip.
Electrical Noise
USB power supplies, switching regulators, and nearby digital circuits introduce noise.
Temperature Drift
ADC behavior changes slightly as the chip temperature changes.
Wi-Fi Interference
Radio activity can affect measurements, especially when using ADC2.
Common Problems with Raw ADC Readings
When working with ESP32 sensor readings through analogRead(), you may encounter:
•Values that jump up and down even when the voltage is stable
•Measurements that differ from multimeter readings
•Sudden spikes caused by noise
•Different results on different ESP32 boards
These issues are normal and can be corrected.
Understanding ADC Attenuation
ESP32 ADC attenuation settings allow you to expand the measurable voltage range for different applications.
| Attenuation | Approximate Range |
|---|---|
| 0 dB | 0 to 1.1 V |
| 2.5 dB | 0 to 1.5 V |
| 6 dB | 0 to 2.2 V |
| 11 dB | 0 to 3.3–3.9 V |
For most projects powered at 3.3 V, 11 dB attenuation is the most practical option. Additional attenuation specifications can be found in the official ESP32 ADC API documentation.
analogSetAttenuation(ADC_11db);
ESP32 ADC1 vs ADC2
ADC1
•Works even when Wi-Fi is active
•Recommended for reliable analog measurements
ADC2
•Shared with Wi-Fi hardware
•May fail when wireless features are enabled
If your project uses Wi-Fi, always select ADC1 pins such as GPIO32 to GPIO39.
ESP32 ADC Calibration
ESP32 ADC calibration compensates for the internal variations of each ESP32 chip.
Without calibration, a reading may be off by tens of millivolts or more. With calibration, the reported voltage is much closer to the real value.
Why Calibration Matters
Calibration corrects:
•Offset errors
•Gain errors
•Reference voltage differences
This is especially useful for:
•Battery monitors
•Current sensors
•Analog instrumentation
Using analogReadMilliVolts()
The easiest way to obtain calibrated readings in the Arduino IDE is to use ESP32 analogReadMilliVolts().
int voltage = analogReadMilliVolts(16);
Serial.println(voltage);
This function returns the measured voltage directly in millivolts and uses the ESP32 calibration data stored in eFuse when available.
For most applications, this is more accurate than converting raw ADC counts manually. On some ESP32 boards, raw ADC conversion can become noticeably inaccurate near the upper voltage range. Using analogReadMilliVolts() usually provides much more reliable results.
Basic Calibration Example

The following sketch compares raw counts and calibrated voltage.
const int adcPin = 16;
void setup() {
Serial.begin(115200);
analogReadResolution(12);
analogSetAttenuation(ADC_11db);
}
void loop() {
int raw = analogRead(adcPin);
int mv = analogReadMilliVolts(adcPin);
Serial.print("Raw: ");
Serial.print(raw);
Serial.print(" Voltage: ");
Serial.print(mv);
Serial.println(" mV");
delay(1000);
}
Connect the input to a known voltage and compare the result with a multimeter to verify your ESP32 analog sensor calibration.


ESP32 ADC Noise Reduction Techniques
To reduce ESP32 ADC noise, it is important to remember that even calibrated readings can still fluctuate.Filtering helps smooth the measurements.
√Moving Average Filter
Tip:
Use the Arduino Serial Plotter to compare raw ADC readings and filtered values visually. This makes it much easier to evaluate filtering performance.
An ESP32 moving average filter takes multiple samples and computes their average.
long total = 0;
for (int i = 0; i < 16; i++) {
total += analogReadMilliVolts(34);
delay(2);
}
int average = total / 16;
√This method is simple and very effective for slowly changing signals. For another practical example of reading analog values with ESP32, see the PCF8591 ADC lesson.
√Exponential Moving Average (EMA)
The ESP32 exponential moving average (EMA) filter gives more weight to recent samples.
float filtered = 0;
float alpha = 0.2;
void loop() {
int reading = analogReadMilliVolts(34);
filtered = alpha * reading + (1 - alpha) * filtered;
Serial.println(filtered);
delay(50);
}
Choosing alpha
•0.1 = smoother response
•0.3 = faster response
•0.5 = more responsive but less filtered
EMA is ideal when memory is limited. It is also commonly used in real-time sensor projects because it smooths noise without introducing as much delay as a large moving average filter. Developers interested in additional digital filtering techniques can explore Microchip's application note covering several filtering methods for analog sensor data. It is also commonly used in real-time sensor projects because it smooths noise without introducing as much delay as a large moving average filter.
Simple Hardware Tips
To improve ESP32 analog readings, software filtering works best when combined with good hardware practices.
Stable Power Supply
Use a quality power source. Cheap USB adapters often introduce noise.
Short Wires
Breadboards and loose jumper wires can sometimes introduce additional noise into analog measurements.Long wires act as antennas and pick up interference.
Add a Capacitor
Place a 100 nF ceramic capacitor between the ADC input and GND.
This small capacitor helps remove high-frequency noise.

Avoid Floating Inputs
Always connect the ADC pin to a valid voltage source. Floating pins produce random values.
Lower Source Impedance
Very high resistance sources can reduce ADC accuracy. Buffer the signal if necessary.
Quick Tip
If your ADC readings still fluctuate after software filtering, try powering the ESP32 from a different USB adapter or external power source. Poor-quality USB power is one of the most common causes of unstable analog measurements.
Common Troubleshooting Tips
Reading Is Always Zero
The following ESP32 ADC troubleshooting tips can help resolve common measurement issues.
•Check wiring
•Verify the correct GPIO number
•Ensure the voltage is above 0 V
Reading Is Always 4095
•Input voltage exceeds the selected range
•Wrong attenuation setting
Values Fluctuate Too Much
•Add averaging
•Use a capacitor
•Improve grounding
•Replace the power supply
Measured Voltage Does Not Match a Multimeter
•Use analogReadMilliVolts()
•Confirm attenuation settings
•Check resistor divider values
ADC Stops Working with Wi-Fi
•Move the signal to an ADC1 pin
Conclusion
ESP32 ADC calibration and ESP32 ADC filtering are essential techniques for improving measurement stability, especially since ESP32 ADC readings are often less accurate than many beginners expect.
By combining analogReadMilliVolts(), software filtering techniques, and simple hardware improvements, you can achieve cleaner and more reliable analog measurements in real-world ESP32 projects.
Whether you are monitoring batteries, reading analog sensors, or building IoT devices, understanding ADC behavior is an important step toward creating stable and professional projects.
