How to Build a Variable Bench Power Supply Using the LM317
At some point in every electronics hobbyist's journey, running circuits from 9V batteries stops being practical. You need a bench power supply — a regulated, adjustable voltage source that stays stable under load and protects your circuits from voltage spikes.
Buying one is the easy answer. Building one teaches you more about voltage regulation, feedback circuits, and power electronics than almost any other project. The LM317 is the classic choice for this build: a three-terminal adjustable regulator that's been in continuous production since 1970, costs almost nothing, and works exactly as specified every time.
How the LM317 works
The LM317 is a linear voltage regulator with three pins: input (IN), output (OUT), and adjustment (ADJ). It maintains a fixed 1.25V reference voltage between its output and adjustment pins.
By placing a resistor divider between the output and ground (through the adjustment pin), you set the output voltage:
V_out = 1.25 × (1 + R2/R1)
Where R1 is a fixed 240Ω resistor between OUT and ADJ, and R2 is an adjustable resistor (potentiometer) between ADJ and GND.
For a 1.25V to 30V adjustable supply, R2 needs to vary from 0Ω to roughly 5.6kΩ. A 5kΩ potentiometer with a 240Ω fixed R1 gives approximately 1.25V to 25V adjustment range.
Parts list
- LM317T voltage regulator (TO-220 package)
- Heat sink for LM317 (essential — it gets hot under load)
- Transformer: 12-0-12V or 15-0-15V, 1–2A secondary
- Bridge rectifier: 1A or 2A, 50V (or four 1N4007 diodes)
- C1: 4700µF 50V electrolytic capacitor (main filter cap)
- C2: 0.1µF ceramic capacitor (input bypass)
- C3: 1µF electrolytic capacitor (output stability)
- C4: 10µF electrolytic capacitor (output bypass)
- R1: 240Ω 1% tolerance resistor
- R2: 5kΩ multi-turn potentiometer
- D1: 1N4007 diode (output protection)
- D2: 1N4007 diode (adjustment pin protection)
- Fuse: 1A inline on AC input
- Project box, binding posts, power switch, indicator LED
The circuit
The AC mains feeds through a fuse and switch to the primary of the transformer. The secondary (12–15V AC) goes to the bridge rectifier, which converts it to pulsating DC.
C1 (4700µF) smooths the pulsating DC into relatively steady DC — this is your unregulated supply, typically 15–20V DC from a 12V AC transformer after rectification and filtering.
The LM317's input pin connects to this filtered DC. The output pin connects through R1 (240Ω) to the output terminal and through R2 (5kΩ pot) to ground. The adjustment pin connects to the junction of R1 and R2.
Protection diodes: D1 connects from output to input (anode toward input) to protect against reverse input voltage. D2 connects from adjustment pin to output (anode toward adjustment) to protect when a capacitive load is connected to the output.
C2 (0.1µF) between input and ground suppresses high-frequency oscillation. C3 (1µF) between adjustment and ground improves ripple rejection by roughly 15dB — a significant improvement for a single component. C4 (10µF) on the output improves transient response.
Heat dissipation — the part most guides skip
This is where most bench supply builds go wrong. The LM317 is a linear regulator — it burns off the difference between input and output voltage as heat.
Power dissipated = (V_in - V_out) × I_load
At minimum output voltage (say 1.25V) from an 18V unregulated supply, driving 1A load:
P = (18 - 1.25) × 1 = 16.75W
That's a lot of heat for a TO-220 package. The LM317T has a thermal resistance of 5°C/W junction-to-case. Without a heat sink, the junction temperature at 16.75W would be:
T_j = T_ambient + (5 × 16.75) = 25 + 83.75 = 108.75°C
The maximum junction temperature is 125°C — you're dangerously close with no headroom. A heat sink with thermal resistance of 3°C/W brings this to:
T_j = 25 + (16.75 × (5 + 3)) = 25 + 134°C — still too hot at full dissipation.
The solution: either limit maximum current to 500mA (practical for bench work), use a larger heat sink, or use a pre-regulator that tracks the output voltage to keep the voltage drop across the LM317 closer to 3V at all times. The Power Supply Designer calculates heat sink requirements for your specific operating conditions.
Building safely
The AC mains side of this circuit is dangerous. Always work on it when unplugged. Use proper insulation on all mains-voltage wiring. The transformer provides galvanic isolation between the mains and your DC circuit — respect it.
Use a properly rated fuse on the AC input. A 1A slow-blow fuse is appropriate for a 1A supply. The fuse protects your transformer, not the LM317 — the regulator has its own internal current limiting.
Mount everything in an insulated plastic project box, not a metal one (unless properly earthed). Label the output binding posts clearly with polarity.
Testing
Before connecting mains power, measure resistance from output positive to negative — it should be high (the potentiometer resistance plus R1). Check that you haven't accidentally created a short on the DC side.
With power connected, measure the unregulated DC at the input to the LM317. It should be 15–20V depending on your transformer. Then measure the output while turning the potentiometer through its full range — voltage should adjust smoothly from ~1.25V to your maximum output voltage.
Connect a resistive load (not your precious circuits) and verify the voltage stays stable as current increases. A small drop under load is normal (typical output impedance for LM317 circuits is under 0.1Ω, so voltage drop at 500mA should be under 50mV).
Ready to put this into practice?
Open Power Supply Designer