Fork me on GitHub

Project Notes

#092 LM317 Constant Current Power Supply

A low-power constant current source using the LM317

Here’s a quick video of the circuit in action:

Power317CC

Notes

The LM317 is typically used as an adjustable voltage supply as demonstrated in the LM317 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

Construction

Breadboard

The Schematic

The Build

With 1 LED on

The Build

With 2 LEDs on

The Build

With 3 LEDs on

The Build

Credits and References

About LEAP#92 Power

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

Project Source on GitHub Return to the LEAP Catalog
About LEAP

LEAP is my personal collection of electronics projects - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader