Skip to content

freq0ut/BandpassGeffesAlgorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bandpass-Geffes-Algorithm

Click here for my Blog post on Geffe's Algorithm Python Script

Introduction

Analog filter design can be a tedious task, requiring frequency transformations, pages and pages of algebra (which is prone to calculation errors), and many simulations to check that you are getting the response you expected to. Through the use of Geffe’s algorithm and Delyiannis-Friend circuits, bandpass filter design can be partially automated. 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.

It is required that you have Python 3 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 [taken from M.E. Van Valkenburg's Analog Filter Design]:

Input

Input

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.

Parameter Details

Butterworth Pole Locations

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

Butterworth Poles

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.

Gain Picture

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.

Resistor and Cap Output

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

Schematic

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

Auto Generated Bode Magnidute 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.

Plot Output

LT Spice AC Sweep

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

LTSpice Plot Output

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!

LTSpice Plot Output

LTSpice Plot Output

Click here for the Python Script

-Zack

About

Python program for bandpass filter design

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages