As anyone who has bought batches of LEDs on Ebay from Chinese suppliers knows, a detailed datasheet on the characteristics of the LEDs can be pretty hard to come by! That's where this circuit comes in: with the help of an Arduino and a few external components, one can build an LED Analyzer that will analyze a LED's I-V characteristics and spit out an equation that one can use to calculate its voltage drop from its forward current and vice versa.
Here's a quick video of the analyzer in action:
Step 1: The Setup
Of course, Q3 is a current sink and what we want is a current source, to pump current into the LED so its forward voltage can be measured. Q1 and Q2 perform this turnaround function. IC2A and R5 buffer the sensed voltage and protect the input to the Arduino.
The Arduino runs a sketch that ramps up the DAC voltage, and hence the current through the LED, and then reads the resulting LED forward voltage through one of its analog input pins. It then communicates with a Python script running on a PC via its serial to USB link, and this script organizes the data and displays a graph of the LED under test's I-V characteristic. It also runs a curve-fitting routine that generates coefficients for an exponential function similar to the Shockley diode model. To get a smaller error in the fit function, the Python script has the option of running the analysis multiple times and the averaging the data; the data generated for the "Results" section that follows was averaged over ten runs of the analyzer.
Here's a quick parts list for the hardware:
MCP4725 DAC breakout board with pull up resistors and capacitor (available at http://www.sparkfun.com )
LM358 dual op amp or similar (1x)
BC547 NPN transistor or similar (1x)
BC556 PNP transistor or similar (2x)
10 ohm resistor (2x)
220 ohm resistor (1x)
100 ohm 1% or better resistor (R4) 1x
1k ohm resistor (1x)
0.1uF bypass capacitor (1x)
0.01uF capacitor (1x)
LEDs to test!
Step 2: The Results - Red LED
No big surprises here. The forward voltage of this LED is just under 2 volts for most of the current range, and it crosses 2 volts right at the upper limit of the scale, at around 20 - 30 mA.
What's going on at the bottom end, though? The generated exponential fit doesn't seem to fit the data very well down there. Here's what's happening: The actual diode current doesn't exactly adhere to an exponential curve. In the real world, all real components have parasitic elements that cause their behavior to deviate from an "ideal" model. In the case of an LED, the major player is the LED's internal resistance. As current through the LED increases, this internal resistance causes a voltage drop, which in turn causes the measured voltage across the LED to be _greater_ than what one would expect from a strictly exponential model. The curve fitting routine does its best to fit a curve to the data, but because of this nonideality it can't really do it, because the LED is not behaving in a strictly exponential fashion!
Because of this issue, the exponential fit generated is NOT really suitable for use as a SPICE model. To generate a proper SPICE model, one would calculate the LED exponential parameters at a low level of current where the ohmic term doesn't have much effect, and then calculate the value of resistance separately. Properly calculating the value of resistance from the measure data is somewhat tricky - hopefully it will be in the next version! The fit curve does, however, allow one to calculate a forward voltage for a particular value of current in the region where the curves overlap.
There is also an error due to the measuring setup. The current mirroring arrangement has an error because of the base currents of the transistors! The true current through the LED is approximately given by: (alphaQ3*Isense) - 2*(alphaQ3*Isense)/beta, where alphaQ3 is the alpha of transistor Q3 and beta is the beta (current gain) of transistors Q1 and Q2. Fortunately, so long as beta stays high over the region of interest, the error is not too bad. There is additionally an error due to the Early effect of Q2, but it is also relatively small.
Step 3: The Results - UV Led
Step 4: The Results - Blue LED
Step 5: The Results - White LED
Step 6: The Results - Green LED
Step 7: The Results - Yellow LED
Step 8: The Results - Mystery Diode
Step 9: The Code
Next steps? I hope to be able to create a routine that will analyze a LED and generate a proper SPICE model, including the correct values for the diode saturation current, emission coefficient, and series resistance that can be used for simulation. There are also improvements that can be made to the measuring setup; as it stands now the current through the LED under test is calculated via an indirect method. A more accurate way to calculate the LED current would be to place a current sense in series with the LED, using a precision resistor to measure the current directly. Hopefully when I have some time...
If anyone builds this tester, please let me know how it works out!