Electronics & Circuits · Study deck

Sampling and Aliasing: Nyquist and Filters

A sensor can report a slow false wave when it samples a fast real signal.

Voltage Vera is your guide for this deck.

analogdigitalnyquist
Voltage Vera, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Apply Nyquist Theorem: Calculate minimum sampling rates for different signals
  • Diagnose Aliasing: Explain why undersampling causes incorrect frequency representation and predict aliased frequencies
  • Design Anti-Aliasing Filters: Specify hardware low-pass filter parameters to prevent high-frequency contamination before ADC
  • Evaluate Sampling-Power Trade-offs: Select optimal sampling rates that satisfy Nyquist while minimizing energy consumption in battery-powered IoT devices
iotclass.org

Major section

Start Simple

Nyquist sampling is the rule that prevents a changing signal from pretending to be something else.

  • The stored trace may be neat and still be false.
  • Sampling rate means how many measurements are taken each second.
  • The deeper sections develop aliasing, limits, filtering, oversampling, and reconstruction.
iotclass.org

Major section

Nyquist-Shannon Sampling Theorem

Sampling means taking readings from a changing signal.

  • If the readings are too far apart, a fast real wave can look like a slow false one; that error is aliasing.
  • Sampling rate is the number of readings each second.
  • The first design question is simple: what is the fastest part of the signal you must preserve.

Why it matters

An input filter reduces fast parts that the chosen rate cannot represent.

iotclass.org

Major section

Phoebe's Field Notes: Why Aliases Fold Back

The mathematical gist: Sampling at fsf_sfs​ gives a Nyquist ceiling fs/2f_s/2fs​/2.

  • The chapter’s 800 Hz harmonic sampled at 1000 Hz appears at 200 Hz, while 2500 Hz leaves a 250 Hz gap above the named 1 kHz precursor.

Let Eddie connect sample rate, Nyquist ceiling, and alias folding.

iotclass.org

Major section

Deep dive: Putting Numbers to It

For audio sampling human voice (max frequency fmax=3400f_{max} = 3400fmax​=3400 Hz), Nyquist requires fsample≥2×3400=6800f_{sample} \geq 2 \times 3400 = 6800fsample​≥2×3400=6800 Hz minimum.

  • Telephony uses 8 kHz (18% margin).
  • That reading provides the evidence needed for the section’s next calculation, comparison, or field check.
  • Following those roles reveals how sample rate changes the reconstructed signal.

Key terms

Bare Nyquist
Bare Nyquist is the mathematical minimum, but real devices usually need extra margin for noise, timing uncertainty, and anti-aliasing filter roll-off.
Nyquist-Shannon sampling theorem summary
Nyquist-Shannon sampling theorem summary
iotclass.org

Major section

Deep dive: Putting Numbers to It (continued)

The theorem has direct implications for how we choose sampling rates in practice.

  • Bare Nyquist is the mathematical minimum, but real devices usually need extra margin for noise, timing uncertainty, and anti-aliasing filter roll-off.
  • It turns how sample rate changes the reconstructed signal from a verbal claim into labelled evidence.
  • Undersampling (too slow) causes aliasing - high frequencies appear as low frequencies!
How sample rate changes the reconstructed signal
How sample rate changes the reconstructed signal
iotclass.org

Major section

Sampling Tradeoffs for Vibration

Option A: 500 Hz Sampling (FAILS).

  • Sampling at 500 Hz = exactly at signal frequency → aliasing occurs!
  • Aliasing: Nyquist frequency is only 250 Hz, so the 500 Hz component folds back to |500: 500| = 0 Hz (DC) or nearby low frequencies depending on phase.
  • But: Real motors have frequency components >500 Hz (harmonics, noise).
Aliasing in a real sampling scenario
Aliasing in a real sampling scenario
iotclass.org

Major section

Sampling Rate vs Power

At 32 bits per sample, 86.4 million samples/day require about 346 MB/day.

  • Option B: Low-frequency sampling (1 Hz): Adequate for slow environmental signals (temperature, humidity), power draw ~0.005mW with sleep between samples, generates 86,400 samples/day, requires 345 kB/day storage.
  • Decision Factors: For battery-powered environmental sensors where signals change over minutes or hours, 1 Hz sampling can reduce sampling work while preserving relevant variation; battery-life gain depends on the full power budget.
  • For vibration analysis, motor monitoring, or audio capture, 1000+ Hz is mandatory to avoid aliasing.
iotclass.org

Major section

Anti-Aliasing Filter Strategies

Problem: Real-world signals have infinite frequency components (noise, harmonics).

  • Attenuates 50 Hz by only about 10.4 dB before 100 Hz sampling; stronger rejection is needed if a 50 Hz component must not alias.
  • Specify the required stopband attenuation from the out-of-band signal level and allowed error; f_cutoff = f_sample / 4 is only a starting point.
  • Setting fcutoff=fsample/4f_{cutoff} = f_{sample}/4fcutoff​=fsample​/4 creates transition bandwidth, but filter order and out-of-band signal levels still determine whether attenuation at and above fsample/2f_{sample}/2fsample​/2 is adequate.
iotclass.org

Deck summary

Key takeaways

Nyquist sampling is the rule that prevents a changing signal from pretending to be something else.

  • Sampling means taking readings from a changing signal.
  • The mathematical gist: Sampling at fsf_sfs​ gives a Nyquist ceiling fs/2f_s/2fs​/2.
  • For audio sampling human voice (max frequency fmax=3400f_{max} = 3400fmax​=3400 Hz), Nyquist requires fsample≥2×3400=6800f_{sample} \geq 2 \times 3400 = 6800fsample​≥2×3400=6800 Hz minimum.
  • The theorem has direct implications for how we choose sampling rates in practice.
iotclass.org

Retrieval practice

Recall check 1 of 2

Voltage Vera says: answer from memory, then check your reasoning.

Q1You need to sample a 500 Hz signal. What is the minimum sampling rate according to Nyquist?

A250 Hz
B1000 Hz
C500 Hz
D2000 Hz
Show answer

Answer: B The Nyquist theorem requires f_sample >= 2 x f_max = 2 x 500 Hz = 1000 Hz.

iotclass.org

Retrieval practice

Recall check 2 of 2

Voltage Vera says: answer from memory, then check your reasoning.

Q2An ADC samples at eight kilohertz and the wanted signal ends at one kilohertz. Which anti-alias filter plan is reviewable?

APut a 2 kHz filter only after the DAC, leaving ADC input unprotected.
BUse a 5 kHz pre-ADC cutoff because it removes energy that would alias below the 4 kHz Nyquist boundary.
CPlace an analog low-pass before ADC near 2 kHz; verify attenuation at 4 kHz.
DPut a 2 kHz filter only in firmware after aliasing has occurred.
Show answer

Answer: C A pre-ADC filter needs transition room and measured stopband proof.

iotclass.org

Print reference

Answers

Answer key.

  1. B · The Nyquist theorem requires f_sample >= 2 x f_max = 2 x 500 Hz = 1000 Hz.
  2. C · A pre-ADC filter needs transition room and measured stopband proof.
iotclass.org