An Analog-to-Digital Converter (ADC) is fundamentally a unit translation engine: it converts continuous analog voltage (Volts) into discrete digital binary numbers (counts). If you are asking what is a to d converter while debugging a standard 5V microcontroller circuit, the direct answer is a scaling ratio. For a standard 10-bit ADC with a 5.0V reference voltage, an input of 2.5V converts exactly to a digital count of 512.

The governing formula is:

Digital Count = floor((V_in / V_ref) × 2^n)

Substituting our bench values: floor((2.5V / 5.0V) × 1024) = 512.

Here is how the digital count shifts across a ±20% voltage range (2.0V to 3.0V) for this exact 10-bit, 5V setup:

10-Bit ADC Conversion Table (V_ref = 5.0V)
Analog Input (V_in) Ratio (V_in / V_ref) Digital Count (Decimal) Binary Output (10-bit)
2.0V0.4004090110011001
2.1V0.4204300110101110
2.5V0.5005121000000000
2.9V0.5805931001010001
3.0V0.6006141001100110

Core Assumptions: V_ref, Bit Depth, and Mains Scaling

The conversion answer is entirely fixed by two assumptions: the Reference Voltage (V_ref) and the Bit Resolution (n). The reference voltage defines the maximum measurable ceiling, while the bit depth defines how many discrete slices that ceiling is divided into (the Least Significant Bit, or LSB).

How does this shift for 120V vs 230V vs 3-phase AC?
An ADC silicon chip operates at low-voltage DC levels (typically 0–3.3V or 0–5V). You never feed 120V or 230V mains directly into an ADC pin. To measure mains AC, you use a front-end potential transformer (like the ZMPT101B module) to step the voltage down to a 0–3.3V AC waveform centered at a 1.65V DC bias.

  • 120V AC: The transformer steps 170V peak down to ~1.65V peak. The ADC samples the biased sine wave, and your firmware calculates the RMS value.
  • 230V AC: The transformer ratio shifts to step 325V peak down to the same 1.65V peak. The ADC math remains identical; only the physical scaling multiplier in your code changes.
  • 3-Phase: You require three separate ADC channels sampling simultaneously to capture the 120-degree phase offsets. If your ADC multiplexes too slowly, the phase angle calculations will be skewed.
When the Conversion is Meaningless: The math breaks down entirely in two scenarios. First, if V_in > V_ref, the ADC experiences rail clipping and simply outputs the maximum count (e.g., 1023), destroying the waveform data. Second, if your sampling rate violates the Nyquist theorem (sampling at less than twice the highest frequency of the input signal), you get aliasing—where high-frequency noise masquerades as low-frequency data.

How the Math Shifts Across Common Reference Voltages

Treating a 5V Arduino conversion as universal is a common bench mistake. Here is how the exact same 2.5V input translates across different microcontroller ecosystems:

Ecosystem V_ref Resolution (n) Total Steps LSB Voltage Count for 2.5V
Arduino Uno (ATmega328P) 5.0V 10-bit 1024 4.88 mV 512
ESP32-WROOM-32 (Internal) 3.3V 12-bit 4096 0.80 mV 3103
Industrial PLC (Analog Input) 10.0V 16-bit 65536 0.15 mV 16384

Note: The internal ESP32 ADC is notoriously non-linear near the 0V and 3.3V rails. For precision work on 3.3V systems, bypass the internal ADC and use an external I2C chip.

ADC Selection Decision Tree

Stop guessing which breakout board to buy. Use this decision path to terminate on a concrete part number based on your signal type.

Signal Requirement Speed Needed Recommended Part Number Interface Approx. Cost (2026)
High-Precision DC (Load cells, RTDs, thermocouples) Slow (< 1 kSPS) Texas Instruments ADS1115 (16-bit) I2C $4.50
Multi-Channel DC (Joysticks, potentiometers, MIDI) Medium (200 kSPS) Microchip MCP3008 (10-bit, 8-ch) SPI $2.80
High-Speed AC Waveforms (Audio, ultrasonic, RF envelope) Fast (65 MSPS) Analog Devices AD9235 (12-bit) Parallel/LVDS $32.00
Basic Hobby DC (Simple battery voltage monitoring) Slow (15 kSPS) Use Internal MCU ADC (Arduino/AVR) Internal $0.00

Real-World Bench Pitfalls and Fixes

Datasheets assume ideal conditions. On the workbench, you will encounter these specific failure modes:

  1. Source Impedance Mismatch: Microcontroller ADCs use an internal sample-and-hold capacitor (typically 10-14 pF). If your analog source (like a high-value voltage divider) has an output impedance greater than 10 kΩ, the capacitor won't charge fully during the sampling window. Fix: Add a 100 nF ceramic capacitor directly at the ADC pin to act as a local charge reservoir, or buffer the signal with an op-amp like the LM358.
  2. Ground Bounce Noise: If your digital loads (like an ESP32 transmitting over WiFi) share the same ground trace as your ADC reference, digital switching noise will inject millivolt spikes into your analog readings. Fix: Use a star-ground topology or an external ADC with differential inputs (like the ADS1115) to reject common-mode noise.
  3. Missing Codes: In cheaper or high-speed ADCs, thermal noise can cause the digital output to skip specific integer values (e.g., jumping from 511 to 513). Fix: Oversample by a factor of 4 and average the results in software to smooth out the quantization noise.

Quick Reference FAQ

What is the difference between an ADC and a DAC?
An ADC (Analog-to-Digital Converter) measures real-world voltage and turns it into binary code for a microprocessor to read. A DAC (Digital-to-Analog Converter) does the reverse: it takes binary code from a microprocessor and generates a physical voltage to drive analog circuits like audio amplifiers or motor controllers.

Why does my ESP32 ADC read 4095 when the pin is disconnected?
A floating ADC pin acts as an antenna, picking up 50/60Hz mains hum and RF interference from the ESP32's own WiFi radio. The internal sample capacitor charges to the rail. Always tie unused ADC pins to GND via a 10kΩ pull-down resistor.

How do I convert the ADC count back to voltage in code?
Reverse the formula. In C++ for an Arduino: float voltage = (adc_count * 5.0) / 1023.0;. Note that dividing by 1023 (the max count) rather than 1024 (the number of steps) is a common debate; for standard SAR ADCs, dividing by 1024 is technically more accurate to the LSB step size, though 1023 ensures the max reading maps exactly to V_ref.

For deeper architectural theory on sampling and quantization noise, refer to the Analog Devices Data Conversion Handbook. For ESP32-specific ADC quirks and calibration routines, consult the official Espressif ESP-IDF ADC Documentation. A solid primer on SAR vs Sigma-Delta topologies can also be found in this All About Circuits ADC guide.