Analog-to-digital conversion

How a voltage becomes a number: resolution, reference voltage, sampling rate and the Nyquist limit.

Foundation

How an ADC turns a voltage into numbers An analog voltage is sampled at regular times and each sample is rounded to one of a fixed set of steps between 0 and the reference voltage. One step, 1 LSB, is Vref divided by 2 to the N; the sampling rate must be more than twice the signal's highest frequency. analog input digital readings sample Not to scale Vref 0 Time 1 LSB One step (1 LSB) = Vref / 2N 12-bit, 3.3 V reference: about 0.8 mV per step Sampling rate more than twice the highest frequency in the signal (Nyquist–Shannon) Effective bits (ENOB) counts noise and distortion; lower than the nominal resolution SAR (successive approximation) The usual ADC built into microcontrollers Delta-sigma Trades speed for high resolution; suits weighing and temperature
An ADC samples the voltage at regular times and rounds each sample to one of 2^N steps between 0 and Vref; each step is Vref / 2^N.

Key points

  1. An N-bit ADC divides its reference voltage into 2^N steps, so one step (1 LSB) is Vref / 2^N: about 0.8 mV for a 12-bit converter with a 3.3 V reference.1
  2. To capture a signal without aliasing, it must be sampled at more than twice its highest frequency component (the Nyquist–Shannon criterion).23
  3. Effective number of bits (ENOB) expresses real-world performance including noise and distortion, and is lower than the nominal resolution.4
  4. The ADCs built into microcontrollers are typically SAR (successive-approximation) converters; delta-sigma converters trade speed for high resolution and suit slow, precise signals such as weighing and temperature.5167

Common mistakes

  • Using a noisy power rail as the ADC reference, then blaming the sensor for the noise.