notesonly.in

One notebook for every subject — open it anywhere.

Log in

ADC and DAC Basics: How Analog Meets Digital Explained

The real world is analog: temperature, sound, and light vary smoothly. Computers only understand digital ones and zeros. An ADC (analog-to-digital converter) turns a smooth voltage into a digital number, and a DAC (digital-to-analog converter) turns numbers back into smooth voltages.

Every digital thermometer, microphone input, and music player depends on these converters. Microcontroller ADCs read sensors, while DACs drive speakers and motor controllers. Sampling, resolution, and quantization explain both the magic and the limits of digital measurement and sound.

Key Concepts

  • Sampling: measuring the signal at regular instants; the sampling rate fs is samples per second.
  • Nyquist theorem: fs ≥ 2fmax, at least twice the highest signal frequency, to capture it faithfully.
  • Aliasing: sampling too slowly folds high frequencies down as fake low frequencies, corrupting the data permanently.
  • Quantization: rounding each sample to one of 2n levels for n bits.
  • Resolution: the smallest detectable voltage change, one LSB.
  • Quantization error: the rounding error, always within ±½ LSB.
  • Flash ADC: 2n − 1 comparators convert in one step; extremely fast, used in oscilloscopes.
  • SAR ADC: successive approximation, a binary search in n steps; the balanced choice inside most microcontrollers.
  • R-2R ladder DAC: a resistor network using only two values that converts codes to proportional voltages.

Formulas

  • Step size: VLSB = Vref / 2n volts.
  • Error bound: ±Vref / 2n+1, i.e. ±½ LSB.
  • Code: round(Vin / VLSB), from 0 to 2n − 1.
  • Nyquist: fs ≥ 2 × fmax; CDs use 44.1 kHz since hearing tops near 20 kHz.

Worked Example

An 8-bit ADC with Vref = 5 V measures 2.0 V. Find the step size, output code, and error.

  1. VLSB = 5/256 = 0.01953 V (19.5 mV per step).
  2. Code = 2.0/0.01953 = 102.4, rounds to 102 = 011001102. It represents 102 × 0.01953 = 1.992 V.
  3. Error = 2.0 − 1.992 = 8 mV, within ±½ LSB (±9.77 mV). A 10-bit ADC would shrink steps to 4.88 mV.

Common Misconceptions

  • More bits always sound better. Beyond 16 bits the noise is already below hearing and room noise; extra bits help instruments, not ears.
  • Faster sampling alone fixes aliasing. An anti-aliasing low-pass filter before the ADC is still mandatory.
  • DAC output is perfectly smooth. A basic DAC makes a staircase; a reconstruction filter smooths it into a continuous wave.

Real-World Applications

  • Microphone inputs and audio recorders use ADCs; headphones are driven through DACs.
  • Multimeters and temperature loggers measure the world with ADCs.
  • Digital oscilloscopes capture fast waveforms with gigasample flash ADCs.
  • Motor controllers and function generators produce control voltages with DACs or PWM.

To recap: the ADC samples and quantizes with step Vref/2n, Nyquist demands twice the top frequency, and the DAC rebuilds voltages from codes. Resolution sets fineness, sampling sets the speed limit, and together they let digital systems touch the analog world.