# Anti-Aliasing Filters: Applying Sampling Theory to ADC Design

May 20, 2020 by Robert Keim## This article examines an important aspect of the Nyquist–Shannon sampling theorem and explains its connection to the need for anti-aliasing filters in analog-to-digital conversion.

So far, we've explored the theoretical underpinnings of the Nyquist-Shannon theorem, including the frequency domain effect on sampling. We then touched on how these foundational principles apply in real-life circuit design—specifically, addressing the importance of oversampling in real-life mixed-signal systems.

Throughout the series, the version of the sampling theorem I have used states that perfect reconstruction is possible when the sampling rate is equal to or greater than two times the highest frequency in the original signal—not the frequency of interest, not the dominant frequency, but the *highest* frequency.

This seemingly harmless little detail actually creates a major rift between theoretical sampling and real-life A/D conversion.

### What Is Your Signal’s Highest Frequency?

The first problem with the sampling theorem is that you will never be able to sample at twice the highest frequency: thanks to thermal noise, which has constant power spectral density up into the terahertz range, the bandwidth of every signal far exceeds the capabilities of analog-to-digital converters.

Of course, I’m not suggesting that all signals have a bit of noise at 1 THz and therefore mixed-signal electronics cannot exist. Rather, I’m trying to dramatically demonstrate the impossibility of looking at a signal’s Fourier transform, drawing a vertical line, and declaring that the spectrum is completely empty to the right of that line.

Noise, interference, and the gradual variations characteristic of natural phenomena all contribute to signal spectra that don’t have a readily identifiable highest frequency.

### High-Frequency Components and Aliasing

Why can’t we just ignore those troublesome frequency components? We’re not trying to digitize them, we don’t have any need to analyze or record them—let’s just forget about them and choose the sampling rate according to the frequencies that we want!

I wish it were that simple, but we have to remember that analog input frequencies cause aliasing when they exceed half of the sampling frequency—which, by the way, is sometimes called the **folding frequency**, because components above this frequency fold around the sampling frequency and thus overlap with the original spectrum. We can’t simply ignore components above the folding frequency because they will mingle with the frequencies of interest and thereby eliminate our ability to perfectly reconstruct the original signal.

Consider the following diagram:

Let’s say that the main bell-shaped portion of the spectrum contains the frequencies of interest, and the low-amplitude tail that decays gradually toward zero represents unimportant higher-frequency components.

The sampling rate chosen in this system is adequate for capturing the frequencies of interest, but we can’t ignore the unimportant frequencies because aliasing causes the unimportant frequencies to extend into and distort the portion of the spectrum that we want to accurately reconstruct.

However, this idea of ignoring unimportant frequencies is actually the basis for how we deal with this problem in engineered systems. At the end of the day, we *have* to ignore unwanted high frequencies, because we can’t completely eliminate them. But before we ignore them, we should at least make some effort to mitigate their deleterious effect on the performance of the system.

And this is where the anti-aliasing filter comes into play.

### Filtering before Sampling

Shannon’s sampling theorem specifies the minimum acceptable sampling rate relative to the highest frequency in a signal. Another way to say this is that Shannon is giving us a sampling-rate requirement for *band-limited signals*, i.e., signals whose Fourier transform has an identifiable upper bound.

The signals that we find in physical circuits are not really band-limited, but we are determined to sample them anyway, and consequently, we will try to *make* them band-limited. This is the purpose of an anti-aliasing filter.

By passing the signal through a low-pass filter before sampling, we can attenuate spectral content above a specified frequency and thereby create an upper frequency bound.

The signal won’t become perfectly band-limited, since real-life filters don’t create infinite attenuation above the cutoff frequency. It can, however, be close enough to band-limited: aliasing will occur, but its effect on overall system performance will be negligible.

#### How Do We Select the Cutoff Frequency?

This will depend on various factors. The general idea is to preserve the important portion of the spectrum and suppress the unimportant portion. Then, you choose the ADC sampling rate according to how much you want to attenuate the frequency components that will alias into the spectrum of interest.

Let’s say that you are using a first-order RC low-pass filter for your anti-aliasing filter, with a cutoff frequency of 20 kHz. The frequency response looks like this:

If you sample at 100 kHz, the folding frequency is 50 kHz: everything above 50 kHz will contribute to aliasing error. Thus, with this filter, the “aliasing band” will have a minimum attenuation of 9 dB.

Is that enough?

There’s no simple answer to that question, and in any case, the answer depends on system requirements.

Nevertheless, my engineering intuition tells me that we should strive to reduce the amplitude of the aliasing band by at least an order of magnitude. This first-order RC filter gives us 20 dB of attenuation at 200 kHz, so we’ll need to sample at 400 kHz. That’s a fairly high sampling rate in the context of the ADCs that I like to use—i.e., the ones that are conveniently integrated into microcontrollers. Thus, I might have to relax my attenuation requirements, or I could consider using a second-order topology for the anti-aliasing filter.

### Conclusion

As the name implies, anti-aliasing filters reduce the amount of aliasing that occurs when we sample a signal. They do this by suppressing spectral content above the folding frequency, thereby making real-life signals more consistent with the band-limited signals to which Shannon’s sampling theorem applies.

Though you can make the anti-aliasing filter less critical by increasing your sampling rate, I think that it is good practice to always include at least a basic RC filter in your ADC circuits.

5 CommentsRobert – you said:

”. . . . .addressing the importance of oversampling in real-life mixed-signal systems. . . . . .”

If you, personally, choose to remain ignorant of and confused about what “Oversampling” (OS) ACTUALLY is, that’s up to you. But if on the other hand, you come on this site posing as an expert (writing a tutorial), repeating misleading nonsense, even when corrected by others, this is a disservice to your readers.

OS is not NOT simply exceeding 2Fmax by perhaps 2.1 or 5 or 10. Not even close! Rather it is a brilliant ploy to reduce quantization noise, number of bits, and COST by significant factors while maintaining a nominal sampling rate. PLEASE do READ my comments from Part 3, or at least the firsts 5-10 pages (VERY readable) of Hauser:

M. Hauser, “Principles of Oversampling A/D Conversion,” J. Audio Eng. Soc, Vol. 39, No. 1/2, Jan/Feb 1991, pp 3-26:

http://anyflip.com/ybei/apqk/basic

- Bernie