In [1]:

```
from __future__ import division
#Given data
Ep= 0.0153*10**-17 #in J
lamda= 1300 # in nm
nita_ext= 0.1
e = 1.6*10**-19 #in C
Eg= 1.42*e # in eV
S= nita_ext*Eg/e # in W/A (where S= deltaP/deltaI )
print " Slope of efficiency = %0.4f W/A" %S
# Note: In the book, the evaluated value of Eg/e is wrong because the value of 1.42*e/e = 1.42 not equal to 0.956 ,
# Hence the answer in the book is wrong
```

In [2]:

```
#Given data
e = 1.6*10**-19 #in C
Eg= 1.48*e # in J
R=1 # in Ω
i_p= 100 # in mA
i_p= i_p*10**-3 # in A
i_F= 10 # in mA
i_F= i_F*10**-3 # in A
Popt= 1.25 # in mW
Popt= Popt*10**-3 # in W
nitaP= Popt/((i_p**2*Eg/e)+i_F**2*R)*100 # in %
print " Power efficiency = %0.1f %%" %nitaP
```

In [3]:

```
#Given data
lamda= 670 # in nm
h_int= 1/100
EpIn_eV= 1248/lamda # in eV
I=50 # in mA
P= h_int*EpIn_eV*I # in mW
print " Power radiated by an LED = %0.2f mW" %P
# Note : There is a calculation error in evaluating the value of P so the answer in the book is wrong
```

In [4]:

```
#Given data
I=40 # in mA
I=I*10**-3 # in A
lamda=1310*10**-9 # in m
h= 6.62*10**-34 # in Js
c= 3*10**8 # in m/s
e= 1.6*10**-19 # in C
toh_r= 30 # in ns
toh_nr= 100 # in ns
toh= toh_r*toh_nr/(toh_r+toh_nr)
nita_int= toh/toh_r
print " The internal quantum efficiency = %0.2f" %nita_int
Ep= h*c/lamda # in J
P= nita_int*Ep*I/e # in W
print " The optical power generated internally to the LED = %0.2f mW" %(P*10**3)
# Note : There is a calculation error in evaluating the value of P so the answer in the book is wrong
```

In [7]:

```
#Given data
# Part (a)
R= 0.85 # in A/W
Pop= 1 # in mW
Ip= R*Pop # in mA
print "Part (a) : The photocurrent = %0.2f mA" %Ip
print "Part (b) : If the incident light power is 2mW then it is not proportional to Pop"
print " so it can not be found the value of photocurrent"
```

In [8]:

```
#Given data
N1= 5.4*10**6 # Number of EHPs generated
N2= 6*10**6 # Number of incident photons
nita= N1/N2
print " The quantum efficiency at 1300 nm = %0.f %%" %(nita*100)
```

In [9]:

```
#Given data
e= 1.6*10**-19 # in C
Eg= 0.75*e # in J
h= 6.62*10**-34 # in Js
c= 3*10**8 # in m/s
n=70/100
# Formula Eg= h*c/lamda
lamda= h*c/Eg # in m
lamda=lamda*10**9 # in nm
R= n*lamda/1248 # in A/W
print " Responsivity = %0.3f A/W" %R
```

In [10]:

```
#Given data
n=50/100
lamda= 900 # in nm
R= n*lamda/1248 # in A/W
print " Responsivity = %0.2f A/W" %R
# Part (b)
Ip= 10**-6 # in A
Pop= Ip/R # in W
print " The received optical power = %0.2e W" %Pop
# Part (c)
h= 6.62*10**-34 # in Js
c= 3*10**8 # in m/s
# Pop= n*h*c/lamda
n= Pop*lamda*10**-9/(h*c)
print " The corresponding number of received photons = %0.3e" %n
# Note : There is a calculation error in evaluating the value of n (number of received photons) ,
# so the answer in the book is wrong
```

In [11]:

```
#Given data
V=4 # in V
Vr1= 0.7 # in V
Vr2= 0.3 # in V
R1= 4 # in kΩ
R2= 4 # in kΩ
I1= (V-Vr1)/R1 # in mA
I2= (V-Vr2)/R2 # in mA
print " The value of I1 = %0.3f mA" %I1
print " The value of I2 = %0.3f mA" %I2
```

In [12]:

```
#Given data
V_Dmin= 1.5 # in V
V_Dmax= 2.3 # in V
Vs= 10 # in V
R1= 470 # in Ω
Imax= (Vs-V_Dmin)/R1 # in A
Imin= (Vs-V_Dmax)/R1 # in A
print " The maximum value of current = %0.1f mA" %(Imax*10**3)
print " The minimum value of current = %0.1f mA" %(Imin*10**3)
```

In [14]:

```
#Given data
V_Dmin= 1.8 # in V
V_Dmax= 3 # in V
# Case first
Vs= 24 # in V
R1= 820 # in Ω
Imin= (Vs-V_Dmax)/R1 # in A
Imax= (Vs-V_Dmin)/R1 # in A
print "The variation in current in first case = %0.1f mA" %(Imax*10**3-Imin*10**3)
# Case second
Vs= 5 # in V
R1= 120 # in Ω
Imin= (Vs-V_Dmax)/R1 # in A
Imax= (Vs-V_Dmin)/R1 # in A
print "The variation in current in second case = %0.1f mA" %(Imax*10**3-Imin*10**3)
print "The variation in current in first case is smaller than in second case, So the brighness in the first case will "
print "remain constant , whereas in the second case it will be changing."
```

In [19]:

```
#Given data
Vout= 8 # in V
V_F= 1.8 # in V
Ip_max= 16 # in mA
Ip_max= Ip_max*10**-3 # in A
I_F= Ip_max
Rs1= (Vout-V_F)/I_F # in Ω
print "If V_F= 1.8, then the value of Rs = %0.1f Ω" %Rs1
# If
V_F= 2.0 # in V
Rs2= (Vout-V_F)/I_F # in Ω
print "If V_F= 2.0, then the value of Rs = %0.f Ω" %Rs2
print "In either case, the smallest standard value resistor that has a value greater than ",round(Rs1,1),"Ω and",int(round(Rs2))
print "ohm resistor .is the 390 Ω"
```

In [20]:

```
#Given data
Ip= 1 # in mA
Pop= 1.5 # in mW
R= Ip/Pop # in A/W
print " The responsivity of the photodiode = %0.2f A/W" %R
```

In [21]:

```
#Given data
lamda= 800 # in nm
EpIn_eV= 1248/lamda # in eV
h_int= 5/100
I=50 # in mA
P= h_int*EpIn_eV*I # in mW
print " Power radiated by an LED = %0.1f mW" %P
```

In [25]:

```
#Given data
toh_r= 35 # in ns
toh_nr= 110 # in ns
toh= toh_r*toh_nr/(toh_r+toh_nr) # in ns
nita_int= toh/toh_r
print " The internal quantum efficiency = %0.2f" %(nita_int*100)
```

In [26]:

```
#Given data
N1= 6*10**6 # Number of EHPs generated
N2= 8*10**6 # Number of incident photons
nita= N1/N2
print " The quantum efficiency of photon detector = %0.f %%" %(nita*100)
```

In [27]:

```
#Given data
e= 1.6*10**-19 # in C
Eg= 0.75*e # in J
h= 6.62*10**-34 # in Js
c= 3*10**8 # in m/s
n=90/100
# Formula Eg= h*c/lamda
lamda= h*c/Eg # in m
lamda=lamda*10**9 # in nm
R= n*lamda/1248 # in A/W
print " Responsivity = %0.2f A/W" %R
```

In [28]:

```
#Given data
V_Dmin= 1 # in V
V_Dmax= 2 # in V
Vs= 20 # in V
R1= 470 # in Ω
Imax= (Vs-V_Dmin)/R1 # in A
Imin= (Vs-V_Dmax)/R1 # in A
print " The maximum value of current = %0.f mA" %(Imax*10**3)
print " The maximum value of current = %0.2f mA" %(Imin*10**3)
```

In [1]:

```
#Given data
V_Dmin= 2.5 # in V
V_Dmax= 5 # in V
# Case First
Vs= 25 # in V
Rs= 250 # in Ω
Imax= (Vs-V_Dmin)/Rs # in A
Imin= (Vs-V_Dmax)/Rs # in A
print "The variation in current in first case = %0.f mA" %(Imax*10**3-Imin*10**3)
# Case sec
Vs= 10 # in V
Rs= 130 # in Ω
Imax= (Vs-V_Dmin)/Rs # in A
Imin= (Vs-V_Dmax)/Rs # in A
print "The variation in current in second case = %0.f mA" %(Imax*10**3-Imin*10**3)
print "Hence for the 25-V supply, the brightness of LED will be constant and for 10 V , it will be change"
```

In [30]:

```
#Given data
V1= 0.3 # in V
V2= 0.7 # in V
R1= 6 # in kΩ
R2= 6 # in kΩ
Vs= 12 # in V
I1= (Vs-V1)/R1 # in mA
I2= (Vs-V2)/R2 # in mA
print " The value of I1 = %0.2f mA" %I1
print " The value of I2 = %0.2f mA" %I2
```

In [31]:

```
#Given data
n=40/100
lamda= 800 # in nm
Ip = 2*10**-6 # in A
R= n*lamda/1248
# part (b)
Pop= Ip/R # in W
print " Responsivity = %0.3f" %R
print " The received optical power = %0.2e watt" %Pop
```

In [32]:

```
#Given data
I=35 # in mA
I=I*10**-3 # in A
lamda=1300*10**-9 # in m
h= 6.62*10**-34 # in Js
c= 3*10**8 # in m/s
e= 1.6*10**-19 # in C
toh_r= 30 # in ns
toh_nr= 90 # in ns
toh= toh_r*toh_nr/(toh_r+toh_nr) # in ns
nita_int= toh/toh_r
print " The internal quantum efficiency = %0.2f" %nita_int
Ep= h*c/lamda # in J
P= nita_int*Ep*I/e # in W
print " The optical power generated internally to the LED = %0.3f mW" % (P*10**3)
```

In [33]:

```
#Given data
lamda= 600 # in nm
h_int= 4/100
EpIn_eV= 1248/lamda # in eV
I=50 # in mA
P= h_int*EpIn_eV*I # in mW
print " Power radiated by an LED = %0.2f mW" %P
```

In [34]:

```
#Given data
V_Dmin= 2 # in V
V_Dmax= 4 # in V
Vs= 15 # in V
R1= 470 # in Ω
Imax= (Vs-V_Dmin)/R1 # in A
Imin= (Vs-V_Dmax)/R1 # in A
print " The maximum value of current = %0.1f mA" %(Imax*10**3)
print " The minimum value of current = %0.1f mA" %(Imin*10**3)
```

In [35]:

```
#Given data
Vout= 10 # in V
V_F= 2 # in V
Ip_max= 15 # in mA
Ip_max= Ip_max*10**-3 # in A
I_F= Ip_max
Rs= (Vout-V_F)/I_F # in Ω
print " The value of Rs = %0.1f Ω" %Rs
```

In [36]:

```
#Given data
Ep= 0.0153*10**-17 #in J
lamda= 1300 # in nm
nita_ext= 0.1
e = 1.6*10**-19 #in C
Eg= 1.42*e # in eV
S= nita_ext*Eg/e # in W/A (where S= deltaP/deltaI )
print " Slope of efficiency = %0.4f W/A" %S
# Note: In the book, the evaluated value of Eg/e is wrong because the value of 1.42*e/e = 1.42 not equal to 0.956 ,
# Hence the answer in the book is wrong
```

In [37]:

```
#Given data
e = 1.6*10**-19 #in C
Eg= 1.48*e # in J
R=1 # in Ω
i_p= 100 # in mA
i_p= i_p*10**-3 # in A
i_F= 10 # in mA
i_F= i_F*10**-3 # in A
Popt= 1.25 # in mW
Popt= Popt*10**-3 # in W
nitaP= Popt/((i_p**2*Eg/e)+i_F**2*R)*100 # in %
print " Power efficiency = %0.1f %%" %nitaP
```

In [41]:

```
from math import exp
# Given data
kT= 0.025 # in eV (Let as take T=300 K)
E= 1.42/2 # in ev (Let E = E_C-E_F)
FE= exp(-E/kT)
print " The probability of exciting electrons at conduction band = %0.2e " %FE
```

In [43]:

```
# Given data
k= 1.38*10**-23
T= 300 # in K (assume)
V_D= 0.7 # The depletion voltage for silicon
e=1.6*10**-19 # in C
# n_n/n_p= p_p/p_n = %e**(e*V_D/(k*T))
ratio= exp(e*V_D/(k*T)) # ratio of majority to minority charge carriers in n and p of a silicon semiconductor
print " Ratio of majority to minority charge carriers in n and p of a silicon semiconductor = %0.1e" %ratio
```