Lab 6: A Low Pass Filter

The goal: Build a simple passive filter and process an input function.

The basic set up of a low pass filter.

The simplest low pass filter looks much like a voltage divider, except that the lower resistor is replaced with a capacitor. This circuit will allow low frequency signals to pass, while blocking higher frequency signals. (High and Low are determined by the values of $R$ and $C$.)

A bode plot of a passive RC low pass filter.

This plot shows the frequency response of a RC low pass filter. As the input frequency increases, the magnitude of the output decreases. The cutoff frequency is defined by: $$f_c = \frac{1}{2 \pi R C}$$

You'll note it's not a shape cutoff, but rather a tapered reduction. The sharpness of the filter can be changed by more complicated filter designs, but for the present, this passive filter (i.e. made only with resistors and capacitors) will suffice.

The Lab Procedure

You will use the builtin function tone() in the Arduino language to make a square wave on a PWM digital output pin. Read more about tone() in the Arduino Reference, but in short it allows you to control the frequency of the PWM output, rather than the duty cycle. See here to explore the difference: Adjustable PWM simulation.

You can then measure that square wave using an Analog In pin.

The basic set up of a low pass filter.

Here's an example plot of about 80 milliseconds worth of data from the tone() function. This tone was set to 60 Hz, meaning we should expect a period between each repeat of the duty cycle of about 16.67 milliseconds, using $(T = 1/f)$.

Several points are highlighted showing the times of each. This confirms a period of 16-17 milliseconds. (Our data acquisition is set to one point per millisecond, so any thing more accurate would not be possible.)

Make sure you can reproduce this plot, or something similar before moving on. i.e. check that your basic code and measurement for tone() to Analog IN is working.

Next, build a low pass RC filter by following the circuit diagram above. You should have a 22 Ω resistor and a 100 µF capacitor. It's set up just like a voltage divider, except the capacitor replaces a resistor. Use the Analog In to measure the voltage across the capacitor. This is the filtered signal.

Your task is to prove (quantitatively1) that your filter works. There are several ways to accomplish this, using the techniques we have looked at this semester. Or, come up with a new one!

To be included:

[1] In this case a qualitative way to show that it's working would be to hook a speaker up to the output and say: "listen, it sounds different! Can't you hear it?". We can do better in physics. Try to find a way to prove that the filter is working that is not based on the senses.