Section & group no.: B,GP:6 Roll No.
:2023_EE_072
University of Engineering and Technology, Lahore
Department of Electrical Engineering
EE216: Electronic Devices & Circuits
Experiment 1
Objectives
To plot the VD-ID curve of a diode.
Apparatus required
1N4007 diode, 100 Ω resistor
PRECAUTIONS
Keep all connections as short as possible.
Before applying DC power supplies to the circuit make sure that they are
all set to zero volts.
Switch off the power supplies before making any change in the circuit.
1- Connect the circuit shown in Figure 1. Apply a 1 KHz, 12 Vpk-pk
triangular wave with a DC offset of 4 V, at Vin.
Figure 1
1 of 5
Section & group no.: B,GP:6 Roll No.:2023_EE_072
Figure 1.1
2- Press the XY button on the oscilloscope. Switch both channels to GND.
A dot will appear onthe screen. This is origin of the plot. Place this dot
at a suitable position on the screen.
3- Now switch both channels to DC. A curve will appear on the screen
similar to the one shown in Figure 2. This is V D-ID curve of the diode
rotated around Y-axis (ID axis).
Figure 2
2 of 5
Section & group no.: B,GP:6 Roll No.:2023_EE_072
Figure 2.1
3 of 5
Section & group no.: B,GP:6 Roll No.:2023_EE_072
Figure 2.2
4- For the VD values given in Table 2 measure the corresponding I D values
from the curve. In this case ID is equal to the Y-axis value divided by R 1.
Note down the values in Table 1.
VD (V) ID (mA)
-0.8 0
-0.6 0
-0.4 0
-0.2 0
0 0
0.2 0
0.4 0
0.6 0
0.7 20
0.8 60
Table 1
VD
5- A real diode follows the equation I D =I s (e ¿ ¿ − 1)¿ where IS and VT are constants. IS
VT
is called the “reverse saturation current” and VT is the thermalvoltage having a value of
25mV at room temperature. Write a python or MATLAB code that uses curve fitting on
the data given in Table 1 to find the value of IS
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
# Given data (VD in V, ID in mA)
VD = np.array([-0.8, -0.6, -0.4, -0.2, 0, 0.2, 0.4, 0.6, 0.7, 0.8])
ID = np.array([0, 0, 0, 0, 0, 0, 0, 0, 20, 60]) # Current in mA
# Thermal voltage (VT) in volts
VT = 25e-3
# Diode equation
def diode_eq(VD, IS):
return IS * (np.exp(VD / VT) - 1)
# Curve fitting
initial_guess = [1e-12] # Initial guess for IS
popt, _ = curve_fit(diode_eq, VD, ID, p0=initial_guess)
# Extract the fitted value of IS
IS_fitted = popt[0]
# Plot the data and fitted curve
VD_fit = np.linspace(-0.8, 0.8, 100) # Generate VD values for smooth curve
ID_fit = diode_eq(VD_fit, IS_fitted) # Compute fitted current
plt.scatter(VD, ID, color='blue', label='Data Points') 4 of 5
plt.plot(VD_fit, ID_fit, color='red', label=f'Fitted Curve (IS = {IS_fitted:.2e} A)')
plt.xlabel('VD (V)')
plt.ylabel('ID (mA)')
Section & group no.: B,GP:6 Roll No.:2023_EE_072
Is = 7.64e-13 A
5 of 5