BitFlow
← Academy·ADC and DAC: Meeting the Analog World
∿Core~35 min

ADC and DAC: Meeting the Analog World

How digital systems measure and produce real voltages: sampling, aliasing, quantization, and the main converter designs.

Two steps from analog to digital

Sound, temperature and light are all analog, and a processor can only work with numbers. An analog-to-digital converter (ADC) measures a voltage and produces a number. A digital-to-analog converter (DAC) does the reverse. Going from analog to digital takes two separate steps, and each loses something in its own way.

  • Sampling chops time into instants. It decides how fast a signal you can capture.
  • Quantization rounds each sample to a code. It decides how finely you can measure.

Sampling and the Nyquist limit

How often do you need to measure? The Nyquist-Shannon sampling theorem gives the answer: to capture a signal fully, sample at more than twice its highest frequency. If you don't, high frequencies pretend to be low ones, and this is called aliasing.

f_s > 2 × f_max
Half the sampling rate is called the Nyquist frequency.

Loading the animation…

TipYou've seen aliasing in films, when a turning wheel appears to spin backwards. The camera is sampling too slowly.

Once aliased, a signal can't be fixed, so the unwanted frequencies have to be removed before sampling. That's the job of an analog anti-aliasing filter. CD audio samples at 44.1 kHz so that it can capture sound up to about 20 kHz, with room left for the filter.

f_alias = | f − f_s × round(f / f_s) |
Practice

A 7 kHz tone is sampled at 10 kHz. What frequency does it appear to be?

Quantization

An n-bit ADC has 2ⁿ codes. The voltage between neighbouring codes is called the LSB, or the converter's resolution.

1 LSB = V_ref / 2ⁿ
An 8-bit converter on a 5 V range has an LSB of about 19.5 mV.

Loading the animation…

SNR ≈ 6.02 n + 1.76 dB
The best possible signal-to-noise ratio of an ideal n-bit converter, for a full-scale sine wave.
Worked example: Reading a code

A 10-bit ADC with a 3.3 V reference reads 512. What's the input voltage?

  1. 1 LSB = 3.3 / 1024 = 3.22 mV.
  2. 512 × 3.22 mV = 1.65 V.

Answer:About 1.65 V, halfway up the range, as you'd expect from a code halfway up.

Practice

What's the resolution of a 12-bit ADC with a 4.096 V reference?

DACs

A DAC is the simpler direction: each bit contributes a share of the reference voltage in proportion to its weight, and they're all added.

V_out = V_ref × code / 2ⁿ

Loading the animation…

TypeHow it worksTrade-off
Binary-weightedOne resistor per bit, each double the lastSimple, but needs a very wide range of precise resistors
R-2R ladderA network of only two resistor valuesEasy to make accurately, the most common
PWMA digital pulse train, filteredVery cheap, but slow; used by microcontrollers
Try PWM in the Board Lab →A lesson dims an LED by switching it fast, which is a DAC made from one pin.

ADC designs

Measuring is harder than producing, and each design makes a different trade between speed, resolution and cost. The most common is successive approximation, which is a binary search with a DAC inside.

Loading the animation…

TypeConversion timeTypical use
Flash1 clock, using 2ⁿ − 1 comparatorsVery fast, such as oscilloscopes; costly in power and area
SARn clocks, 1 comparatorMicrocontrollers; a good all-rounder
Dual-slopeUp to 2ⁿ⁺¹ clocksDigital multimeters: slow, accurate, rejects noise
Sigma-deltaMany clocks, oversampledAudio and precise sensors
Practice

How many comparators does an 8-bit flash ADC need?

Practice

A SAR ADC has 10 bits and runs at 1 MHz. How long is one conversion?

Exam problemsGATE: fine to skip at first

Beyond resolution, datasheets quote offset error (a constant shift), gain error (a wrong slope), and linearity: how far each step differs from one LSB. A converter is monotonic if its output never falls as the code rises.

Practice · GATE-style

What is the output of a 4-bit DAC with V_ref = 8 V for code 1010?

Practice · GATE-style

What SNR can an ideal 16-bit converter reach?

Practice · GATE-style

How many bits must an ADC have to resolve 1 mV on a 5 V range?

Practice · GATE-style

What's the minimum sampling rate for a signal with components up to 15 kHz?

Was this chapter helpful?