Converting a 2.50V analog signal using a 12-bit AD converter with a 3.3V reference yields exactly 3102 digital counts. The governing formula is Count = (Vin / Vref) × (2n - 1). Substituting our bench values: (2.50 / 3.30) × 4095 = 3102.27, which the silicon truncates to 3102. This direct conversion assumes a stable, noise-free reference voltage (Vref), an ideal linear transfer function, and a DC input that has settled before the sampling capacitor engages.
Neighboring Values: 12-Bit ADC at 3.3V (±20% Range)
When debugging sensor drift, it helps to see how the digital output shifts around your target voltage. Here is the count mapping for a 2.5V nominal input, spanning a ±20% tolerance band (2.0V to 3.0V):
| Analog Input (Vin) | Digital Count (12-bit) | Hex Value | Delta from 2.5V |
|---|---|---|---|
| 2.00V | 2481 | 0x9B1 | -621 counts |
| 2.20V | 2730 | 0xAAA | -372 counts |
| 2.40V | 2978 | 0xBA2 | -124 counts |
| 2.50V (Nominal) | 3102 | 0xC1E | Baseline |
| 2.60V | 3227 | 0xCA3 | +125 counts |
| 2.80V | 3475 | 0xD93 | +373 counts |
| 3.00V | 3722 | 0xE8A | +620 counts |
Resolution & LSB Scaling: How Bit Depth Shifts the Answer
The assumption that fixes your conversion accuracy is the Least Significant Bit (LSB) voltage, which is dictated by your bit depth and Vref. A 10-bit Arduino Uno reading a 5V reference has an LSB of 4.89 mV. If your sensor outputs a 2 mV change per degree, a 10-bit AD converter cannot physically resolve single-degree shifts. You must scale up the bit depth or shrink the Vref.
| ADC Resolution | Max Count (2n-1) | LSB at 3.3V Vref | LSB at 5.0V Vref | Common Hardware Platform |
|---|---|---|---|---|
| 8-Bit | 255 | 12.94 mV | 19.61 mV | ATtiny85, legacy PIC |
| 10-Bit | 1023 | 3.22 mV | 4.89 mV | Arduino Uno (ATmega328P) |
| 12-Bit | 4095 | 0.80 mV | 1.22 mV | ESP32, STM32, Raspberry Pi Pico |
| 16-Bit | 65535 | 0.05 mV (50 µV) | 0.076 mV (76 µV) | TI ADS1115, external Sigma-Delta |
If you switch from a 3.3V reference to a 1.1V internal reference on an AVR chip, your 10-bit LSB drops from 3.22 mV to 1.07 mV, effectively multiplying your resolution by three without changing the silicon. However, you must ensure your input signal never exceeds 1.1V, or the ADC will hard-clip at 1023.
Measuring Mains: The 120V vs 230V vs 3-Phase Shift
Unlike AC power calculations where shifting from 120V to 230V or 3-phase simply changes your amperage draw, applying line-level AC voltages directly to an AD converter will instantly destroy the silicon via overvoltage breakdown. To measure 120V, 230V, or 3-phase mains with an ADC, the 'conversion' shifts from a simple math equation to a hardware scaling and biasing problem.
Here is how the conversion math shifts when measuring AC mains:
- 120V AC (US): The RMS voltage is 120V, but the peak-to-peak swing is ~339V. A step-down transformer scales this to a safe 0-3V AC swing, which is then biased to a 1.5V DC offset so the negative half-cycles don't clip below the ADC's ground.
- 230V AC (EU/UK): The peak-to-peak swing reaches ~650V. Your transformer ratio must be twice as aggressive as the 120V setup to keep the output within the same 0-3V ADC window, altering your software multiplier accordingly.
- 3-Phase Systems: You cannot measure 3-phase with a single AD converter channel. You need three isolated step-down transformers and either a 3-channel simultaneous-sampling ADC (like the TI ADS8688) or three separate single-channel ADCs triggered by a shared hardware interrupt to capture the 120° phase shift accurately.
When AD Converter Math Becomes Meaningless
The formula Count = (Vin / Vref) × (2n - 1) assumes ideal conditions. On the bench, several physical realities render this mathematical conversion completely meaningless:
- Floating or Noisy Vref: If your 3.3V reference is sourced directly from a cheap switching buck converter with 50mV of ripple, your 12-bit ADC's 0.80mV LSB is buried in noise. The digital counts will jitter wildly even if Vin is a perfect battery source. Fix: Use a dedicated low-dropout regulator (LDO) or a precision voltage reference IC (like the LM4040) for Vref.
- Source Impedance Mismatch: SAR (Successive Approximation Register) ADCs use an internal sampling capacitor. If your sensor's output impedance is higher than 10kΩ, the capacitor cannot charge fully during the acquisition window. The ADC will read artificially low voltages. Fix: Buffer high-impedance sensors (like thermistors or pH probes) with an op-amp voltage follower before the ADC pin.
- Aliasing (Nyquist Violation): If you are sampling a 10kHz PWM signal but your AD converter is only taking readings at 12kHz, the resulting digital counts will map to a phantom low-frequency beat. The math is correct, but the data represents a ghost signal. Fix: Add a hardware RC low-pass filter with a cutoff frequency at least half your sampling rate.
Real-World ADC IC Comparison (2026 Bench Favorites)
| Module / IC | Architecture | Resolution | INL (Max Error) | Typical Cost |
|---|---|---|---|---|
| ESP32 Internal | SAR | 12-bit | ±275mV offset (non-linear) | $0.00 (Built-in) |
| TI ADS1115 | Sigma-Delta | 16-bit | ±2 LSB | $3.50 (I2C Module) |
| Microchip MCP3008 | SAR | 10-bit | ±1 LSB | $2.10 (SPI IC) |
Note: The ESP32's internal ADC is notorious for non-linearity near the 0V and 3.3V rails. For precision DC measurements under 100mV, bypass it entirely and use an external I2C AD converter like the ADS1115.
Frequently Asked Questions
Why does my 12-bit ADC read 4095 when the input is only 3.4V?
The maximum count (4095) represents any voltage equal to or greater than Vref. If your Vref is 3.3V, an input of 3.4V exceeds the reference rail, causing the AD converter to hard-clip at the maximum digital value. You are no longer measuring voltage; you are measuring a logic HIGH.
Can I improve ADC resolution by oversampling?
Yes. By taking multiple samples and averaging them, you can mathematically gain resolution. The rule of thumb is that you need 4n samples to gain n additional bits of resolution. To turn a 10-bit ADC into a 12-bit AD converter via software oversampling, you must sample 64 times and divide by 4, provided there is at least 1 LSB of natural thermal noise in the signal to dither the readings.






