LEDs keep accumulating, and they are spread around in my work space. Most of them are clear, see-through LEDs. Some are dead (either by abuse, or because they are cheap Chinese diodes).
Most of them are high intensity LEDs, and they often need below 1 mA so they won't blind me.
In other words:
I need a way to test my LEDs to see if they work, which color they are, and find a suitable brightness.
After having used the LM317 in various projects, I had noticed that it could be used as a constant current source. This got me thinking about using it with LEDs.
Here's the circuit I came up with:
Forget for a moment that the pinout on the regulator is wrong (the attached Eagle project files are correct). Here's how it works:
- The LM317 will always keep a 1.25V reference voltage between the output and the adjust pins. Adding resistance in this loop will generate a constant current.
- I want to limit the current to a maximum of 20 mA. Knowing that, and the voltage (1.25V), using Ohm's law will give me the correct resistor: U/I = R -> 1.25/0.02 = 62.5 ohms. I settled for 63 ohms which is close enough.
- Adding 10k ohms will give a minimum current of 1.25 mA, so I put a 10k potentiometer in the loop as well. There's a linear pot in the picture above, a logarithmic one will work better.
- An amperemeter can be hooked up in series with the LED, to see what the current is.
- A voltmeter can be hooked up in parallel with the LED, to see the forward voltage drop.
- Using these two parameters, you can get the desired brightness in any circuit. Use Ohm's law or one of the many online LED calculators.
I built it, and it works.
The linear pot that I used makes the LED go darker relatively fast, a logarithmic one is better.