Skip to content

Filters and Frequency Response

Filters and Frequency Response hero image
Modified:
Published:

Every real-world signal contains noise. The temperature reading from a thermistor has 50/60 Hz mains hum. The audio signal from a microphone has ultrasonic components that alias when sampled. The power supply rail has high-frequency switching noise. Filters let you keep the signal you want and reject everything else. This lesson teaches you to design, build, and analyze passive RC filters for the frequencies that matter in embedded systems. #AnalogElectronics #Filters #FrequencyResponse

What Is a Filter?

A filter is a circuit that selectively passes signals at certain frequencies while attenuating (reducing) signals at other frequencies. The four basic filter types are:

Low-Pass Filter

Passes low frequencies, attenuates high frequencies. Used for smoothing, noise removal, and anti-aliasing before ADC inputs.

High-Pass Filter

Passes high frequencies, attenuates low frequencies. Used for removing DC offset, AC coupling, and blocking slow drift from sensor signals.

Band-Pass Filter

Passes a range of frequencies, attenuates everything above and below. Used for selecting a specific signal frequency from a noisy environment.

Band-Stop (Notch) Filter

Rejects a specific frequency range and passes everything else. Used for removing 50/60 Hz mains hum from sensitive measurements.

The RC Low-Pass Filter



The simplest and most commonly used filter in embedded electronics is the RC low-pass filter. You already encountered this in Lesson 2 when studying RC circuits.

Circuit

A resistor in series, followed by a capacitor to ground:

[R] 10K
Vin o---/\/\/---+---o Vout
|
[C] 15nF
|
GND
Low freq: C is open, Vout = Vin
High freq: C is short, Vout = 0
fc = 1/(2*pi*10K*15nF) = 1061 Hz

Cutoff Frequency

The cutoff frequency (also called the -3 dB frequency or corner frequency) is:

At the cutoff frequency, the output signal is attenuated to of the input (a 3 dB reduction in power).

Transfer Function

The ratio of output to input voltage as a function of frequency:

Frequency relative to Output/Input ratiodB
0.995-0.04 dB
0.707-3 dB
0.447-7 dB
0.0995-20 dB
0.01-40 dB

Roll-Off Rate

A first-order RC filter has a roll-off of -20 dB per decade (a factor of 10 in frequency). This means that for every 10x increase in frequency above , the output drops by a factor of 10. This is a gentle slope. For sharper filtering, you need higher-order filters or active filters.

Bode Plots



A Bode plot is a graph that shows a filter’s frequency response. It has two parts:

  1. Magnitude plot: Output amplitude (in dB) vs frequency (log scale)
  2. Phase plot: Phase shift (in degrees) vs frequency (log scale)

Reading a Bode Plot

For a first-order RC low-pass filter:

Magnitude:

  • Flat at 0 dB for frequencies well below
  • Drops by 3 dB at
  • Falls at -20 dB/decade for frequencies above

Phase:

  • Starts at 0 degrees at very low frequencies
  • Reaches -45 degrees at
  • Approaches -90 degrees at very high frequencies

Decibels Quick Reference

Decibels (dB) express the ratio of two power or amplitude levels on a logarithmic scale:

Voltage RatiodB
1.0 (no change)0 dB
0.707-3 dB
0.5-6 dB
0.316-10 dB
0.1-20 dB
0.01-40 dB
2.0+6 dB
10.0+20 dB

The RC High-Pass Filter



Swap the resistor and capacitor positions to get a high-pass filter:

[C] 15nF
Vin o---||------+---o Vout
|
[R] 10K
|
GND
Low freq: C is open, Vout = 0
High freq: C is short, Vout = Vin
fc = 1/(2*pi*10K*15nF) = 1061 Hz

Cutoff Frequency

Same formula as the low-pass:

But the behavior is opposite: frequencies below are attenuated, and frequencies above pass through.

Transfer Function

Common Uses

  • AC coupling: Removing the DC component from a signal so you can amplify only the AC part. This is how oscilloscope “AC coupling” mode works.
  • Removing sensor drift: A temperature sensor that drifts slowly can have its drift removed with a high-pass filter while preserving fast transient responses.
  • Audio: Blocking DC offset before a speaker to prevent cone displacement.

Band-Pass Filter



A band-pass filter combines a high-pass and a low-pass filter in series. It passes frequencies between a lower cutoff () and an upper cutoff ():

V_in ── C_HP ──┬── R_HP ──── R_LP ──┬── V_out
│ │
GND C_LP
GND

The bandwidth is the difference between the two cutoff frequencies:

The center frequency is:

Design Approach

Design the high-pass section first (to set ), then the low-pass section (to set ). The two sections should not load each other significantly. A rule of thumb: make the low-pass resistor at least 10 times larger than the high-pass resistor.

Worked Example: Audio Band-Pass

To pass audio frequencies from 100 Hz to 10 kHz:

High-pass section (): Choose :

Low-pass section (): Choose (10x the high-pass R to minimize loading):

Anti-Aliasing Filters



The Aliasing Problem

When an ADC samples a signal, it can only correctly represent frequencies below half the sampling rate (the Nyquist frequency):

If the input signal contains frequencies above , those frequencies “fold” back into the lower frequency range, creating phantom signals (aliases) that are indistinguishable from real signals.

Example: An ADC sampling at 1 kHz has . A 700 Hz noise signal in the input will appear as a 300 Hz alias in the sampled data (). No amount of digital filtering can remove this alias because it looks identical to a real 300 Hz signal.

The Solution: Anti-Aliasing Filter

Place a low-pass filter before the ADC input with a cutoff frequency at or below the Nyquist frequency. This attenuates frequencies above before they reach the ADC.

For a 1 kHz sampling rate, set to about 500 Hz or slightly below:

Choose and :

Close enough to 500 Hz. This single-pole filter provides -20 dB/decade roll-off. At the Nyquist frequency (500 Hz), the signal is attenuated by about 3 dB. At 1 kHz, it is attenuated by about 7 dB. For many applications, this is sufficient. For higher performance, use a two-stage RC filter (-40 dB/decade) or an active filter.

Second-Order Filters



A second-order filter uses two RC stages in series, providing -40 dB/decade roll-off (twice as steep as first-order):

[R1] 3.3K [R2] 33K
Vin o-/\/\/--+---o-/\/\/--+---o Vout
| |
[C1] 100nF [C2] 10nF
| |
GND GND
Stage 1 Stage 2
R2 >> R1 to reduce loading
Roll-off: -40 dB/decade

The cutoff frequency of the cascade is not simply the individual cutoff frequency. Due to loading between stages, the effective cutoff is lower:

For accurate second-order filter design, use a Sallen-Key active filter topology (which uses an op-amp and provides precise control over the response shape). But for quick prototyping, two cascaded RC stages with the second R being 10x the first (to reduce loading) works adequately.

Butterworth vs Chebyshev

When you design active filters, you can choose the response shape:

TypeCharacteristicPassbandTransition
ButterworthMaximally flat passbandNo rippleModerate steepness
ChebyshevRipple in passbandSome rippleSteeper transition
BesselMaximally flat group delayNo rippleGentle transition

For most embedded ADC applications, Butterworth is the standard choice because the flat passband means no signal distortion in the frequency range of interest.

Component Selection for Filters



Resistor Tolerance

For filters, use 1% metal film resistors when possible. The cutoff frequency depends directly on the resistor value, so a 5% tolerance resistor creates a 5% uncertainty in . For audio or measurement applications, this matters.

Capacitor Selection

  • C0G/NP0 ceramic: Best stability, lowest distortion. Ideal for filter circuits. Available up to about 10 nF.
  • X7R ceramic: Good stability, available in larger values. Acceptable for most filters.
  • X5R/Y5V ceramic: Capacitance varies significantly with voltage and temperature. Avoid for filter circuits.
  • Film capacitors: Excellent for audio filters. Stable and low-distortion.

Source Impedance Consideration

The filter’s input source must have a low impedance compared to the filter resistor. If the source impedance is comparable to R, it shifts the cutoff frequency. Solution: buffer the source with an op-amp voltage follower (Lesson 5) before the filter.

Practical Build: RC Low-Pass Filter



Components Needed

ComponentQuantityNotes
Breadboard1From previous lessons
Resistors: 1k, 3.3k, 10k, 33k, 100k ohm1 each1% preferred
Capacitors: 100 pF, 1 nF, 10 nF, 100 nF, 1 1 eachCeramic C0G or X7R
Function generator (or MCU generating a square wave)1For frequency sweep
Oscilloscope (or MCU with ADC for slow signals)1For measuring output
Digital multimeter1AC voltage mode
Passive buzzer1For audio demonstration
LED + 220 ohm resistor1For low-frequency visual indicator
Jumper wiresSeveralMale-to-male

Circuit: Audio Low-Pass Filter

  1. Choose component values For a 1 kHz cutoff: , . If you do not have 15 nF, use 10 nF () or two 10 nF in series plus a 10 nF in parallel for approximately 15 nF. Alternatively, use and for .

  2. Build the filter Connect the resistor from the input to the output node. Connect the capacitor from the output node to ground.

  3. Connect a signal source If you have a function generator, set it to produce a sine wave at 100 Hz, 1V amplitude. If you are using an MCU, generate a PWM signal and vary the frequency.

  4. Measure the output at several frequencies Sweep the input frequency and measure the output amplitude at each point:

    • 10 Hz, 50 Hz, 100 Hz, 200 Hz, 500 Hz, 1 kHz, 2 kHz, 5 kHz, 10 kHz, 20 kHz
  5. Record the results Calculate at each frequency. Below , the ratio should be close to 1. At , it should be about 0.707. Above , it drops progressively.

  6. Plot the response Plot your measurements on a graph with frequency (log scale) on the horizontal axis and (or dB) on the vertical axis. You have just made your own Bode plot.

Alternative: No Function Generator

If you do not have a function generator or oscilloscope, you can still demonstrate filtering:

  1. Use an MCU to generate PWM Program an Arduino or STM32 to generate a square wave at a specific frequency on a GPIO pin.

  2. Build the RC filter Connect the filter between the GPIO pin and an ADC input on the same or different MCU.

  3. Read the ADC at different PWM frequencies At low frequencies, the ADC will read a signal that toggles between high and low. At high frequencies (well above ), the ADC reads a nearly constant voltage (the average of the square wave, about ).

  4. Listen to the difference Connect a passive buzzer after the filter. Generate a square wave at 2 kHz (a clear tone). Now put it through the 1 kHz low-pass filter. The buzzer tone becomes muffled because the harmonics that give the square wave its sharp edges are attenuated.

Measurement Table

Frequency (Hz)Predicted Measured Predicted dBMeasured dB
101.000________0.0________
1000.995________-0.04________
5000.905________-0.87________
1000 ()0.707________-3.0________
20000.447________-7.0________
50000.196________-14.2________
100000.0995________-20.0________

Common Mistakes



Watch Out For These

  • Forgetting the anti-aliasing filter: Sampling without filtering can produce aliased signals that look real but are artifacts. Always filter before the ADC.
  • Using the wrong capacitor type: X5R and Y5V ceramic capacitors change value with applied voltage and temperature. Use C0G/NP0 or film capacitors for filter circuits.
  • Ignoring source impedance: A high-impedance source shifts the filter’s cutoff frequency. Buffer the source if needed.
  • Single-pole filter for demanding applications: A first-order RC filter only gives -20 dB/decade. For strong noise rejection, you need second-order (-40 dB/decade) or higher-order active filters.
  • Filter output driving a low-impedance load: If the load impedance is comparable to the filter’s output impedance, the load changes the filter response. Buffer the filter output with an op-amp if needed.

How This Connects to Embedded Systems



Filters Are Everywhere in MCU Design

  • Anti-aliasing before ADC: The STM32 ADC can sample at up to 2.4 Msps. Without an anti-aliasing filter, any noise above the Nyquist frequency folds into the measurement. A simple RC filter on the ADC input pin solves this.
  • Debouncing: A low-pass RC filter on a button input removes high-frequency contact bounce. Combined with Schmitt trigger input (which most MCU GPIO pins have), this gives clean digital transitions.
  • Audio processing: If your MCU processes audio (voice recognition, tone detection), you need band-pass filtering to isolate the frequency range of interest.
  • PWM to analog conversion: A low-pass filter converts a PWM signal into a smooth analog voltage. This is a poor man’s DAC. The cutoff frequency must be well below the PWM frequency for clean output.
  • EMC compliance: On production PCBs, filters on power inputs and signal lines help meet electromagnetic compatibility requirements by reducing conducted and radiated emissions.
  • Sensor noise reduction: Averaging ADC samples in software is a digital low-pass filter. Combining a hardware RC filter with software averaging provides excellent noise rejection.

Summary



Filter TypeCircuitCutoff FormulaPasses
Low-pass (RC)R series, C to groundFrequencies below
High-pass (RC)C series, R to groundFrequencies above
Band-passHP + LP in cascade to Frequencies between cutoffs
First-order roll-offSingle RC stageN/A-20 dB/decade
Second-order roll-offTwo RC stagesN/A-40 dB/decade
Design ParameterKey Consideration
Anti-aliasing At or below
Component toleranceUse 1% resistors, C0G capacitors for precision
Source impedanceMust be low relative to filter R
Load impedanceMust be high relative to filter output impedance

Next lesson: oscillators and timing circuits. The 555 timer generates precise frequencies using the RC time constants you have been studying, and crystal oscillators provide the stable clock that drives your MCU.

Comments

Loading comments...


© 2021-2026 SiliconWit®. All rights reserved.