Archive for July 24th, 2012
Based on that comment and faced with two sacks of LEDs, I thought an LED curve tracer might come in handy at some point. While I could modify the MOSFET tester to work with LEDs, they have a higher forward voltage and a much lower current than that hardware can handle without some serious chopping & slicing.
At least for the cheap 5 mm LEDs I’m considering, a forward drop well under 4 V and current under 75 mA should suffice. That suggests a +5 V supply for the LED, a fairly high current-sense resistor, and an Arduino for a quick-and-dirty controller.
The overall idea:
- Run the LED between a regulated supply and the MOSFET drain
- MOSFET source to current-sense resistor to ground
- Measure all three MOSFET terminal voltages
- Set the gate voltage with a PWM-to-DC filtered voltage
The MOSFET current depends on the gate-to-source voltage, which varies with the current through the sense resistor, so the firmware must measure the actual current and adjust the gate voltage to make the answer come out right. This being a DC application, it can probably monotonically increase VGS and stop when it sees the right current. The MOSFET must have a logic-level gate, so that voltages around +4 V will produce sufficient drain current.
The PWM must run at 32 kHz to minimize the size of the filter cap.
If the LED supply is slightly lower than the Arduino’s VCC supply, then the analog input can report the actual voltage and the forward drop is
VCCLED - VDrain. Given a regulated supply, that’s as good measuring the voltage against the ground reference.
The current is
VSource / RSense. For a current under, say, 100 mA, a 10 Ω sense resistor will drop 1 V, leaving about 4 V of headroom for VGS. The default 5 V reference means the ADC steps are 5 mV, so the current steps will be 0.5 mA. One could use the Arduino’s internal 1.1 V band-gap reference for higher resolution: 0.11 mA. Changing that is a simple matter of software.
So, after a bit of doodling and a pair of afternoon thunderstorms that forced a complete computer shutdown (and forced me into the Basement Laboratory), here it is:
The Arduino Pro Mini board (it’s actually a cheap knockoff) has female headers for all the usual signals and a male header to match the sockets on the FTDI Basic programmer board, all from my heap. The connections use flying leads stripped from a length of ribbon cable, soldered to male header pins snipped from a stick, and reinforced with heatstink tubing. The Pro Mini isn’t anchored in place and probably never will be.
Another view, minus cables and FTDI:
The LED leads just jam into an old IC socket. The top pushbutton triggers the test, the bottom one doesn’t do anything yet.
Nothing fancy at all; I hand-wired it to avoid all the usual DIY PCB hassles.The bottom view shows all the wiring:
The schematic, such as it is:
The regulator is a random Fairchild KA278RA05C +5 V LDO, obtained surplus. The 68 kΩ resistor trims the internal divider to pull the output to 4.87 V, just a touch under the Arduino’s 4.93 V regulator. The power supply is a 7.5 V 2 A surplus lump with no pedigree.
The MOSFET is an IRLZ14 logic-level FET with grossly excessive qualifications.
The sense resistor is a pair of 21.0 Ω 1% resistors in parallel = 10.5 Ω. That’s just a firmware constant, so I don’t care what the actual value works out to be.
Next, a dab of firmware…