Engineering 77 Lab 1-Non-linear Devices: Diodes
Aron Dobos, Tyler Strombom
6 September 2005
Abstract
The non-linear device characteristics of the 1N914 and 1N4001 diodes were measured in the laboratory. The calculated device parameters were compared to the manufacturer’s specifications, and some deviations were observed. The actual behavior of the two diodes was also compared to the ideal and constant voltage drop diode models.
Task 1 : Measuring the I-V Relationships
The circuit shown in Figure 1 was connected in the lab, first with the 1N914 diode. The voltage V1 was varied from -10 V to 10 V. The current flow through the diode was obtained by measuring the precise resistance of R1 and the voltage across it. The plot of the diode current vs. the diode voltage for the 1N914 and 1n4001 are shown in Figures 2 and 3, respectively.
Figure 1. Task 1 Circuit Schematic
Figure 2. 1N914 Data and Curve Fit
Figure 3. 1N4001 Data and Curve Fit
From the best fit curve, we can obtain the saturation current Is and emission coefficient n parameters. The results are shown in Table 1.
Table
1. Is and n Values
|
Experimental |
Manufacturer
1 |
Manufacturer
2 |
|||
|
Is |
n |
Is |
n |
Is |
n |
1N914 |
3.33E-10 |
1.676 |
2.22E-10 |
1.65 |
xxx |
xxx |
1N4001 |
1.59E-09 |
1.718 |
7.69E-11 |
1.45 |
3.70E-09 |
1.774 |
The table evidences some disagreement on the parameter values. For the 1N914 diode, the experimental and manufacturer values are in fact quite close, and the differences due to aberrations in the manufacturing. For the 1N4001 however, the experimental data is much closer to the values put forth by manufacturer 2, and those specified by manufacturer 1 are completely different. One might conclude that there is some reasonably significant variation among diodes that bear the same device name.
Calculating Vdiode for V1 = 2 Volts
There are two separate equations for the current through circuit 1. They are
Eq. 1
and
Eq. 2
where Is is the saturation current, Vdiode is the voltage across the diode (also Vout), Vt is the thermal voltage, n is the emission coefficient, V1 is the input voltage, and R is the resistance in the circuit. The two equations can be used to determine Vout/Vdiode by combining the two equations into
Eq. 3
Equation 3 can be plotted in Matlab, as shown below:
Figure 4: Plot of f(Vdiode)
When f(Vdiode) = 0, equations 1 and 2 are equal. The value for Vdiode at this point is the voltage across the diode when the input voltage is 2 V. Using the Matlab program in Appendix A, f(Vdiode) equals zero at 0.5886 V for the 1N4001 diode and 0.6382 V for the 1N914 diode.
Half-Wave Rectifier
The following circuit was constructed with a 1N914 diode
Figure 5: Circuit Schematic
and Vin and Vout were displayed on an oscilloscope. A copy of the oscilloscope screen is given in Figure 6.
Figure 6: Oscilloscope Screen for Task 2
To compare the behavior of the actual 1N914 diode to various models, a MATLAB program was written to determine the behavior of the circuit using the ideal diode, the constant voltage drop model, and the actual diode equation. The simulation results are shown in Figure 7, using the device parameters for the 1N914. The input is the same 1kHz 2Vp-p used in the laboratory. The MATLAB simulation code is included in Appendix A.
Figure 7. Simulation of various diode models.
The solution using the actual diode equation unsurprisingly seems to correspond to the laboratory results best. The second best model is the constant voltage drop. With this model, a better choice of voltage drop could have been chosen (i.e. ~ 0.6 V instead of 0.7V) to yield better matching between the model and actual diode behavior.
Diode Equation Solver
Using a Simple
The brute force iterative approach to solving the non-linear
diode equation in calc_diode_dc_op.m
was extremely slow and would not give reasonable results unless the accuracy
threshold was made very small. A better
method for finding the zero of the circuit equation is
The function f and its derivative are given below.
Our MATLAB implementation stops if convergence is not
reached after 30 iterations. It also
quits if the next guess for Vd
steps outside the lower and upper bounds.
Using
%diodeeqn1(i) = input(i) - calc_diode_dc_op(input(i), Is, n,
R);
diodeeqn1(i) = input(i) - newton(-2,
2, 0.00001, input(i), R, Is, n);
Figure 8. Simulation results using a simple
A more robust solver could be developed that has better convergence properties, but this simple method appeared to work acceptably for the simple circuit under analysis.
Using
For the 1N4001:
newton(.5, .9, 0.00001, 2, 993,
1.59e-9, 1.718)
0.5886
For the 1N914:
newton(.5, .9, 0.00001, 2, 993,
3.33e-10, 1.676)
0.6382
These results compare favorably to the diode voltages
obtained in Task 1(See Calculating Vdiode for V1 = 2 Volts).
Appendix A: MATLAB Code
Matlab program for calculating Vdiode
for V1 = 2 Volts
% e77 lab
1
% F(Vdiode) method
R=993; %measured resistance
Is1=1.59e-9; %saturation
current for 1n4001
Is2=3.33e-10; %saturation current for 1n914
n1=1.718; %emission coefficient for 1n4001
n2= 1.676; %emission coefficient for 1n914
Vin=2; %input voltage
Vt=0.025; %thermal voltage
DT=.000001; %step size
Vd=-1:DT:1; %array for diode voltage
fvd1 = (Vin-Vd)./R - Is1*(exp(Vd./(n1*Vt))-1);
fvd2 = (Vin-Vd)./R - Is2*(exp(Vd./(n2*Vt))-1);
for i=1:length(Vd),
if ( fvd1(i) > -.000001 & fvd1(i)
< .000001 )
ans1 = Vd(i);
end
if ( fvd2(i) > -.000001 & fvd2(i)
< .000001 )
ans2 = Vd(i);
end
end
answer1=ans1
answer2=ans2
plot(Vd, fvd1, 'r', Vd, fvd2, 'g');
axis([-1 1 -2.2e-3
3.2e-3]);
grid on
title('Solving for
Diode Voltage');
xlabel('Vd (volts)');
Matlab program for simulating various diode
models
%% e77 lab
1
%% ideal
diode
%%
constant voltage drop (0.7V)
%% diode
equation
t = 0:1e-5:2e-3;
R = 993;
Is = .1e-12;
n = 1;
VT=0.025;
input = sin( t .*
(2*pi*1000) );
len = length(t);
ideal = zeros( len, 1 );
const = zeros( len, 1 );
diodeeqn1 = zeros( len, 1 );
for i=1:len,
if ( input(i) < 0 )
ideal(i) = 0;
else
ideal(i) = input(i);
end
if (input(i)-0.7 < 0)
const(i) = 0;
else
const(i) = input(i)-0.7;
end
diodeeqn1(i) = input(i) - calc_diode_dc_op(input(i), Is, n,
R);
end
plot(t,input, t, ideal, t,const, t,
diodeeqn1 )
legend('1kHz 2Vp-p
input', 'ideal', 'const', 'diodeeqn');
title('Expected
Results Using Various Diode Models (1N914)');
xlabel('Time (s)');
ylabel('Vout (Volts)');
print -dbitmap 'sim.bmp'
MATLAB Code for
calculating the DC operating point of a diode (slow iterative method)
function [vd] = calc_diode_dc_op(Vin, Is, n, R)
err = 1;
accuracy = 0.000001;
step = 0.000005;
vd = 0.6;
while abs(err) >
accuracy,
Id1 = Is*(exp(vd/(n*0.025))-1);
Id2 = (Vin - vd)/R;
err = Id1 - Id2;
if (err > 0)
vd
= vd-step;
elseif (err < 0)
vd
= vd+step;
end
end
MATLAB Code for
DC-OP using a simple version of Newton’s Method
function [Vd] = newton(Vd1, Vd2, threshold,
Vin, R, Is, n)
% newton's method for diode dc op
% Vd1,Vd2: lower and upper bounds for Vd
%
threshold: accuracy of Vd
result
% Vin: input voltage
% R: resistance
% Is, n: diode parameters
max_iter = 30; % maximum
number of iterations
Vd = (Vd1+Vd2)/2; % start with the midpoint of the
bounds
VT = 0.025; % thermal voltage
for i=1:max_iter,
f = (Vin-Vd)/R -
Is*(exp(Vd/(n*VT))-1); %
calculate f
df
= -1/R - Is/(n*VT)*exp(Vd/(n*VT)); %
calculate df
dx
= f/df;
Vd
= Vd - dx; % x1 = x -
f(x)/df(x)
if (Vd < Vd1 | Vd > Vd2)
disp('newton: exceeded bounds');
return;
end
% if change from previous Vd value was smaller than
% the accuracy threshold, we're
done, so return.
if (abs(dx) < threshold)
return;
end
end
disp('newton: failed to converge in 30 iterations');