Chapter 2: TRANSISTORS AND OTHER DEVICES

Example 2.1,Page number 89

In [1]:
#Variable declaration
Rb=200                  #base resistance(ohm)
Vbe=0.7                 #base emitter voltage drop(V) in active region          
Vbb=5                   #base voltage of bipolar transistor(V) 
beeta=100               #current gain
Rc=3                    #collector resistance(k ohms)
Vcc=10                  #voltage given to the collector(V)

#Calculations
Ib=(Vbb-Vbe)/Rb           #base current(mA)  
Ic=beeta*Ib               #collector current(mA) 
Vcb=-Vbe-(Rc*Ic)+Vcc      #collector base voltage drop(V)

#Results
print"base current",Ib,"mA" 
print"collector current",Ic,"mA"
print"reverse bias collector junction is",Vcb,"V"
base current 0.0215 mA
collector current 2.15 mA
reverse bias collector junction is 2.85 V

Example 2.2,Page number 90

In [3]:
#Variable declaration
Vbb=5               #base voltage of bipolar transistor(V)
Vbe=0.7             #base emitter voltage drop(V) in active region  
Rb=150              #base resistance(ohm)
beeta=125           #curret gain     
Rc=3                #collector resistance(k ohms)  
Vcc=10              #supply voltage(V)
Vce=0.2             #collector to emitter voltage(V)

#Calculations
#Part a
Ib=(Vbb-Vbe)/Rb       #base current(mA)
Ic=beeta*Ib           #collector current(mA)
Vcb=-Vbe-(Rc*Ic)+Vcc  #collector base voltage drop(V)

#Part b -for npn transistor
Vbe=0.8             #base emitter voltage drop(V) in saturation
Ic=(Vcc-Vce)/Rc     #collector current(mA)
Ib=(Vbb-Vbe)/Rb     #base current(mA)
Ibmin=Ic/beeta      #minimum base current(mA) to go into saturation(mA)

#Results
print"In active region, base current is",round(Ib/1E-3),"*10**-3 mA and collector current is",round(Ic,2),"mA" 
print"base current and collector current in npn are",round((Ib/1E-3),2),"*10**-3 mA","and",round(Ic,2),"mA resp."
print"base current minimum is",round(Ibmin,3),"mA"
In active region, base current is 28.0 *10**-3 mA and collector current is 3.27 mA
base current and collector current in npn are 28.0 *10**-3 mA and 3.27 mA resp.
base current minimum is 0.026 mA

Example 2.3,Page number 91

In [4]:
#Variable declaration
Vbb=5                 #base voltage of bipolar transistor(V)
Vbe=0.7               #base emitter voltage drop(V) in active region  
Rb=50                 #base resistance(ohm)
beeta=50              #current gain
Re=1.8                #emitter resistance(k ohms)    
Vcc=10                #supply voltage(V)
Vce=0.2               #collector to emitter voltage(V)

#Calculations
Ib=(Vbb-Vbe)/(Rb+Re*(beeta+1))      #base current(mA)
Ic=beeta*Ib                         #collector current(mA)
Ie=Ib+Ic                            #emitter current(mA)

#Results
print"values are Ib:",round(Ib,2),"mA,Ic:",round(Ic,2),"mA and Ie:",round(Ie,2),"mA"
values are Ib: 0.03 mA,Ic: 1.52 mA and Ie: 1.55 mA

Example 2.4,Page number 91

In [6]:
#Variable declaration
Vbe=0.7                      #base to emitter voltage(V)
Rb=250                       #base resistance(k ohms)
Vcc=10                       #supply voltage(V)
Rl=0.5                       #load resistance(k ohms)

#Calculations
Ic=Vcc/Rl                    #collector current(mA)
IbQ=(Vcc-Vbe)/Rb             #Ib at operating point(uA)
IcQ=8                        #Ic at operating point(mA)
VceQ=6                       #Vce at operating point(V)

#Results
print"values are IbQ:",IbQ,"uA,IcQ:",IcQ,"mA and Vcc:",Vcc,"V"
print"collector current Ic is",Ic,"mA and output voltage,vL=6-2 sinwt V"
values are IbQ: 0.0372 uA,IcQ: 8 mA and Vcc: 10 V
collector current Ic is 20.0 mA and output voltage,vL=6-2 sinwt V

Example 2.5,Page number 104

In [4]:
#Variable declaration
Vgs=12                   #gate to source voltage(V)
Vt=4                     #threshold voltage(V)
Id=12.8                  #drain current(mA)
K=0.0002                 #device parameter 
Vdd=24                   #drain voltage(V)
Vds=Vgs=8                #drain to source voltage(V)      

#Calculations
Id=K*((Vds-Vt)**2)       #drain current at Vds=8V
Rd=(Vdd-Vds)/Id          #drain resistance(k ohms)

#Result
print"diode resistance is",Rd,"ohms"
diode resistance is 5000.0 ohms

Example 2.7,Page number 106

In [5]:
#Variable declaration
Vds=7.5                #drain to source voltage(V)
Id=5                   #drain current(mA)      

#Calculations
Vgs=-1.5               #gate to source voltage(V)
Vgg=-Vgs               #gate voltage=gate to source voltage(V) 

#Result
print"gate voltage is",Vgg,"V"
gate voltage is 1.5 V

Example 2.8,Page number 107

In [13]:
#Variable declaration
Vds=7.5                  #drain to source voltage(V)
Idss=8.                  #drain current for Vgs(V)
Vgs=2.                   #gate to source voltage(V)
Vp=4.                    #peak voltage(V)

#Calculations
Id=Idss*((Vp-Vgs)/Vp)**2  #drain current(mA)

#Result
print"diode current is",Id,"mA"
diode current is 2.0 mA

Example 2.10,Page number 115

In [7]:
#Variable declaration
beeta=160               #current gain
Vee=10                  #emitter voltage(V)
Rb=400                  #base resistance(k ohms)
Veb=0.8                 #emitter to base voltage(V)
Re=2.5                  #emitter resistance(k ohms)
Rc=1.5                  #collector resistance(k ohms)   

#Calculations
#Part a 
Ib=(Vee-Veb)/((Re*(1+beeta))+Rb)    #base current(uA)
Ic=beeta*Ib                         #collector current(mA)
Ie=(beeta+1)*Ib                     #emitter current(mA) 
Vce=Vee-(Re*Ie)-(Rc*Ic)             #emitter to collector voltage(V)   
Vce=-Vce                            #collector to emitter voltage(V)

#Part b
beeta=80                            #current gain 
Ib1=(Vee-Veb)/((Re*(1+beeta))+Rb)   #base current(uA)
Ic1=beeta*Ib1                       #collector current(mA)
Ie1=(beeta+1)*Ib1                   #emitter current(mA)   
Vce1=-(Vee-(Ie1*Re)-(Rc*Ic1))       #collector to emitter voltage(V)   
                      
#Result
print"collector current and Vce for beeta=160 are",round(Ic,2),"mA","and",round(Vce,2),"V" 
print"Ic and Vce for beeta=80 are",round(Ic,2),"mA","and",round(Vce1,2),"V"
collector current and Vce for beeta=160 are 1.83 mA and -2.63 V
Ic and Vce for beeta=80 are 1.83 mA and -5.08 V

Example 2.13,Page number 120

In [10]:
from sympy import*
import math 

#Variable declaration
K=2                      #device parameter
Rd=Rs=2.5*10**3          #drain resistance(k ohms)
R1=100*10**3             #resistance(ohms)
R2=200*10**3             #resistance(ohms)
Vdd=12                   #drain voltage(V)
Vt=4                     #threshold voltage(V)

#Calculations
Vgg=(R2*Vdd)/(R1+R2)
Id=symbols('Id')                         #gate voltage(V)
expr=solve(Id**2-3.28*Id+2.56,Id)
print expr
Id=1.28
Vds=Vdd-5*Id

#Result
print"Id is",Id,"mA and Vds is",Vds,"V"
[1.28000000000000, 2.00000000000000]
Id is 1.28 mA and Vds is 5.6 V

Example 2.14,Page number 121

In [6]:
#Variable declaration
k=2.                       #device parameter
Vt=-1.                     #threshold voltage(V)
Vdd=-12.                   #drain voltage(V)
R1=300.                    #resistance(kohms)
R2=100.                    #resistance(kohms)

#Calculations
#Part a
Vgs=-2                  #gate to source voltage(V)
Vgg=(R2*Vdd)/(R1+R2)    #gate voltage(V)
Id=k*((Vgs-Vt)**2)      #drain current(mA)
Rs=(Vgs-Vgg)/Id         #source resistance(k ohms) as Id=Is,Kvl in GS loop
Is=Id

#Part b
Vds=-4                    #drain to source voltage(V)
Rd=(-Vdd+Vds-(Is*Rs))/Id  #applying kvl in DS loop

#Part c 
Vt=-1.5                      #threshold voltage(V)             
Vgg=-1.5                     #gate voltage using Id formula    
R2new=(Vgg*R1)/(Vdd-Vgg)     #new resistance(k ohms)

#Results
print"a)source resistance is",Rs,"kohm" 
print"b)drain resistance is",Rd,"kohm"
print"c)R2new is",round(R2new,2),"kohm"
a)source resistance is 0.5 kohm
b)drain resistance is 3.5 kohm
c)R2new is 42.86 kohm

Example 2.15,Page number 122

In [20]:
import math

#Variable declaration
Vp=-4                    #peak voltage(V)
Idss=10                  #drain current for Vgs(V)
Vdd=18                   #drain voltage(V)   
Rs=2               #source resistance(ohms) 
Rd=2               #drain resistance(ohms)
R1=450*10**3             #resistance(ohms)
R2=90*10**3              #resistance(ohms)

#Calculations
Vgg=(R2*Vdd)/(R1+R2)
from sympy import*
Id=symbols('Id')
expr=solve(20*Id**2-148*Id+245,Id)
print expr
Id1=2.5
Vds=Vdd-((Rs+Rd)*Id1)

#Result
print"Id is",Id1,"mA and Vds is",Vds,"V"
[5/2, 49/10]
Id is 2.5 mA and Vds is 8.0 V

Example 2.16,Page number 123

In [3]:
import math

#Variable declaration
Vp=4                    #peak voltage(V)
Idss=12.                #drain current for Vgs(V) 
Vdd=12                  #drain voltage(V)
Id=4.                   #drain current(mA)
Vds=6                   #drain to source voltage(V)

#Calculations
Rs=(Vp/4)*(1-(math.sqrt(Id/Idss)))      #by Id=Idss(1-(Vgs/Vp))^2 and putting Vgs=4Rs in it and solving
Rd=((Vdd+Vds)/Id)-Rs                    #solving equation -Vdd-Vds+(Id*(Rd+Rs))=0      
                                             
#Result
print"source resistance is",round(Rs,2),"kohm" 
print"drain resistance",round(Rd,2),"kohms"
source resistance is 0.42 kohm
drain resistance 4.08 kohms