# Chapter1 - Constant current sources¶

## Ex 1.1 - page 4¶

In [2]:
from __future__ import division
Iout=8 #micro A
VBE=0.7 #V
Beta=80 #unitless
VCC=20 #V
IREF=Iout*(1+2/Beta) #micro A
R=(VCC-VBE)/IREF #Mohm
print "Reference current is %0.2f uA" %IREF
print "Resistance required is %0.2f Mohm" %R

Reference current is 8.20 uA
Resistance required is 2.35 Mohm


## Ex 1.2 - page 5¶

In [5]:
from __future__ import division
Iout=1 #mA
VBE=0.7 #V
Beta=100 #unitless
VCC=30 #V
IREF=Iout*(1+2/Beta) #mA
R=(VCC-VBE)/IREF #kohm
print "Reference current is %0.2f mA" %IREF
print "Resistance required is %0.1f kohm" %R

Reference current is 1.02 mA
Resistance required is 28.7 kohm


## Ex 1.3 - page 5¶

In [6]:
from __future__ import division
Iout=0.5 #mA
Beta=50 #unitless
VEB=0.7 #V
VCC=5 #V
IREF=Iout*(1+2/Beta) #mA
R=(VCC-VEB)/IREF #kohm
print "Reference current is %0.2f mA" %IREF
print "Resistance required is %0.2f kohm" %R

Reference current is 0.52 mA
Resistance required is 8.27 kohm


## Ex 1.4 - page 8¶

In [9]:
from __future__ import division
Iout=8 #micro A
Beta=100 #unitless
VBE=0.7 #V
VCC=20 #V
IREF=Iout/(1+2/Beta/(1+Beta)) #micro A
R=(VCC-2*VBE)/IREF #Mohm
print "Reference current is %0.2f micro A" %IREF
print "Resistance required is %0.2f Mohm" %R

Reference current is 8.00 micro A
Resistance required is 2.33 Mohm


## Ex 1.5 - page 8¶

In [12]:
from __future__ import division
Iout=60 #micro A
VBE=0.7 #V
Beta=150 #unitless
VCC=30 #V
IREF=Iout*(1+2/Beta/(1+Beta)) #micro A
R=(VCC-2*VBE)/IREF #Mohm
R*=10**3  #kohm
print "Reference current is %0.3f mA" %IREF
print "Resistance required is %0.1f kohm" %R

Reference current is 60.005 mA
Resistance required is 476.6 kohm


## Ex 1.6 - page 9¶

In [14]:
from __future__ import division
VBE=0.7 #V
Beta=120 #unitless
VCC=10 #V
R=5.6 #kohm
#KCL at node x : IREF=IC1+I1 #as Beta>>1
#KCL at node y : I1=IC2+IB3 #as Beta>>1
IREF=(VCC-VBE)/R #mA
#as IREF=2*IC+IB3=IC*(2+1/Beta)=2*IC #as Beta>>1
IC=IREF/2 #mA
Iout=IC #mA
print "Output current is %0.2f mA" %Iout

Output current is 0.83 mA


## Ex 1.7 - page 13¶

In [17]:
from __future__ import division
import math
Iout=6 #micro A
IREF=1.2 #mA
VBE2=0.7 #V
VT=26 #mV
Beta=120 #unitless
VCC=20 #V
R=(VCC-VBE2)/IREF #kohm
print "Value of resistance R is %0.f kohm " %R
IC1=Iout #micro A
IC2=(IREF-IC1*10**-3/Beta)/(1+1/Beta) #mA
RS=1/(IC1*10**-6)*VT*10**-3*math.log(IC2*1000/IC1) #ohm
RS/=10**3 #kohm
print "Value of resistance RS is %0.1f kohm" %RS

Value of resistance R is 16 kohm
Value of resistance RS is 22.9 kohm


## Ex 1.8 - page 14¶

In [21]:
from __future__ import division
IREF=1 #mA
Io2=20 #micro A
Io3=40 #micro A
VBE1=0.7 #V
VT=26 #mV
VCC=10 #V
VEE=-10 #V
R=(VCC-VBE1-VEE)/IREF #kohm
print "Value of resistance R is %0.2f kohm " %R
RE2=VT/Io2*math.log(IREF*1000/Io2) #kohm
print "Value of resistance RE2 is %0.2f kohm" %RE2
RE3=VT/Io3*math.log(IREF*1000/Io3) #kohm
print "Value of resistance RE3 is %0.2f kohm " %RE3
VBE2=VBE1-RE2*Io2/1000 #V
print "Value of Base emitter voltage of transistor Q2 is %0.4f V" %VBE2
VBE3=VBE1-RE3*Io3/1000 #V
print "Value of Base emitter voltage of transistor Q3 is %0.4f V" %VBE3

Value of resistance R is 19.30 kohm
Value of resistance RE2 is 5.09 kohm
Value of resistance RE3 is 2.09 kohm
Value of Base emitter voltage of transistor Q2 is 0.5983 V
Value of Base emitter voltage of transistor Q3 is 0.6163 V


## Ex 1.9 - page 18¶

In [23]:
from __future__ import division
Beta=100 #unitless
VBE=0.715 #V
R=5.6 #kohm
RC=1 #kohm
VCC=10 #V
VCB1=0 #V(Q1 will act as diode)
IREF=(VCC-VBE)/R #mA
#KCL at node x : IREF=IC1+2*IB
#KCL at node y : I1=IC2+IB3 #as Beta>>1
IREF=(VCC-VBE)/R #mA
#as IREF=2*IC1/Beta+IC1
IC1=IREF/(1+2/Beta) #mA
IC2=IC1 #mA
IC3=IC1 #mA
print "Collector current in each transistor, IC1=IC2=IC3 is %0.2f mA" %IC1
IRC=IC1+IC2+IC3 #mA
print "Current through RC is %0.2f mA" %IRC

Collector current in each transistor, IC1=IC2=IC3 is 1.63 mA
Current through RC is 4.88 mA


## Ex 1.10 - page 19¶

In [25]:
from __future__ import division
Vout=5 #V
Beta=180 #unitless
R=22 #kohm
VCC=10 #V
VBE=0.7 #V
IREF=(VCC-VBE)/R #mA
IC=(IREF-VBE/R)/(1+2/Beta) #mA
RC=(VCC-Vout)/IC #kohm
print "IC1 & IC2 are %0.2f mA" %IC
print "RC is %0.2f kohm" %RC
#Answer in the book is wrong.

IC1 & IC2 are 0.39 mA
RC is 12.93 kohm