Concept explainer · Beginner · 4 min read
ADCs Explained
How analogRead Works on Arduino, ESP32 and Pico
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
An analog-to-digital converter (ADC) measures a voltage and returns a number. On an Arduino Uno, analogRead gives 0 to 1023 for 0 to 5 V, so each step is about 4.9 mV. The ESP32 and Pico return 0 to 4095 for 0 to 3.3 V. Convert a reading to volts with volts = reading x reference / maximum count, keep the input below the reference voltage, and average several readings to reduce noise.
Key specs at a glance
- Uno / Nano / Mega
- 10-bit, 0 to 1023, 5 V reference (or 1.1 V internal)
- ESP32
- 12-bit, 0 to 4095, about 0.1 to 3.1 V usable with default attenuation
- Raspberry Pi Pico
- 12-bit, 3 inputs on GP26 to GP28, 3.3 V reference
- ESP8266
- 10-bit, one input (A0)
- External upgrade
- ADS1115: 16-bit, 4 inputs, I2C, programmable gain
- Source impedance
- Keep under about 10 kΩ on AVR boards
Resolution and reference voltage
An ADC divides the range from 0 V to its reference voltage into steps. A 10-bit ADC has 1024 steps; a 12-bit ADC has 4096. The step size (the smallest change it can see) is reference / steps: 5 V / 1024 = 4.9 mV on an Uno, 3.3 V / 4096 = 0.8 mV on a Pico. Converting back:
volts = reading x Vref / (2^bits - 1)
So a reading of 512 on an Uno is about 2.5 V. Accuracy also depends on the reference: if the Uno's 5 V rail is really 4.8 V from USB, every reading is 4% off. Use analogReference(INTERNAL) (1.1 V) for small signals, or measure the real supply and use that value. The ADC resolution calculator does the arithmetic.
Board-by-board quirks
| Board | Quirk | What to do |
|---|---|---|
| Arduino Uno | Reference follows the 5 V supply | Use INTERNAL 1.1 V or an external AREF for accuracy |
| ESP32 | Non-linear below about 0.1 V and above about 3.1 V | Use analogReadMilliVolts(), which applies factory calibration |
| ESP32 | ADC2 pins do not work while Wi-Fi is on | Use ADC1 pins (GPIO 32 to 39) |
| ESP32 | Default attenuation measures up to about 3.1 V | analogSetPinAttenuation() for lower ranges |
| ESP8266 NodeMCU | Bare chip reads 0 to 1 V; board divider extends it to 3.3 V | Check your board before adding dividers |
| Raspberry Pi Pico | Arduino-Pico returns 10-bit by default | Call analogReadResolution(12) |
| Raspberry Pi (Pi 4, Pi 5) | No ADC at all | Add an ADS1115 or MCP3008 |
- Arduino Uno
- Quirk:
- Reference follows the 5 V supply
- What to do:
- Use INTERNAL 1.1 V or an external AREF for accuracy
- ESP32
- Quirk:
- Non-linear below about 0.1 V and above about 3.1 V
- What to do:
- Use analogReadMilliVolts(), which applies factory calibration
- ESP32
- Quirk:
- ADC2 pins do not work while Wi-Fi is on
- What to do:
- Use ADC1 pins (GPIO 32 to 39)
- ESP32
- Quirk:
- Default attenuation measures up to about 3.1 V
- What to do:
- analogSetPinAttenuation() for lower ranges
- ESP8266 NodeMCU
- Quirk:
- Bare chip reads 0 to 1 V; board divider extends it to 3.3 V
- What to do:
- Check your board before adding dividers
- Raspberry Pi Pico
- Quirk:
- Arduino-Pico returns 10-bit by default
- What to do:
- Call analogReadResolution(12)
- Raspberry Pi (Pi 4, Pi 5)
- Quirk:
- No ADC at all
- What to do:
- Add an ADS1115 or MCP3008
Reading a voltage with averaging
const int PIN = A0;
const float VREF = 5.0; // measure your real 5 V rail for better accuracy
void setup() { Serial.begin(115200); }
void loop() {
long sum = 0;
for (int i = 0; i < 16; i++) {
sum += analogRead(PIN);
delay(2);
}
float raw = sum / 16.0;
float volts = raw * VREF / 1023.0;
Serial.println(volts, 3);
delay(500);
}Measuring higher voltages and small signals
use a voltage divider. To read up to 15 V on a 3.3 V ADC, 100 kΩ over 27 kΩ gives about 3.2 V at 15 V. Account for the ratio in code and add a small capacitor (100 nF) across the lower resistor for a steadier reading.
a thermocouple or load cell gives millivolts; amplify them with an op-amp or a dedicated chip such as the HX711, or use an ADS1115 with its programmable gain.
more than the board's supply voltage on an analog pin can damage it. Add a series resistor (1 to 10 kΩ) as protection when the source could spike.
Reducing noise
Average several samples, add a 100 nF capacitor from the analog input to ground, keep sensor wires short and away from motor wires, and power analog sensors from a clean supply. On ESP32, readings are noisier during Wi-Fi transmission: take samples between transmissions or average more. If you still need precision, an external ADC beats the built-in ones.
Try it: ADC resolution calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Assuming the Uno's 5 V reference is exactly 5.000 V.
- Using ESP32 ADC2 pins with Wi-Fi on.
- Feeding more than 3.3 V into an ESP32 or Pico analog pin.
- Reading a high-impedance divider (1 MΩ) on an Uno and getting drifting values.
- Expecting linear readings from the ESP32 near 0 V and 3.3 V.
Frequently asked questions
What does analogRead return?
A number proportional to the input voltage: 0 to 1023 on 10-bit boards like the Uno, 0 to 4095 on 12-bit boards like the ESP32 and Pico.
How do I convert analogRead to voltage?
volts = reading x reference voltage / maximum count. On an Uno: volts = reading x 5.0 / 1023.
Why are my ESP32 analog readings wrong?
The ESP32 ADC is non-linear near the ends of its range, ADC2 fails with Wi-Fi on, and the default range tops out near 3.1 V. Use ADC1 pins and analogReadMilliVolts().
How many analog inputs does a Raspberry Pi Pico have?
Three usable ADC inputs on GP26, GP27 and GP28, plus an internal temperature sensor.
When should I use an ADS1115?
When you need more accuracy, more inputs, small signals with gain, or an ADC on a Raspberry Pi, which has none built in.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 34 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
- Microchip ATmega328P datasheet, ADC chapter
- Espressif ESP32 ADC documentation
- Raspberry Pi RP2040 datasheet, ADC chapter
- Texas Instruments ADS1115 datasheet
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.



