Diode Model Fit
This tool fits a dataset (perhaps digitized from WebPlotDigitizer (beta or current)) to the Shockley diode equation:
\[ I_D = \left( \exp\!\left(\frac{V_D}{n V_T}\right) - 1 \right) I_S \text{, where } V_T = \frac{k_B}{q_p} T \]Here, \(V_D\) and \(I_D\) are the voltage and current across the diode. The diode parameters are the 'ideality factor' \(n\) (commonly called 'emission coefficient'[1]) and the 'saturation current' \(I_S\). Finally, \(V_T\) is the 'thermal voltage', a function of the Boltzmann constant \(k_B := 1.380\,649 \times 10^{-23}~\units{\unitJ/\unitK}\) and the elementary charge \(q_p := 1.602\,176\,634 \times 10^{-19}~\units{\unitC}\), and (absolute) temperature \(T\) in \(\units{\unitK}\).
SPICE's model is a bit more sophisticated, adding a series-resistance \(R_S\) inside the diode. Any current flowing in the diode over this resistance creates its own voltage drop (by Ohm's Law). Thus, the total forward voltage \(V_F\) across the diode should be:
\[ V_F = R_S I_D + V_D \]Substituting that into the previous equation, we get:
\begin{align*} I_D &= \left( \exp\!\left(\frac{V_F-R_S I_D}{n V_T}\right) - 1 \right) I_S \\ &= W\!\left( \exp\!\left(\frac{ R_S I_S + V_F }{n V_T}\right) \frac{R_S}{n V_T} I_S \right) \! \frac{n V_T}{R_S} - I_S \end{align*}(Note that in the first line \(I_D\) is on both the left and right; simplifying this form requires \(W\), the Lambert \(W\) function.)
The inverse of this equation is also useful[2]:
\[ V_F = \ln\!\left( \frac{I_D}{I_S} + 1 \right) n V_T + R_S I_D \]Diode Model Calculator
This is just a simple calculator to evaluate the above equations. Set the diode parameters and temperature in the first table, then change either \(V_F\) or \(I_D\) in the second table to see the other one update.
\(I_S\) | \(\unitsA\) |
---|---|
\(R_S\) | \(\unitsOmega\) |
\(n\) | |
\(T_C\) | \(\unitsDegC\) |
\(V_T\) | \(\unitsV\) |
---|---|
\(V_F\) | \(\unitsV\) |
\(I_D\) | \(\unitsA\) |
Diode Model Curve Fit
Fitting data to this model is useful because we need accurate models in order to accurately predict how diodes (including LEDs and laser diodes) perform.
The following calculator (not linked to the first one!) allows you to fit the diode model to data.
Data Input
More data points generally results in a more accurate fit.
Data format is a list of lines, where each line is a pair of voltage (in volts) and current (in amps). Some datasheets swap the order around, so be careful (you can select which one you have below). SI prefixes / units are not necessary. Scientific notation with e
notation, comments with #
, and blank lines are supported. See example data.
Note that diodes are temperature-dependent. Although the model is calculated from data at some measurement temperature, the model generalizes to any temperature, in theory. Most simulators assume a certain fixed temperature[3]; in the likely case this is different from the measurement temperature, the model will produce different values from the datasheet. This is expected and correct.
Measured at temperature \(\unitsDegC\)
Result
\(I_S\) | \(\unitsA\) |
---|---|
\(R_S\) | \(\unitsOmega\) |
\(n\) |
( so it has the same characteristics, but at temperature \(\unitsDegC\).)
Plot model at temperature \(\unitsDegC\)
Notes
This calculator is inspired by the diode-fitting calculator here. I wrote my own version because that one had some issues[5].