LTspice Modeling an LED

I'm trying to create a spice model for a Vishay VSLY5940 IR LED (datasheet) and after following a few examples I found online, I'm unable to complete my calculations.

I created a graph in Excel that looks similar to the datasheet $$\I_f,~ V_s,~ V_f\$$ but I am not able to solve for $$\R_s,~ N,\$$ or $$\I_s\$$. I tried to solve for these using the following equations:

Assumed values: $$\R_s=.01,~ N=1,~ I_s=10n,~ V_{th}=.0259\$$

$$V_1=R_sI_{D1}+N \times V_{th}\ln\left(\frac{I_{D1}}{I_S}\right)$$

$$V_2=R_sI_{D2}+N \times V_{th}\ln\left(\frac{I_{D2}}{I_S}\right)$$

$$V_3=R_sI_{D3}+N \times V_{th}\ln\left(\frac{I_{D3}}{I_S}\right)$$

$$V_4=R_sI_{D4}+N \times V_{th}\ln\left(\frac{I_{D4}}{I_S}\right)$$

Any suggestions on how to solve for $$\R_s,~ N,\$$ or $$\I_s\$$?

Update: I tried adding the model using Jonk's numbers in their answer below, but my I(f) vs V(f) graph doesn't match up to what's on the datasheet:

• Have you tried using the Shockley equation? Dec 20, 2021 at 18:21
• Try adding some small amount of series resistance to make the changeover more fluid and less sharpened. Dec 20, 2021 at 18:31

Here's the relevant chart from your datasheet:

For three variables you'll need three points on it. I've selected the ones for $$\1\:\text{mA}\$$, $$\30\:\text{mA}\$$ and $$\1\:\text{A}\$$. The voltage values I picked off are $$\1.25\:\text{V}\$$, $$\1.5\:\text{V}\$$, and $$\2.85\:\text{V}\$$, respectively.

The code I used is:

def diode():
print( "This program uses 3 diode measurements to extract parameters." )
print( "You will need to have taken these measurements beforehand." )
print( "Enter each point as [ <diode current>, <diode voltage> ]." )
print( "" )
TA= int( input( "Enter the ambient temperature in Celsius (default is 27 C): " ) or "27" )
print( "" )
VT= 8.61733034e-5 * ( 273.15 + TA )
POINTS= []
vd, id, N, ISAT, RS= symbols( "vd id N ISAT RS" )
for i in range(3):
pid, pvd= input( "Enter point " + str(i) + ": " ).split()
POINTS.append( { vd: float( pvd ), id: float( pid ) } )
EQS= []
for i in range(3):
EQS.append( Eq( POINTS[i][vd], RS*POINTS[i][id] + N*VT*ln(POINTS[i][id]) - N*VT*ISAT ) )
print( POINTS )
print( EQS )
ANS= solve( EQS, [ RS, N, ISAT ] )[0]
print( "RS   = " + str(ANS[0]) )
print( "N    = " + str(ANS[1]) )
print( "ISAT = " + str(exp(ANS[2])) )


Plugging these into Python code running on Sage, I get: $$\R \approx 1.16185\:\Omega\$$, $$\I_\text{SAT}\approx 2.96406\:\text{pA}\$$, and $$\N \approx 2.475312\$$.

The above code is actually somewhat more robust on $$\N\$$ than it is on the other parameters. But I think those parameters will reasonably closely reproduce that curve. (I've not checked.)

You are free to work out your own method. Especially if you require an Excel answer. I'm not interested in providing that. But the above should, at least, provide you with an approach to implement in Excel, should you want to do that.

Here's what I get from LTspice using the parameter values my program calculated from just three points (more would be better, of course.)

I then used "cursors" on LTspice to pick off the relevant values:

You can use LTspice yourself, if you want to check out other values on the curve and see how they match up with the chart. My algorithm isn't intended to exactly match up with LTspice, as LTspice handles a much more sophisticated model (which would require more points, obviously.) But it usually gets pretty close.

• @Pete Let me use LTspice to plot it for you using the full numbers my program generated.
– jonk
Dec 20, 2021 at 21:53
• you nailed it, thank you so much! I had been struggling on this for 5 hours today. Thank you so much for your help, made my day!
– Pete
Dec 20, 2021 at 23:01
• @Pete Non-linear equations, especially when combined with linear equations that depend upon them, can be a sincere pain where every tiny step has to be carefully examined for mistakes. This is one of those places where a symbolic solver can help, though it does turn out that a human (at least so far) still can out-pace existing software. I can easily solve these kinds of problems where SymPy as well as Wolfram Alpha just fall apart and fail miserably. So creativity and imagination still have their place.
– jonk
Dec 20, 2021 at 23:18
• @2e0byo No particular reason except that I was writing this for myself and hadn't intended to exhibit it anywhere, and I was just in that mood at the time.
– jonk
Dec 21, 2021 at 11:54
• @jonk fair! I'm just a pedant. It's a neat answer (+1) and I agree entirely re. solving problems like this by hand: one can often see the answer quicker than specifying all the constraints to make a symbolic solver behave itself. Dec 21, 2021 at 11:57