A low-power constant current source using the LM317
Here’s a quick video of the circuit in action:
The LM317 is typically used as an adjustable voltage supply as demonstrated in the Power317 project.
But it can also be used as a constant current supply. The details are hiding towards the end of the application notes in the datasheet, with little explanation. However this tutorial on YouTube does an excellent job of clarifying how it works.
So my intention here is to test a low-power constant current source to drive a variable number of LEDs with constant brightness.
Let’s set the design criteria to be around 2-3mA constant current. That’s far from max brightness for an LED, but enough to be definitely on.
Since the 317 will attempt to maintain 1.25V across output to adjustment pins, we therefore select an appropriate value for R1 such that (by ohms law) we get our desired current.
In my case, it seems 470Ω is a good fit. This should result in a constant current of 2.66mA.
Using some 3mm LEDs that have a forward voltage Vf of about 1.9-2V, that means a 9V supply should handle up to 3 LEDs in series at 2.66mA before we run out of voltage headroom (VCC - ~2V = 7V).
So how does it work in practice? Pretty much spot on! With 1,2, or 3 LEDs in series, the 317 holds the current at 2.71mA.
Some notes on the circuit:
- The first DIP switch is a master on/off that will light LED1 when on. When off we get 0 current as is expected.
- The second and third DIP switches selectively enable or bypass LED2 and LED3
- The 10μF electrolytic capacitors smooth the power supply and are not really necessary for this circuit
With 1 LED on
With 2 LEDs on
With 3 LEDs on
Credits and References
- LM317 datasheet
- Laser / LED Driver and Constant Current Source Tutorial! - excellent video on the subject