If you are measuring 2.5V DC using a standard 10-bit ADC (like the internal SAR ADC on an ATmega328P) with a 5.0V reference, the direct converted digital output is 512 (decimal) or 0x200 (hex). This assumes a unipolar input range (0V to Vref) and an ideal, noise-free signal. The underlying formula used to derive this is:

Digital Code = (V_in / V_ref) × 2^n

Code = (2.5V / 5.0V) × 2^10 = 0.5 × 1024 = 512

Because bench signals rarely sit perfectly on a round number, here is a quick-reference table for neighboring voltages (±20% of our 2.5V target) assuming that same 10-bit, 5.0V reference architecture:

10-Bit ADC Conversion Table (Vref = 5.0V)
Analog Input (V_in)Digital Code (Decimal)Hex ValueLSB Error Margin (±1)
2.00V4090x199408 - 410
2.10V4300x1AE429 - 431
2.25V4600x1CC459 - 461
2.50V5120x200511 - 513
2.75V5630x233562 - 564
2.90V5930x251592 - 594
3.00V6140x266613 - 615

Comparing Analog to Digital Converter Types

The formula above assumes an ideal conversion, but in practice, the physical architecture of the silicon dictates your sample rate, latency, and noise floor. When selecting between analog to digital converter types, you are trading speed for resolution. A Flash ADC gives you nanosecond latency but burns power and limits you to 8-12 bits. A Sigma-Delta ADC gives you 24-bit precision but takes milliseconds to settle.

Architecture Comparison: Real-World ADC Types
ArchitectureTypical ResolutionSample RateLatencyCommon Part NumberBest Application
Successive Approximation (SAR)8 to 18-bit10 kSPS to 5 MSPSLow (µs)MCP3008 (10-bit), ADS8688 (16-bit)General MCU inputs, sensor polling, battery monitoring
Sigma-Delta (Σ-Δ)16 to 32-bit10 SPS to 1 MSPSHigh (ms)ADS1115 (16-bit), ADS1256 (24-bit)Load cells, RTD thermocouples, precision DC metrology
Flash6 to 12-bit10 MSPS to >1 GSPSZero (ns)TLC5540 (8-bit), MAX109 (8-bit)Oscilloscopes, SDR (Software Defined Radio), video digitizing
Pipelined12 to 16-bit10 MSPS to 500 MSPSMedium (Clock cycles)AD9467 (16-bit), LTC2208 (13-bit)Medical imaging, radar, intermediate-frequency (IF) sampling

If you are building a DIY bench power supply and need to read voltage and current, a 16-bit SAR or Sigma-Delta like the Texas Instruments ADS1115 is the correct choice. If you are building an audio effects pedal, you need a Pipelined or high-speed SAR to hit >44.1 kSPS without introducing aliasing.

How Reference Voltage and Mains Scaling Shift the Code

The digital output is entirely dependent on your assumptions regarding Vref (Reference Voltage) and n (Bit Depth). If you take that same 2.5V signal and feed it into the internal 12-bit ADC of an ESP32 (using a 3.3V reference and 0dB attenuation), the math shifts drastically:

Code = (2.5V / 3.3V) × 2^12 = 0.7575 × 4096 = 3103

Warning: ESP32 ADC Nonlinearity
While the math says 3103, the ESP32's internal SAR ADC is notoriously non-linear near the rails (below 0.15V and above 3.0V). For precision work on an ESP32, bypass the internal ADC entirely and use an external I2C ADC like the ADS1115.

Scaling for 120V, 230V, and 3-Phase Mains

A common point of confusion is how this conversion applies to mains voltage. You cannot feed 120V AC, 230V AC, or 3-phase power directly into any silicon ADC. Doing so will instantly vaporize the input protection diodes and destroy the microcontroller. The "conversion" for mains requires front-end analog scaling via Potential Transformers (PTs) or high-voltage resistor dividers.

Here is how the math shifts when measuring a 230V RMS European mains line using a 100:1 step-down transformer and a 3.3V, 12-bit ADC:

  • Step 1 (Transform): 230V RMS ÷ 100 = 2.3V RMS.
  • Step 2 (Find Peak): AC ADC readings require peak voltage. 2.3V × √2 (1.414) = 3.25V Peak.
  • Step 3 (Convert): (3.25V / 3.3V) × 4096 = 4034 (Decimal code at the peak of the sine wave).

For 120V US mains through the same 100:1 transformer, the peak is only 1.7V, yielding a digital code of 2110. For 3-phase systems, the conversion math per phase remains identical, but you must sample all three phases simultaneously using a multi-channel synchronous ADC (like the ADE9000) to calculate true power factor and phase angles.

When Voltage-to-Bit Conversions Become Meaningless

An ADC will always output a number, but that number is physically meaningless under certain bench conditions. Before trusting your serial monitor output, rule out these three failure modes:

  1. Source Impedance > 10 kΩ (SAR ADCs): SAR ADCs use an internal sample-and-hold capacitor. If your analog source (like a high-value voltage divider) has an impedance greater than 10 kΩ, the internal capacitor cannot fully charge during the acquisition window. Your 2.5V signal might read as 2.1V simply because the capacitor ran out of time to fill up. Fix: Add an op-amp buffer (e.g., LM358) between the source and the ADC pin.
  2. Noise Floor Exceeds 1 LSB: If you are using a 24-bit Sigma-Delta ADC (like a load cell amplifier), 1 LSB on a 5V scale is roughly 0.3 µV. Standard breadboard EMI and thermal noise will easily exceed this. If your last 4 bits are flickering randomly, your effective resolution is only 20 bits. Fix: Use a moving average filter in software and ensure a star-ground topology.
  3. Unbuffered Multiplexing: When rapidly switching between channels on a multi-channel ADC (like the CD4051B multiplexer feeding an Arduino), charge injection from the previous channel bleeds into the current reading. Fix: Read the pin twice and discard the first value, or add a 10ms settling delay between MUX channel switches.
Bench Tip: Always verify your Vref with a multimeter before trusting the ADC math. If your Arduino's 5V USB rail is actually sagging to 4.7V due to a long cable, your 512 code no longer represents 2.5V—it represents 2.35V. For critical measurements, use the microcontroller's internal 1.1V bandgap reference to measure the actual VCC rail, then use that calculated VCC value as your Vref variable in software.