LM317 Constant-Current LED Driver

Drive a string of LEDs at a precise, regulated current with just an LM317 and one resistor — the simplest two-component constant-current source in the analog toolkit.

Difficulty: Breadboard. Estimated build time: about 20 minutes. Estimated parts cost: about US$2.80. 5-line bill of materials. Compare supplier offers when available. A constant-current source for LEDs that keeps the drive current rock-steady regardless of how many LEDs you put in series or how the supply voltage drifts.

Pick a current and a resistor

Decide on a target LED current first — standard 5 mm LEDs are happy at 10-20 mA, 1 W power LEDs want 300-350 mA, a single sense resistor handles either case. The formula is R = 1.25 V / I_target. For 20 mA: R = 62 Ohm. Use a 1/2 W resistor (the LM317 will dissipate ~25 mW in the resistor, so a 1/4 W part also works but 1/2 W runs cooler).

Wire the regulator

Take a 9 V supply or 9 V battery. Connect the positive rail to the anode of LED 1, LED 1's cathode to LED 2's anode (and so on for as many series LEDs as you want, up to about 5 for a 9 V supply), the last LED's cathode to the LM317's IN pin. Connect the sense resistor between OUT and ADJ. The ADJ pin is also your output — wire it back to the supply ground through the load (in this circuit, that's just a wire to GND if your LEDs are upstream).

Verify and tune

Power up and measure: every LED should glow at the same brightness, and an ammeter in series with the string should read the current you targeted to within ~5%. Try briefly shorting one LED out — the current stays the same, only the dropped voltage changes. That's the difference between a current source and a resistor-limited circuit, and it's exactly why this driver matches LED colours and survives supply voltage drift.