# Introducing Filters

It has now come time to introduce **filter circuits**! **Filters **are a fundamental building block which **alter **the **frequency response (amplitude vs frequency)** of an **electronic system** to achieve a **desired response** such as a **low pass** **filter **which **passes through low frequencies **while **filtering out high frequencies **and **high pass filters **which **permits high frequencies while filtering out low frequencies.**

## Low Pass Filter

Let's begin by taking a look at the simplest type of filter, namely the **low pass filter**, which we can simply build by connecting a **resistor **and **capacitor** in series as shown below:

The graph above shows the **gain** measured in **dB (decibel) **vs **frequency **in **Hz**.

As can be seen the **gain **is initially 0dB at 0Hz which slowly drops off before dropping off steeply where a gain of 0dB means an input with amplitude 1V would be 1V measured at the output. Intuitively this makes sense as at low frequencies the **capacitor acts** as an **open circuit**, having an **impedance** approaching *infinity *meaning that the **vast majority** of the voltage is **dropped across the capacitor** i.e. **Most of the input voltage makes it to the output**. For **high frequencies** the **capacitor **looks like a **short circuit**, i.e. **no voltage drops across it meaning the gain is very low**.

## High Pass Filter

## Half Power Point

While analyzing the frequency response of filters there is a **figure of merit** known as the **half power point** which is the frequency at which the **gain is approximately equal to -3dB**. As such it is also known as the -3dB point.

It is also commonly referred to as the **cutoff frequency **as on one side of this frequency the gain will rapidly decrease. For **low pass filters** this is for frequencies **ABOVE **the **cutoff frequency** while for **high pass filters** this is for frequencies **BELOW **the **cutoff frequency**. You can observe these trends in the frequency response plots shown previously.

For **RC circuits**, it turns out this frequency is **inversely proportional** to the **time constant **of the circuit. This means if we have a **low time constant**, i.e. the capacitor **charges very quickly**, then we expect the **cutoff frequency** to be a **high value**. Now why does this make sense intuitively? Well if we consider a low pass arrangement then for a **low time constant** we will only start to observe the capacitor as a **short circuit at very high frequencies** where the electrons only very briefly move towards the plates to charge them and **not long enough to charge the plates **as is the case for **low frequencies**.

**TODO: **Add gifs for charging low pass filter with high tau and low tau. Same with high pass filter.

## Examples

- Determine the half power point for the low pass filter shown below:

**half power point**of a simple RC low pass filter recall we just need to know the time constant and then plug it into the formula below:

2. Determine the cutoff frequency for the high pass filter shown below:

## Let's Design Some Filters!

Yep that's right, I've once again used the verboten (forbidden in English) word DESIGN in the context of education, oh the horror. Yep we are going to learn what we need to do here and now before going into the real world and getting thrusted onto it by your boss under time pressure.

So let's take on the dark art of **filter design** head first by first trying to **build a low pass filter** for a **cutoff frequency** of say **1kHz**.

For a design question we now need to think what resistor and capacitor values we should use, to determine that we should calculate the **time constant** based on the frequency.

Okay so we need to determine a **resistor and capacitor combination** with a **time constant** of around** 0.159ms**. If we round up to say **0.160ms** then the frequency will only be *slightly off* and we can use more **commonly found component values**. We could then have say a **16kHz resistor** in series with a **0.1uF capacitor to achieve this** which are common values. To check common values you can always search for parts on your preferred suppliers website to see what is available based on **availability**, **cost **and **tolerance**.

## Getting the hands dirty

Alright so now that we have a few filter circuits up our sleeves let's have a crack at throwing a couple of **capacitors**, **resistors **and **inductors **together in interesting ways and see how the **frequency response** looks using our old mate **LTSpice**.

Let's begin by drawing the circuit below:

Now the reason we need to set the value to AC 1. Is we want to perform what's known as AC Analysis which plots the amplitude vs frequency. We can achieve this via the simulation tab as shown below:

We have set 1000 points per decade sweeping from 1Hz to 1MHz, a nice general sweep to get the spectrum. We can then just left click on the **node **connecting R1, C1 and L1 to perform the measurement as shown below:

Interesting, so as we can see we get some activity around 50kHz to 250kHz. So what we can do is change our sweep to cover this range to "zoom in". Let's also increase the number of points to 5000 for higher resolution:

So what we can see is the amplitude increases with frequency until around 112.556kHz and then drops off again, this is known as a **band pass filter**.

So we can now experiment with the values of R, L and C to see how the spectrum changes. As an example let's change R 10 10k and view the spectrum:

Interesting, the peak frequency did not change! However look at the amplitude axis! -16.09dB vs close to -0.4dB is a huge change! The resistor has strongly **attenuated **the signal which is expected.

Let's then try increasing the **capacitance to 10mF:**

The effect has been pushing the peak frequency back to 1.126kHz and the gain has drastically dropped to between -53.5dB and -54dB. How about changing the **inductance by bumping it to 10mH.**

Note the peak frequency has only slightly shifted to around 1.5kHz but the **amplitude **has increased to slightly above 0dB. Also notice the curve is **less sharp**. To explain this intuitively recall that higher inductance has a larger impedance which increases with frequency and so what happens is that as the impedance of the capacitor reduces with frequency we see a larger voltage form at the node until eventually the impedance of the capacitance drops so low that the majority of the voltage drops across the resistor. The **frequency **at which the **reactance **of the **inductor **and **capacitor **are equal is the resonant point and it is here where we see the maximum as at this point the source only effectively **see's a** **resistive load**.

I encourage you to try drawing other circuits with resistors, capacitors and inductors to see different filters. We will explore all sorts of complex filters in great detail in the intermediate course!