A 2.5V analog input converted by a 16-bit ADC with a 5.0V reference voltage yields a digital output code of 32,768 (hex 0x8000), with a least significant bit (LSB) voltage resolution of 76.29 µV. The governing formula is D = (V_in / V_ref) × 2^n. Substituting our exact query values: D = (2.5V / 5.0V) × 2^16 = 0.5 × 65,536 = 32,768. This direct conversion assumes a stable, noise-free 5.0V reference and a unipolar (0V to 5V) input range. If your reference drifts by even 10mV, your lower bits become unreliable.
Neighboring Value Conversions (±20% Range)
When bench-testing sensors, you rarely sit exactly on 2.5V. Below is the conversion table for a ±20% variance around our 2.5V baseline (2.0V to 3.0V), assuming the same 16-bit architecture and 5.0V V_ref. This table is critical for setting software thresholds in your microcontroller code.
| Analog Input (V_in) | Digital Code (Decimal) | Digital Code (Hex) | Percentage of Full Scale |
|---|---|---|---|
| 2.0V | 26,214 | 0x6666 | 40.0% |
| 2.1V | 27,525 | 0x6B85 | 42.0% |
| 2.2V | 28,836 | 0x70A4 | 44.0% |
| 2.3V | 30,147 | 0x75C3 | 46.0% |
| 2.4V | 31,457 | 0x7AE1 | 48.0% |
| 2.5V (Baseline) | 32,768 | 0x8000 | 50.0% |
| 2.6V | 34,079 | 0x851F | 52.0% |
| 2.7V | 35,389 | 0x8A3D | 54.0% |
| 2.8V | 36,700 | 0x8F5C | 56.0% |
| 2.9V | 38,011 | 0x947B | 58.0% |
| 3.0V | 39,322 | 0x999A | 60.0% |
What Fixes the Answer (and When the Conversion is Meaningless)
The exact digital output is fixed by three hardware assumptions: the reference voltage (V_ref) accuracy, the bit-depth (n), and whether the ADC is configured for unipolar or bipolar measurement. If you switch the ADS1115 from unipolar to bipolar mode, the formula shifts to account for negative voltages, and a 2.5V input yields a completely different code.
When the conversion is meaningless: If your breadboard's analog ground has a noise floor of 2mV RMS, resolving a 16-bit LSB of 76.29 µV is mathematically possible but physically meaningless. The lower 4 to 5 bits will just display random noise. In this scenario, a 12-bit ADC is functionally identical to a 16-bit ADC unless you add hardware low-pass filtering.
The High-Voltage AC Trap: 120V vs 230V vs 3-Phase
A common mistake in power monitoring projects is attempting to apply DC ADC formulas directly to AC mains. If your input is 120V vs 230V vs 3-phase AC, the direct ADC voltage conversion is meaningless for three reasons:
- Hardware Destruction: Standard silicon ADCs (like the MCP3008 or internal ESP32 ADCs) have absolute maximum ratings of 3.3V or 5V. Applying 120VAC will instantly vaporize the input trace.
- Scaling Requirements: You must use a voltage transformer (e.g., ZMPT101B) to step the AC down to a ±1.65V bipolar range centered around a DC offset.
- Unknown Power Factor (pf): If you are trying to convert AC voltage and current readings into Watts, the conversion is meaningless if the power factor (pf) is unknown. Apparent power (VA) does not equal real power (W) on inductive loads like motors. To measure real power across 120V/230V/3-phase systems, abandon standard ADCs and use a dedicated energy metering IC like the Microchip ATM90E26, which calculates phase angle and pf in hardware.
How Reference Voltage Shifts the Math (3.3V vs 5V vs 12V)
Your V_ref dictates your LSB size. Shrinking the reference voltage increases resolution but reduces your maximum measurable voltage. Here is how the LSB shifts across common 2026 bench power rails for a 16-bit architecture:
3.3V Reference (Common for ESP32/STM32): LSB = 50.35 µV. Ideal for low-voltage thermocouples and biopotential sensors, but requires strict 3.3V LDO regulation.
5.0V Reference (Common for Arduino/5V logic): LSB = 76.29 µV. The standard baseline for industrial 4-20mA loops when paired with a 250Ω shunt resistor.
12.0V Reference (Automotive/Industrial): LSB = 183.1 µV. Used for direct battery monitoring, but requires an ADC capable of tolerating high-voltage references or an external resistor divider.
For a deep dive into how reference noise couples into your LSB, consult the Analog Devices Data Converter Tutorials, which detail how a 1mV noise spike on a 5V reference destroys the bottom 4 bits of a 16-bit conversion.
Decision Tree: Picking the Right ADC Architecture
Don't just default to your microcontroller's internal ADC. Use this decision path to select the correct architecture and exact part number for your 2026 build.
| If your project requires... | Then choose this Architecture... | Concrete Part Pick (2026) | Approx. Cost |
|---|---|---|---|
| High speed (>1 MSPS) for capturing fast transients, motor commutation, or RF envelopes. | Flash or Pipelined SAR Trades resolution for raw speed. No digital filtering delay. | AD7606 (16-bit, 200kSPS simultaneous sampling SAR) | ~$24.00 |
| High precision (16-24 bit) for slow-moving signals like load cells, RTDs, or precision DC voltage. | Sigma-Delta (ΣΔ) Oversamples and digitally filters. Excellent noise rejection (50/60Hz). | ADS1115 (16-bit, 860SPS I2C) or ADS1256 (24-bit SPI) | ~$2.50 - $8.00 |
| General purpose, moderate speed (10-12 bit) for reading potentiometers, basic joysticks, or battery voltage. | Successive Approximation (SAR) Low power, instant conversion, easy SPI/I2C integration. | MCP3008 (10-bit, 8-channel SPI) or ADS7830 (8-bit I2C) | ~$1.80 - $2.20 |
| Basic threshold detection where exact voltage doesn't matter, just 'is it above X?' | Internal MCU ADC Free, but typically suffers from high integral non-linearity (INL) and VDD noise. | ESP32-S3 Internal ADC (12-bit, but effectively 10-bit usable) | $0.00 (On-chip) |
Default Recommendation: If you are building a standard DIY sensor node and need reliable, repeatable numbers without designing a complex analog front-end, buy the Adafruit ADS1115 breakout board. The Sigma-Delta architecture handles noisy breadboard environments far better than internal SAR ADCs, and the I2C interface works with every major microcontroller.
Frequently Asked Questions
Why does my 12-bit ADC read 4095 when the input is only 3.2V?
Your V_ref is likely tied to a 3.3V rail that has sagged to 3.2V, or your microcontroller's internal reference is uncalibrated. If V_ref drops to 3.2V, then 3.2V becomes the new 100% full-scale value, yielding the maximum code of 4095 (2^12 - 1). Always measure your actual V_ref pin with a multimeter and substitute that exact number into your software formula.
Can I use a voltage divider to measure 120V AC with a 5V ADC?
Technically yes, but practically it is highly dangerous and violates safety isolation standards. A resistor divider provides no galvanic isolation; a fault in the high-voltage side will feed 120V directly into your low-voltage microcontroller, risking fire and lethal shock. Always use an isolated voltage sensor module or a dedicated energy metering IC for mains AC.
How do I convert the digital code back to voltage in C++?
Reverse the formula. V_in = (Digital_Code / 2^n) × V_ref. For a 16-bit ADC with a 5V reference reading a code of 32768: V_in = (32768 / 65536.0) * 5.0 = 2.5V. Ensure you use floating-point math (65536.0) in your code to prevent integer division truncation.






