If you are reading a 2.5V signal on a standard 5V, 10-bit analog and digital converter (like the ATmega328P on an Arduino Uno), the direct converted digital value is 512. The universal formula used to calculate this is:

Digital Value = (Analog Voltage / Reference Voltage) × (2^Resolution - 1)

Substituting our exact query values into the formula:
Digital Value = (2.5V / 5.0V) × (2^10 - 1)
Digital Value = 0.5 × 1023 = 511.5 (which rounds to 512).

This conversion assumes your reference voltage (Vref) is locked at exactly 5.00V and the ADC resolution is strictly 10 bits. If either of those assumptions shifts, your digital output changes entirely. Below is a quick-reference table of neighboring values within a ±20% range of our 2.5V baseline, assuming that same 5V/10-bit environment.

Table 1: 10-Bit ADC Digital Values for Voltages Near 2.5V (Vref = 5.0V)
Analog Input (V) Digital Value (Decimal) Hexadecimal Binary (10-bit)
2.00V (-20%)4090x1990110011001
2.10V4300x1AE0110101110
2.20V4500x1C20111000010
2.30V4710x1D70111010111
2.40V4910x1EB0111101011
2.50V (Baseline)5120x2001000000000
2.60V5320x2141000010100
2.70V5530x2291000101001
2.80V5730x23D1000111101
2.90V5940x2521001010010
3.00V (+20%)6140x2661001100110

The Core Conversion Formula and Fixed Assumptions

The math behind an analog and digital converter is essentially a ratio. The ADC measures the input voltage as a fraction of its reference voltage (Vref), then maps that fraction across its total available digital steps. A 10-bit converter has $2^{10}$ (1024) total states, ranging from 0 to 1023.

The answer we calculated above (512) is entirely fixed by two assumptions:

  1. The Reference Voltage is exactly 5.00V: On a typical Arduino Uno powered via USB, the 5V rail is actually the USB VBUS. According to the official Arduino hardware documentation, USB voltage can sag to 4.8V or spike to 5.2V depending on your host PC's power delivery. If your Vref is actually 4.8V, a true 2.5V input will yield a digital reading of (2.5 / 4.8) × 1023 = 533, not 512. This is why precision builds use the dedicated AREF pin with a clean, external voltage reference IC like the LM4040.
  2. The Resolution is exactly 10 bits: The ATmega328P hardware is natively 10-bit. If you are using a microcontroller with a different architecture, the multiplier changes.
Safety & Hardware Limit: Never feed an analog voltage higher than Vref + 0.3V into an ADC pin. Exceeding this absolute maximum rating forward-biases the internal ESD protection diodes, injecting current into the substrate and potentially bricking the microcontroller or causing erratic readings on adjacent analog pins.

Reference Voltage Shifts: 3.3V, 12-Bit, and 16-Bit Systems

Just as AC power calculations shift drastically when moving from 120V single-phase to 208V three-phase, ADC conversions shift entirely when you change the microcontroller ecosystem or add external silicon. You cannot use the 5V/10-bit math universally.

Here is how that exact same 2.5V analog signal converts across three common modern architectures:

  • 3.3V / 12-Bit (ESP32-S3): The ESP32 uses a 12-bit ADC with a 3.3V reference.
    Calculation: (2.5 / 3.3) × (4095) = 3102.
  • 16-Bit External (ADS1115 at 4.096V FSR): When you need precision, you bypass the internal MCU ADC and use an I2C breakout like the Texas Instruments ADS1115. Setting the internal Programmable Gain Amplifier (PGA) to a 4.096V Full-Scale Range (FSR) yields 15 bits of positive resolution (32,767 steps).
    Calculation: (2.5 / 4.096) × 32767 = 19969.
  • 3.3V / 10-Bit (Raspberry Pi Pico / RP2040): The RP2040 features a 12-bit ADC, but many developers truncate it to 10-bit in software to match legacy Arduino code. If truncated to 10-bit on a 3.3V reference:
    Calculation: (2.5 / 3.3) × 1023 = 775.

For deeper architectural specifics on external delta-sigma converters, refer to the Texas Instruments ADC circuit design guides, which detail how oversampling and digital filtering affect the final decimal output.

When Analog to Digital Conversion Becomes Meaningless

Math only works if the physics at the pin are stable. The conversion formula becomes entirely meaningless—and your data garbage—under three specific bench conditions:

  1. Source Impedance > 10kΩ: Internal ADCs use a sample-and-hold (S/H) capacitor (typically around 14pF on AVR chips). If your analog source (like a high-value voltage divider or an NTC thermistor) has an output impedance greater than 10kΩ, the S/H capacitor cannot charge fully before the conversion clock triggers. The result is a digital value that reads artificially low and fluctuates wildly. Fix: Buffer the signal with an op-amp (like an LM358) or add a 100nF ceramic capacitor directly at the ADC pin to act as a local charge reservoir.
  2. Floating Inputs: If an analog pin is left unconnected (floating), it acts as an antenna. The high-impedance CMOS input will couple with 50/60Hz mains hum and RF noise, yielding random digital values between 0 and 1023. Always tie unused analog pins to GND via a 10kΩ pull-down resistor.
  3. Uncalibrated Internal References: If you configure your code to use the MCU's internal 1.1V bandgap reference instead of the VCC rail, but you use 5.0V in your math formula, your calculations will be off by a factor of 4.5. The internal reference is typically accurate only to ±10% from the factory.

Frequently Asked Questions

How does an analog and digital converter handle negative voltages?

Standard single-ended internal ADCs (like those on the Arduino Uno or ESP32) cannot read negative voltages; they will simply clamp at 0 and risk damaging the pin if the voltage drops below -0.3V. To measure negative voltages, you must use an external differential ADC like the ADS1115. By wiring the signal to the AIN0 pin and your ground reference to AIN1, the ADS1115 measures the potential difference. If AIN0 is lower than AIN1, the converter outputs a negative digital integer (using two's complement binary representation), allowing you to measure bipolar signals like AC waveforms or shunt resistor voltage drops.

Why is my ESP32 analog and digital converter reading non-linear values?

The internal 12-bit ADC on the original ESP32 (and many ESP32-S2 variants) is notoriously non-linear, particularly near the 0V and 3.3V rails. According to the Espressif ADC oneshot driver documentation, the native analog front-end operates best between roughly 100mV and 950mV. When you use the default 11dB attenuation to read up to 3.3V, the internal amplifier introduces curve distortion. If your project requires accurate voltage mapping across the full 0-3.3V range, do not rely on the internal ESP32 ADC. Instead, use an external I2C ADC or switch to the ESP32-S3/C3, which feature significantly improved internal ADC linearity.

What is the difference between an internal and external analog and digital converter?

An internal ADC is built into the microcontroller's silicon. It is free, requires no extra wiring, and is fast enough for basic tasks like reading a potentiometer or a slow-moving temperature sensor. However, internal ADCs share the noisy digital ground plane of the MCU and typically max out at 10 to 12 bits of resolution. An external ADC (like the 16-bit ADS1115 or 24-bit HX711) is a dedicated IC that communicates via I2C or SPI. External converters feature isolated analog ground planes, internal low-noise voltage references, and programmable gain amplifiers (PGAs). You choose an external converter when you need to resolve microvolt-level changes, such as reading a strain gauge load cell or a precision RTD temperature probe.