Experiment 6 Active Butterworth Low-Pass Filters Systems and Signals Laboratory ©2017 Prof. Mohamad Hassoun

Contents:  Pre-lab  Lab activities: Design and build an active circuit that realizes a fourth-order low-pass Butterworth filter and experimentally determine the (magnitude and phase), step-response and impulse-response.  Post-lab  Links to resources and data sheets: o The LF351 op amp data sheet o The LM741 op amp data sheet o Capacitor types and their application o WaveForms configuration file: experiment6

Electronic components required for this experiment o LF351 operational (3) o 18kΩ (1/4 Watt, 5%) resistor (2) o 20kΩ (1/4 Watt, 1%) resistor (1) o 43kΩ (1/4 Watt, 5%) resistor (2) o 150pF (Polypropylene, 1%) capacitor (1) o 820pF (Polypropylene, 1%) capacitor (1) o 1nF (Polypropylene, 1%) capacitor (2) o 0.01휇F (Polypropylene, 5%) capacitor

Background We desire a low-pass filter that has a maximally-flat magnitude response, |퐻(휔)|, over the pass- band region, [−휔푐 + 휔푐], where 휔푐 is the radian . A class of maximally flat filters can be obtained by utilizing the following Butterworth function, where 푛 is the filter order. 1 퐴(휔, 푛) = |퐻(휔, 푛)| = 휔 2푛 √1 + ( ) 휔푐 The following is a plot showing the magnitude response of the Butterworth low-pass filter for a normalized cutoff frequency, 휔푐 = 1.

The for an 푛th-order Butterworth low-pass filter has no zeros; it is given by 1 1 퐻(푠) = = 푛 푛−1 (푠 − 푝1)(푠 − 푝2) … (푠 − 푝푛) 푎푛푠 + 푎푛−1푠 + ⋯ + 푎1푠 + 푎0

푗휋(2푘+푛−1) 푗휃푘 with poles 푝푘 = 푒 = 푒 2푛 , 푘 = 1, 2 , … 푛. This leads to all filter poles to have negative real parts (thus assuring a stable filter) and to be symmetrically located on the unit-circle in the complex plane. For example, for 푛 = 1 the pole is at −1. For 푛 = 2 the poles are complex conjugate and are 3휋 5휋 푗 푗 located at 푝1 = 푒 4 and 푝2 = 푒 4 , as depicted in the figure below.

The 2nd order filter’s transfer function can then be written as 1 1 퐻(푠) = 3휋 5휋 = 푗 푗 2 (푠 − 푒 4 ) (푠 − 푒 4 ) 푠 + √2푠 + 1

For 푛 = 4 the poles are computed and depicted in the figure below.

This leads to the transfer function (prove it and include your solution as part of the pre-lab assignment) 1 퐻(푠) ≅ 푠4 + 2.61푠3 + 3.41푠2 + 2.61푠 + 1

The following figures show the magnitude and phase spectra associated with the 4th order low- 푗휔 pass Butterworth filter, with cutoff frequency of 휔 = 10 [obtained by setting 푠 = in the 푐 10 above normalized 퐻(푠)]. In practice, we are concerned with the spectra for 휔 ≥ 0.

For convenience, we can tabulate the values of the poles and denominator coefficients of 퐻(푠) as shown in the following table (note that 푎0 and 푎푛 are always 1).

휃푘 n 푎0 푎1 푎2 푎3 푎4 푎5 푎6 푎7 푎8 휋 1 1 1 3휋 5휋 2 1 1 , √2 4 4 2휋 4휋 3 1 2 2 1 , 휋, 3 3 5휋 7휋 9휋 11휋 4 1 2.61 3.41 2.61 1 , , , 8 8 8 8 3휋 4휋 6휋 7휋 5 1 3.24 5.24 5.24 3.24 1 , , 휋, , 5 5 5 5 6 1 3.87 7.46 9.14 7.46 3.87 1 8 1 5.13 13.14 21.85 25.69 21.85 13.14 5.13 1

The denormalized transfer function for a low-pass Butterworth filter with order 푛, dc gain 퐾 and cutoff-frequency 휔푐 can be obtained according to the formula 퐾 퐻 (푠) = 퐿푃 푠 푛 푠 푛−1 푠 푎푛 ( ) + 푎푛−1 ( ) + ⋯ + 푎1 ( ) + 1 휔푐 휔푐 휔푐

Example. Obtain a second-order Butterworth low-pass filter with cutoff frequency 휔푐 =1000 rad/sec and dc gain of 10.

From the above table we have the denominator coefficients 1, √2 and 1. Hence, the normalized transfer function is

1 퐻(푠) = 푠2 + √2푠 + 1

The denormalized filter transfer function (with 퐾 = 10) is then

10 107 퐻 (푠) = = 퐿푃 푠 2 푠 2 3 6 1 ( ) + √2 ( ) + 1 푠 + 10 √2푠 + 10 103 103

The following second-order active circuit (known as the Sallen-Key circuit) has the transfer function 1 푅 푅 퐶 퐶 퐻(푠) = 1 2 1 2 1 1 1 푠2 + ( + ) 푠 + 푅1퐶1 푅2퐶1 푅1푅2퐶1퐶2

Example. Design the above active circuit such that it realizes the 2nd order low-pass Butterworth filter 107 퐻퐿푃(푠) = 푠2 + 103√2푠 + 106

We may express the above transfer function as 106 퐻퐿푃(푠) = (10) 푠2 + 103√2푠 + 106 which suggests that a Sallen-Key circuit can be used followed by an op-amp amplifier stage of gain 10. So, by matching coefficients in the expression 1 106 푅 푅 퐶 퐶 = 1 2 1 2 2 3 6 1 1 1 푠 + 10 √2푠 + 10 푠2 + ( + ) 푠 + 푅1퐶1 푅2퐶1 푅1푅2퐶1퐶2 1 1 1 we arrive at the requirements = 106 and + = 103√2. We have ample 푅1푅2퐶1퐶2 푅1퐶1 푅2퐶1 flexibility to set the four element values since we have only two constraints (equations) to satisfy. So, we choose 푅1 = 푅2 = 10kThis choice leads to 퐶1 ≅ 0.14휇F and 퐶2 ≅ 70.7nF. In practice, the capacitors are picked from what is available in production and would be chosen as close as possible to the design values obtained. The following table of standard capacitor values suggests that the closest available values for our filter capacitors would be 퐶1 = 0.15휇F and 퐶2 = 68nF = 0.068휇F. Polyester, Polypropylene film and metalized capacitors are most appropriate for filter circuits. Ceramic disc capacitors may be used, but they are susceptible to changes in temperature. The DC gain can be realized by cascading a non-inverting voltage amplifier with gain of 10.

Higher order filters (with even order) can be implemented by cascading two or more Sallen-Key stages, with each stage designed to match one conjugate pairs of poles. In other words if a 4th- order low-pass filter with poles 푒±푗휃1 and 푒±푗휃2 is to be realized, then the first Sallen-Key circuit stage is designed to match poles 푒±푗휃1 and the second stage matches 푒±푗휃2 . A final stage consisting of an op-amp voltage amplifier circuit is used to set the dc gain, 퐾. The structure is shown in the figure below.

Since we are using op-amp circuit with high input impedance and low output impedance, it is safe to cascade those stages as shown above, without adversely loading the stages. The resistors in such circuits have to be on the order of Kotherwise you would have to insert a buffer circuit between the cascaded stages. Matlab-Based Analog Toolbox: AFD The Analog Filter Design (AFD) Toolbox bundles a suite of tools for analog filter design and analysis. Given a filter type (high-pass or low-pass) it can calculate pole and zero placements, display time and frequency-domain system responses, calculate the required resistor and capacitor values for various active-circuit implementations and complete several other useful functions. This toolbox is not part of Matlab and need to be installed as an Add-On. A compressed folder containing the software is available from the course web page. Download by clicking the Analog Filter Design for Matlab link. Then extract the files from the downloaded zipped folder. Double- click the file to install. This will create the Add-On in Matlab, as shown in the following figure.

The executable script afd.m need to be dragged from the unzipped folder and pasted into the metadata directory as you can see in the above figure. The toolbox is executed by typing afd at the Matlab prompt. A tutorial is available on the course webpage (AFD Tutorial). The following example illustrates the design and active-circuit generation of a (two-stage) fourth-order, low- pass Butterworth filter with 10kHz cutoff frequency and dc gain of 1. First, enter the values as shown below.

From the “Analyze” menu we choose “List Transfer Function” and then “Plot Poles and Zeros” to obtain the following:

The frequency response is obtained by choosing “Plot Frequency Response” from the “Analyze” menu. The blue trace represents actual 푅/퐶 values and the black trace represents ideal values.

The following are the filter’s step and impulse responses (generated by AFD):

Next, you may design an active Sallen-Key circuit that implements the filter by selecting “Build Circuit” from the “Build” menu. The two required stages are shown below along with their component values (5% tolerance elements were chosen).

1. Pre-Lab Study the above “Background” section which should help you complete the following steps.

a. Install the AFD Toolbox software in Matlab on your PC and generate all of the simulation results (plots), shown in the previous section, for the 4th order Butterworth low-pass filter with |퐻(0)| = 1 and 푓푐 = 10kHz for: (1) ideal components, and (2) actual (5% tolerance) components values. b. Use Mathcad to compare the magnitude repose (|퐻(푓)| 푣푠 푓) of the two filters from Step a. Employ a logarithmic scale for frequency. Recall that 휔 = 2휋푓 and that each stage has a transfer function given by 1 푅 푅 퐶 퐶 퐻(푓) = 1 2 1 2 1 1 1 (푗2휋푓)2 + ( + ) (푗2휋푓) + 푅1퐶1 푅2퐶1 푅1푅2퐶1퐶2

Hint: The overall filter transfer function is the product of the transfer functions of the individual stages. Your plot should look similar to the following plot.

c. Determine (from the frequency response plot, via tracing) the cutoff frequencies of the ideal and the actual (5% tolerance components) filters. d. Employ Multisim to verify the frequency response of the filter you designed in Step a. (use the 5% tolerance components). Also, determine the response of the filter to a 1kHz square signal. Repeat for a 10kHz frequency. Sample results are shown below.

e. Search your laptop for the folder that contains the configuration file (for WaveForms) “default.dwf3work” and then download the “experiment6” configuration file and place it inside that folder. You will need this file for the Lab activity. It is important to read the following section (as part of the pre-lab assignment) in order to familiarize yourself with the upcoming lab activity.

2. Lab activity Make actual measurements of all resistor and capacitor values that you use in the following circuit. Make sure to take photographs of all circuits that you build in the lab. Also, you are to save all scope trace images. You will be using these photos/images in your lab report.

a. Use the breadboard to build the 4th order low-pass Butterworth filter that you have designed and analyzed in the Pre-lab activity. Employ two LF351 op-amps.

You are to ask your lab instructor to double check your circuit wiring before applying power to your circuit. b. Connect the input of your filter to the waveform generator. Apply a sine wave with 2Vpp. Monitor the input signal and the filter’s output signal on CH1 and CH2 of the oscilloscope, respectively. Set CH1 and CH2 to 500mV/div and the time scale to 20휇sec/div. Make sure the scope channels are set to “INVERSION: OFF”. Determine, experimentally, the input sinusoid (cutoff) frequency that leads to about 0.7 Volt amplitude for the output signal. Capture and save the scope’s display image. The image should display in the measurements bar the following values: input signal frequency, input signal max voltage, output signal max voltage and the phase difference between the output and the input. See sample scope image below.

[Note: if the filter’s output signal is noisy attach 0.1휇F capacitor between +푉푠 and ground and another 0.1휇F capacitor between – 푉푠 and ground]

c. Tabulate the output signal amplitude and phase for the following input frequencies: 1kHz, 2kHz, 3kHz, …, 9kHz, 10kHz. d. Change the circuit input to a 2Vpp, 50% duty cycle square wave. Determine (and save the scope’s display image) the filter’s output for the following square wave frequencies: 2kHz, 3kHz, 4kHz, 5kHz and 10kHz. Set the time scale at 100sec/div for all cases. The following figure shows the scope traces for the 3kHz case.

e. In this step you will determine the step-response of your filter. Set the input to a 50% duty cycle, 1kHz square wave with low level at 0Volt and high level at 1 Volt. Set the scope channels to 200mV/div and 20휇sec/div. Set the scope to “averaging mode” (through the “AQUIRE” menu). Shift the traces vertically and horizontally so that the response looks like the one in the sample figures below. Save the scope’s display image. Next, press the CURSOR button and set the mode to “Track” and set CursorA to CH2. Use the “INTENSITY” knob to position the cursor at the peak of the filter output. Save the scope’s display image.

f. In this step you will generate the impulse response of the filter. Keep the same settings as in Step e, but change CH1 and CH2 to 1V/div. Connect the output of the filter to the input of the differentiator circuit, shown below. Connect the output of the differentiator to CH2. Set CH2 to “Invert: ON” mode (this is necessary in order to undo the inversion inherent in the differentiator). The idea here is to generate the impulse response of the filter as the derivative of the step-response. Move the cursor so that it reads the time and max amplitude of the impulse response. Measure the minimum amplitude of the impulse response and the time it occurs at. You will be comparing these values to those you generated from the AFD simulation from the Pre-lab. Save the scope’s display image. Refer to the sample shown below.

[Note: For the purpose of your Post-lab analysis, recall that the differentiator 푑푣 input/output relationship is given by: 푣 = −푅퐶 푖푛. So, remember that the scope 표 푑푡 amplitude measurements that you have made for the impulse-response need to be normalized by dividing them by 푅퐶 = (20 ∗ 10−3) ∗ (0.01 ∗ 10−6) = 2 ∗ 10−4] g. Use the AnalogDiscovery2 (AD2) and the WaveForms software on your PC to generate the frequency response of your filter. Use a BNC-to-hook clip cable to connect the input of the filter to the W1 connector of the AD2 (refer to the figure below). W1 is also connected via a BNC-to-BNC cable to CH1 (scope input 1) of the AD2. Connect the output of the filter to CH2 (scope input 2) of the AD2. Connect the AD2 module to your laptop (via the supplied USB cable) and run the WaveForms software. Choose “experiment6” when prompted (this is the configuration file that you have downloaded to your PC in the Pre-lab activity).

The “experiment6” configuration file configures WaveForms to generate a magnitude and phase frequency response plots, with logarithmically spaced frequencies between 1kHz and 50kHz. Click on the “Single” icon to generate the magnitude and phase response plots.

Use the vertical marker to determine the cutoff frequency of the filter (the frequency at which the gain is equal to about 0.707). Record the phase value at this frequency. Use Jing to capture and save the network analyzer image (see below).

As you disassemble your circuit, and in case you forgot to measure element values, carefully measure and record the actual resistors and capacitors values.

3. Post-lab Write your lab report according to the required format. Analyze and discuss, in details, all results obtained from your pre-lab and your lab activity. Compare the theoretical and experimental performance of the filter. Report the absolute relative errors (in percent) for all experimental measurement whenever the true (ideal) value is known. Your report should also include the following simulations: a. Use the measured resistor and capacitor values and Mathcad to plot the magnitude and phase responses of the filter and determine the cutoff frequency (in Hz).

b. Use the measured resistor and capacitor values to determine the response of the filter to a 1 Volt amplitude (2Vpp), 50% duty cycle, 1 kHz square wave. Employ your Multisim circuit from the pre-lab. Compare your result to the experimental result.

c. Substitute the measured component values of your filter in the denominator of 퐻(푠) and solve for the two complex conjugate poles of each of the two filter stages; i.e., 1 1 1 solve for the roots of the quadratic 푠2 + ( + ) 푠 + = 0, for each 푅1퐶1 푅2퐶1 푅1푅2퐶1퐶2 stage. Plot the these four poles in the complex plane and compare them to the exact 5휋 7휋 9휋 11휋 푗 푗 푗 푗 Butterworth poles:푒 8 , 푒 8 , 푒 8 , 푒 8 .

d. Use the measured component values to determine the (fourth-order) transfer function 퐻(푠) of your two-stage filter (remember that the overall filter transfer function is the product of the transfer functions of the individual stages). Then, use Mathcad’s inverse Laplace Transform command to determine and plot the step-response, 퐻(푠) 푦 (푡) = 퐿−1 { }, and the impulse response, 푦 (푡) = 퐿−1{퐻(푠)}. Your 푠푡푒푝 푠 푖푚푝푢푙푠푒 plots should look very similar to the following plots.