Professional Documents
Culture Documents
Lab 7 - Filters
Lab 7 - Filters
Lab 7: Filters
© 2019 National Instruments
All rights reserved. Neither this resource, nor any portion of it, may be copied or reproduced in
any form or by any means without written permission of the publisher.
National Instruments respects the intellectual property of others, and we ask our readers to do
the same. This resource is protected by copyright and other intellectual property laws. Where
the software referred to in this resource may be used to reproduce software or other materials
belonging to others, you should use such software only to reproduce materials that you may
reproduce in accordance with the terms of any applicable license or other legal restriction.
All other trademarks or product names are the property of their respective owners.
Additional Disclaimers: The reader assumes all risk of use of this resource and of all
information, theories, and programs contained or described in it. This resource may contain
technical inaccuracies, typographical errors, other errors and omissions, and out-of-date
information. Neither the author nor the publisher assumes any responsibility or liability for any
errors or omissions of any kind, to update any information, or for any infringement of any patent
or other intellectual property right.
Neither the author nor the publisher makes any warranties of any kind, including without
limitation any warranty as to the sufficiency of the resource or of any information, theories, or
programs contained or described in it, and any warranty that use of any information, theories, or
programs contained or described in the resource will not infringe any patent or other intellectual
property right. THIS RESOURCE IS PROVIDED “AS IS.” ALL WARRANTIES, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY AND ALL IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
NON-INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS, ARE DISCLAIMED.
No right or license is granted by publisher or author under any patent or other intellectual
property right, expressly, or by implication or estoppel.
IN NO EVENT SHALL THE PUBLISHER OR THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, COVER, ECONOMIC, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THIS RESOURCE OR ANY INFORMATION, THEORIES, OR PROGRAMS
CONTAINED OR DESCRIBED IN IT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES, AND EVEN IF CAUSED OR CONTRIBUTED TO BY THE NEGLIGENCE OF THE
PUBLISHER, THE AUTHOR, OR OTHERS. Applicable law may not allow the exclusion or
limitation of incidental or consequential damages, so the above limitation or exclusion may not
apply to you.
Lab 7 - Filters
Learning Objectives
In this lab you will explore, through hands-on experience, the concept and properties of filters. Among
the experiments, you will
Use the NI Automated Measurements Board to measure the effect of filters on a signal of a
given frequency.
Use the NI Automated Measurements Board to measure the behavior of different filters in the
frequency domain.
Compare the attenuation of 1st and 2nd order filters.
Identify the effect that a load has on a passive filter compared to an active filter.
Conduct experiments using the NI ELVIS III and record your observations
Conduct experiments using the NI Automated Measurements Board and record your
observations
Complete Check for Understanding Questions
Required Tools and Technology
Platform: NI ELVIS III View User Manual:
http://www.ni.com/en-us/support/mo
Note: The NI ELVIS III Cables and del.ni-elvis-iii.html
Accessories Kit (purchased separately) View Tutorials:
is required for using the instruments. https://www.youtube.com/playlist?
list=PLvcPIuVaUMIWm8ziaSxv0gwt
shBA2dh_M
Filtering
Filter circuits play an important role in many electronics designs. They are primarily used to pass desired
signals while blocking unwanted signals, based on their frequency characteristics. Filters behave
differently with signals of different frequencies and can affect the different components of our signal. For
example, if our measurement is made up of a 10mV 1kHz signal wave combined with a 5mV 60Hz noise
component, a filter could attenuate only one of those components and leave the other.
A filter can be designed to implement the behavior that we want, and we will see later how these designs
can be enacted.
Ideal Filters
In an ideal filter, frequencies past the desired cutoff frequency would be completely attenuated and
desired frequencies wouldn’t have any attenuation. You can see an example of this in the image below.
An ideal filter
Let’s look at examples of how filters are constructed and how they behave.
Examples of Filters
A high pass filter passes signals of a higher frequency than the cutoff and attenuates signals lower than
the cutoff frequency. Some of the most common uses of a high pass filter include:
A low pass filter passes signals of a lower frequency than the cutoff and attenuates signals with a higher
frequency. It is important to note that low pass filters are complementary to high pass filters. Low pass
filters come in many forms such as:
Anti-alias filters
Digital filters
Acoustic barriers
To calculate the cutoff frequency of a low pass divider, the following formula should be used:
To learn more, you can read about low pass filters at the following links:
https://en.wikipedia.org/wiki/Low-pass_filter#Electronic_low-pass_filters and
https://en.wikipedia.org/wiki/Voltage_divider#Low-pass_RC_filter.
Simulate: Low Pass Filter
Open the following public circuit on Multisim Live:
https://www.multisim.com/content/gnFpbdwNkeTsQDBSqJqmMi/filters-1st-order-passive/open/
1. Using the formula for the cutoff frequency of a low pass filter, what is the expected cutoff
frequency for this circuit? ____________________
2. Run the simulation by pressing the top-left play button.
3. At what frequency does the attenuation approximately equal -3dB (this is the cutoff frequency for
this filter)? ____________________
a. Does this match the expected cutoff frequency? ____________________
4. Change the resistance to 2kΩ.
a. How should the cutoff frequency change? ____________________
b. Run the simulation and confirm the new cutoff frequency? ____________________
Experiment: Low Pass Filters – Time Domain
In this experiment you will use your NI Automated Measurements Board and LabVIEW to conduct
measurements on a basic low pass filter. You will measure the stimulus voltage and compare it to the
filtered voltage, for different frequencies of input.
The low pass filter has a cut-off frequency of 3.3KHz.
In the IP address section enter the IP address of the NI ELVIS III connected to
your computer.
Connect socket 20 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 21 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
In the VI, set the Filter Type to Low Pass.
When you’ve made your connections, run the VI.
1. Set the Sine Wave Frequency to 10Hz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
2. Set the Sine Wave Frequency to 2.5kHz. What is the amplitude of the Response signal?
____________________
3. Set the Sine Wave Frequency to 3.3kHz. What is the amplitude of the Response signal?
____________________
4. Set the Sine Wave Frequency to 6kHz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
5. Stop the VI when you’re done.
Experiment: High Pass Filters – Time Domain
Let’s repeat the previous experiment using a High Pass Filter.
The onboard high pass filter has a cut-off frequency of 33Hz.
In the IP address section enter the IP address of the NI ELVIS III connected to
your computer.
Connect socket 26 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 27 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
In the VI, set the Filter Type to High Pass.
When you’ve made your connections, run the VI.
1. Set the Sine Wave Frequency to 10kHz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
2. Set the Sine Wave Frequency to 50Hz. What is the amplitude of the Response signal?
____________________
3. Set the Sine Wave Frequency to 33Hz. What is the amplitude of the Response signal?
____________________
4. Set the Sine Wave Frequency to 10Hz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
5.
6. Stop the VI when you’re done.
Simulate: High Pass Filter
Open the following public circuit on Multisim Live:
https://www.multisim.com/content/5QL2e8R8sCHWcSYuwyKCGf/filters-high-pass/open/
1. Using the formula for the cutoff frequency of a high pass filter, what is the expected cutoff
frequency for this circuit? ____________________
2. Run the simulation by pressing the top-left play button.
3. At what frequency does the attenuation approximately equal -3dB (this is the cutoff frequency for
this filter)? ____________________
a. Does this match the expected cutoff frequency? ____________________
4. Change the resistance to 2kΩ.
a. How should the cutoff frequency change? ____________________
b. Run the simulation and confirm the new cutoff frequency? ____________________
5. Add a 1kΩ resistive load to the output of the filter.
a. Rerun the simulation and document the effect on the cutoff frequency and slope of the
graph. ________________________________________________
6. Change the resistive load to 100Ω.
a. What is the effect on the cutoff frequency and slope of the graph compared to the 1kΩ
load? ________________________________________________
Introduction: Non-ideal Filters - Effect of Load and Active Filters
As we saw in the previous simulation, adding a resistive load to our filters caused an effect on the
performance of our filter. Imagine an application where the load was changing but we want the filter to
maintain its behavior. How can we overcome this reality of filters that takes us further away from ideal
filter behavior?
What we need is electrical isolation between the filter and the load. In the amplifiers lab we talked about
unity gain amplifiers: they have the property of isolating the input from the output. We can use this type
of component to create an Active filter, and to get closer to the ideal filter behavior that we’d like.
Let’s look at the difference between these filter types.
Because this is an active filter, frequencies that do get passed through are subject to an amplification gain
equal to -R2/R1. This means that the shown topology is an inverting amplifier configuration. On top of
being a filter, this circuit is also an amplifier.
Experiment: Effect of Load – Active Filters
In the previous section, we focused on passive filters. We saw the effect that a load circuit has on a
passive filter, which we’ll explore in more detail now. Active filters behave much more like perfect filters
when a load is applied, even a load like our measurement device is providing.
Now we’ll visualize that affect by applying different loads to the active filter.
In the IP address section enter the IP address of the NI ELVIS III connected to
your computer.
Connect socket 22 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 23 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
In the VI, set the Filter Type to Low Pass.
When you’ve made your connections, run the VI.
Keeping the existing connections, also connect socket 23 (the output of the filter) to User 0.
On the breadboard, wire User 0 to a 1kΩ resistor.
Wire the other end of the 1kΩ resistor to AGND.
3. Make sure Capture Previous Bode Plot is set to True, then click the Sweep button.
4. At the cut-off frequency of 3.3kHz, what was the approximate gain (in dB)?
___________________________
5. Was this more or less attenuation than the unloaded filter? ___________________________
6. Is the slope of the filter with a load steeper than the unloaded filter?
__________________________
7. Stop the VI when you’re done.
8. What do you observer about changing the resistance of the load for an active filter?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Introduction: Non-ideal Filters - Order and Stopband Roll-off
If you recall the ideal-filter behavior that we hoped to achieve, it looked like this:
An ideal filter
What we achieve in real analog circuits resembles something closer to the graph below.
Here, we see a sloping decrease in amplitude over a range of frequencies, with two different sloping
behaviors shown.
This slope indicates the second major property of a filter:
- The stopband roll-off: the slope at which the filter increases attenuation.
Stopband Roll-Off
As we’ve discussed, filters pass certain signals and block others. They do this by attenuating the
amplitude of signals that fall outside the desired frequency range.
The amount of this attenuation changes at different frequencies, and the slope of this change is called the
stopband roll-off. This slope of attenuation is a main consideration that a filter designer takes into account
when choosing or building a filter. The property of a filter that affects the roll-off is called the filter order.
(You can see the Filter Order section for more details about orders of filters, and we will experiment with
filters of different order to analyze the effect,)
Here we see an example of a common way of representing filter behavior. This graph shows the
comparison of the input voltage to the output voltage, at different frequencies. The ratio of output to
input, the gain, is commonly represented in decibels (dB) for filters. This formula represents how to
calculate gain in decibels. Note that attenuation (a smaller output) is represented as negative decibels.
The signal frequency forms the X axis of the graph and is typically shown on a logarithmic scale.
Generally, filter behavior graphed this way forms a linear slope, and is expressed as dB/decade – where a
decade is the space between powers of 10; i.e. 10, 100, 1000, etc.
Filter Order
The most basic type of filter, a passive RC circuit, is called a 1 st order filter. Whether in high pass or low
pass configuration, the attenuation that it provides – the degree of filtering – is quite gradual.
To design a filter closer to an ideal filter, which has a sharp drop past the cutoff frequency, you have to
increase the filter order. One easy way to increase the filter order of RC filters is to cascade multiple RC
low pass filters into a ladder network. Each additional resistor-capacitor pair you add increases the filter
order by 1.
2nd Order High Pass Filter Circuit Diagram
Experiment: Active Low Pass Filters – Time Domain
In this experiment you will use your NI Automated Measurements Board and LabVIEW to conduct
measurements on active low pass filters. You will measure the stimulus voltage and compare it to the
filtered voltage, for different frequencies of input.
These low pass filters have a cut-off frequency of 3.3KHz @ -3dB for the 1st order filters and @ -6dB for
the 2nd order filter.
In the IP address section enter the IP address of the NI ELVIS III connected to
your computer.
1. Set the Sine Wave Frequency to 10Hz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
2. Set the Sine Wave Frequency to 2.5kHz. What is the amplitude of the Response signal?
____________________
a. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
3. Set the Sine Wave Frequency to 3.3kHz. What is the amplitude of the Response signal?
____________________
a. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
b. How close to the specification of the cut-off frequency gain was this?
__________________
4. Set the Sine Wave Frequency to 6kHz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
b. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
5. Stop the VI when you’re done.
2nd Order Active Low Pass Filter
Now let’s look at the 2nd order low pass filter. As discussed, the biggest behavioral difference between
filters of different order will be the amount of attenuation at each frequency.
This filter has a cut-off of 3.3kHz @ -6dB.
Connect socket 24 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 25 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
In the VI, set the Filter Type to Low Pass.
When you’ve made your connections, run the VI.
1. Set the Sine Wave Frequency to 10Hz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
2. Set the Sine Wave Frequency to 2.5kHz. What is the amplitude of the Response signal?
____________________
a. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
3. Set the Sine Wave Frequency to 3.3kHz. What is the amplitude of the Response signal?
____________________
a. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
b. How close to the specification of the cut-off frequency gain was this?
__________________
4. Set the Sine Wave Frequency to 6kHz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
b. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
5. Was the attenuation of the 2nd order filter more or less than the attenuation of the 1st order; and by
what factor (half as much, 10 times more, etc.)? __________________________
6. What does this indicate about orders of filters? What would you expect from a 3 rd order filter of
this type and construction?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Experiment: Active High Pass Filters – Time Domain
Let’s repeat the previous experiment using High Pass Filters.
The onboard high pass filters have a cut-off frequency of 33Hz @ -3dB for the 1st order filters and @ -
6dB for the 2nd order filter.
In the IP address section enter the IP address of the NI ELVIS III connected to
your computer.
1. Set the Sine Wave Frequency to 10kHz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
2. Set the Sine Wave Frequency to 50Hz. What is the amplitude of the Response signal?
____________________
a. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
3. Set the Sine Wave Frequency to 33Hz. What is the amplitude of the Response signal?
____________________
a. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
b. How close to the specification of the cut-off frequency gain was this?
__________________
4. Set the Sine Wave Frequency to 10Hz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
b. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
5. Stop the VI when you’re done.
2nd Order Active Low Pass Filter
Now let’s look at the 2nd order high pass filter. As discussed, the biggest behavioral difference between
filters of different order will be the amount of attenuation at each frequency.
This filter has a cut-off of 33Hz @ -6dB.
Connect socket 30 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 31 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
In the VI, set the Filter Type to High Pass.
When you’ve made your connections, run the VI.
1. Set the Sine Wave Frequency to 10kHz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
2. Set the Sine Wave Frequency to 50Hz. What is the amplitude of the Response signal?
____________________
a. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
3. Set the Sine Wave Frequency to 33Hz. What is the amplitude of the Response signal?
____________________
a. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
b. How close to the specification of the cut-off frequency gain was this?
__________________
4. Set the Sine Wave Frequency to 10Hz. What is the amplitude of the Response signal?
_____________________________
a. Is the signal lower or higher than the cut-off, and is it getting passed or blocked?
____________________
b. Using the decibel gain formula, convert the response voltage to decibel gain.
________________
5. Was the attenuation of the 2nd order filter more or less than the attenuation of the 1st order; and by
what factor (half as much, 10 times more, etc.)? __________________________
Experiment: Filters in the Frequency Domain
As you’ve seen, the behavior of a filter is very different at different frequencies.
We’ve chosen a few frequencies to look at, but we can also use software to sweep through many
frequencies and examine the results. A sweep of frequencies and the results are typically graphed “in the
frequency domain”, indicated by Frequency being along the X axis. We’re graphing gain as a function of
frequency.
A commonly used instrument to analyze circuits in this way is the Bode analyzer. We’re going to use a
LabVIEW VI, but a Bode analyzer works in much the same way.
In the IP address section enter the IP address of the NI ELVIS III connected to
your computer.
Connect socket 22 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 23 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
In the VI, set the Filter Type to Low Pass.
When you’ve made your connections, run the VI.
Connect socket 24 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 25 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
4. Make sure Capture Previous Bode Plot is set to True, then click the Sweep button.
5. Did the filter attenuate lower frequencies or higher frequencies?
___________________________
6. At the cut-off frequency of 3.3kHz, what was the approximate gain (in dB)? How close to the
specification was this? ___________________________
7. Was this more or less attenuation than the 1st order filter, and by what factor were they different?
___________________________
8. Is the slope of the 2nd order filter steeper than the 1st order filter? __________________________
9. Stop the VI when you’re done.
1st vs. 2nd Order Active High Pass Filter
Connect socket 28 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 29 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
In the VI, set the Filter Type to Low Pass.
When you’ve made your connections, run the VI.
Connect socket 30 (the input to the filter) to the Bank A analog input channel AI0 and also to
Bank A analog output channel AO0.
Connect socket 31 (the output of the filter) to Bank B channel AI0.
Connect the Filter socket to the Analog Ground socket.
4. Make sure Capture Previous Bode Plot is set to True, then click the Sweep button.
5. Did the filter attenuate lower frequencies or higher frequencies?
___________________________
6. At the cut-off frequency of 33Hz, what was the approximate gain (in dB)? How close to the
specification was this? ___________________________
7. Was this more or less attenuation than the 1st order filter, and by what factor were they different?
___________________________
8. Is the slope of the 2nd order filter steeper than the 1st order filter? __________________________
9. Stop the VI when you’re done.
10. From the slopes of the graphs, what can you conclude about the amount of attenuation for 1 st and
2nd order filters? What would you expect to see from a 3rd order filter?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Conclusion
Note: The following questions are meant to help you self-assess your understanding so far.
1. What differences and similarities did you observe between the active filter and the passive
filter?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
2. What effect did you observe when increasing the order of a filter?
______________________________________________________________________________
3. When designing and implementing your own signal conditioning, would you lean toward active
or passive filters? When might you use passive filters?
______________________________________________________________________________
______________________________________________________________________________
______________________________________________________________________________
Explore Further
In this lab you explored the properties and behavior of filters. You investigated the differences between
active and passive filters and the differences between 1st and 2nd order filters. Additionally, you identified
the effect of a load on a passive filter.
All of this works together to demonstrate one form of signal conditioning, which is used to pass certain
frequencies and restrict others. It’s often the case that when implementing a measurement, you know the
expected signal frequency. In this case, you can design high pass and low pass filtering to target your
measurement signal and remove unwanted noise.
In the Error, Noise, Precision and Accuracy lab, you’ll explore discuss filters used for noise removal. In
the measurement application labs, you’ll implement signal conditioning when taking your measurements.