# Chapter05: Bipolar Junction Transistors (BJTs)¶

## Ex5.1:pg-395¶

In :
# BJT will be operating in active mode
B=100.0; # B is beta value
a=B/(B+1); # a is alpha value
v_BE=0.7; # v_BE (V) at i_C=1mA
i_C1=1*10.0**-3; # (A)
I_C2=2*10.0**-3; # (A)
V_T=25*10.0**-3; # (V)
V_C=5; # (V)
V_CC=15.0; # (V)
V_B=0; # (V)
V_RC=V_CC-V_C;# V_RC is the voltage drop across resistor R_C
R_C=V_RC/I_C;
print R_C/1000,"=Collector Resistance R_C (Kohm)"
V_BE=v_BE+V_T*math.log(I_C2/i_C1);
print round(V_BE,3),"=Base emitter voltage V_BE (V) at i_C=2mA"
V_E=V_B-V_BE;
print round(V_E,3),"=Emitter voltage V_E (V)"
I_E=I_C2/a;
print I_E*1000,"=Emitter current I_E (mA)"
R_E=(V_E-(-V_CC))/I_E;
print round(R_E/1000,2),"= Emitter resistance R_C (Kohm)"

5.0 =Collector Resistance R_C (Kohm)
0.717 =Base emitter voltage V_BE (V) at i_C=2mA
-0.717 =Emitter voltage V_E (V)
2.02 =Emitter current I_E (mA)
7.07 = Emitter resistance R_C (Kohm)


## Ex5.2:pg-413¶

In :
I_S=10.0**-15; # (A)
R_C=6.8*10**3; # (ohm)
V_CC=10.0; # (V)
V_CE=3.2; # (V)
V_T=25.0*10**-3; # (V)

# 5.2a
I_C=(V_CC-V_CE)/R_C;
print I_C*1000,"= Collector current (A)"
V_BE=V_T*math.log(I_C/I_S);
print round(V_BE*1000,1),"= V_BE (mV)"

# 5.2b
V_in=5*10**-3; # sinuosoidal input 0f peak amplitide 5mv
A_v=-(V_CC-V_CE)/V_T;
print A_v,"= Voltage gain"
V_o=-A_v*V_in; # negative sign to make positive value of voltage gain
print V_o,"= Amplitude of output voltage (V)"

# 5.2c
v_CE=0.3# (V)
i_C=(V_CC-v_CE)/R_C;
print round(i_C*1000,2),"= i_C (mA)"
v_be=V_T*math.log(i_C/I_C); # v_BE is positive increment in v_BE
print round(v_be*1000),"= required increment (mV)"

# 5.2d
v_O=0.99*V_CC;
R_C=6.8*10**3; # (ohm)
i_C=(V_CC-v_O)/R_C;
I_C=1*10**-3; # (A)
print round(i_C*1000,4),"= i_C (mA)"
v_be=V_T*math.log(i_C/I_C);
print round(v_be*1000,1),"= negative increment in v_BE (mV)"

# the answer for the C part is incorrect in the textbook

1.0 = Collector current (A)
690.8 = V_BE (mV)
-272.0 = Voltage gain
1.36 = Amplitude of output voltage (V)
1.43 = i_C (mA)
9.0 = required increment (mV)
0.0147 = i_C (mA)
-105.5 = negative increment in v_BE (mV)


## Ex5.3:pg-420¶

In :
# transistor is specified to have B value in the range of 50 to 150
V_C=0.2; # V_C=V_CEsat
V_CC=10; # (V)
R_C=10**3; # (ohm)
V_BB=5; # (V)
V_BE=0.7; # (V)
bmin=50; # range of bete is 50 to 150
I_Csat=(V_CC-V_C)/R_C;
I_BEOS=I_Csat/bmin; # I_B(EOS)=I_BEOS
I_B=10*I_BEOS; # base current for an overdrive factor 10
R_B=(V_BB-V_BE)/I_B;
print round(R_B/1000,1),"= Value of R_B (Kohm)"

2.2 = Value of R_B (Kohm)


## Ex5.4:pg-422¶

In :
V_BB= 4; # (V)
V_CC=10; # (V)
V_BE=0.7; # (V)
b=100; # beta = 100
R_E=3.3*10**3; # (ohm)
R_C=4.7*10**3; # (ohm)
V_E=V_BB-V_BE;
print V_E,"= Emitter voltage (V)"
I_E=(V_E-0)/R_E;
print I_E*1000,"= Emitter current (mA)"
a=b/(b+1.0) # alpha value
I_C=I_E*a;
print round(I_C*1000,2),"= Collector current (mA)"
V_C=V_CC-I_C*R_C; # Applying ohm's law
print round(V_C,1),"= Collector voltage (V)"
I_B=I_E/(b+1);
print round(I_B*1000,2),"= Base current (mA)"

3.3 = Emitter voltage (V)
1.0 = Emitter current (mA)
0.99 = Collector current (mA)
5.3 = Collector voltage (V)
0.01 = Base current (mA)


## Ex5.5:pg-423¶

In :
print "Assuming active mode operation"
V_CC=10.0; # (V)
R_C=4.7*10**3; # (V)
R_E=3.3*10**3; # (ohm)
V_BE=0.7; # (V)
V_BB=6.0; # (V)
V_CEsat=0.2; # (V)
V_E=V_BB-V_BE;
print V_E,"= Emitter voltage (V)"
I_E=V_E/R_E;
print round(I_E*1000,1),"= Emitter current (mA)"
V_C=V_CC-I_E*R_C; # I_E=I_C
print round(V_C,2),"= Collector voltage (V)"
print "Since V_C < V_B our assumption is wrong\n Hence its saturation mode operation"
V_E=V_BB-V_BE;
print V_E,"= Emitter voltage (V)"
I_E=V_E/R_E;
print round(I_E*1000,1),"= Emitter current (mA)"
V_C=V_E+V_CEsat;
print V_C,"= Collector voltage (V)"
I_C=(V_CC-V_C)/R_C;
print round(I_C*1000,2),"= Collector current (mA)"
I_B=I_E-I_C;
print round(I_B*1000,2),"=Base current (mA)"
Bforced=I_C/I_B; # transistor is made to operate at a forced beta value
print round(Bforced,1),"= forced beta"

Assuming active mode operation
5.3 = Emitter voltage (V)
1.6 = Emitter current (mA)
2.45 = Collector voltage (V)
Since V_C < V_B our assumption is wrong
Hence its saturation mode operation
5.3 = Emitter voltage (V)
1.6 = Emitter current (mA)
5.5 = Collector voltage (V)
0.96 = Collector current (mA)
0.65 =Base current (mA)
1.5 = forced beta


## Ex5.6:pg-426¶

In :
V_CC=-10; # (V)
R_E=2000; # (ohm)
R_C=1000; # (ohm)
V_EE=10; # (V)
V_E=0.7; # (V) emitter base junction will be forward biased with V_E=V_EB=0.7V
print V_E,"= Emitter base junction is forward biased with V_E (V)"
I_E=(V_EE-V_E)/R_E;
print round(I_E*1000,2),"= Emitter current (mA)"
B=100; # Assuming beta 100
a=B/(B+1.0);
I_C=a*I_E; # Assuming the transistor to operate in active mode
print round(I_C*1000,1),"= Collector current (mA)"
V_C=V_CC+I_C*R_C;
print round(V_C,1),"= Collector voltage (V)"
I_B=I_E/(B+1);
print round(I_B*1000,2),"= Base current (mA)"

0.7 = Emitter base junction is forward biased with V_E (V)
4.65 = Emitter current (mA)
4.6 = Collector current (mA)
-5.4 = Collector voltage (V)
0.05 = Base current (mA)


## Ex5.8:pg-428¶

In :
# Example 5.8 : Analyse the circuit to find node voltages and branch currents
V_CC= 10; # (V)
R_C=2000.0; # (ohm)
V_BB=5.0; # (V)
R_B=100.0*10**3; # (ohm)
B=100.0; # beta value
I_B=(V_BB-V_BE)/R_B;
print round(I_B*1000,3),"= Base current (mA)"
I_C=B*I_B;
print round(I_C*1000,1),"= Collector current (mA)"
V_C=V_CC-I_C*R_C;
print V_C,"= Collector voltage (V)"
V_B=0.7 ; # V_B=V_BE
print V_B,"= Base voltage (V)"
I_E=(B+1.0)*I_B;
print round(I_E*1000,1),"= Emitter current (mA)"

0.043 = Base current (mA)
4.3 = Collector current (mA)
1.4 = Collector voltage (V)
0.7 = Base voltage (V)
4.3 = Emitter current (mA)


## Ex5.9:pg-429¶

In :
# assuming that the transistor is saturated
V_CC=-5; # (V)
V_EE=5; # (V)
R_B=10000; # (ohm)
R_C=10000; # (ohm)
R_E=1000; # (ohm)
V_EB=0.7; # (V)
V_ECsat=0.2; # (V)
# using the relation I_E=I_C+I_B
V_B=3.75/1.2; #(V)
print round(V_B,2),"= Base voltage (V)"
V_E=V_B+V_EB;
print round(V_E,2),"= Emitter voltage (V)"
V_C=V_E-V_ECsat;
print round(V_C,2),"= Collector voltage (V)"
I_E=(V_EE-V_E)/R_E;
print round(I_E*1000,2),"= Emitter current (mA)"
I_B=V_B/R_B;
print round(I_B*1000,2),"= Base current (mA)"
I_C=(V_C-V_CC)/R_C;
print round(I_C*1000,2),"= Collector current (mA)"
Bforced=I_C/I_B; # Value of forced beta
print round(Bforced,1), "= Forced Beta value"

3.13 = Base voltage (V)
3.83 = Emitter voltage (V)
3.63 = Collector voltage (V)
1.17 = Emitter current (mA)
0.31 = Base current (mA)
0.86 = Collector current (mA)
2.8 = Forced Beta value


## Ex5.10:pg-430¶

In :
V_CC=15; # (V)
R_C=5000; # (ohm)
R_B1=100*10**3; # (ohm)
R_B2=50*10**3; # (ohm)
R_E=3000; # (ohm)
V_BE=0.7; # (V)
B=100; # beta value
V_BB=V_CC*R_B2/(R_B1+R_B2);
print V_BB,"=V_BB (V)"
R_BB=R_B1*R_B2/(R_B1+R_B2);
print round(R_BB/1000.0,1),"=R_BB (Kohm)"
I_B=I_E/(B+1.0);
print round(I_B*1000,4),"=Base current (mA)"
I_E=(V_BB-V_BE)/(R_E +(R_BB/(B+1)))
print round(I_E*1000,2),"=Emiter current (mA)"
I_B=I_E/(B+1.0)
print round(I_B*1000,4),"=Base current (mA)"
V_B=V_BE+I_E*R_E;
print round(V_B,2),"=Base voltage (V)"
a=B/(B+1.0); # alpha value
I_C=a*I_E
print round(I_C*1000,2),"=Collector current (mA)"
V_C=V_CC-I_C*R_C;
print V_C,"=Collector voltage (V))"

5 =V_BB (V)
33.3 =R_BB (Kohm)
0.0128 =Base current (mA)
1.29 =Emiter current (mA)
0.0128 =Base current (mA)
4.57 =Base voltage (V)
1.28 =Collector current (mA)
8.60746885499 =Collector voltage (V))


## Ex5.11:pg-432¶

In :
V_CC=15.0; # (V)
R_C1=5000.0; # (ohm)
R_B1=100.0*10**3; # (ohm)
R_B2=50.0*10**3; # (ohm)
R_E=3000.0; # (ohm)
V_BE=0.7; # (V)
R_E2=2000.0; # (ohm)
R_C2=2700.0; # (ohm)
V_EB=0.7; # (V)
B=100.0; # beta value
V_BB=V_CC*R_B2/(R_B1+R_B2);
R_BB=R_B1*R_B2/(R_B1+R_B2);
I_E1=(V_BB-V_BE)/(R_E +(R_BB/(B+1.0)))
print round(I_E1*1000,2),"= I_E1 (mA)"
I_B1=I_E1/(B+1.0)
print round(I_B1*1000,2),"I_B1 (mA)"
V_B1=V_BE+I_E*R_E;
print round(V_B1,2),"=V_B1 (V)"
a=B/(B+1.0); # alpha value
# beta and alpha values are same for the two transistors
I_C1=a*I_E
print round(I_C1*1000,2),"= IC1 (mA)"
V_C1=V_CC-I_C1*R_C1;
print round(V_C1,1),"V_C1 (V))"
V_E2=V_C1+V_EB;
print round(V_E2,1),"V_E2(V)"
I_E2=(V_CC-V_E2)/R_E2;
print round(I_E2*1000,2),"I_E2 (mA)"
I_C2=a*I_E2;
print round(I_C2*1000,2),"I_C2 (mA)"
V_C2=I_C2*R_C2;
print round(V_C2,2),"V_C2 (V)"
I_B2=I_E2/(B+1.0);
print round(I_B2*1000,3),"I_B2 (mA)"

1.29 = I_E1 (mA)
0.01 I_B1 (mA)
4.57 =V_B1 (V)
1.28 = IC1 (mA)
8.6 V_C1 (V))
9.3 V_E2(V)
2.85 I_E2 (mA)
2.82 I_C2 (mA)
7.61 V_C2 (V)
0.028 I_B2 (mA)


## Ex5.13:pg-438¶

In :
I_E=1*10**-3; # (A)
V_CC=12; # (V)
B=100; # beta value
V_B=4; # (V)
V_BE=0.7; # (V)
R1=80; # (ohm)
R2=40; # (ohm)
V_C=8; # (V)
V_E=V_B-V_BE;
print V_E,"= Emitter voltage (V)"
R_E=V_E/I_E;
print R_E/1000,"= Emitter resistance (Kohm)"
I_E=(V_B-V_BE)/(R_E+(R1*R2/(R1+R2))/(B+1));
print I_E*1000,"= more accurate value for I_E (mA) for R1=80 ohm and R2=40 ohm"
R1=8; # (ohm)
R2=4; # (ohm)
I_E=(V_B-V_BE)/(R_E+(R1*R2/(R1+R2))/(B+1));
print I_E*1000,"= more accurate value for I_E (mA) for R1=8 ohm and R2=4 ohm"
R_C=(V_CC-V_C)/I_E; # I_E=I_C
print round(R_C/1000.0),"= Collector resistor (Kohm)"

3.3 = Emitter voltage (V)
3.3 = Emitter resistance (Kohm)
1.0 = more accurate value for I_E (mA) for R1=80 ohm and R2=40 ohm
1.0 = more accurate value for I_E (mA) for R1=8 ohm and R2=4 ohm
4.0 = Collector resistor (Kohm)


## Ex5.14:pg-450¶

In :
# Example 5.14 : Analysis of transistor amplifier
V_CC=10; # (V)
R_C=3000; # (ohm)
R_BB=100*10**3; # (ohm)
V_BB=3; # (V)
V_BE=0.7; # (V)
V_T=25*10**-3; # (V)
I_B=(V_BB-V_BE)/R_BB;
print round(I_B*1000,2),"= Base current (mA)"
I_C=B*I_B;
print round(I_C*1000,2),"= Collector current (mA)"
V_C=V_CC-I_C*R_C;
print V_C,"= Collecor voltage (V)"
I_E=B*I_C/(B+1);
r_e=V_T/I_E;
print round(r_e,2),"= r_e (ohm)"
g_m=I_C/V_T;
print g_m*1000,"= g_m (mA/V)"
r_pi=B/g_m;
print round(r_pi/1000,2),"= r_pi (Kohm)"
# v_i is input voltage let us assume it to be 1 V
v_i=1;
v_be=v_i*r_pi/(r_pi+R_BB)
print round(v_be,3),"= v_be"
v_o=-g_m*R_C*v_be;
print round(v_o),"= Output voltage (V)"
A_v=v_o/v_i;
print round(A_v),"= Voltage gain"

0.02 = Base current (mA)
2.3 = Collector current (mA)
3.1 = Collecor voltage (V)
10.98 = r_e (ohm)
92.0 = g_m (mA/V)
1.09 = r_pi (Kohm)
0.011 = v_be
-3.0 = Output voltage (V)
-3.0 = Voltage gain


## Ex5.17:pg-464¶

In :
# Example 5.17 : Amplifier parameters
# Transistor amplifier is having a open circuit voltage of v_sig of 10mV
v_sig=10*10.0**-3; # (V)
R_L=10*10.0**3; # (ohm)
R_sig=100*10.0**3; # (ohm)
print "Calculation with R_L infinite"
v_i=9.0; # (V)
v_o=90.0; # (V)
A_vo=v_o/v_i;
print A_vo,"= A_vo (V/V)"
G_vo=v_o/A_vo;
print G_vo,"= G_vo (V/V)"
R_i=G_vo*R_sig/(A_vo-G_vo)
print (R_i/1000),"= R_i (Kohm)"
print "Calculations with R_L = 10k ohm"
v_o=70*10**-3; # (V)
v_i=8*10**-3; # (V)
A_v=v_o/v_i;
print A_v,"= Voltage gain A_v (V/V)"
G_v=v_o*10**3/10.0;
print G_v,"= G_v (V/V)"
R_o=(A_vo-A_v)*R_L/A_v;
print round(R_o/1000,2),"= R_o (Kohm)"
R_out=(G_vo-G_v)*R_L/G_v;
print round(R_out/1000,2),"= R_out (Kohm)"
R_in=v_i*R_sig/(v_sig-v_i);
print R_in/1000,"= R_in (Kohm)"
G_m=A_vo/R_o;
print round(G_m*1000),"= G_m (mA/V)"
A_i=A_v*R_in/R_L;
print A_i,"= A_i (A/A)"
R_ino=R_sig/((1+R_sig/R_i)*(R_out/R_o)-1); # R_ino is R_in at R_L=0
print round(R_ino/1000,1),"= R_in at R_L =0"
A_is=A_vo*R_ino/R_o;
print int(A_is),"= A_is (A/A)"

Calculation with R_L infinite
10.0 = A_vo (V/V)
9.0 = G_vo (V/V)
900.0 = R_i (Kohm)
Calculations with R_L = 10k ohm
8.75 = Voltage gain A_v (V/V)
7.0 = G_v (V/V)
1.43 = R_o (Kohm)
2.86 = R_out (Kohm)
400.0 = R_in (Kohm)
7.0 = G_m (mA/V)
350.0 = A_i (A/A)
81.8 = R_in at R_L =0
572 = A_is (A/A)


## Ex5.18:pg-497¶

In :
# Transistor is biased at I_C=1mA
V_CC=10.0; # (V)
V_EE=10.0; # (V)
I=0.001; # (A)
R_B=100000.0; # (ohm)
R_C=8000.0; # (ohm)
R_sig=5000.0; #(ohm)
R_L=5000.0; # (ohm)
B=100.0; # beta value
V_A=100.0; # (V)
C_u=1*10.0**-12; # (F)
f_T=800.0*10**6; # (Hz)
I_C=0.001; # (A)
r_x=50.0; # (ohm)
# Values of hybrid pi model parameters
g_m=I_C/V_T;
r_pi=B/g_m;
r_o=V_A/I_C;
w_T=2*math.pi*f_T;
CpiplusCu=g_m/w_T; # C_u+C_pi
C_pi=CpiplusCu-C_u;
R_l=r_o*R_C*R_L/(r_o*R_C+R_C*R_L+R_L*r_o) # R_l=R_L'
A_M=R_B*r_pi*g_m*R_l/((R_B+R_sig)*(r_pi+r_x+(R_B*R_sig/(R_B+R_sig))));
print round(A_M),"= Midband gain (V/V)"
R_seff=(r_pi*(r_x+R_B*R_sig/(R_B+R_sig)))/(r_pi+r_x+R_B*R_sig/(R_B+R_sig)); # Effective source resistance R_seff=R'_sig
C_in=C_pi+C_u*(1+R_l*g_m);
f_H=1/(2*math.pi*C_in*R_seff);
print int(f_H/1000),"= 3dB frequency (KHz)"

# the answer is the book is slightly different due to approximation

39.0 = Midband gain (V/V)
759 = 3dB frequency (KHz)


## Ex5.19:pg-502¶

In :
# Example 5.19 : To select values of capacitance required
R_B=100000.0; # (ohm)
r_pi=2500.0; # (ohm)
R_C=8000.0; # (ohm)
R_L=5000.0; # (ohm)
R_sig=5000.0; # (ohm)
B=100.0; # beta value
g_m=0.04; # (A/V)
r_pi=2500.0; #(ohm)
f_L=100.0; # (Hz)
r_e=25.0; # (ohm)
R_C1=R_B*r_pi/(R_B+r_pi)+R_sig; # Resistance seen by C_C1
R_E=r_e+R_B*R_sig/((R_B+R_sig)*(B+1)); # Resistance seen by C_E
R_C2=R_C+R_L;# Resistance seen by C_C2
w_L=2*math.pi*f_L;
C_E=1/(R_E*0.8*w_L); #C_E is to contribute only 80% of the value of w_L
print round(C_E*1e6,1),"= C_E (microF)"
C_C1=1/(R_C1*0.1*w_L); #C_C1 is to contribute only 10% of the value of f_L
print round(C_C1*1e6,1),"= C_C1 (microF)"
C_C2=1/(R_C2*0.1*w_L); #C_C2 should contribute only 10% of the value of f_L
print round(C_C2*1e6,1),"= C_C2 (microF)"

27.6 = C_E (microF)
2.1 = C_C1 (microF)
1.2 = C_C2 (microF)