Chapter6 - Oscillators and waveform generators

Ex 6.1 - page 170

In [3]:
from __future__ import division
from math import pi, sqrt, ceil
f0=600 #Hz#Oscillating Frequency
print "Various design parameters are :-"
C=0.05 #micro F#Chosen for the design
print "Capacitance = %0.2f micro F" %C
R=1/(2*pi*f0*sqrt(6)*C*10**-6) #ohm
R=R/1000 #kohm
print "Resistance R = %0.1f kohm" %R
#To avoid loading effect
Ri=10*R #kohm#Ri>=10*R
Ri=ceil(Ri) #kohm
print "Resistance Ri = %0.1f kohm" % Ri
Rf=29*Ri #kohm#Rf>=29*Ri
print "Resistance Rf = %0.1f kohm" %Rf
Rf=640 #kohm
#Balancing the circuit
Rom=Rf*Ri/(Rf+Ri) #kohm
Rom=ceil(Rom) #kohm
print "Resistance Rom = %0.1f kohm" %Rom
Various design parameters are :-
Capacitance = 0.05 micro F
Resistance R = 2.2 kohm
Resistance Ri = 22.0 kohm
Resistance Rf = 638.0 kohm
Resistance Rom = 22.0 kohm

Ex 6.3 - page 181

In [6]:
from __future__ import division
from math import pi
f0=12 #kHz#Oscillating Frequency
print "Various design parameters are :-"
C=0.01 #micro F#Chosen for the design between 0.01 & 1 micro F
print "Capacitance = %0.2f micro F " % C
R=1/(2*pi*f0*1000*C*10**-6) #ohm
R=R/1000 #kohm
print "Resistance R = %0.1f kohm" %R
Ri=3*R/2 #kohm#Ri>=3*R/2
print "Resistance Ri = %0.2f kohm" %Ri
Ri=2.2 #kohm
Rf=2*Ri #kohm
print "Resistance Rf = %.1f kohm" %Rf
Various design parameters are :-
Capacitance = 0.01 micro F 
Resistance R = 1.3 kohm
Resistance Ri = 1.99 kohm
Resistance Rf = 4.4 kohm

Ex 6.5 - page 184

In [10]:
from __future__ import division
from math import pi
f0=2 #kHz#Oscillating Frequency
print "Various design parameters are :-"
C=0.05 #micro F#Chosen for the design
print "Capacitance = %0.2f micro F " %C
R=1/(2*pi*f0*1000*C*10**-6) #ohm
R=R/1000 #kohm
print "Resistance R = %0.1f kohm " %R 
Ri=3*R/2 #kohm#Ri>=3*R/2
print "Resistance Ri = %0.1f kohm " %Ri 
Rf=2*Ri #kohm
print "Resistance Rf = %0.1f kohm " %Rf 
Various design parameters are :-
Capacitance = 0.05 micro F 
Resistance R = 1.6 kohm 
Resistance Ri = 2.4 kohm 
Resistance Rf = 4.8 kohm 

Ex 6.6 - page : 184

In [12]:
from __future__ import division
from math import pi
#Data given
R1=1 #kohm
R2=1 #kohm
R=1 #kohm
C=4.7 #micro F
f0=1/(2*pi*R*10**3*C*10**-6) #Hz#Oscillating Frequency
print "Oscillation frequency = %0.2f Hz " %f0 
Oscillation frequency = 33.86 Hz 

Ex 6.7 - page : 188

In [19]:
from __future__ import division
f0=200 #Hz#Oscillating Frequency
print "Various design parameters are :-" 
C=0.05 #micro F#Chosen for the design
print "Capacitance = %0.2f micro F " %C 
R=0.159/(f0*C*10**-6) #ohm
R=R/1000 #kohm
print "Resistance R = %0.1f kohm " %R 
R=510 #kohm
C1=C;C2=C;C3=C #micro F
print "Capacitance C1 = C2 = C3 = %0.2f micro F " %(C3) 
R2=R;R3=R #kohm
print "Resistance R2 = %0.1f kohm, R3 = %0.1f kohm " %(R3,R2)
#Answer for R is calculated wrong in the textbook.
Various design parameters are :-
Capacitance = 0.05 micro F 
Resistance R = 15.9 kohm 
Capacitance C1 = C2 = C3 = 0.05 micro F 
Resistance R2 = 510.0 kohm, R3 = 510.0 kohm 

Ex 6.8 - page : 189

In [21]:
from __future__ import division
Rf=570 #kohm
Ri=15 #kohm
A=Rf/Ri #Gain of the circuit
Amin=29 #Minimum Gain requirement of RC phase shift oscillator
deltaA=(A-Amin)/Amin*100 #%(Exceeding Gain)
print "Gain is exceeded by %0.f %% " %deltaA 
Gain is exceeded by 31 % 

Ex 6.9 - page : 192

In [23]:
from __future__ import division
from math import pi, sqrt
print "Part (a)"
L1=25 #micro H
L2=10 #micro H
Rf=22 #kohm
C=0.01 #micro F
LT=L1+L2 #micro H
fr=1/(2*pi*sqrt(C*10**-6*LT*10**-6)) #Hz
fr=fr/1000 #kHz
f0=fr #/kHz
print "Oscillation frequency = %0.1f kHz " %f0 
Ri=Rf/(L1/L2) #kohm
print "Resistance Ri = %0.1f kohm " %Ri 
print "Part (b)"
C1=220 #pF
C2=680 #pF
Rf=22 #kohm
L=1 #mH
CT=C1*C2/(C1+C2) #pF
fr=1/(2*pi*sqrt(L*10**-3*CT*10**-12)) #Hz
fr=fr/1000 #kHz
f0=fr #/kHz
f0=round(f0) #kHz
print "Oscillation frequency = %0.1f kHz " %f0
Ri=Rf/(C1/C2) #kohm
print "Resistance Ri = %0.1f kohm " %Ri
Part (a)
Oscillation frequency = 269.0 kHz 
Resistance Ri = 8.8 kohm 
Part (b)
Oscillation frequency = 390.0 kHz 
Resistance Ri = 68.0 kohm 

Ex 6.10 - page : 198

In [26]:
from __future__ import division
f0=1 #/kHz
Vsat=14 #V
print "Various design parameters are :-"
C1=0.05 #micro F#Chosen for the design
print "Capacitance = %0.2f micro F " %C1
Rf=1/(2*f0*10**3*C1*10**-6)/1000 #kohm
print "Resistance Rf = %0.1f kohm " %Rf 
#R2=0.86*R1 and Rf=R1||R2
R2byR1=0.86 #from R2=0.86*R1 
R2=Rf*(1+R2byR1) #kohm
R1=R2/R2byR1 #kohm
print "Resistance R1 = %0.1f kohm " %R1 
print "Resistance R2 = %0.1f kohm " %R2 
Various design parameters are :-
Capacitance = 0.05 micro F 
Resistance Rf = 10.0 kohm 
Resistance R1 = 21.6 kohm 
Resistance R2 = 18.6 kohm 

Ex 6.11 - page 199

In [28]:
from __future__ import division 
from math import log
T=10 #ms#(Time period)
f0=1/(T*10**-3) #Hz
C=0.05 #micro F#Chosen for the design
#Formula : f0=1/{2*Rf*C*log(1+2*R2/R1)}
Rf=1/(f0*2*C*10**-6*log(1+2))/1000 #kohm#By putting R1=R2 for this case
Rf=round(Rf) #kohm
print "Resistance Rf = %0.1f kohm " %Rf 
print "Capacitance for the design is %0.2f micro F " %C 
Resistance Rf = 91.0 kohm 
Capacitance for the design is 0.05 micro F 

Ex 6.12 - page : 200

In [30]:
from __future__ import division 
from math import log
R1=4.7 #kohm
R2=3.3 #kohm
Rf=2 #kohm
C=0.1 #micro F
f0=1/2/(Rf*1000)/(C*10**-6)/log(1+2*R2/R1)/1000 #kHz
print "Frequency of output signal is %0.2f kHz " %f0 
Frequency of output signal is 2.85 kHz 

Ex 6.13 - page : 204

In [32]:
from __future__ import division 
f0=1.5 #kHz
Vout=6 #V##peak to peak
Vsat=13.5 #V
print "Various design parameters are : "
R2=10 #kohm#/choosen for the design
R1=R2*2*Vsat/Vout #kohm
print "R1 = %0.2f kohm " %R1 
print "R2 = %0.2f kohm " %R2 
#Let Cf=0.05 micro F for the design
Cf=0.05 #micro F
print "Cf = %0.2f micro F " %Cf 
Ri=R1*1000/(f0*1000)/4/(Cf*10**-6*R2*1000)/1000 #kohm
print "Ri = %0.2f kohm " %Ri 
Various design parameters are : 
R1 = 45.00 kohm 
R2 = 10.00 kohm 
Cf = 0.05 micro F 
Ri = 15.00 kohm 
In [34]:
#Ex 6.14
from __future__ import division 
#Data given
R1=6.8 #kohm
Ri=100 #kohm
R2=1.5 #kohm
Cf=0.01 #micro F
Vsat=14 #V
Vo_pp=2*R2/R1*Vsat #V##Peak to peak output of triangular wave
print "Peak to peak output of triangular wave is %0.1f V " %Vo_pp
f0=R1*1000/(4*Ri*10**3*Cf*10**-6*R2*10**3)/1000 #kHz#Oscillating Frequency
print "Oscillation frequency is %0.2f Hz" %f0
Peak to peak output of triangular wave is 6.2 V 
Oscillation frequency is 1.13 Hz

Ex 6.15 - page : 205

In [35]:
from __future__ import division 
#Data given
f0=1 #kHz
Vo_pp=7 #V
Vsat=14 #V
print "Various design parameters are :-"
#Let R2=10 #kohm for the design
R2=10 #kohm
R1=2*R2*Vsat/Vo_pp #kohm
print "R1 = %0.2f kohm " %R1 
print "R2 = %0.2f kohm " %R2 
#Choose Cf=0.1 micro F for the design
Cf=0.1 #micro F
print "Cf = %0.2f micro F " %Cf 
Ri=R1*10**3/(4*f0*10**3*Cf*10**-6*R2*10**3)/1000 #kohm
print "Ri = %0.2f kohm " %Ri 
Various design parameters are :-
R1 = 40.00 kohm 
R2 = 10.00 kohm 
Cf = 0.10 micro F 
Ri = 10.00 kohm 

Ex 6.16 - page : 208

In [40]:
from __future__ import division 
from math import log
#Data given
tau=1 #ms(time period)
R1byR2_min=1.8 # min R1/R2
R1byR2_max=9 # max R1/R2
Beta_min=1/(1+R1byR2_min) #minimum value of Beta
Beta_max=1/(1+R1byR2_max) #maximum value of Beta
Tmax=2*tau*log((1+Beta_min)/(1-Beta_min)) #ms##For minimum value of Beta
fmin=1/(Tmax*10**-3) #Hz
Tmin=2*tau*log((1+Beta_max)/(1-Beta_max)) #ms##For maximum value of Beta
fmax=1/(Tmin*10**-3)/1000 #kHz
print "Frequency range is %d Hz to %0.1f kHz." %(fmin, fmax)
Frequency range is 669 Hz to 2.5 kHz.

Ex 6.17 : page 211

In [42]:
from __future__ import division 
from math import sqrt, pi
#Data given
Ls=3 #H
Cs=0.05 #pF
Rs=2 #kohm
Cm=10 #pF
fS=1/2/pi/sqrt(Ls*Cs*10**-12)/1000 #kHz
print "Series resonant frequency is %0.f kHz " %fS 
CT=Cm*Cs/(Cm+Cs) #pF##Equivalent capacitance
fP=1/2/pi/sqrt(Ls*CT*10**-12)/1000 #kHz
print "Parallel resonant frequency is %0.f kHz " %fP 
Series resonant frequency is 411 kHz 
Parallel resonant frequency is 412 kHz 

Ex 6.18 - page : 220

In [44]:
from __future__ import division 
#Data given
f0=5 #kHz
D=60 #%##duty cycle
VCC=12 #V
#As D=t1/(t1+t2)
t2BYt1=1/(D/100)-1 #ratio of t1 & t2
#RB/(2*RA-RB)=t2/t1
RAbyRB=(1/t2BYt1+1)/2 #Ratio of RA & RB
print "Various design parameters are :"
#Let CT=0.05 micro F for this design choosing between 0.01 & 1 microo F
CT=0.05 #micro F
print "CT = %0.2f micro F " %CT 
RA=1/(f0*10**3)/(5/3)**2/(CT*10**-6)/1000 #kohm
print "RA = %0.2f kohm " %RA
RB=RA/RAbyRB #kohm
print "RB = %0.2f kohm " %RB
Various design parameters are :
CT = 0.05 micro F 
RA = 1.44 kohm 
RB = 1.15 kohm 

Ex 6.19 - page : 225

In [49]:
from __future__ import division 
#Data given
Rf=15 #kohm
RT1=4.7 #kohm
R1=56 #kohm
R2=6.8 #kohm
R3=10 #kohm
R4=1 #kohm
R5=1 #kohm
CB=1 #micro F
CT=0.05 #mic
VCC=15 #V
V1=-15 #V##Voltage given through the resistance(R1) 56 kohm
print "Part (i)"
Vin=2 #V
Vo=Rf/R1*(-V1)-Rf/R2*Vin #V
print "Voltage Vo = %0.3f V " %Vo 
N_VCC=0 #V##-VCC##voltage given to the 12th pin of IC
V7=N_VCC+3 #V
print "Voltage V7 = %0.2f V " %V7
I=(V7-Vo)/RT1 #mA
print "Current I = %0.2f mA " %I 
Rmult=R4*R5/(R4+R5)+R3 #kohm##on pin 3
print "Total resistance on pin 3, Rmult = %0.2f kohm " %Rmult
f0=0.32*I*10**-3/(CT*10**-6)/1000 #kHz
print "Oscillation frequency is %0.1f kHz " %f0
print "Part (ii)"
Vin=5 #V
Vo=Rf/R1*(-V1)-Rf/R2*Vin #V
print "Voltage Vo = %0.f V " %Vo 
N_VCC=0 #V##-VCC##voltage given to the 12th pin of IC
V7=N_VCC+3 #V
print "Voltage V7 = %0.f V " %V7 
I=(V7-Vo)/RT1 #mA
print "Current I = %0.2f mA " %I 
Rmult=R4*R5/(R4+R5)+R3 #kohm##on pin 3
print "Total resistance on pin 3, Rmult = %0.2f kohm " %Rmult 
f0=0.32*I*10**-3/(CT*10**-6)/1000 #kHz
print "Oscillation frequency is %0.2f kHz" %f0
Part (i)
Voltage Vo = -0.394 V 
Voltage V7 = 3.00 V 
Current I = 0.72 mA 
Total resistance on pin 3, Rmult = 10.50 kohm 
Oscillation frequency is 4.6 kHz 
Part (ii)
Voltage Vo = -7 V 
Voltage V7 = 3 V 
Current I = 2.13 mA 
Total resistance on pin 3, Rmult = 10.50 kohm 
Oscillation frequency is 13.63 kHz