4

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\$

enter image description here

$$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)$$

enter image description here

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:

enter image description here

enter image description here

ocrdu
  • 8,705
  • 21
  • 30
  • 42
Pete
  • 135
  • 2
  • 9

1 Answers1

13

Here's the relevant chart from your datasheet:

enter image description here

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:

import sympy
from sympy import symbols, ln, exp, solve, Eq

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])) )

if __name__ == "__main__":
    diode()

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.)

enter image description here

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

enter image description here

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.

lokthelok
  • 3
  • 2
jonk
  • 77,059
  • 6
  • 73
  • 185
  • A bit confused by these numbers, reposted with pictures below – Pete Dec 20 '21 at 21:52
  • 1
    @Pete Let me use LTspice to plot it for you using the full numbers my program generated. – jonk Dec 20 '21 at 21:53
  • Thank you I appreciate it! – Pete Dec 20 '21 at 22:01
  • 1
    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 '21 at 23:01
  • @Pete Glad it helped!! You can [look here](https://electronics.stackexchange.com/a/592785/38098) if you care about the closed equation. It's a little bit annoying, though. – jonk Dec 20 '21 at 23:09
  • 1
    @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 '21 at 23:18
  • Incidentally, why did you use all caps for a muteable (POINTS)? – 2e0byo Dec 21 '21 at 11:31
  • 1
    @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 '21 at 11:54
  • 1
    @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. – 2e0byo Dec 21 '21 at 11:57
  • @2e0byo I'd enjoy seeing how you'd write it. I only starting learning Python and Sympy about a year ago and have only used it, occasionally, since. I still have a great deal yet to learn. – jonk Dec 21 '21 at 12:01
  • I've rewritten this (keeping the logic exactly the same) and put it [in a gist](https://gist.github.com/2e0byo/b182449309bb09b89446670f350ee2eb). Coding styles vary enormously and your code is completely fine, but you did ask... note that I don't get exactly the same results unless I'm misentering points, but I do get the same results with your code and mine. – 2e0byo Dec 21 '21 at 14:28
  • 1
    @2e0byo Thanks so much. I'm heading off to bed, right now. (Again.) But I will read through it carefully, tomorrow. Thanks!! – jonk Dec 21 '21 at 14:34