5.5.4Embedded Systems & Real-Time Software

ADC - DAC — resolution, sampling rate, Nyquist

1,717 words8 min readdifficulty · medium1 backlinks

1. Resolution — slicing the amplitude

WHY this formula? Each bit is a yes/no switch. With NN independent binary switches you can count from 00 to 2N12^N - 1. So the full input span VrefV_{ref} is divided into 2N2^N levels separated by 2N12^N - 1 gaps.


2. Sampling rate — slicing time

Figure — ADC - DAC — resolution, sampling rate, Nyquist

3. Nyquist — the speed limit


4. DAC — putting it back


5. Common mistakes


Recall Feynman: explain to a 12-year-old

Imagine drawing a moving wave by dotting your pencil on paper now and then. Resolution = how many height-lines your paper has (more lines = smoother heights). Sampling rate = how often you dot. If a wave wiggles up-and-down fast but you dot too slowly, your dots make a different, slower wave — that's a magic trick called aliasing where the fast wave hides as a slow one. The rule: dot at least twice per wiggle. The DAC is the friend who connects your dots back into a smooth wave.


Flashcards

What does ADC resolution (bits) determine?
The amplitude precision — number of levels 2N2^N and step size LSB =Vref/(2N1)=V_{ref}/(2^N-1).
Formula for LSB of an N-bit ADC?
Vref/(2N1)Vref/2NV_{ref}/(2^N-1)\approx V_{ref}/2^N.
LSB of a 12-bit ADC with 3.3 V ref?
0.806\approx 0.806 mV (3.3/40953.3/4095).
State the Nyquist criterion.
fs>2fmaxf_s > 2 f_{max} to perfectly reconstruct a band-limited signal.
What is the Nyquist frequency?
fs/2f_s/2 — the highest frequency representable at sampling rate fsf_s.
What is aliasing?
High-frequency content above fs/2f_s/2 folds back and masquerades as a lower frequency.
Alias frequency for 1800 Hz sampled at 1000 Hz?
180021000=200|1800-2\cdot1000|=200 Hz.
How do you prevent aliasing?
Anti-aliasing low-pass filter before the ADC (cut-off below fs/2f_s/2).
Why CD uses 44.1 kHz not 40 kHz?
Margin above 2×202\times20 kHz for the anti-alias filter's roll-off.
Ideal SNR of an N-bit ADC?
6.02N+1.766.02N+1.76 dB (≈6 dB per bit).
Why q2/12q^2/12 for quantization noise?
Variance of a uniform distribution of width qq is q2/12q^2/12.
What does a DAC's reconstruction filter do?
Smooths the zero-order-hold staircase, removing spectral images above fs/2f_s/2.
Does adding bits fix aliasing?
No — bits fix amplitude precision; aliasing needs faster fsf_s or a filter.

Connections

  • Quantization Noise & SNR
  • Anti-Aliasing Filters
  • Zero-Order Hold & Reconstruction
  • Fourier Transform & Frequency Domain
  • Fixed-Point vs Floating-Point in Embedded DSP
  • Successive Approximation vs Sigma-Delta ADC
  • Sensor Interfacing on Microcontrollers

Concept Map

sampled by

produces

reversed by

amplitude sliced by

time sliced by

gives 2^N codes

rounding causes

sets limit

constrained by

if violated

defines

Continuous real-world signal

ADC

Discrete number

DAC

Resolution N bits

Sampling rate fs

LSB step Vref/2^N-1

Quantization error

SNR 6.02N+1.76 dB

Nyquist fs greater than 2 fmax

Aliasing

Nyquist freq fs/2

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, real world ka signal continuous hota hai — voltage smoothly upar neeche hota rehta hai. Lekin microcontroller sirf numbers samajhta hai. ADC us continuous voltage ko ek number bana deta hai, aur DAC wapas number se voltage. Do cheezein quality decide karti hain: resolution (kitne bits — yaani amplitude ko kitne fine slices mein kaatte ho) aur sampling rate (time mein kitni baar measure karte ho per second).

Resolution ka funda simple hai: NN bits matlab 2N2^N levels. Step size yaani LSB =Vref/(2N1)=V_{ref}/(2^N-1). Jitne zyada bits, utna chhota step, utni saaf height. 12-bit aur 3.3 V pe LSB ~0.8 mV — isse chhota change ADC dekh hi nahi sakta.

Ab sabse important cheez — Nyquist. Ek sine wave ko theek se capture karne ke liye usko ek period mein kam se kam do baar sample karna padta hai, isiliye rule hai fs>2fmaxf_s > 2 f_{max}. Agar tum slow sample karoge, toh ek fast wave dhokha deti hai — woh ek slow wave jaisi dikhne lagti hai. Isko aliasing kehte hain. Example: 1800 Hz signal ko 1000 Hz pe sample karo toh woh fake 200 Hz ban jaata hai! Fix kya hai? ADC se pehle ek anti-aliasing low-pass filter lagao jo fs/2f_s/2 se upar sab kuch hata de.

Yaad rakhna do galtiyan: (1) zyada bits aliasing fix nahi karte — bits amplitude ke liye hain, aliasing time/frequency ka problem hai. (2) Nyquist exactly 2f2f nahi, strictly zyada chahiye, practically 2.5×2.5\times rakho filter ke liye margin. Mnemonic: "Bits = Height, Rate = Time, Two-times = No Crime."

Go deeper — visual, from zero

Test yourself — Embedded Systems & Real-Time Software

Connections