LED Curve Tracer: Repeatability

Measuring the same LED many times should produce the same data every time. Here’s an LED measured ten times in quick succession, with each data point consisting of the average of three ADC conversions:

Repeatability - 3 samples

Repeatability – 3 samples

Ten more measurements of the same LED, but with each data point being the average of ten ADC conversions:

Repeatability - 10 samples

Repeatability – 10 samples

Not much to choose between the two, although averaging more readings does reduce the scatter just a bit. The ADC resolution is 5 mV, which is painfully obvious along the X axis. The Y axis has a smaller spread because it’s the independent variable: the firmware sets the MOSFET gate voltage to produce a given current and the ADC steps are relatively larger (the input voltage is only 75 mA × 10.5 Ω = 800 mV, tops).

I think it’s close enough for my simple needs.

The ADC code looks like this:

//-- Read AI channel
// averages several readings to improve noise performance
// returns value in mV assuming VCC ref voltage

#define NUM_T_SAMPLES 10

float ReadAI(byte PinNum) {
  word RawAverage;

  digitalWrite(PIN_SYNC,HIGH); // scope sync

  RawAverage = analogRead(PinNum); // prime the averaging pump

  for (int i=2; i <= NUM_T_SAMPLES; i++) {
    RawAverage += (word)analogRead(PinNum);


  RawAverage /= NUM_T_SAMPLES;
  return Vcc * (float)RawAverage / 1024.0;

And the Gnuplot routine that produces the graphs, including a bit of cruft that reminds me how to make two Y axis scales:

#-- overhead
export GDFONTPATH="/usr/share/fonts/truetype/"
echo Base name: ${base}
echo Output file: ${ofile}
#-- do it
gnuplot << EOF
#set term x11
set term png font "arialbd.ttf" 18 size 950,600
set output "${ofile}"
set title "${base}"
set key noautotitles
unset mouse
set bmargin 4
set grid xtics ytics
set xlabel "Forward Voltage - mV"
set format x "%6.3f"
set xrange [1.8:2.1]
#set xtics 0,5
set mxtics 2
#set logscale y
#set ytics nomirror autofreq
set ylabel "Current - mA"
set format y "%4.0f"
#set yrange [0:${rds_max}]
#set mytics 2
#set y2label "right side variable"
#set y2tics nomirror autofreq 2
#set format y2 "%3.0f"
#set y2range [0:200]
#set y2tics 32
#set rmargin 9
set datafile separator "\t"
#set label 1 "Comment" at 0.90,0.35 font "arialbd,18"
plot	\
    "$1" using (\$5/1000):((\$1>0)?\$2/1000:NaN) with linespoints lt 3 lw 2 lc 1

  1. #1 by Rob on 2012-07-31 - 03:27

    Info such as this might be
    very useful to me if I were
    and back into the test lab!

    Nice graphs, Ed!

    • #2 by Ed on 2012-07-31 - 08:40

      into the test lab!

      And that’s an order; it should keep you from seeing pixels in your sleep!

      The graphs come from Gnuplot and the post now has the Bash script that makes it happen. Should have put that in the first time.


  2. #3 by Red County Pete on 2012-07-31 - 11:03

    Thoughts from an old test engineer (“retired” in 2002 as part of the dot-bomb implosion). How much (if any) of the jitter is due to heating of the DUT (er, Device Under Test). At your higher currents, you might be seeing 14C junction temperature elevations (from a SWAG of 100 degrees/watt for the package), and the thermal time constant(s) will get you.
    HI don’t speak Arduino; my engineering tends to do more with ranch and rural applications now, but you might try a program to look at the heating effects at a given current. Last time I looked at thermal time constants, interesting effects showed up in the first 10s of milliseconds (chip heating), 1s of seconds (leadframe heating) and so on. For a 18 pin DIP, it could take 15 minutes in still air to hit equilibrium. This was on silicon, but III-V materials should show similar effects. (Basic method was to apply a known power for the time, then to measure the Vf at a lower current for a short test time. This was easy for bipolar devices with a backside diode, but the same approach would/should work for an LED front biased. For a diode, you might want to do the heating and measuring at the same currents. Resistance effects shouldn’t foul things up too much. The bipolar devices drew upwards of half a watt.)
    I need to get up to speed on gnuplot. I used to use plotmtv, but the last time I looked, the source was hard to find, and the package hadn’t been supported in a few years. That was 10 years ago. Nice 3D capabilities, along with the ability to rotate the viewpoint on the fly.

    • #4 by Ed on 2012-07-31 - 11:15

      14C junction temperature elevations

      OK, I’ll extract the first and last two runs from that average-of-10 dataset, plot ’em with some ID, and see if there’s any progression.

      LED data sheets always tell you to keep the duty cycle down to some minute value for high currents, so applying what’s basically a DC overload makes no sense at all. On the other paw, I was so pleased that the thing Just Worked…

      Nice 3D capabilities, along with the ability to rotate the viewpoint on the fly.

      Gnuplot may have Borged those features, as it can do all manner of 3D stuff. I used a very small fraction of its capabilities to plot those WWVB reception noise graphs and it worked well for my simple needs.

      • #5 by Red County Pete on 2012-07-31 - 11:38

        Thanks for the tip. Guess I should find a Linux update with a kernal newer than my 2002 2.4.xx

        The data sheet should/might tell you the thermal resistance of the package, either in junction to ambient or junction to case–depends on the application and mounting. The old HP optoelectronics catalogs had this data in the back of the sheet.

        • #6 by Ed on 2012-07-31 - 13:10

          find a Linux update with a kernal newer than my 2002 2.4.xx

          Aye, but if you’re running Y2k era hardware, the latest versions may be so portly they don’t fit in the box. I need a Round Tuit that will install Tiny Core on an ancient laptop that can’t handle anything newer…