If you are reading a 2.5V DC signal on a standard 5V Arduino Uno (which uses the 10-bit ATmega328P A/D converter), the direct digital count returned by analogRead() is 512. Conversely, a single ADC step (1 LSB) represents exactly 4.88 mV (5.0V ÷ 1023). This conversion assumes a perfect 5.00V reference and a stable DC input. If you are using a 3.3V Arduino (like the Pro Mini or Due) or an ESP32, the math shifts entirely based on the reference voltage and bit-depth, which we will map out below.
The Core Conversion Formula and Neighboring Values
The formula to convert an analog voltage into a digital ADC count is straightforward:
Digital Count = (Vin / Vref) × (2n - 1)
Where n is the bit-depth (10 for Uno, 12 for ESP32). For a 10-bit ADC, 210 - 1 = 1023.
Substituting our baseline values: Count = (2.5V / 5.0V) × 1023 = 511.5, which the microcontroller rounds to 512. To reverse the math and find the voltage from a raw ADC reading: Voltage = (Count × Vref) / 1023.
Here is a quick-reference table showing how the digital count shifts across a ±20% range around our 2.5V baseline, assuming a 5.0V reference and 10-bit resolution:
| Analog Input (Vin) | % of Baseline | Expected ADC Count (10-bit) | Voltage per Step (mV) |
|---|---|---|---|
| 2.00V | -20% | 410 | 4.88 mV |
| 2.10V | -16% | 430 | 4.88 mV |
| 2.50V | Baseline | 512 | 4.88 mV |
| 2.90V | +16% | 593 | 4.88 mV |
| 3.00V | +20% | 614 | 4.88 mV |
What Fixes the Answer: Reference Voltage and System Scaling
The single assumption that fixes your conversion answer is the Reference Voltage (Vref). On a standard Arduino Uno, analogRead() defaults to the 5V USB rail. Bench reality check: USB power from a PC often sags to 4.7V or spikes to 5.2V. If your Vref is actually 4.7V, a true 2.5V input will read 545, not 512. For precision work, you must use analogReference(EXTERNAL) and feed a dedicated precision voltage reference (like a 4.096V or 2.048V shunt) into the AREF pin, as detailed in the official Arduino analogReference documentation.
Scaling for Mains: 120V, 230V, and 3-Phase Systems
How does this conversion shift when measuring higher AC system voltages? You never feed mains voltage directly into an A/D converter. You must use a Potential Transformer (PT) or an isolated AC voltage sensor module. The conversion math shifts based on the PT ratio and the peak voltage of the system:
- 120V AC (Nominal): Peak voltage is ~170V. A 100:1 PT yields a 1.7V peak sine wave. On a 5V Arduino, 1.7V reads ~348 at the peak.
- 230V AC (Nominal): Peak voltage is ~325V. The same 100:1 PT yields 3.25V. If you are using a 3.3V ESP32, this will clip and saturate the ADC. You must step up to a 200:1 PT to keep the peak under 1.65V (midpoint of a 3.3V biased ADC circuit).
- 3-Phase Systems: Measuring 3-phase requires three isolated ADC channels sampling simultaneously. Standard microcontrollers cannot sample three pins at the exact same microsecond. For 3-phase, abandon the internal ADC and use a dedicated energy metering IC like the ATM90E26, which handles the phase-shift and RMS calculations in hardware.
When the Conversion Becomes Meaningless
There are three scenarios where your mathematically perfect ADC conversion is completely useless on the bench:
1. Source Impedance > 10kΩ: The ATmega328P ADC uses an internal sample-and-hold (S/H) capacitor (approx 14pF). According to the Microchip ATmega328P datasheet, this capacitor must charge within 1.5 ADC clock cycles. If your sensor or voltage divider has an output impedance higher than 10kΩ, the capacitor won't fully charge, resulting in readings that lag, fluctuate, or read artificially low.
2. Floating Pins: An unconnected analog pin acts as an antenna. It will happily convert 60Hz/50Hz mains hum and RF noise into wildly swinging digital counts. Always tie unused analog pins to GND or use a pull-down resistor.
3. Noise Exceeding 1 LSB: If your 5V circuit has 10mV of switching noise on the ground plane, and your 1 LSB is 4.88mV, your lowest two bits will be pure random noise. No amount of software averaging will fix a hardware noise floor that exceeds your ADC resolution.
Decision Tree: Picking the Right A/D Converter for Arduino
Stop guessing which ADC setup to use. Follow this decision path to terminate on the exact part number you need for your next build:
| Your Application Requirement | Constraint / Bottleneck | Concrete Part Pick |
|---|---|---|
| Reading a potentiometer, LDR, or basic battery voltage. | Speed and precision are not critical. 10-bit is fine. | Built-in ATmega328P (Use the Uno/Nano internal ADC) |
| Measuring slow-moving DC signals (thermocouples, load cells, precision battery monitoring) where 10-bit jitter is unacceptable. | Needs 16-bit resolution, low noise, but speed is < 860 SPS. | Texas Instruments ADS1115 (I2C, 16-bit, programmable gain amplifier) |
| Sampling audio, AC waveforms, or high-speed sensor arrays where you need >10kHz sample rates. | I2C is too slow; internal ADC multiplexer switching takes too long. | Microchip MCP3008 (SPI, 10-bit, 8-channel, up to 200ksps) |
| You need 3.3V logic, high resolution, but the ESP32 internal ADC is too non-linear. | ESP32 internal ADC is notoriously non-linear below 0.15V and above 2.5V. | Adafruit ADS1115 Breakout (Bypass the ESP32 ADC entirely via I2C) |
The Default Recommendation: If your project requires any measurement that will be logged to an SD card, sent to an MQTT broker, or used for closed-loop PID control, skip the internal 10-bit ADC. Wire up an ADS1115 via I2C. It costs about $4 on a breakout board, eliminates USB-rail voltage sag errors, and provides 16-bit precision that makes your math actually mean something.
FAQ: Arduino ADC Edge Cases
Why does my ESP32 ADC read 4095 when I apply 3.3V?
The ESP32 features a 12-bit ADC (0-4095), but its internal architecture is optimized for low-power RF operations, not precision DC measurement. The Espressif ESP32 datasheet notes significant non-linearity. Furthermore, the default attenuation setting maps 3.3V to roughly 3.1V in practice. Always use an external I2C ADC like the ADS1115 if you need true 3.3V mapping on an ESP32.
Can I read negative voltages with an Arduino A/D converter?
No. The absolute minimum voltage on any ATmega328P or ESP32 analog pin is -0.5V relative to GND. Applying a negative voltage will forward-bias the internal ESD protection diodes, potentially destroying the microcontroller. To read bipolar signals (like an AC sine wave centered on 0V), you must build a DC bias circuit using an op-amp or resistor divider to shift the signal's midpoint to Vref/2 (e.g., 2.5V on a 5V system) before it reaches the ADC pin.






