Instiq
Chapter 4 · Hardware & interfaces·v1.0.0·Updated 7/10/2026·~16 min

What's changed: Initial version

4.3AD/DA conversion

Key points

Covers the resolution and quantization error of AD conversion, which turns an analog signal into a digital value; the sampling theorem (Nyquist theorem) and aliasing, which describe the conditions under which the original signal can be reconstructed correctly; and the low-pass filter (LPF), which removes high-frequency components, building judgment for AD/DA selection in practice.

For an embedded device to process a sensor's continuous analog signal, it must always pass through a conversion to a digital value (AD conversion). Here the designer must work backward from the frequency content of the signal to be measured and the required precision to decide two numbers: "how many bits should the AD converter have?" and "at what frequency should it sample?" This section builds the judgment needed to decide how to select AD/DA converter specifications in practice, grounded in three pieces of theory: resolution, quantization error, and the sampling theorem.

4.3.1Resolution and quantization error

  • Resolution indicates how many discrete digital levels an AD converter can use to represent its input voltage range, and is normally expressed in bits. n-bit resolution means 2^n levels; for example, 10 bits divides the range into 2^10 = 1024 levels, and 12 bits into 2^12 = 4096 levels. As the bit count increases, the voltage width per level becomes finer, allowing a more precise representation of the analog value.
  • Quantization error is the error that inevitably arises when a continuous analog value is rounded into a discrete level. If the input voltage range is V and the resolution is n bits, the voltage width per level (one LSB) is V / 2^n, and the theoretical maximum quantization error is half that (±1/2 LSB). There is a tradeoff: raising the resolution reduces quantization error, but increases the bit count, conversion time, and cost required.

4.3.2The sampling theorem (Nyquist) and aliasing

  • The sampling theorem (Nyquist theorem) states that if fmax is the highest frequency component present in the original signal, then setting the sampling frequency fs such that fs > 2 x fmax (strictly greater than twice fmax) allows the original signal to be reconstructed in theory perfectly from the samples. This minimum required sampling rate 2 x fmax is called the Nyquist rate; in contrast, half the sampling frequency fs/2 is the Nyquist frequency, above which input components cause aliasing. Note carefully: it is not that "twice is enough"—it must exceed twice (there exist conditions under which sampling at exactly twice fails to reconstruct the signal).
  • Aliasing (foldover noise) is the phenomenon in which, when sampling fails to satisfy the sampling theorem's condition (fs > 2 x fmax), high-frequency components appear as different, lower-frequency components than they actually are. Once it occurs, it cannot be removed afterward by digital signal processing (the information is already lost at the moment of sampling), so the key countermeasure is to insert an analog low-pass filter (LPF) (an anti-aliasing filter) before the AD conversion stage, removing high-frequency components above fmax in advance.
Exam point

Most-tested: "n-bit resolution = 2^n levels, quantization error is ±1/2 LSB = V / 2^(n+1)", "the sampling theorem = fs > 2 x fmax (equality is not sufficient)", and "the countermeasure for aliasing = an analog LPF before AD conversion (it cannot be removed afterward)". Watch for the common misconception that "the sampling frequency only needs to equal the Nyquist rate (2 x fmax)."

4.3.3Practical AD/DA selection and LPF design

  • Practical AD converter selection is the work of choosing a bit count and sampling frequency that simultaneously satisfy three things: the highest frequency component in the signal being measured (fmax), the required voltage resolution, and the CPU load/power budget available for sampling processing. Over-specifying (an excessively high resolution or sampling frequency) wastes cost, power, and processing load, so choosing the minimum performance that satisfies the requirements is a basic principle of embedded design.
  • DA conversion (digital to analog) is the reverse conversion: after turning a digital value into a stepped voltage, an LPF (smoothing filter) smooths out the staircase-shaped waveform to approximate the original signal. The LPF after DA conversion serves a different purpose from "the anti-aliasing filter before AD conversion"—it removes the staircase-shaped noise (harmonic components) introduced by quantization to reconstruct a smooth analog waveform.

Suppose an embedded engineer is assigned the AD-conversion design for an accelerometer that detects motor vibration. Analyzing the target first reveals that the highest frequency component of the vibration to be detected is 500 Hz, and higher frequencies above that can be ignored as noise. From the sampling theorem, the sampling frequency fs must satisfy fs > 2 x 500 Hz = 1000 Hz, so, allowing margin, the engineer sets the sampling frequency to 1.2 kHz (exactly 1000 Hz is the theoretical boundary, and because a real ADC has jitter and non-ideal filter characteristics, a setting clearly exceeding twice the frequency is safer). Next, considering resolution, since the requirement is to capture even minute changes in vibration, the engineer judges that 10 bits (1024 levels) is too coarse and adopts 12 bits (4096 levels); if the input voltage range is 3.3 V, the theoretical quantization error shrinks to roughly ±(3.3 V / 2^12) / 2 ≈ ±0.4 mV. There is one design mistake that must not be overlooked here—even with the sampling frequency set to 1.2 kHz, if the sensor's output signal itself contains high-frequency noise above 500 Hz, converting it directly causes aliasing, which appears as spurious low-frequency components in the band below 500 Hz. The engineer initially thought "as long as the sampling frequency satisfies the sampling theorem, that is enough," but then realized that without adding an analog LPF (anti-aliasing filter) with a cutoff frequency around 500 Hz immediately before the AD converter, high-frequency noise folds back and contaminates the measurement data, and revised the design accordingly. Because aliasing, once it occurs, cannot be removed by digital signal processing afterward, the core judgment of this section is that a countermeasure at the analog stage before AD conversion is indispensable.

ItemDefinitionDesign implication
Resolution n bitsRepresents the input range in 2^n levelsMore bits raise cost/processing time, reduce error
Quantization errorMax ±1/2 LSB (LSB = V / 2^n)Work backward from required precision to set resolution
Sampling theoremReconstructable if fs > 2 x fmaxEquality is insufficient; set with margin
Aliasing countermeasureAnalog LPF before AD conversionCannot be removed by digital processing afterward
Warning

Trap: "setting the sampling frequency to exactly twice the highest frequency component satisfies the sampling theorem's condition" is wrong—the sampling theorem requires fs > 2 x fmax (strictly exceeding twice), and exactly twice is a boundary condition that is insufficient in practice. Also wrong: "even if aliasing occurs, it can be removed afterward with a digital filter"—because the information is already lost at the moment of sampling, the countermeasure must always be an analog LPF before AD conversion.

Resolution/sampling/quantization.
Bridging analog & digital

4.3.4Section summary

  • Resolution of n bits gives 2^n levels; quantization error is at most ±1/2 LSB (LSB = V / 2^n)—a tradeoff between precision and cost
  • The sampling theorem requires fs > 2 x fmax (equality is insufficient)—failing to satisfy it causes aliasing, making reconstruction impossible
  • The countermeasure for aliasing is an analog LPF (anti-aliasing filter) before AD conversion—it cannot be removed by digital processing afterward

Sign in to track progress — Log in.

Quick check

(just a quick review)

Q1. Given that the highest frequency component a vibration sensor needs to detect is 500 Hz, which sampling frequency setting most appropriately satisfies the sampling theorem?

Q2. In an AD conversion design, the sampling frequency was set correctly to satisfy the sampling theorem, but the sensor's output signal itself contained noise at a higher frequency than assumed. Which is the most accurate description of the result of performing AD conversion in this state?

Q3. Which is the most accurate description of the effect of changing an AD converter from 10-bit to 12-bit resolution, with an input voltage range of 3.3 V?

Check your understandingPractice questions for Chapter 4: Hardware & interfaces

Keep track of your progress

The full study guide is free to read. Sign up free to practice with the question bank, track what you have read, review your mistakes, and highlight passages.