What is the Nyquist theorem and what is aliasing?
Short answer: The Nyquist–Shannon sampling theorem says a signal must be sampled at more than twice its highest frequency component to be reconstructed without loss. If frequencies above half the sample rate (the Nyquist frequency, f_s/2) are present, they fold back and appear as false lower frequencies — aliasing — which cannot be removed after sampling. That is why an anti-aliasing low-pass filter is placed before the ADC.
Aliasing example: sampling at 1 kHz, a 900 Hz signal appears at |900 − 1000| = 100 Hz. Mains hum (50/60 Hz) harmonics and switching-regulator noise commonly alias into sensor readings this way.
Practical rules
- Sample at 5–10× the highest frequency of interest when possible; this relaxes the anti-aliasing filter (a simple RC filter rolls off slowly: only −20 dB/decade).
- Put the filter's cut-off at or below the band of interest and well below f_s/2.
- Use oversampling + digital filtering + decimation: sample fast with a simple analog filter, then filter and downsample digitally (sigma-delta ADCs do this internally).
- For slow sensors, choose a sampling rate that rejects mains: averaging over exactly 20 ms (50 Hz) or 16.67 ms (60 Hz), or 100 ms for both.
Related: quantisation noise (from finite resolution) is different from aliasing; dithering and oversampling can reduce its effect.