Chapter 5 :Selected applications of Op Amps

Example 5.1 Page No 120

In [1]:
#Given
Ei = 0.5         #Input voltage
Ri = 1*10**3     #Input resistance in ohm

#Calculation
Im = Ei / Ri     #Meter Current

#Result
print"Meter Current = ", Im*1000,"mA"  
Meter Current =  0.5 mA

Example 5.2 Page No 120

In [2]:
#Given
Efs = 5.0       #Full scale Voltage
Ifs = 50*10**-6 #Full scale Meter Current
#Calculation
Ri = Efs / Ifs  # Input Resistance

#Result
print" Input Resistance =", Ri/1000,"Kohm"
 Input Resistance = 100.0 Kohm

Example 5.3 Page No 122

In [3]:
#Given
Edc = 5.0
Erms = 5.0
Epeak = 5.0
Eptop = 5.0      # Voltages of meters 
Ifs = 50*10**-6  # Full scale Meter Current

#Calculation
Ri1 = Edc / Ifs               # DC Voltmeter
Ri2 = 0.90 * (Erms / Ifs )    # Rms ac voltmeter ( math.sine wave only )
Ri3 = 0.636 * (Epeak / Ifs )  #Peak Reading Voltmeter ( math.sine wave only )
Ri4 = 0.318 * (Eptop / Ifs )  #Peak-to-Peak ac Voltmeter(math.sine wave only)

#Result
print" Ri1 ", Ri1/1000,"kohm"
print" Ri2 =",Ri2/1000 ,"kohm"
print" Ri3 = ", Ri3/1000,"kohm"
print" Ri4 = ", Ri4/1000,"kohm"
 Ri1  100.0 kohm
 Ri2 = 90.0 kohm
 Ri3 =  63.6 kohm
 Ri4 =  31.8 kohm

Example 5.4 Page No 123

In [4]:
#Given
Vo = 10.3         #Voltage across the load resistor
Ei = 5.0          #Input voltage
Ri = 1*10**3      #Input Resistance

#calculation
I = Ei / Ri  #Zener Current
Vt = Vo - Ei  #Zener Voltage

#Result
print" Zener Current = ", I,"A"
print" Zener Voltage = ", Vt ,"V"
 Zener Current =  0.005 A
 Zener Voltage =  5.3 V

Example 5.5 Page No 124

In [4]:
#Given
Ei = 1.0        #Reference voltage
Ri = 1*10**3    #Input Resistance
Vo = 0.6       #Outpur Voltage

#Calculation
I = Ei / Ri   #Diode Current
Vdiode = Vo 

#Result
print" Diode Current = ", I*1000 ,"mA"
print" Voltage drop across the diode = ", Vdiode,"V"
 Diode Current =  1.0 mA
 Voltage drop across the diode =  0.6 V

Example 5.6 Page No 127

In [5]:
#Given
R = 10*10**3     #Resistance
E2 = 0           #Source across negative terminal
Rl = 5*10**3     # Load Resistance
E1 = 5.0           # source across positive terminal

#calculation
Il = (E1 - E2)/R  #Load Current
Vl = Il * Rl  # Voltage across Rl 
Vo = (2*Vl)-E2  #Output voltage

#Result
print"(a) Load current across Rl = " , Il*1000 ,"mA"
print"(b) Voltage across load resistance = " , Vl,"V"
print"(c) Output Voltage = ", Vo ,"V"
(a) Load current across Rl =  0.5 mA
(b) Voltage across load resistance =  2.5 V
(c) Output Voltage =  5.0 V

Example 5.7 Page No 127

In [6]:
#Given
R = 10*10**3      #Resistance
E2 = 5.0          #Source across negative terminal
Rl = 5*10**3      # Load Resistance
E1 = 0            # source across positive terminal

#Calculation
Il = (E1 - E2)/R  #Load Current
Vl = Il * Rl      # Voltage across Rl 
Vo = (2*Vl)-E2    #Output voltage

#Result
print"(a) Load current across Rl =  " , Il*1000,"mA"
print"(b) Voltage across load resistance = " , Vl,"V"
print "(c) Output Voltage = ", Vo ,"V"
(a) Load current across Rl =   -0.5 mA
(b) Voltage across load resistance =  -2.5 V
(c) Output Voltage =  -10.0 V

Example 5.8 Page No 132

In [7]:
#Given
Vo = 5.0         #Output Voltage
Rf = 100*10**3   #Feedback Resistance

#calculation
Isc = Vo / Rf    #Short Circuit Current

#Result
print" Short Circuit Current = " , Isc*10**6,"microA"
 Short Circuit Current =  50.0 microA

Example 5.9 Page No 132

In [11]:
#Given 
Rf = 10*10**3      #Feedback Resistance
I = 10*10**-6      #Current through Photo Detector

#calculation
Vo = Rf * I       #Vo for Dark Condition
I1 = 1*10**-3     #Current in presence of sunlight
Vo1 = Rf * I1     #output voltage in light condition

#Result
print"(a)Output Voltage for dark Condition =  ", Vo,"V"
print"(b) Output voltage in light condition =  ", Vo1,"V"
(a)Output Voltage for dark Condition =   0.1 V
(b) Output voltage in light condition =   10.0 V

Example 5.10 Page No 133

In [13]:
#Given
Rf = 100*10**3 #Feedback Resistance
Il1 = 1*10**-6  #Load current 1

#calculation
Vo1 = Rf * Il1  #Output voltage in photo detector
Il2 = 50*10**-6  # Load  current 2
Vo2 = Rf * Il2  #Output Voltage in photo detector

#Result
print" (a)Output Voltage in photo detector for Il1 =  ",Vo1 ,"V"
print " (b)Output Voltage in photo detector for Il2 =  ",Vo2 ,"V"
 (a)Output Voltage in photo detector for Il1 =   0.1 V
 (b)Output Voltage in photo detector for Il2 =   5.0 V

Example 5.11 Page No 134

In [8]:
#Given
R = 1*10**3
R1 = 99*10**3  

#calculation
m = R1 / R        #multiplier
Isc = 10*10**-6   #Current on short-circuit condition
Il = (1 + m)*Isc 

#result
print" Load current = ", Il*1000,"mA"
 Load current =  1.0 mA

Example 5.12 Page No 136

In [1]:
#Given
Im = 100*10**-6     #Meter current 
Isc = 0.5           # Current in short-circuit condition
Rf = 20             # Feedback resistance
Rm = 0.8*10**3     #Meter resistance

#calculation
d = Isc / Im      #Current divider
R1 = d * Rf 
Rscale = R1 - Rm 

#Result
print" Resistance dRf = ", R1/1000 ,"kohm"
print" Rscale = ", Rscale/1000,"kohm"
 Resistance dRf =  100.0 kohm
 Rscale =  99.2 kohm

Example 5.13 Page No 138

In [1]:
#Given
f = 10**3  #Frequency of Ei in Hz
Ci = 0.01*10**-6  

#Calculation
import math
m = math.tan(math.pi/4)
Ri = m / (2*math.pi*f*Ci)

#result
print" Value of Ri = ",round(Ri/1000,1),"kohm"
 Value of Ri =  15.9 kohm

Example 5.14 Page No 138

In [3]:
#Given
f = 10**3 
Ri = 100*10**3  
Ci = 0.01*10**-6

#calculation
import math
phaseangle = 2*math.atan(2*math.pi*f*Ri*Ci)

#result
print" Phase angle  =", round(phaseangle*180/3.14,2),"degree"
 Phase angle  = 162.0 degree

Example 5.15 Page no 143

In [2]:
#Given
#From fig 5-14(a) and b
Ei=2      #V, voltage
Vf=4      #Vf force

#Calculation
Vo=-2*Ei     #Vo forces
Vcap=3*Ei

#Result
print"Vo is",Vo,"V"
print"Vcap is",Vcap,"V"
Vo is -4 V
Vcap is 6 V

Example 5.16 Page no 144

In [3]:
#Given
Ei=4    #V
Vo=8    #V

#Calculation
Vr=-Vo
Vcap=Ei+Vo

#Result
print"Vcap is",Vcap,"V"
Vcap is 12 V

Example 5.17 Page no 144

In [6]:
#Given
Ri=1*10**5
C=10**-6

#Calculation
T=3*Ri*C
Et=5*T

#Result
print"Equilibrium Time is",Et,"s"
Equilibrium Time is 1.5 s

Example 5.18 Page no 146

In [7]:
#given
Ci=0.1*10**-6      #capacitance, farady
Ci_=0.1            #microF
f=1000             #frequency
#Calculation
import math
Ri=1/(2*math.pi*f*Ci)
Rf=20/(2*math.pi*f*Ci)
Cf=1/(2*math.pi*f*Rf)
#a=0.4*math.sin(2*math.pi*1000*t)
#Vo=-Cf*Ci*a

from sympy import *
import numpy as np
t = Symbol('t')
y = -Rf*Ci_/10**6*0.4*sin(2*math.pi*1000*t)
y_ = y.diff(t)

#Reslt
print Ci_
print"a)Rf is ",round(Rf/1000,1),"kohm"
print"Cf is ",round(Cf*10**6,9),"microF"
print"(b)Output voltage is ",y_,"V"

#NOTE: Answer is same .In the book it is written 2*math.pi*1000  .
0.1
a)Rf is  31.8 kohm
Cf is  0.005 microF
(b)Output voltage is  -8.0*cos(6283.18530717959*t) V