Analog-to-Digital Conversion

4 min read Last updated Fri Jun 12 2026 02:12:51 GMT+0000 (Coordinated Universal Time)

An ADC maps a sampled analog voltage to a binary integer. MCUs process binary values. Sensors output continuously varying voltages.

D=VinVref×(2n1)D = \left\lfloor \frac{V_\text{in}}{V_\text{ref}} \times (2^n - 1) \right\rfloor

Here:

  • DD: digital output value
  • VinV_\text{in}: input voltage
  • VrefV_\text{ref}: reference voltage
  • nn: resolution in bits

An nn-bit ADC produces 2n2^n discrete levels.

Parameters:

  • Sampling rate
    Maximum conversions per second.
  • Reference voltage
    Upper bound of the measurable input range.

Types

  • Parallel
    All bits resolved simultaneously. Fast. Hardware cost scales exponentially with resolution.
  • Serial
    Bits resolved 1 at a time over multiple cycles. Lower cost. Slower.

Flash ADC

2n12^n - 1 comparators in parallel, each with a distinct reference from a resistor ladder. All fire simultaneously. A priority encoder converts the thermometer code to binary.

  • Fastest: 1 clock cycle per conversion
  • Hardware cost grows exponentially with bit depth
  • Used in oscilloscopes and high-speed RF sampling

Counter-Ramp ADC

A counter starts at 0 and increments each clock cycle. Its value feeds an internal DAC, producing a staircase voltage. A comparator checks the staircase against VinV_{in} each cycle. When the staircase exceeds VinV_{in}, the counter is latched as output.

Tconv=D×TclkT_{conv} = D \times T_{clk}

Here:

  • DD: steps to reach VinV_{in}
  • TclkT_{clk}: clock period

Conversion time varies with VinV_{in}. Full-scale requires up to 2n12^n - 1 cycles.

  • Simplest serial design: 1 comparator, 1 counter, 1 DAC
  • Slower than SAR for most inputs
  • Used in low-cost, low-speed applications

Tracking ADC

A counter-ramp variant. Replaces the reset counter with an up/down counter that continuously follows VinV_{in}.

Per clock cycle:

  • Counter increments if DAC output is below VinV_{in}
  • Counter decrements if DAC output is above VinV_{in}

The counter never resets. Output is always the current counter value.

  • No start-conversion trigger needed
  • Fast for slowly changing inputs
    Steps ±1\pm 1 per cycle to maintain lock.
  • Slow for large step changes
    Must slew ±1\pm 1 per cycle. Worst case: 2n2^n cycles.
  • Unsuitable for multiplexed inputs switching between unrelated voltages

Successive Approximation Register ADC

1 comparator, 1 internal DAC, and an nn-bit SAR register. Resolves 1 bit per cycle via binary search, MSB to LSB.

Sequence for bit kk (starting at k=n1k = n-1):

  1. Set bit kk to 1 in the SAR register.
  2. Feed the SAR value to the DAC to produce a trial voltage.
  3. Compare DAC output to VinV_{in}.
  4. If VinVDACV_{in} \geq V_{DAC}: keep bit kk at 1. If Vin<VDACV_{in} < V_{DAC}: clear bit kk to 0.
  5. Move to bit k1k-1 and repeat.

After nn cycles the SAR register holds the final output.

  • Exactly nn cycles regardless of VinV_{in}
  • 1 comparator, 1 DAC, 1 shift register
  • Most common in MCUs (ATmega, STM32, ESP32 all use SAR)

Dual-Slope ADC

2-phase operation:

  1. Integrate VinV_{in} for fixed period T1T_1, charging a capacitor.
  2. Discharge with fixed Vref-V_{ref}. Measure time T2T_2 to reach zero.
Vin=Vref×T2T1V_{in} = V_{ref} \times \frac{T_2}{T_1}

Result depends only on the ratio of times, not component tolerances. Noise averages out over T1T_1.

  • Very high accuracy and noise rejection
  • Slow: conversion takes milliseconds
  • Used in digital multimeters and precision instrumentation

Sigma-Delta ADC

Oversamples far above the Nyquist rate, applies noise shaping, then decimation-filters to a high-resolution output.

  • Resolution up to 24 bits
  • Slow: latency proportional to oversampling ratio
  • Used in audio codecs and precision sensors

Comparison

ADC TypeResolution (bits)SpeedCost
Flash4–12Very fastHigh
Successive Approximation8–16Medium–fastLow
Dual-Slope12–18SlowMedium
Sigma-Delta12–24SlowLow

Implementation in MCUs

MCUs expose multiple analog pins but contain only 1 ADC. An analog MUX connects exactly 1 pin to the ADC at a time. The MUX channel is set in software before each conversion.

Analog pins
  A0 ─┐
  A1 ─┤
  A2 ─┼─── MUX ─── Sample & Hold ─── ADC ─── Digital output
  A3 ─┤
  A4 ─┘

A sample-and-hold captures the pin voltage at conversion start and holds it constant for the full duration.

1 ADC is shared across all channels to minimize silicon area. An ADC contains a comparator, an internal DAC, control logic, and reference circuitry. Duplicating it per pin multiplies cost proportionally. A MUX adds only a few transistors per channel.

Was this helpful?