# Introduction

Analog filter design can be a tedious task, requiring frequency transformations, pages and pages of algebra, and many simulations to check that you are getting the response you designed for. Through the use of Geffe’s algorithm and Delyiannis-Friend circuits, bandpass filter design can be partially automated.

Delyiannis-Friend circuit with unity gain [1]:

The purpose of this post isn’t to detail the specifics behind Geffe’s algorithm, but rather to share with you a python script I wrote that will apply Geffe’s algorithm to a given set of input parameters, and output the required component values for each Friend circuit.

It is required that you have Python3 along with numpy, matplotlib, and scipy installed on your machine. The script can be executed through the Powershell if you are a Windows user by navigating to the directory where the Geffe_Friend_Bandpass.py file is located and then typing: python .\Geffe_Friend_Bandpass.py

# Entering Input Parameters

Upon execution, the python script will prompt you for some input parameters.

You are first asked for the maximum attenuation in the stop bands and the minimum attenuation in the pass band.

Then, you are asked to specify the pass band frequencies (f1 and f2) and one of the stop band frequencies (f3 or f4). The other stop band frequency is solved for automatically. See the following image [1]:

# Parameter Details

The script will then return to you the information you had just entered, along with the minimum order filter required to meet your specifications.

# Butterworth Pole Locations

The locations of the poles are returned in both polar and rectangular format.

# Gain Information

The gain of each stage is normalized to unity, resulting in unity gain at the center frequency.

The script can be tweaked to create a filter/amplifier, or an additional amplifier can be added after the filter.

# Required Resistor and Capacitor Values

The script will automatically calculate reasonable component values for each Friend circuit.

Note that n operational amplifiers (Friend circuits) are required for an nth order filter.

Click on the image to enlarge it, notice how the resistors and capacitors correspond to the output generated by the python script.

This example can be used as a general case, and the same arrangement will arise for any nth order output.

# Auto Generated Bode Magnitude Plot

The script will then call on matplotlib to generate the bode magnitude plot of the filter. Interactive cursors have been added to allow for inspection of the pass and stop band frequencies.

# Plotting in LT Spice (AC Sweep)

Here is the frequency response of the circuit once it had been built in LTSpice:

# Conclusion

So what is this script good for? Let’s say you wanted to build a circuit that required multiple analog bandpass filters, but don’t want to crank out all the math to calculate the component values.

For example, to create an analog audio spectrum analyzer,

you would need 8-10 bandpass filters to select for various bands of the audio spectrum. You could use this script to design 8 bandpass filters very quickly!

# References

[1] E., Van Valkenburg M. Analog Filter Design. New York: Holt, Rinehart, and Winston, 1982. Print.