An electronic filter is a frequency-selective circuit that passes desired signal frequencies while attenuating (blocking) unwanted ones. In a real circuit or installation, a filter changes the amplitude and phase of specific frequency bands—smoothing jagged PWM into clean DC, stripping 60Hz hum from audio, or blocking high-frequency electromagnetic interference (EMI) from entering a power supply. Beginners commonly confuse signal filters (which shape waveforms based on frequency) with power line conditioners or surge protectors (which regulate voltage amplitude or block transients regardless of frequency). To visualize it, think of a bouncer at a club checking IDs: a low-pass filter lets the slow, steady bass frequencies in, but turns away the fast, jittery high-frequency treble.
The Four Core Filter Topologies
Before selecting components, you must identify the frequency behavior your application demands. Every complex filter is ultimately built from one of these four foundational responses.
| Filter Type | Passband | Stopband | Common Use Case | Typical Components |
|---|---|---|---|---|
| Low-Pass (LPF) | DC to Cutoff ($f_c$) | Above $f_c$ | PWM smoothing, anti-aliasing before ADCs | Series R/L, Shunt C |
| High-Pass (HPF) | Above $f_c$ | DC to Cutoff ($f_c$) | AC coupling, blocking DC offset in audio | Series C, Shunt R/L |
| Band-Pass (BPF) | Between $f_L$ and $f_H$ | Below $f_L$, Above $f_H$ | Radio tuning, isolating specific sensor tones | Series LC, or cascaded LPF/HPF |
| Band-Stop (Notch) | Below $f_L$, Above $f_H$ | Between $f_L$ and $f_H$ | Removing 50/60Hz mains hum from audio | Parallel LC in series path, or active twin-T |
The fundamental cutoff frequency for a basic first-order RC filter is calculated as: $f_c = \frac{1}{2\pi RC}$
Worked Numeric Example: Sizing an RC Low-Pass Filter
Let’s say you are using an ESP32 to generate a 20 kHz PWM signal to emulate an analog voltage for a motor controller’s 0-5V input. The motor controller expects a smooth DC voltage, but the raw PWM is a harsh 5V square wave switching at 20,000 times per second. We need a low-pass filter to strip the 20 kHz switching fundamental and leave only the DC average.
Step 1: Define the target cutoff frequency ($f_c$).
A standard rule of thumb is to place the cutoff frequency at least one decade (10x) below the noise frequency to achieve significant attenuation. For a 20 kHz PWM signal, we will target an $f_c$ of 2,000 Hz (2 kHz).
Step 2: Choose a standard capacitor value.
Capacitors come in fewer standard values than resistors. Let’s select a 100 nF (0.1 µF) ceramic capacitor, which is a ubiquitous, cheap, and physically small X7R component.
Step 3: Calculate the required resistance.
Rearranging the cutoff formula to solve for R:
$R = \frac{1}{2 \pi \times f_c \times C}$
$R = \frac{1}{2 \pi \times 2000 \times 100 \times 10^{-9}}$
$R = \frac{1}{0.001256} \approx 796 \Omega$
Step 4: Select the nearest standard resistor and verify.
The nearest standard E24 resistor value is 820 Ω. Let’s recalculate the actual cutoff frequency with this real-world part:
$f_c = \frac{1}{2 \pi \times 820 \times 100 \times 10^{-9}} \approx 1940 \text{ Hz}$
For signal filtering, avoid standard X7R or Y5V ceramic capacitors if the circuit handles audio or precision DC. X7R capacitors exhibit a severe voltage coefficient (a 100nF X7R cap might drop to 40nF at 5V DC bias) and are piezoelectric, meaning they can act as microphones and inject vibration noise into your signal. For precision analog filters, spend the extra $0.05 per part and use C0G/NP0 dielectric capacitors, which remain stable regardless of voltage or temperature.
At 20 kHz (one decade above our 1.94 kHz cutoff), a first-order filter provides -20 dB of attenuation, reducing the 5V ripple to about 0.5V. If your motor controller requires even cleaner DC, simply cascade a second identical 820Ω/100nF stage to create a second-order filter, yielding -40 dB of attenuation and dropping the ripple to a negligible 50 mV.
Where You Meet This in Practice
Filters aren't just textbook concepts; they solve specific, painful problems on the bench and in the panel.
- Signal Level (PCB & Microcontrollers): You will use RC low-pass filters as anti-aliasing guards right before the analog-to-digital converter (ADC) pins on an STM32 or Arduino. Without them, high-frequency RF noise folds back into your digital readings, causing erratic sensor data. You will also find high-pass filters (AC coupling capacitors) at the output of digital-to-analog converters (DACs) to block the internal DC offset voltage.
- Power & Mains Level (Enclosures & Panels): When wiring a Variable Frequency Drive (VFD) or a high-wattage switching power supply, you will install an EMI/RFI line filter (like the TE Connectivity / Schaffner FN2090 series) on the 120V/240V AC input. These contain common-mode chokes and X/Y safety capacitors to prevent the high-frequency switching noise generated by the VFD from back-feeding into your building's mains and disrupting sensitive networking equipment.
- RF & Communications: Band-pass filters are mandatory at the antenna inputs of ESP32 or LoRa modules to reject out-of-band cellular and WiFi interference, ensuring the receiver's low-noise amplifier (LNA) isn't saturated by stronger nearby signals.
Active vs. Passive: Choosing the Right Implementation
Once you know the topology (e.g., Low-Pass), you must decide whether to build it passively or actively.
Passive Filters (Resistors, Capacitors, Inductors)
Passive filters require no external power supply. They are mandatory for high-voltage mains applications, high-current speaker crossovers, and RF antenna tuning. However, they suffer from insertion loss (the resistor burns some signal voltage as heat) and loading effects (the impedance of the next circuit stage alters your carefully calculated cutoff frequency).
Active Filters (Op-Amps + Resistors + Capacitors)
Active filters use operational amplifiers (like the ubiquitous TL072 or OPA2134) to provide gain and buffer the signal. This eliminates insertion loss and prevents the load from affecting the filter's response. They are the standard choice for audio processing, precision sensor conditioning, and active crossover networks. The trade-off? They require dual power rails (e.g., ±12V), are limited by the op-amp's gain-bandwidth product, and cannot handle high-power mains voltages.
For a deep dive into calculating component values for complex active topologies like Sallen-Key or Multiple Feedback (MFB), the Texas Instruments Analog Engineer's Calculator is an indispensable, free bench tool.
Frequently Asked Questions
What type of filter do I need to block PWM switching noise?
You need a low-pass filter. For low-current signal lines (like a 0-5V control voltage), a multi-stage passive RC filter is cheapest and easiest. If you are driving a high-current load (like smoothing the output of a buck converter or a Class-D amplifier), you must use an LC low-pass filter (an inductor in series, capacitor to ground) because a resistor would overheat and waste power under heavy DC load.
What type of filter is best for audio crossover networks?
For passive speaker crossovers handling tens of watts, LC band-pass and high-pass/low-pass filters using air-core inductors and non-polarized electrolytic or metalized polypropylene capacitors are standard. For high-fidelity studio monitors, designers increasingly use active filters (op-amps) or DSP (Digital Signal Processing) before the amplification stage, which eliminates the massive, heavy inductors and prevents power loss in the crossover components.
What type of filter should I use on a 120V AC mains input?
You need an EMI/RFI power line filter. These are specialized, safety-certified modules containing common-mode chokes (to block noise that appears on both Line and Neutral simultaneously) and differential-mode chokes (to block noise between Line and Neutral). Crucially, they use X-rated (line-to-line) and Y-rated (line-to-ground) safety capacitors designed to fail open rather than short and cause a fire or shock hazard. Never substitute standard ceramic capacitors in a mains filter.
What type of filter removes 60Hz hum from a sensor signal?
You need a band-stop (notch) filter tuned precisely to 60 Hz (or 50 Hz, depending on your regional mains frequency). While a passive twin-T notch filter can work, it is notoriously difficult to tune and suffers from a wide, sloppy attenuation band. In practice, an active notch filter using an op-amp with a summing junction, or a digital notch filter applied in software after the ADC samples the signal, provides a much sharper, deeper null without degrading the surrounding audio or sensor bandwidth.






