# Chapter 2 : Operational Amplifier¶

## Example 2.1 Page No.44¶

In [2]:
# Given Data

R1 = 5*10**3
Rf = 20*10**3
vi = 1
RL = 5*10**3

# calculating the values
vo = float((1+(Rf/R1))*vi)
ACL = int(vo/vi)
iL = int((vo/RL)*10**3)
i1 = float(((vo - vi)/Rf))*(10**3)
io = iL+i1

# printing the values
print "Output voltage vo = ",vo,"V"
print "Gain ACL          = ",ACL
print "Load current iL   = ",iL,"mA"
print "The value of i1   = ",i1,"mA"
print "Output current io = ", io,"mA"

Output voltage vo =  5.0 V
Gain ACL          =  5
Load current iL   =  1 mA
The value of i1   =  0.2 mA
Output current io =  1.2 mA


## Example 2.2 Page No.44¶

In [3]:
# Given data

R1 = 10*10**3      #R1 input resistance
Rf = 100*10**3     # Rf feedback resistance
vi = float(1)          #input voltage
RL = 25*10**3
#calculating the values

i1 = float((vi/R1)*10**3)                 # input resistace id the ratio of input voltage to the input resitance
vo = float(-(Rf/R1)*vi)            # finding the output voltage
iL = float((abs(vo)/RL)*10**3)                  #  calculating the load current
io = float((i1+iL))                 # calculating the output current which is equal to the sum of input current and load current

#printing the values

print "The input current i1  =",i1,"mA"
print "The output voltage vo =",vo,"V"
print "The load current iL   =",iL,"mA"
print "The output current io =",io,"mA"

The input current i1  = 0.1 mA
The output voltage vo = -10.0 V
The load current iL   = 0.4 mA
The output current io = 0.5 mA


## Example 2.3 Page No.49¶

In [4]:
# Given data

ACL = 5     # Gain of the amplifier
R1 = 10*10**3 # input resisitance in ohms

# calculations

Rf = (5-1) * R1 # calculating the resistance of feedback resistor

# printing the values

print "The value of feedback resistor = ", (Rf/10**3),"KiloOhms"

The value of feedback resistor =  40 KiloOhms


## Example 2.4 Page No.49¶

In [6]:
# Given Data

R1 = 5*10**3
Rf = 20*10**3
vi = 1
RL = 5*10**3

# calculating the values
vo = float((1+(Rf/R1))*vi)
ACL = int(vo/vi)
iL = int((vo/RL)*10**3)
i1 = float(((vo - vi)/Rf))*(10**3)
io = iL+i1

# printing the values
print "Output voltage vo = ",vo,"V"
print "Gain ACL          = ",ACL
print "Load current iL   = ",iL,"mA"
print "The value of i1   = ",i1,"mA"
print "Output current io = ", io,"mA"

Output voltage vo =  5.0 V
Gain ACL          =  5
Load current iL   =  1 mA
The value of i1   =  0.2 mA
Output current io =  1.2 mA


## Example 2.6 Page No.61¶

In [7]:
# Given Data
from decimal import Decimal, ROUND_HALF_UP
import math
Beta = 200
ICQ = 100*10**-6
CMRR = 80

# finding the solution
# for VT =25 milli volt
VT = 25*10**-3
gm = float(ICQ/VT)
CMRR = 10**(80/20) # log inverse is equal to powers of 10
RE = float((CMRR-1)/gm)
x = Decimal((RE/10**6))

# printing the values

print " The value of gm =",int(math.ceil((gm*10**3))),"mMho"            #converting the answer into milli Mho
print " The value of Rc =",int((Rc/10**3)),"kiloOhm"         #converting the answer into Kilo Ohm
print " The value of RE =", x.quantize(Decimal('2.5')),"MegaOhm"         #converting the answer into MegaOhm

 The value of gm = 4 mMho
The value of Rc = 25 kiloOhm
The value of RE = 2.5 MegaOhm


## Example 2.7 Page No.61¶

In [8]:
import math
# Given Data
RC = 2*10**3
RE = 4.3*10**3
VCC = VEE = 5
beta0 = 200
VBE = 0.7
VT = 25*10**-3                                  # VT = 25 mV

#calculations

Ibq  = (((VEE - VBE)/(2*(1+beta0)*RE)))*10**6   # converting the into mA
IBQ = int(Ibq*10)/10.0                          # rounding the answer 2.48 to 2.4
ICQ = beta0 * IBQ*10**-3                        # finding ICQ and convert it into milli Ambere
V01 = V02 = VCC - (RC * ICQ*10**-3)
VCEQ = V01 + VBE
gm = ICQ / VT                                   # Finding the gm value in milli Mho
rpi = float(beta0/gm)                           # finding rpi interms of KiloOhms
ADM = -(gm*RC)/10**3                            # Calculating the gain
ACM = float((-beta0*RC)/(rpi*10**3 + (2*beta0) * RE)) # Calulating the value of ACM and coverting it into a float
CMRR = float(round(ADM,2)/round(ACM,2))               # rounding ACM and ADM to 2 digits after decimals and taking the
#ratio
CMRRdb = float(20*math.log10(round(CMRR,1)))          # Find the CMRR in dB using equation 20*log(CMRR)

# Printing all values

print "The IBQ        =",IBQ,"uA"
print "The ICQ        =",ICQ,"mA"
print "The V01        =",V01,"mV"
print "The VCEQ       =",VCEQ,"V"
print "The gm         =",gm,"m Mho"
print "The rpi        =",round(rpi,1),"kilo Ohm"
print "The ACM        =",round(ACM,2)
print "The CMRR       =",round(CMRR,1)
print "The CMRR in dB =",int(CMRRdb*10)/10.0,"dB"


The IBQ        = 2.4 uA
The ICQ        = 0.48 mA
The V01        = 4.04 mV
The VCEQ       = 4.74 V
The gm         = 19.2 m Mho
The rpi        = 10.4 kilo Ohm
The ADM        = -38.4
The ACM        = -0.23
The CMRR       = 167.0
The CMRR in dB = 44.4 dB


## Example 2.8 Page No.62¶

In [9]:
# v1 = 15*sin*2*pi(60)t + 5*sin*2*pi(1000)t mV
# v1 = 15*sin*2*pi(60)t - 5*sin*2*pi(1000)t mV

# Given data

gm = 4*10**-3
RC = 125*10*3
RE = 1.25*10**3
beta0 = 200

# calculating the values

rpi = beta0/gm              # value is in ohms
ADM =-500                   # Given Value
ACM = -((200*RC)/(402*RE)+rpi)*10**-6
print "ACM is =",round(ACM,2)

# derivation part is as follows
# VDM = (v1 - v2)/2 = 5*sin*2*pi(1000)*t
# VCM = (v1 - v2)/2 = 15*sin*2*pi(60)*t
# VO1 = ADM*VDM + ACM*VCM
# VO2 = ADM*VDM - ACM*VCM
# V01 = -2500*sin*2*pi(1000)t - 0.75*sin*2*pi(60)t mV
# V01 =  2500*sin*2*pi(1000)t - 0.75*sin*2*pi(60)t mV

ACM is = -0.05


## Example 2.9 Page No.63¶

In [10]:
import math
from fractions import Fraction
# Given data

beta0 = 100
IQ = 5*10**-4
RC = 10*10**3
RE = 150
VT = 25*10**-3

# calculations

ICQ = float(IQ/2)
gm  = float(ICQ / VT)
rpi = beta0/gm
# calculaing the gain in Differential mode
# To get the differentila mode gain multiply the value by 2

# print the values

print "ICQ value is =",ICQ*10**3,"mA"
print "gm value is  =",Fraction(gm).limit_denominator(100),"Mho"
print "rpi value is =",int(rpi/10**3),"kilo Ohm"
print "THe gain is  =",int(math.ceil(ADM2)),"V/V"

ICQ value is = 0.25 mA
gm value is  = 1/100 Mho
rpi value is = 10 kilo Ohm
THe gain is  = 40 V/V


## Example 2.10 Page No.67¶

In [12]:
# Given Data
VCC = 10.0                  # initializing as floats
beta = 125.0
VBE = 0.7

# calculations
# Define a function for calculating the value of R1 according to the equation given in 2.67
def R1(I):
R1 = (beta/(2+beta))*((VCC-VBE)/I)
return (R1/1000)
# Cosisdering Ic = 1mA
print "The value of R1 when I is 1 mA  = ",round(R1(10**-3),2),"Kilo Ohm"           # calling the function R1 with arguiment as current value 1 mA
print "The value of R1 when I is 10 uA = ",int(round(R1(10*10**-6),0)),"Kilo Ohm"  # calling the function R1 with arguiment as current value 10 uA

The value of R1 when I is 1 mA  =  9.15 Kilo Ohm
The value of R1 when I is 10 uA =  915 Kilo Ohm


## Example 2.11 Page No.69¶

In [13]:
# Given data
import math
I0 = 10*10**-6
VCC =10
VBE = 0.7
beta = 125
VT = 25*10**-3

# Solution of the problem is
Iref = 10**-3 # Assumption

R1 = (VCC - VBE)/Iref
# Finding the value RE from the equation 2.74
RE = (VT/(1+(1/beta)*I0))*math.log(Iref/I0)

# printing the values

print "The value of R1 =",R1/10**3,"Kilo Ohms"
print "The value of RE =",round(RE*100,1),"Kilo Ohms"

The value of R1 = 9.3 Kilo Ohms
The value of RE = 11.5 Kilo Ohms


## Example 2.13 Page No.74¶

In [15]:
# Given data

VCC = 10.0
beta = 100
VBE = 0.7
RE = 10*10**3

# solution
# fom the KVL loop1
Iref = ((VCC - VBE)/RE)   # Finding the Iref
# Assuming the transistor are identical
# Iref = 2IE
# IE = IC + IB
IC = (beta*Iref/(2*(1+beta)))
I0 = IC
#Displaying the values

print "The value of Iref =",Iref*10**3,"mA"             # Converting the value into mA
print "The value of IC   =",round(IC*10**3,2),"mA"      # Converting the value into mA and rounding the answer
print "The value of I0   =",round(I0*10**3,2),"mA"      # Converting the value into mA and rounding the answer

The value of Iref = 0.93 mA
The value of IC   = 0.46 mA
The value of I0   = 0.46 mA


## Example 2.14 Page No.75¶

In [16]:
# Given data

VCC = 12.0
Rref = 15*10**3
R1 = 2.8*10**3
beta = 200
VBE = 0.7
V0 = 6.0

#Calculations
#Calculations for finding the IC1 and IC2
Iref = (VCC - VBE)/Rref
I1 = VBE / R1
IC1 = (Iref - I1)/(1+(2/beta))
IC2 = IC1 # Due to mirror effect
RC = (VCC - V0)/IC1

# Displaying the values

print "The value of Iref  =",round(Iref*10**3,2),"mA"             # convert into milli amps and rounding the output
print "The value of I1    =",round(I1*10**3,2),"mA"               # convert into milli amps and rounding the output
print "The value of IC1   =",round(IC1*10**3,1),"mA"              # convert into milli amps and rounding the output
print "The value of Rc    =",int(round(RC*10**-3,0)),"Kilo Ohm"   # convert into kilo Ohms and rounding the output

The value of Iref  = 0.75 mA
The value of I1    = 0.25 mA
The value of IC1   = 0.5 mA
The value of Rc    = 12 Kilo Ohm


## Example 2.15 Page No.75¶

In [17]:
# Given data

VCC = 10.0
VBE = 0.75
R1 = 4.7*10**3

# solution
# I is approximately equals to Ic(2 + (1/beta)), since 1/beta is a small value its considerd as 2Ics
I = (VCC - VBE)/R1
# IE3 is approxiamtly equal to IC3 = I/2
#finding the value of IC
IC = I /2
print " The value of I  =",round(I*10**3,2),"mA"
print " The value of IC =",round(IC*10**3,2),"mA"

 The value of I  = 1.97 mA
The value of IC = 0.98 mA


## Example 2.16 Page No.80¶

In [18]:
# Given data
VCC = 15.0
VBE = 0.7
R = 10*10**3
RC2 = 5*10**3
# consider beta is a large value
I = (VCC - VBE)/R
IC1 = IC2 = I
#V12 = V1 - V2
V12 = VBE + IC2 * RC2

# displaying the values
print "The value of I        =",round(I*10**3,2),"mA"
print "The value of V1 - V2  =",V12,"V"

The value of I        = 1.43 mA
The value of V1 - V2  = 7.85 V


## Example 2.17 Page No.83¶

In [20]:
import math
# Given data

VEE = 6.0
VCC = 6.0
VD = VD1 = VD2 = VD3 = VD4 = 0.7
R5 = 3.2*10**3
R4 = 1.5*10**3
VBE1 = VBE2 =VBE3 = VBE4 = VBE5 = VBE6 = VBE7 = VBE8 = 0.7
R1 = 2.2*10**3
R2 = 7.75*10**3
R3 = 5.2*10**3
R6 = 1.5*10**3
R7 = 3*10**3
R8 = 3.4*10**3
R9 = 6*10**3
R10 =30*10**3
hfe = 100
VT = 26*10**-3

# Solution for part A

VBN1 = round((-VEE+VD+VD)*R5/(R4+R5),2)
I1 = (VEE+VBN1-VBE1)/R1
IQ = I1  # If the base current of Q1 is neglected
IC2 = IC3 = IQ2 = round(IQ/2,6)
VC2 = VC3 = round((VCC - R2*IC2),2)
VE4 = VC2 - VBE4
I6 = round(VE4/R6,6)
IC4 = IC5 = round((I6/2),6)
VC5 = round(VCC - IC5*R7,2)
VE6 = round(VC5 - VBE6,2)
IC7 = I8 = round((VEE - VD3)/R8,5)
VB8 = VBE8 + VD4 - VEE
I9 = round((VE6 - VB8)/R9,5)
I10 = IC7 - I9
Vo = (I10 * R10) + VB8
V0 = int(Vo)         # Vo value is assumed to be very small

# Displaying the values
print "PART A"
print "=================="
print "the value of VBN1 =",VBN1,"V"
print "The value of I1   =",I1*10**3,"mA"
print "The value of IQ   =",IQ*10**3,"mA"
print "The value of IC2  =",IC2*10**3,"mA"
print "The value of VC3  =",VC3,"V"
print "The value of VE4  =",VE4,"V"
print "The value of IC4  =",IC4*10**3,"mA"
print "The value of VC5  =",VC5,"V"
print "The value of VE6  =",VE6,"V"
print "The value of IC7  =",IC7*10**3,"mA"
print "The value of VB8  =",VB8,"V"
print "The value of I9   =",I9*10**3,"mA"
print "The value of I10  =",I10*10**3,"mA"
print "The value of V0   =",V0,"V"

# Solution for part B
VT = 26*10**-3                #the volt equivalent of temperature
IC2 = IC3 = IC4 = IC5 = IC = 0.5*10**-3
hie = (hfe*VT)/IC
RL2 = RL3 = (R2*R3)/(R2+R3)
AV1 = round((hfe*RL2)/hie,0)
AV2 = round(-(hfe*R7)/(2*hie),2)
AV3 = 1                                        # the thrid stage emitter follower differential gain
AV4 = int(-R10/R9)
AV = AV1*round(AV2,1)*AV4                      # again rounding AV2 to get the desired value

# Displaying the values
print "PART B"
print "=================="
print "The value of hie =",int(hie)
print "The value of RL2 =",RL2*10**-3,"Kilo Ohms"
print "The value of AV1 =",int(AV1)
print "The value of AV2 =",round(AV2,1)
print "The value of AV3 =",AV3
print "The value of AV4 =",AV4
print "The value of AV  =",int(AV)

PART A
==================
the value of VBN1 = -3.13 V
The value of I1   = 0.986363636364 mA
The value of IQ   = 0.986363636364 mA
The value of IC2  = 0.493 mA
The value of VC3  = 2.18 V
The value of VE4  = 1.48 V
The value of IC4  = 0.494 mA
The value of VC5  = 4.52 V
The value of VE6  = 3.82 V
The value of IC7  = 1.56 mA
The value of VB8  = -4.6 V
The value of I9   = 1.4 mA
The value of I10  = 0.16 mA
The value of V0   = 0 V
PART B
==================
The value of hie = 5200
The value of RL2 = 3.11196911197 Kilo Ohms
The value of AV1 = 60
The value of AV2 = -28.9
The value of AV3 = 1
The value of AV4 = -5
The value of AV  = 8670


## Example 2.18 Page No.87¶

In [21]:
# Given data
VEE = 15.0
VCC = 15.0
VBE1 = VBE2 = VBE3 = VBE4 = VBE5 = VBE= 0.7
R = 28.6*10**3
RC1 = 20*10**3
RC6 = 3*10**3
RC8 = 2.3*10**3
RA = 15.7*10**3
hfe = 100
VT = 25*10**-3

# Solution for part 1 DC - ANALYSIS

I = (VEE - VBE3)/R
ICQ4 = I
ICQ1 = ICQ2 = ICQ4/2
# Q1 and Q2 are biased at 0.25mA so their Collector voltages are
IC1 = IC = ICQ1
VCQ1 = VCQ2 = VCC - (IC1*RC1)
VEQ5 = VEQ6 = VCQ1 - VBE
IQ7 = 4*I
# The collector current of Q5 and Q6 are
ICQ5 = ICQ6 = IQ7/2
VCQ6 = VCC - (ICQ6 * RC6)
VEQ8 = VCQ6 + VBE
IEQ8 = (VCC - VEQ8)/RC8
# The voltage VA at the collector of Q8 is
VA = -VCC + (IEQ8 * RA)
IEQ9 = (0-(-VCC))/RC6

# Displaying all values of Part 1

print "The value of I      =",int(I*10**3),"mA"
print "The value of ICQ1   =",int(ICQ1*10**3),"mA"
print "The value of VCQ1   =",int(VCQ1),"V"
print "The value of VEQ5   =",int(VEQ5),"V"
print "The value of IQ7    =",int(IQ7*10**3),"mA"
print "The value of ICQ5   =",int(ICQ5*10**3),"mA"
print "The value of VCQ6   =",int(VCQ6),"V"
print "The value of VEQ8   =",int(VEQ8),"V"
print "The value of IEQ8   =",int(IEQ8*10**3),"mA"
print "The value of VA     =",VA,"V"
print "The value of IEQ9   =",int(IEQ9*10**3),"mA"

# Part 2 AC -ANALYSIS

hieQ12 = (hfe * VT)/IC
# The ac emitter resistance of transister Q5 - Q6
hieQ56 = (hfe * VT)/ICQ5
RL1 = RL2 = (RC1*hieQ56)/(RC1 + hieQ56)          # parallel combination of resistor RC1 and hieQ56
ADM1 = (hfe * RL2)/hieQ12
ADM2 = -(hfe * RC6)/(2*hieQ56)

# Displaying the values

print "The value of ac emiiter resistace of the transistor Q1-Q2  = ",int(round(hieQ12*10**-3,0)),"Kilo Ohm"
print "The value of ac emiiter resistace of the transistor Q5-Q6  = ",round(hieQ56*10**-3,1),"Kilo Ohm"
print "The value of effective load of Q1-Q2                       = ",round(RL1*10**-3,1),"Kilo Ohm"
print "The value of voltage gain of first differential pair       = ",int(round(ADM1,0)),"Kilo Ohm"
print "The value of voltage gain of second differential pair      = ",int(ADM2),"Kilo Ohm"

The value of I      = 0 mA
The value of ICQ1   = 0 mA
The value of VCQ1   = 10 V
The value of VEQ5   = 9 V
The value of IQ7    = 2 mA
The value of ICQ5   = 1 mA
The value of VCQ6   = 12 V
The value of VEQ8   = 12 V
The value of IEQ8   = 1 mA
The value of VA     = 0.7 V
The value of IEQ9   = 5 mA
The value of ac emiiter resistace of the transistor Q1-Q2  =  10 Kilo Ohm
The value of ac emiiter resistace of the transistor Q5-Q6  =  2.5 Kilo Ohm
The value of effective load of Q1-Q2                       =  2.2 Kilo Ohm
The value of voltage gain of first differential pair       =  22 Kilo Ohm
The value of voltage gain of second differential pair      =  -60 Kilo Ohm

In [ ]: