<?xml version="1.0"?>
<!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
    "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>Modeling LEDs with PSPICE</title>
		<meta name="generator" content="screem 0.12.1" />
		<meta name="author" content="Gregory Leblanc" />
		<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
	</head>
	<body>
		<h1>Modeling LEDs with PSPICE</h1>
		<p>This page is about how to develop a good (or at least, better) spice model for your LED (or any other diode, for that matter).  
		Somebody posted a model that they were using for the Luxeon 1, with a few tweaks which seemed to work for the Luxeon III.  
		I figured that I could do some testing, and come up with an emperical model.</p>
		<h2>The Shockley Diode Model</h2>
		<p>
		<math xmlns="http://www.w3.org/1998/Math/MathML">
			<mrow>
				<msub>
					<mi>I</mi>
					<mi>D</mi>
				</msub>
				<mo>=</mo>
				<msub>
					<mi>I</mi>
					<mi>S</mi>
				</msub>
				<mo>[</mo>
				<msup>
					<mi>e</mi>
					<mfrac>
						<mrow>
							<msub>
								<mi>V</mi>
								<mi>D</mi>
							</msub>
						</mrow>
						<mrow>
							<mi>&eta;</mi>
							<mo>&InvisibleTimes;</mo>
							<msub>
								<mi>V</mi>
								<mi>T</mi>
							</msub>
						</mrow>
					</mfrac>
				</msup>
				<mo>-</mo>
				<mn>1</mn>
				<mo>]</mo>
			</mrow>
		</math>
		</p>
		<p>The Shockley Model of the diode is the equation that SPICE uses to model the behaviour of diodes.  Essentially it says that the current
		through the diode is equal to the reverse saturation current of the diode <math xmlns="http://www.w3.org/1998/Math/MathML"> <msub>
		<mi>I</mi> <mi>S</mi></msub></math> times the base of the natural logarathm raised to the power of the forward voltage of the diode
		<math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>V</mi><mi>D</mi></msub></math> divided by the emission co-efficient, 
		&eta; times the thermal voltage, <math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>V</mi><mi>T</mi></msub></math>, 
		minus 1.
		</p>
		<p>Wow, Math doesn't translate to English all that well.  Stick with the written equation up above, and things will be easier.</p>
		<p>A few of those parameters bear further explaining:<br/>
		&eta; &mdash; The emission co-efficient is a &quot;fudge factor&quot; which is essentially used to make the math work out right.  There is a 
		more precise mathematical model for the diode, but it&apos;s far too complex to actually use, so we're going to go with the easy model.<br/>
		<b><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>V</mi><mi>D</mi></msub></math></b> is the thermal voltage.  If you 
		really want to know what this means, I think you have to grab a physics book.  For now, suffice it to say that, at room temperature, 
		this is 26mV.<br/>
		</p>
		<p>If we play around with that equation a bit, we&apos;ll find that when the forward voltage of the diode is above 0.1V, then the minus 1 in the
		equation has a very small impact on the result.  In order to make our lives just a little bit easier, we're going to ignore that, too.  Remember,
		our mathematical model for the diode is only an approximation, and we're making it only slightly less accurate.  The minus 1 would allow this
		model to for negative voltages (that is, reverse bias on the diode), but we aren't concerned with those, and the data that we collected probably
		doesn't give an acurate representation there.
		</p>
		<p>That&apos;s the extent of our math, for now.  Let's talk about how to gather some of this data.</p>
		<h2>Gathering Data</h2>
		<p>There are two obvious ways to gather data.  The first way is to use a Curve Tracer.  This is a device used to measure and characterize 
		transistors, both BJT and FET types.  It will also plot the IV characteristics of a diode, LED or otherwise.  All we need to do is hook the diode up
		to the curve tracer, adjust the voltage and current scales, and view the plot.  On the vacuum tube based curve tracers that I have available, 
		I needed to copy the curve from the screen onto graph paper by hand.  There are probably some more modern ones that would allow you to 
		transfer the data to the computer more directly.</p>

		<p>The second way to collect data is with one or more DMMs, a variable power supply, and a few resistors.  The idea here is to do what the 
		curve tracer does by hand.  Alas, we're not nearly as fast as the curve tracer, and possibly not as accurate either.  All that we&amp;ll need 
		to do is to hook up an appropraite resistor in series with the diode and the variable voltage source, and measure the current and voltage.  We
		need to choose a resistor that is small enough to let current flow, but large enough that when we adjust the voltage supply a small amount, 
		it doesn't go flying out of the useful range for our diode.  On the curve tracer, I found that the diode was approximately an open circuit below 
		2.5V.  Any applied voltage less than this will not result in the diode turning on.  My DMM is accurate to about 10mV (0.01V) on the 0-4V scale, 
		and the current that we're trying to measure is in the tens to hundres of milliamps.  Dividing 10mV by 10mA, gives us 1 &Omega;.  So, a 
		1&Omega;, 2 watt (for some safety factor) resistor would work just fine here.  A 10&Omega; resistor will also work, with slightly different 
		calculations to determine current.  We could use a DMM in DC current measuring mode directly, but by using resistors that we have chosen 
		we can determine exactly what the loading effect on the circuit is.  Note that our power supply will need to be able to supply <b>at least</b> 
		1A, and about 6V.  If it's not capable of this, we won&apos;t be able to collect complete data.</p>
		
		<p>Now that we've got all of the components for our circuit, we just need to build it, and take some data.  Wire the power supply, current 
		sensing resistor, and LED in series.  With three DMMs, or an accurate meter on your power supply, you can leave the meters connected
		continuously; otherwise, you'll need to move them around to take different readings.  If you&apos;re using a 1&Omega; resistor, then the
		voltage listed in the meter will be the current through the resistor.  If you're using a different resistor (2&Omega;, 5&Omega;, or 
		10&Omega;) then you'll have to perform some simple calculations to determine the current.  Remember to measure the actual resistance,
		and to use that value when calculating current.  The other important bit of data is the voltage across the diode.  That's really straighforward,
		just hook the DMM across the diode.  I also like to have a meter across the voltage source, so that I know the total voltage of the circuit.</p>
		
		<p>Now we just need to actually gather the data.  Start with the voltage source turned all the way down, and slowly crank it up.  If you only
		have one meter, start with it hooked across the sense resistor.  The voltage across this resistor will be zero until the diode turns on, probably
		in the range of 2.5V, for our Luxeon III diode.  Slowly increase the voltage, and collect data at several points.  You will need to record both the
		current through the circuit, and the voltage dropped by the diode.  Using the curve tracer, there were 4 points at which I had solid data.  Using
		the DMM and voltage source method, it is easy to get more data points, but don't get too carried away.  Half a dozen points is probably plenty
		and more than ten points could actually skew the data.  Make sure that you get one point near the point where you expect to operate the
		diode; in my case, between 700mA and 1A.</p>
		<h2>Calculations</h2>
		<p>Now for the easy part, calculations.  Fire up your vaforite spreadsheet program, and put the diode voltage in the first colum, then put the 
		diode current into a second volumn.  Select the data, and use the charting tool to do an XY plot of the points.  You can also have it add a line
		that connects the points that you've just plotted, if you like.  Next, have your spreadsheet program plot an exponential regression curve which
		fits the data, and have it place the equation of that curve on the chart.  The equation should look something like 
		<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>y</mi><mo>=</mo><mi>a</mi><msup><mi>e</mi><mrow><mi>b</mi>
		<mi>x</mi></mrow></msup></math>.  This looks a lot like our original equation.  Since we're only dealing with voltages greater than 0.1V,
		we're going to ignore the -1 from the original equation.  Therefore, in the equation we were just given by our spreadsheet, 
		<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>a</mi></math> corresponds directly to 
		<math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>I</mi> <mi>S</mi></msub></math>.  There's half of the equation.  
		<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math> isn't quite so straight forward.  We know that 
		<math xmlns="http://www.w3.org/1998/Math/MathML"><mi>b</mi></math> is the same as
		<math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mrow><msub><mi>V</mi><mi>D</mi></msub></mrow><mrow>
		<mi>&eta;</mi><mo>&InvisibleTimes;</mo><msub><mi>V</mi><mi>T</mi></msub></mrow></mfrac></math>  Since we know
		everything except &eta;, a little algebra will get that for us.
		</p>
		<h2>
	</body>
</html>