If you are converting 2.50V using a standard 10-bit ADC convertor with a 5.0V reference (like the internal ADC on an Arduino Uno's ATmega328P), the exact digital output value is 512. The universal formula for this conversion is Digital Value = (Vin / Vref) * (2^n - 1). Substituting our baseline values: (2.50 / 5.00) * (2^10 - 1) = 0.5 * 1023 = 511.5, which the microcontroller rounds to 512. This number is what your analogRead() function will return to your serial monitor.
The Core Conversion Formula & Neighboring Values
An ADC (Analog-to-Digital Converter) maps a continuous voltage range into discrete digital steps. The resolution of those steps is dictated by the bit-depth (n). For a 10-bit ADC, you have 1,024 total steps (0 to 1023). For a 12-bit ADC (like the ESP32), you have 4,096 steps (0 to 4095).
Below is a reference table showing how the digital output shifts across a ±20% voltage range around our 2.50V baseline, assuming a 5.0V reference and 10-bit resolution. This is highly useful when debugging sensor tolerances or setting threshold triggers in your code.
| Input Voltage (Vin) | Variance from Baseline | Digital Value (10-bit, 5V Ref) | Step Size (mV/step) |
|---|---|---|---|
| 2.00V | -20% | 409 | 4.88 mV |
| 2.25V | -10% | 460 | 4.88 mV |
| 2.50V | Baseline | 512 | 4.88 mV |
| 2.75V | +10% | 562 | 4.88 mV |
| 3.00V | +20% | 614 | 4.88 mV |
What Fixes Your Answer: Vref and Bit-Depth Assumptions
The calculation above assumes a perfectly stable 5.00V reference and a 10-bit resolution. In reality, the assumption that fixes your answer is your Vref (Reference Voltage). If your Arduino Uno is powered via a cheap laptop USB port, the 5V rail might actually be 4.6V. If Vref drops to 4.6V, that same 2.50V input now yields a digital value of 558, not 512. Always measure your Vref pin with a multimeter before finalizing your code's conversion multiplier.
If you shift to a 3.3V, 12-bit architecture (like the ESP32-WROOM-32), the math changes entirely. The maximum digital value is 4095, and the Vref is 3.3V. Feeding 1.65V into an ESP32 ADC pin yields: (1.65 / 3.3) * 4095 = 2047. Note that the ESP32's internal ADC is notoriously non-linear near the 0V and 3.3V rails; for precision work, restrict your readings to the 0.15V – 3.15V window.
How the Answer Shifts for Mains AC (120V vs 230V vs 3-Phase)
An ADC convertor cannot natively read high-voltage AC. To measure mains, you must step the voltage down to the 0-3.3V range using an isolated module like the ZMPT101B.
- 120V AC (Nominal): The peak voltage is ~170V. Your voltage divider or transformer must scale 170V peak down to 3.3V peak. The ADC reads the instantaneous waveform, requiring RMS calculation in code (multiply the peak ADC reading by 0.707).
- 230V AC (Nominal): The peak voltage is ~325V. The step-down ratio must be nearly doubled compared to the 120V setup to prevent clipping the 3.3V ADC ceiling.
- 3-Phase Systems: A single-channel ADC convertor is useless here. You need a multi-channel, high-speed ADC (sampling >1kHz) to capture the 120-degree phase shifts across all three lines simultaneously to calculate true power factor.
Decision Tree: Picking the Right ADC Convertor Hardware
Don't default to the microcontroller's internal ADC if your project demands precision. Use this decision path to select the exact hardware for your next build.
| If your project requires... | And your constraint is... | Then pick this concrete part: |
|---|---|---|
| Reading 8 potentiometers for a MIDI controller | Low cost, moderate speed, SPI bus | MCP3008 (10-bit, 8-channel SPI ADC) |
| Measuring a 12V LiFePO4 battery pack voltage | High precision, low speed, I2C bus | ADS1115 (16-bit, 4-channel I2C ADC) |
| Capturing audio waveforms or ultrasonic echoes | Ultra-high speed, single channel | ADC0820 (8-bit, Flash ADC, >1 MSPS) |
| Simple light-level sensing via an LDR | Zero extra BOM cost, basic prototyping | Internal ATmega328P (Arduino Uno 10-bit) |
For 90% of embedded sensor projects requiring better than 10-bit resolution, the TI ADS1115 is the definitive choice. Its internal programmable gain amplifier (PGA) allows you to measure signals as small as ±256mV with 16-bit resolution, completely bypassing the noisy internal references of standard microcontrollers.
When ADC Conversion Becomes Meaningless
Math only works if the physics cooperate. Your ADC conversion is entirely meaningless—and your code will return garbage data—under these three conditions:
- Source Impedance > 10kΩ: Internal ADCs use a sample-and-hold capacitor (typically 10-14pF). If your voltage divider or sensor has an output impedance higher than 10kΩ, the capacitor won't have time to charge before the conversion triggers. Fix: Buffer the signal with an op-amp (like the LM358) or add a 100nF ceramic capacitor between the ADC pin and GND to act as a local charge reservoir.
- Floating Pins: If you run
analogRead()on an unconnected pin, you aren't measuring 0V; you are measuring the antenna effect of the silicon tracing picking up RF noise and thermal drift. Fix: Always tie unused ADC pins to GND via a 10kΩ pull-down resistor. - Noisy Vref Rails: If your ADC reference is tied directly to a switching regulator's output or a USB bus shared with a high-current motor, the reference voltage will ripple. A 50mV ripple on Vref translates directly to a 10-step jitter on a 10-bit ADC. Fix: Use a dedicated low-dropout (LDO) voltage reference IC, such as the LM4040, to feed the Vref pin.
FAQ: ADC Convertor Edge Cases
Why does my ESP32 ADC read 4095 when the input is only 3.0V?
The ESP32's internal 12-bit ADC suffers from severe non-linearity and saturation near the top of its range. Anything above ~3.1V will likely max out at 4095. To fix this, use a voltage divider to scale your maximum expected voltage down to 2.5V, or switch to an external ADS1115 module which maintains linearity across its entire range.
Can I increase my ADC resolution using software?
Yes, through a technique called oversampling. By taking multiple rapid samples of a slightly noisy signal and averaging them, you can mathematically extract extra bits of resolution. As a rule of thumb, oversampling by a factor of 4 yields 1 extra bit of resolution. Taking 64 samples and averaging them can turn a 10-bit ADC into a functional 13-bit ADC, provided the signal has at least 1 LSB of natural dither (noise).
Do I need to calibrate my ADC convertor?
For hobbyist internal ADCs, no. For external precision ADCs like the MCP3008 or ADS1115 used in measurement equipment, you should perform a two-point calibration in software. Read a known 0V (GND) and a known precise voltage (e.g., a 2.048V reference IC), then calculate the slope and offset to correct the raw digital values in your code.






