Core Conversion Formula and Hardware Spec Sheets
When prototyping analog to digital converter applications, the most common baseline query is converting a mid-scale voltage to a digital count. For a standard 10-bit ADC (like the ATmega328P on an Arduino Uno) with a 5.0V reference, an analog input of 2.5V converts to exactly 511 digital counts (or 512 depending on rounding). The formula used is Digital Count = (Vin ÷ Vref) × (2^n - 1), substituting the exact values: (2.5 ÷ 5.0) × 1023 = 511.5.
Because real-world signals fluctuate, here is the conversion table for neighboring values within a ±20% range of that 2.5V baseline, assuming a stable 5.0V reference and 10-bit resolution:
| Analog Input (Vin) | 10-Bit Count (5V Vref) | 12-Bit Count (3.3V Vref) | 16-Bit Count (5V Vref) |
|---|---|---|---|
| 2.0V (-20%) | 409 | 2482 | 26214 |
| 2.25V (-10%) | 460 | 2792 | 29491 |
| 2.5V (Baseline) | 511 | 3102 | 32767 |
| 2.75V (+10%) | 562 | 3412 | 36044 |
| 3.0V (+20%) | 613 | 3722 | 39321 |
Selecting the right silicon is just as critical as the math. Below is a data-dense spec-sheet table comparing the most common ADCs used in modern bench and field builds. Pricing reflects typical 2026 hobbyist breakout and bare IC costs.
| ADC Model | Architecture | Resolution | Max Sample Rate | Interface | Approx. Cost |
|---|---|---|---|---|---|
| ESP32 Internal | SAR | 12-bit | ~200 kSPS | Internal | $4.00 (MCU) |
| Microchip MCP3008 | SAR | 10-bit | 200 kSPS | SPI | $2.15 (IC) |
| TI ADS1115 | Sigma-Delta | 16-bit | 860 SPS | I2C | $3.50 (Breakout) |
| TI ADS1256 | Sigma-Delta | 24-bit | 30 kSPS | SPI | $12.50 (IC) |
Sources: Texas Instruments ADS1115 Datasheet, Microchip MCP3008 Datasheet.
Critical Assumptions: Vref Stability and Mains Scaling
The single assumption that fixes the accuracy of any ADC conversion is the Reference Voltage (Vref). If your Arduino is powered via a USB port that sags from 5.0V to 4.7V under load, your Vref drops with it. That same 2.5V input will now read (2.5 ÷ 4.7) × 1023 = 544 counts. For precision analog to digital converter applications, always use an external precision voltage reference (like the LM4040) or an ADC with an internal bandgap reference (like the ADS1115) rather than relying on the microcontroller's VCC rail.
How the Answer Shifts for 120V vs 230V vs 3-Phase
ADCs operate strictly in the 0–5V or 0–3.3V domain; they cannot read mains voltage directly. When applying ADCs to AC mains monitoring, you must use a step-down potential transformer (like the ZMPT101B) or a resistive divider. The raw ADC count remains in the 0–4095 (12-bit) range, but the software scaling multiplier shifts drastically based on the mains standard:
- 120V AC (North America): Peak voltage is ~170V. Your transformer scales 170V peak down to 1.65V peak (centered on a 1.65V DC bias). The software multiplier maps the ADC count back to 120V RMS.
- 230V AC (Europe/UK): Peak voltage is ~325V. The physical transformer winding ratio or voltage divider must be adjusted to prevent clipping the 3.3V ADC ceiling. The software multiplier shifts to map the count to 230V RMS.
- 3-Phase Systems: Requires three separate ADC channels. Because standard ADCs multiplex or sample sequentially, you must apply a phase-shift correction algorithm in software to account for the microseconds of delay between reading Phase A, Phase B, and Phase C.
When the Conversion is Meaningless
An ADC reading becomes mathematically meaningless in two specific scenarios:
- Aliasing (Nyquist Violation): If your input signal frequency exceeds half your sampling rate (the Nyquist frequency), the ADC will output a lower-frequency ghost signal. Sampling a 60Hz mains wave at 100Hz yields meaningless data; you must sample at >120Hz (ideally >1kHz for harmonic analysis).
- High-Impedance Source Droop: SAR ADCs use an internal sampling capacitor that must charge during the acquisition window. If your source impedance is >10kΩ (e.g., a massive voltage divider), the capacitor cannot charge fully, and the ADC reads a lower voltage than actually exists. Always buffer high-impedance signals with an op-amp (like the MCP6001) before the ADC pin.
Practical Wiring for Industrial Sensor Applications
Industrial analog to digital converter applications frequently rely on 4–20mA current loops rather than 0–10V signals, because current loops are immune to voltage drop over long cable runs. To read a 4–20mA sensor with a standard 0–3.3V ADC, you must convert the current to voltage using a precision shunt resistor.
Shunt Resistor Math: To map 20mA to 3.3V, use Ohm's Law: R = V ÷ I. 3.3V ÷ 0.020A = 165Ω. Use a 165Ω (or standard 162Ω/169Ω) 1% tolerance resistor. At 4mA (the 'zero' or 'live zero' state), the ADC will read 0.004A × 165Ω = 0.66V, allowing your microcontroller to detect a broken wire (0V) versus a valid minimum reading.
FAQ: Edge Cases in ADC Readings
Why does my ESP32 ADC read non-linear values above 2.5V?
The internal SAR ADC on the original ESP32 (and ESP32-S2) is notoriously non-linear near the 3.3V rail. If you feed it 3.0V, it might report a count corresponding to 2.7V. To fix this, you must configure the input attenuation using adc1_config_channel_atten(channel, ADC_ATTEN_DB_11) in the ESP-IDF, or use the analogSetAttenuation(ADC_11db) function in the Arduino core. For true precision, bypass the internal ADC entirely and use an I2C ADS1115. (See the Espressif ESP32 ADC API Reference for silicon-specific errata).
How do I handle negative voltages in a single-supply ADC?
Standard single-supply ADCs will clip or damage the silicon if fed a negative voltage. To measure bipolar signals (like an AC waveform centered at 0V), you must add a DC bias. Create a voltage divider with two equal resistors (e.g., 10kΩ each) between Vref and GND to create a virtual ground at Vref/2 (e.g., 1.65V). AC-couple your input signal through a 10µF capacitor to this bias point, shifting the waveform into the 0–3.3V readable window.
What is the difference between SAR and Sigma-Delta ADCs?
Successive Approximation Register (SAR) ADCs (like the MCP3008) capture a snapshot of the voltage instantly, making them ideal for high-speed multiplexing and oscilloscope-style sampling. Sigma-Delta ADCs (like the ADS1115) oversample the signal at a high frequency and use digital filtering to achieve massive resolution (16 to 24-bit), but at the cost of speed (typically <1kSPS). Use SAR for fast transients; use Sigma-Delta for precision DC measurements like load cells or thermocouples.






