# An Easy Introduction to Electrical Filters(TUTORIAL)

426

2

1

## Introduction: An Easy Introduction to Electrical Filters(TUTORIAL)

Hello there,

Do you want to design an electrical filter to process some noisy signal from a sensor ? Are you just an hobbyist and/or not well versed in designing electrical filters and you are just looking for a quick and easy guide to different filters out there. Then this is the tutorial for you.

We will start with simple concepts on filter design and I will show you how to quickly design a rather complex filter using an easy to use software which offers tools for analyzing a filters performance. LETS GET STARTED!

## Supplies

2x 75Kohm resistor

2x 22nF capacitors

2x arduinos or a signal generator and an oscilloscope if you have one

App(optional)Quick electrical filter design in case you want to design a filter in the future

## Step 1: Basic Intro

To design a low pass filter, a capacitor is used to "short" circuit the higher frequency but allow the lower frequencies to pass through. This happens as the impedance of the capacitor is much lower at higher and higher frequencies when compared to lower frequencies. In turn if you had an inductor instead of a capacitor, the inductor's impedance will get higher as you increase the frequency but acts more like a short circuit at lower frequencies.

So the key of designing filters is to know where to place the resistor,capacitor and or inductor to filter out unwanted frequencies.

Follow the diagram shown for a mathematical explanation.

NB: Although you can use inductors, it's much more easier to use capacitors and resistors in place of an inductor as coils tend to be bulkier and more expensive when compared to cheap resistors and capacitors.

## Step 2: Simulation

To obtain the system's response test run a simulation on MATLAB or Octave. For now I am going to test on octave which is free and can be used from a browser octave

For a cutoff frequency of 1.59Hz the values I have selected are 1kOhms and 100uF capacitor configured to form a low pass RC filter.

Run the following script:

R = 1000; C= 100e-6;

h = tf([1/(R*C)], [1 1/(R*C)]);

bode(h);

Note the slope of the magnitude response.The slope happens begins to become more steep at 1.59Hz(-3dB) meaning that if you had a signal of sin(2*pi*1.59*t) the signal will have lost 50% of its power or 0.707*sin(2*pi*1.59*t). This shows that the system is a low pass filter. If the slope happened first and flat lined at higher frequency then it will be a high pass.

## Step 3: Test the Circuit

Using one arduino as a signal generator and another as an oscilloscope test the circuit. If you have an oscilloscope and a signal generator use them instead.

For the signal generator (You could use the timer interrupts)

[code]
boolean pinState = false;

void setup() {

pinMode(13, OUTPUT);

digitalWrite(13, pinState);

}

void loop() {

pinState = !pinState;

digitalWrite(13,pinState);

}

}

[/code]

For the oscilloscope

[code]
void setup() {

Serial.begin(9600);

}

void loop() {

Serial.print(",");

}

[/code]

## Step 4: Results

Here are the results that i obtained from my crude setup. Note the blue line is lagging behind the red line.

## Step 5: What's Next

If you want to continue on your filter selection journey, I would recommend the following app Quick Electrical Filter design, which has more filters,simulation tools and their responses.Above are some selection of filters in the app.

Have fun