.st0{fill:#FFFFFF;}

News

Upcoming course: Learn first-order filters with Python, simulation, and live experimentation 

 April 18, 2025

By  Peter

Join Our Mailing List

We publish fresh content each week. Read how-to's on Arduino, ESP32, KiCad, Node-RED, drones and more. Listen to interviews. Learn about new tech with our comprehensive reviews. Get discount offers for our courses and books. Interact with our community.

One email per week, no spam, unsubscribe at any time.

If you’re learning electronics, understanding filters is essential. From audio systems to sensors, and from power supplies to communications, filters help us clean up noise, isolate useful signals, and shape the behaviour of circuits. But most students I speak with—myself included, when I was starting out—find filters difficult to grasp through theory alone. Equations tell you what to expect, but they don’t show you what a filter does.

That’s exactly why I’m building a new course: Introduction to Filters. It’s not ready yet, but I want to share what I’m working on and invite you to participate. This course is designed to help you not only understand how filters work, but to see how they work—visually, experimentally, and practically. You’ll simulate filters using Python, analyze circuits in CircuitLab, build them on a breadboard, and measure their behavior using the Digilent Analog Discovery 3’s spectrum analyzer.

Scroll to the bottom of the page and use the discussion tool to ask questions or share ideas. Your feedback will help shape the final course.

Why this course is different

This course brings together the best of theory, simulation, and real-world experimentation. I’ve chosen tools that complement each other and help you build a solid understanding.

Python gives you the power to simulate filters from first principles. You’ll write scripts that calculate voltage output, cutoff frequency, phase shift, and more. And you’ll plot those results with Matplotlib to visualize exactly what’s happening.

CircuitLab lets you build and simulate real circuits quickly, so you can test your ideas without needing a physical lab.

The Digilent Analog Discovery 3, with its spectrum analyzer, helps you see how actual circuits behave across a range of frequencies—bringing theory to life.

Mathematics isn’t avoided—it’s used carefully, to help you understand transfer functions, reactance, and frequency response in practical terms. I must admit – I have always been scared of mathematics. As I’m slowly constructing this course, my attitude has started to shift and I’m becoming fascinated by its power to describe reality.

This approach allows you to move smoothly from simulation to measurement, and from ideas to circuits.

What you’ll learn

Here’s a preview of the main sections of the course. Each one is packed with examples, simulations, plots, and activities to reinforce what you’re learning:

  • Introduction to Filters: Start with the basics: what filters do, the difference between high-pass, low-pass, band-pass, and band-stop configurations, and how filtered and unfiltered signals compare in practice.
  • Dive into First-Order RC and RL Filters: Explore the core behaviors of the simplest filters: RC and RL networks. You’ll study time-domain responses, cutoff frequency, phase shift, and the role of the time constant. You’ll also simulate these filters and build them on a breadboard.
  • Filter Analysis with Bode Plots and Phasors: Learn how to visualize and interpret frequency response using Bode plots, and how phasors simplify analysis. You’ll see how to calculate gain and phase shift across frequency and sketch plots to match.
  • Real-World Applications: Apply your knowledge to practical problems: audio tone shaping, signal conditioning for sensors, switch debouncing, and smoothing PWM signals. You’ll design filters for each application and simulate them.
  • Cascading Filters: Understand why we connect filters in series and how to design cascaded filters for more precise frequency control. You’ll design a second-order band-pass filter and simulate it step by step.
  • A Primer on Python for Electronics: I’ll walk you through setting up Python and writing simple simulation scripts using NumPy and Matplotlib. You don’t need to be a programmer—just willing to experiment.
  • Mathematics Refresher for Filter Analysis: For anyone needing a refresher, I’ve included a section on algebra, complex numbers, and how to simplify and rearrange equations relevant to filter design.

Here’s a small example: RC low-pass filter behaviour

Let me show you an example of what this course looks like in action. One of the early chapters focuses on the RC low-pass filter, which passes low-frequency signals and attenuates high-frequency ones.

CircuitLab Simulation

We begin with the basic circuit. You can buildit in CircuitLab:

Using the simulator, you input a sine wave and observe how the amplitude of the output drops as the frequency increases. You’ll also view the phase shift between input and output.

Frequency vs Magnitude
Frequency vs Phase

Mathematics

We analyze the voltage divider formed by the resistor and capacitor in the frequency domain:

[math]V_{out} = V_{in} \cdot \frac{1}{1 + j\omega RC}[/math]

From this expression, we calculate the cutoff frequency:

[math]f_c = \frac{1}{2\pi RC}[/math]

We also derive the magnitude of the transfer function:

[math]|H(\omega)| = \frac{1}{\sqrt{1 + (\omega RC)^2}}[/math]

And the phase shift:

[math]\phi(\omega) = -\arctan(\omega RC)[/math]

For example, let’s calculate the cutoff frequency. To calculate the cutoff frequency f_c of the RC low-pass filter described in the blog post, we use the formula:

[math]f_c = \frac{1}{2\pi RC}[/math]

Given:

  • [math]R = 1\,\text{k}\Omega = 1000\,\Omega[/math]
  • [math]C = 105\,\text{nF} = 105 \times 10^{-9}\,\text{F}[/math]

Substitute the values:

[math]f_c = \frac{1}{2\pi \cdot 1000 \cdot 105 \times 10^{-9}} \approx \frac{1}{0.00065973} \approx 1515.96\,\text{Hz}[/math]

If your math is a bit rusty, don’t worry. I’ll be including an algebra primer to help you work with all the mathematics in the course.

Python Simulation and Plot

Next, you simulate this behavior in Python. You sweep the frequency and calculate both gain and phase shift.

To simulate the filter’s behavior programmatically, I use two core Python libraries: NumPy and Matplotlib. NumPy allows me to perform fast numerical operations, such as generating logarithmic frequency ranges and computing mathematical functions like square roots and arctangents. It’s ideal for manipulating arrays and performing signal calculations efficiently. Matplotlib is used to visualize the results. With just a few lines of code, you can generate professional-quality plots that show how the gain and phase of a filter change with frequency. These visualizations help connect the formulas with their real-world effects.

Here’s a script that produces the two plots based on the magnitude and phase shift formulas:

import numpy as np
import matplotlib.pyplot as plt

# Constants
R = 1e3        # Resistance in ohms
C = 105e-9     # Capacitance in farads

# Frequency range
f = np.logspace(1, 6, 500)  # 10 Hz to 1 MHz
omega = 2 * np.pi * f

# Transfer function magnitude and phase
H_mag = 1 / np.sqrt(1 + (omega * R * C)**2)
H_phase = -np.arctan(omega * R * C) * (180 / np.pi)

# Plot magnitude response
plt.figure()
plt.semilogx(f, 20 * np.log10(H_mag))
plt.title("RC Low-Pass Filter - Magnitude Response")
plt.xlabel("Frequency (Hz)")
plt.ylabel("Gain (dB)")
plt.grid(which="both", linestyle="--", linewidth=0.5)

# Plot phase response
plt.figure()
plt.semilogx(f, H_phase)
plt.title("RC Low-Pass Filter - Phase Response")
plt.xlabel("Frequency (Hz)")
plt.ylabel("Phase (degrees)")
plt.grid(which="both", linestyle="--", linewidth=0.5)

plt.tight_layout()
plt.show()

If you are familiar with Python, these scripts will be easy to understand and customise. If not, again, no worries. I will include a primer on Python, dumpy and matplotlib to help you understand what you need in the context of this course.

Spectrum analyser

Finally, you build the same circuit on a breadboard and connect it to the Analog Discovery 3. Here’s mine:

The RC filter on the breadboard. The analyser provides the input signal (a sine wave), and samples the output to produce the spectrum plot.

In the analyser software (WaveForms), I have set the signal generator to produce a 1 kHz sinusoidal signal. I use channel one to sample the output, and the spectrum analyser to produce the spectrum plot. It is interesting to change the input signal frequency and see the effect on the attenuation of the output signal. The spectrum analyser makes this easy and fun.

The spectrum analyser shows the input signal (bottom), and the peak at 1 kHz in the spectrum analyser (top).

Here’s another cool capability of this tool: a live Bode plot (which you will learn about in the course).

A Bode plot in the WaveForm software.

Bode plot is a graphical representation of a circuit’s frequency response. It consists of two parts:

  1. Magnitude plot (top): shows how the gain of the circuit changes with frequency, usually in decibels (dB).
  2. Phase plot (bottom): shows how the phase of the output signal shifts relative to the input across different frequencies.

Bode plots are especially useful for analyzing filters, amplifiers, and control systems.

In the top graph, you’re looking at the gain of the filter on my breadboard across a range of frequencies. It’s pretty much flat at the start — that means low-frequency signals are getting through just fine, with almost no loss. But once we hit around 1.5 kHz, you can see the signal start to drop off. That’s the cutoff point. From there, the higher the frequency, the more the filter attenuates the signal. That’s exactly what a low-pass filter is supposed to do.

Now, check out the bottom graph — that’s the phase response. It shows how much the output signal is lagging behind the input. At lower frequencies, there’s not much delay. But as you go higher, the phase starts to shift more and more. Right around the cutoff frequency, you’ll notice it’s approaching –45°, and it keeps moving toward –90° as the frequency increases. Again, this is textbook behavior for a first-order RC filter.

This is a great example of how a Bode plot can show you exactly what your circuit is doing — not just in theory, but in real time, on the bench.

This workflow—math, simulation, measurement—builds your intuition and reinforces each concept from multiple angles. And you get to see the filter do exactly what the math predicted.

Help me shape this course

As I mentioned, the course is still under development. I’m working through chapters, designing example circuits, writing Python scripts, and recording experiments with the Analog Discovery 3. If you have questions or ideas, or if there’s something specific you want to learn, scroll down and use the discussion tool below this post. I’ll be checking regularly and would love to hear your thoughts.

This is the kind of course I wish I had when I was starting out. It’s built around discovery, experimentation, and clear, guided practice—not just memorizing formulas. And I’d love for you to be part of it as it comes together.


Tags

Electronics, filters


You may also like

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Greetings! This one is an unusual post: Education Excellence Magazine, a reputable publication known for showcasing advancements in education, has dedicated its latest cover story to Tech Explorations. This edition focuses on Australia’s Most Dynamic

Read More
Tech Explorations Featured in Education Excellence Magazine

After testing the first prototype of my ESP32-based PCB (see my blog post), I identified several areas for improvement. This iterative improvement process is critical in PCB design, as in any engineering effort. Every prototype

Read More
Update: KiCad 9 and ESP32 PCB design course has new lectures