Chapter 15: Active Filters

Example 1, Page 377

In [2]:
import math

#Variable declaration
fc=1000#fc=given cut-off frequency in Hz
A=-56.#A=required gain to be dropped by this much amount in dB
#Also,A=normalized gain of Butterworth filter=|A(jw)/Ao|
f=10*1000#f=given frequency in Hz where the normalized gain is dropped by given amount

#Calculations
#|A(jw)/Ao|=(-20)*n*log10(w/wc) where n=order of the filter
#|A(jw)/Ao|=(-20)*n*log10(f/fc)
n=A/((-20)*math.log10(f/fc))#n=order of Butterworth low-pass filter
print "Order of given filter to be designed is (n)=%.f"%(math.ceil(n))
#As n=3 (from above calculation) we need cascading of first-order section and second-order section
#For n=3
k=0.5#k=damping factor
Ao=3-(2*k)#Ao=DC gain for each op-amp in a given Butterworth Filter to be designed
R1=10*1000#R1=Assumed resistance in ohms
#Ao=(R1+R2)/R1
R2=(Ao*R1)-R1
#fc=1/(2*%pi*R*C)
R=1000#R=Assumed resistance in ohms
C=1/(2*math.pi*R*fc)

#Results
print "The designed values of resistance and capacitance for a low-pass Butterworth filter are:"
print "R1=%.f k ohm"%(R1/1000)
print "R2=%.f k ohm"%(R2/1000)
print "R=%.f k ohm"%(R/1000)
print "C=%.2f uF"%(C/10**-6)
Order of given filter to be designed is (n)=3
The designed values of resistance and capacitance for a low-pass Butterworth filter are:
R1=10 k ohm
R2=10 k ohm
R=1 k ohm
C=0.16 uF

Example 2, Page 378

In [5]:
import math

#Variable declaration
Ao=5#Ao=high frequency gain of a given first-order Butterworth active HP filter
#Ao=(R1+R2)/R1
R1=1000#R1=Assumed resistance in ohms

#Calculations
R2=(Ao*R1)-R1
fc=200#fc=given cut-off frequency in Hz
#fc=1/(2*%pi*R*C)
R=5*1000#R=Assumed resistance in ohms
C=1/(2*math.pi*R*fc)

#Results
print "The designed values of resistance and capacitance for a high-pass Butterworth filter are:"
print "R1=%.f k ohm"%(R1/1000)
print "R2=%.f k ohm"%(R2/1000)
print "R=%.f k ohm"%(R/1000)
print "C=%.2f uF"%(C/10**-6)
The designed values of resistance and capacitance for a high-pass Butterworth filter are:
R1=1 k ohm
R2=4 k ohm
R=5 k ohm
C=0.16 uF

Example 3, Page 378

In [7]:
import math

#Variable declaration
fo=1000.#fo=centre frequency in Hz
f=100#f=bandwidth in Hz

#Calculations
#Q=wo/w=Quality factor
Q=(2*math.pi*fo)/(2*math.pi*f)
C1=0.02*10**-6
C2=0.02*10**-6#C1=C2=Assumed Capacitances in Farad
Ao=2#Ao=gain at the centre frequency
#R1*C1=Q/(wo*Ao) for active band pass Butterworth filter
wo=2*math.pi*fo
R1=Q/(Ao*wo*C1)
R3=Q/(wo*((C1*C2)/(C1+C2)))
Rp=1./((wo**2)*R3*C1*C2)
R2=(R1*Rp)/(R1-Rp)

#Results
print "The designed values of resistance and capacitance for a second order band-pass Butterworth filter are:"
print "R1=%.f k ohm"%(math.ceil(R1/1000))
print "R2=%.f ohm"%(math.floor(R2))
print "R3=%.f k ohm"%(math.ceil(R3/1000))
print "C1=%.2f uF"%(C1/10**-6)
print "C2=%.2f uF"%(C2/10**-6)
The designed values of resistance and capacitance for a second order band-pass Butterworth filter are:
R1=40 k ohm
R2=401 ohm
R3=160 k ohm
C1=0.02 uF
C2=0.02 uF

Example 4, Page 379

In [9]:
import math

#Variable declaration
fo=400#fo=centre frequency in Hz
Q=10#Q=wo/w=Quality factor
C1=0.1*10**-6
C2=0.1*10**-6#C1=C2=Assumed Capacitances in Farad
Ao=2#Ao=gain at the centre frequency

#Calculations
#R1*C1=Q/(wo*Ao) for active band pass Butterworth filter
wo=2*math.pi*fo
R1=Q/(Ao*wo*C1)
R3=Q/(wo*((C1*C2)/(C1+C2)))
Rp=1/((wo**2)*R3*C1*C2)
R2=(R1*Rp)/(R1-Rp)
#Assuming arbitrarily (R6/R5)=10=a
a=10
R6=10*1000#R6=Assumed resistance in ohms
R5=R6/a
R4=R5/Ao

#Results
print "The designed values of resistance and capacitance for a notch filter are:"
print "R1=%.2f k ohm"%(R1/1000)
print "R2=%.f ohm"%R2
print "R3=%.2f k ohm"%(R3/1000)
print "R4=%.f ohm"%R4
print "R5=%.f k ohm"%(R5/1000)
print "R6=%.f k ohm"%(R6/1000)
print "C1=%.1f uF"%(C1/10**-6)
print "C2=%.1f uF"%(C2/10**-6)
The designed values of resistance and capacitance for a notch filter are:
R1=19.89 k ohm
R2=201 ohm
R3=79.58 k ohm
R4=500 ohm
R5=1 k ohm
R6=10 k ohm
C1=0.1 uF
C2=0.1 uF