For a baseline query of converting 2.5V using a standard 5V A-D converter Arduino setup (10-bit resolution on an Uno or Nano), the direct digital answer is 512. The exact formula used is ADC_Value = (Vin / Vref) × 1023, which substitutes as (2.5 / 5.0) × 1023 = 511.5 (rounded to 512 by the microcontroller's analogRead() function). However, this number is entirely dependent on your board's reference voltage and bit-depth; feeding 2.5V into a 3.3V ESP32 yields a completely different raw count, and attempting to measure raw 120V or 230V mains without a step-down sensor will instantly destroy the silicon.

The Core Conversion Formula and Assumptions

An Analog-to-Digital Converter (ADC) does not measure voltage directly; it measures the ratio of the input voltage to a reference voltage, then maps that ratio to a discrete digital step. The universal formula for any microcontroller ADC is:

ADC_Value = (Vin / Vref) × (2^n - 1)
Where Vin is input voltage, Vref is reference voltage, and n is the bit-resolution.

Two critical assumptions fix this answer: Vref stability and source impedance. On an Arduino Uno (ATmega328P), the default Vref is tied to the USB/BARREL power rail, nominally 5.0V. In reality, USB power from a PC often sags to 4.7V or 4.8V. If your Vref is actually 4.8V, a true 2.5V input will read (2.5 / 4.8) × 1023 = 532, introducing a 4% error before you even write a line of code. Furthermore, the ATmega328P uses a 14pF internal sample-and-hold capacitor. If your analog sensor has an output impedance higher than 10kΩ, the capacitor cannot fully charge during the sampling window, resulting in artificially low, non-linear readings.

Board Shifts, Mains Voltage, and Neighboring Values

The 512 answer is strictly for 5V/10-bit systems. When you shift to 3.3V logic boards like the ESP32 or Arduino Nano 33 IoT, the math changes. The ESP32 features a 12-bit ADC (4095 max steps) with a 3.3V Vref, meaning a 1.65V input theoretically yields 2048. However, the ESP32's internal ADC is notoriously non-linear at the extreme top and bottom of its range, a known hardware quirk documented in the official Arduino analogRead reference and Espressif errata. For precision work on 3.3V systems, bypass the internal ADC and use an external I2C module like the Adafruit ADS1115 16-bit ADC.

How the answer shifts for 120V vs 230V vs 3-phase:
If your project involves measuring AC mains, the direct ADC conversion formula remains identical, but the physical front-end shifts entirely. An Arduino ADC will vaporize if fed 120V or 230V. You must use a step-down voltage sensor (like the ZMPT101B). For 120V RMS (US), the sensor scales the ~170V peak down to a 2.5V-centered oscillating signal. For 230V RMS (EU), the sensor's onboard potentiometer must be adjusted to scale the ~325V peak into that same 0-5V window. For 3-phase industrial systems, the conversion becomes time-critical: the Arduino's single internal ADC multiplexes across pins, introducing a phase-shift error between readings. You must switch to a simultaneous-sampling external ADC to capture 3-phase waveforms without angular distortion.

Below is a reference table showing how neighboring values (±20% around our 2.5V baseline) convert on a standard 5V Uno versus a theoretical linear 3.3V 12-bit system:

Input Voltage (Vin) Arduino Uno (10-bit, 5V Vref) Generic 12-bit (3.3V Vref)
2.00V (-20%)4092481 (Clipped/Over-range)
2.25V (-10%)4602795 (Clipped/Over-range)
2.50V (Baseline)5123106 (Clipped/Over-range)
1.65V (ESP32 Midpoint)3372048
1.00V (-60%)2041240

When the A-D Converter Reading is Meaningless

There are three specific scenarios where applying the conversion formula to your analogRead() data yields useless garbage:

  • Floating Pins: If an analog pin is unconnected, it acts as an antenna. Capacitive coupling from nearby AC wiring or digital traces will cause the 14pF sample capacitor to charge randomly. You will see readings bounce between 100 and 800 with no physical input. Always tie unused analog pins to GND or configure them as digital outputs.
  • Vref Brownout: If you are powering the Arduino via a long USB cable or an under-rated wall wart, the 5V rail may drop to 4.2V under load. Because Vref is derived from this rail, your analogRead() will return a higher number for the exact same physical voltage, tricking your code into thinking the sensor output increased.
  • Exceeding Vref (Clipping): If you feed 5.1V into a 5V-referenced 10-bit ADC, the internal op-amp saturates. The microcontroller will stubbornly report 1023 whether the input is 5.1V or 12V. The conversion is meaningless because the true peak is lost to hardware clipping.

Frequently Asked Questions

Why is my Arduino ADC reading fluctuating by 10-20 points?

A fluctuation of 10-20 points on a 10-bit ADC represents roughly 50mV to 100mV of noise. This is almost always caused by a high-impedance voltage divider (using resistors >10kΩ) failing to charge the internal sample-and-hold capacitor fast enough, or by electromagnetic interference (EMI) from nearby switching components like buck converters or relays. Fix this by placing a 100nF ceramic capacitor directly between the analog input pin and GND to act as a local charge reservoir and low-pass filter.

Can I read negative voltages with a standard Arduino A-D converter?

No. The ATmega328P and ESP32 ADCs are unipolar; they can only measure voltages between 0V and Vref. Feeding a negative voltage (even -0.5V) into an Arduino analog pin will forward-bias the internal ESD protection diodes, pulling current from the ground plane and potentially destroying the microcontroller. To measure negative voltages or bipolar AC waveforms, you must use an op-amp level-shifter circuit to offset the signal into the 0-5V range, or use an external ADC with differential/bipolar inputs like the ADS1115.

How do I change the reference voltage to get better resolution?

If you are reading a sensor that only outputs 0V to 1.1V (like a low-side current shunt), using the default 5V Vref wastes 80% of your ADC range. You can switch the Arduino Uno's Vref to its internal 1.1V bandgap reference by calling analogReference(INTERNAL) in your setup block. This changes your formula multiplier: ADC_Value = (Vin / 1.1) × 1023. Now, a 0.5V input yields 465 instead of 102, effectively giving you 4.5x more resolution for small signals. Never apply more than 1.1V to the analog pins when this mode is active, or you will damage the internal bandgap circuitry.