Diode Junction Biasing

download notebookDownload this example as a Mathematica notebook.

The simplest solid-state elements to start working with are diodes. Since bipolar transistors can be modeled from simple p-n diodes, it is useful to first understand diode behavior. From the exponential nature of diode current, we can derive the following ideal p-n junction current equation while ignoring effects such as reverse breakdown.

Ipn==Is(e^((qvpn)/(kT))-1) 

Here, [Graphics:Images/djb1_gr_2.gif] is the reverse saturation current (which is temperature dependent), [Graphics:Images/djb1_gr_3.gif] is the electron charge, [Graphics:Images/djb1_gr_4.gif] is Boltzmann's constant, [Graphics:Images/djb1_gr_5.gif] is the temperature in degrees kelvin, and [Graphics:Images/djb1_gr_6.gif] is the voltage across the p-n junction (the diode). We can calculate the [Graphics:Images/djb1_gr_7.gif] factor in Mathematica, where 293 kelvin is the standard temperature of STP.

In[1]:=Needs["Miscellaneous`PhysicalConstants`"]

In[3]:=ElectronCharge/(BoltzmannConstant 293 Kelvin)

[Graphics:Images/djb1_gr_8.gif]

From this, we can create a small function for use with the diode (again, we are ignoring reverse breakdown effects, as well as capacitive and resistive effects at high frequencies, so the domain of this equation is limited). (Since we are interested only in low-precision numeric computations here, we apply N to the result of the computation to cause machine-precision real numbers to be returned.)

In[4]:=DiodeCurrent[vpn_,Is_]:=N[Is (E^(39.6 vpn)-1)]

Assuming a typical reverse saturation current of 5 microamperes, we can create the following plot of the behavior of the junction (the factor of 1000 converts amperes to milliamperes for a more readable output).

 
In[5]:=Plot[1000DiodeCurrent[vpn,5/10^6], [vpn, -0.2, 0.15}, AxesLabel->{V, I (mA)}, PlotRange->All]

[Graphics:Images/djb1_gr_10.gif]

Out[5]=-Graphics-

We can see the reverse current domain in this graph. If we increase the range of voltages in the examination of this behavior, the plot appears closer to the ideal diode model of a voltage-dependent on-off switch. In some forms of analysis, it is sufficient to model a diode as a one-way conductor.

Modifying Graph
It is possible to change the above plot by altering the graphics directives. Graphics directives control the way a shape is drawn, for example, by changing the color of the graph or the labels.  So for the above plot we start off changing the color. To change the color of the graph there are a few functions available, (RGBColor[r,g,b], CMYKColor[cyan, magenta, yellow, black] and GrayLevel[level]).  The one we will use is the function RGBColor.  It specifies a color with the specified proportions of red, green, and blue.

 In[6]:=Plot[1000DiodeCurrent[vpn, 5/10^6], {vpn, -0.2, 0.15}, AxesLabel->{V, I (mA)}, PlotStyle->{RGBColor[0,0,1]}, PlotRange->All]

 
Out[6]=-Graphics-
You can also label the plot,or alter the text style. As an example take a look at the following.
Solving a Simple Diode Circuit
The diode equation is easily invertible until one adds resistors and other diodes into the circuit. These more complicated cases with mixed linear and nonlinear components can be handled with Mathematica's internal root finding function, FindRoot. We can set up a simple circuit and solve its loop equation.
 

A diode circuit. Output voltage is measured across the diode.

Since we are using numeric techniques, this calculation can be performed only when values are substituted for V1 and R1. This class of technique requires us to give a starting guess for our function. If we give a pair of points as a guess, FindRoot will use a secant method, while if we give a single guess, it will use a variant of Newton's method. Here we will assume the reverse saturation current to be 1 picoampere, which is typical for low reverse current diodes such as a PAD-1 (as opposed to the typical signal diode figure we used in the previous example). We will also assume that V1 is 1 volt and R1 is 50 ohms.

In[7]:=FindRoot[1-DiodeCurrent[Vout,1/10^12] 50-Vout==0,{Vout,{0.4,0.6}}]
Out[7]={Vout->0.577224}

We can extend this analysis to waveform plotting by extracting the result from the solution rule generated by FindRoot. Here we will plot the voltage across R1 since it results in a familiar rectified waveform.

Note that the output of FindRoot is again in the form of a transformation rule.  It is convenient for us to construct a small function that does the root finding for given input voltage and resistance. We can easily enforce that this will evaluate only when Vin is numeric by testing Vin.

In[8]:=voltageDiode[Vin_?NumberQ,R1_]:= Vout/.FindRoot[Vin-DiodeCurrent[Vout,1/10^12], R1-Vout==0,{Vout,{0.4,0.6}}]

We can now create a plot. It is useful to plot the voltage across R1 since this gives us the familiar half-wave rectified voltage.

In[9]:=Plot[2 Sin[t]-voltageDiode[2 Sin[t],50],{t,0.001,4 π},PlotRange->All]

[Graphics:Images/djb1_gr_16.gif]

Out[9]=-Graphics-