Variable Power Supply: Build Your Own Adjustable DC Unit
In this article
Building a variable power supply lets you create a bench tool that outputs a specific DC voltage and current for testing circuits, charging batteries, or powering projects. This guide shows you how to assemble a simple, safe, adjustable supply using a common LM317 voltage regulator, which handles 1.25V to about 30V at up to 1.5A. You'll need basic soldering skills and a few electronic parts, but no prior power-supply design experience.
What You'll Need
- LM317 adjustable voltage regulator (TO-220 package)
- Transformer: 12V AC, 1A or higher (or a 24V DC wall adapter as an alternative)
- Bridge rectifier (4 diodes, e.g., 1N4007) or a ready-made bridge module
- Two capacitors: 1000 µF / 25V (electrolytic) and 0.1 µF (ceramic)
- Resistors: 240 Ω (1/4W) and a 5 kΩ potentiometer (linear taper)
- Heat sink for the LM317
- Perfboard or PCB, wires, solder, and a soldering iron
- Multimeter for testing
- Enclosure (plastic or metal) and binding posts or banana jacks
- Optional: 1N4007 diode for protection, fuse and holder, on/off switch
Step-by-Step
- Design the circuit. The LM317 output voltage is set by two resistors: R1 (240 Ω) between the output and adjust pins, and R2 (5 kΩ potentiometer) between adjust and ground. Output voltage = 1.25V × (1 + R2/R1). With R2 at 0 Ω, you get 1.25V; at 5 kΩ, about 27V. For a 12V AC transformer, after rectification and filtering you'll have about 17V DC, so the maximum output will be around 15V (the LM317 needs a few volts of headroom).
- Prepare the transformer and rectifier. If using a transformer, connect its secondary (12V AC) to the AC inputs of the bridge rectifier. If using a DC adapter, skip to step 3. The bridge rectifier converts AC to pulsating DC.
- Add the filter capacitor. Connect the 1000 µF capacitor across the rectifier output, observing polarity (positive to positive, negative to negative). This smooths the DC to a steady voltage. Add the 0.1 µF ceramic capacitor in parallel to filter high-frequency noise.
- Mount the LM317 on a heat sink. Apply a thin layer of thermal paste if the heat sink is metal. The LM317's tab is the output pin, so if the heat sink is metal, use an insulating washer and plastic screw to avoid shorting.
- Wire the LM317. Connect the rectified DC positive to the LM317's input pin (left). Connect the output pin (right) to your positive output terminal. Connect the adjust pin (middle) to one end of the 240 Ω resistor; the other end of that resistor goes to output. Then connect the potentiometer: one outer pin to adjust, the other outer pin to ground, and the wiper (middle) to ground as well. This creates the variable voltage divider.
- Add protection diodes. Place a 1N4007 diode across the LM317's input and output (cathode to input, anode to output) to protect against reverse current when the output is shorted or the input is disconnected. Also add a diode across the output and adjust pins (cathode to output, anode to adjust) for the same reason.
- Connect the ground. The negative terminal of the rectifier, the negative side of the filter capacitor, and the ground side of the potentiometer all connect together and to your output's negative terminal.
- Install the fuse and switch (optional but recommended). Put a fuse (e.g., 1A slow-blow) in series with the transformer primary or DC input. Add an on/off switch in the same line.
- Mount everything in an enclosure. Drill holes for the potentiometer shaft, binding posts, switch, and fuse holder. Secure the board and transformer (if any) with screws and standoffs. Ensure the heat sink has ventilation.
- Test the output. Before connecting any load, set the potentiometer to its minimum (usually fully counterclockwise). Plug in the supply and measure the output voltage with a multimeter. You should see about 1.25V. Turn the pot slowly; the voltage should rise smoothly. If it doesn't, check wiring and component orientation.
- Calibrate the dial (optional). Use a multimeter to mark voltage values on the knob at various positions (e.g., 3V, 5V, 9V, 12V) for easy setting later.
Common Mistakes
- Reversing the electrolytic capacitor polarity – this can cause it to burst or explode.
- Overloading the LM317 – drawing more than 1.5A will trigger thermal shutdown; the output will drop or cut out.
- Using a transformer with too high a voltage – if the input exceeds about 35V, the LM317 can be damaged.
- Not using a heat sink – the LM317 dissipates heat as voltage drop increases; without a sink, it overheats quickly.
- Connecting the potentiometer incorrectly – the wiper must connect to ground, not to adjust, or the voltage won't vary correctly.
- Forgetting the 0.1 µF capacitor – this can cause oscillation, leading to unstable output.
Tips
- Use a multimeter to verify each connection before powering up.
- Add a small LED with a resistor (e.g., 1 kΩ) across the output to indicate power is on.
- For better regulation at low currents, use a 10 µF capacitor on the adjust pin to ground.
- If you need more than 1.5A, consider using an LM338 (5A) or a pass transistor.
- Keep wires short and thick to minimize voltage drops, especially for higher currents.
- Use a metal enclosure and connect it to ground for safety and noise shielding.
Troubleshooting
- No output voltage. Check the fuse, switch, and AC input. Verify the rectifier diodes are oriented correctly (AC inputs, DC outputs). Measure the input voltage to the LM317 – it should be about 17V DC.
- Output voltage stuck at 1.25V. The potentiometer may be wired wrong or its wiper is not connected. Check that the pot is not shorted to ground.
- Output voltage jumps or oscillates. Add the 0.1 µF capacitor across the output and ground, and ensure the adjust pin has a 10 µF capacitor to ground. Also check for loose connections.
- LM317 gets very hot. Reduce the load current or increase the heat sink. If the voltage drop is large (e.g., 15V in, 3V out), the regulator dissipates a lot of power – consider a lower input voltage or a switching regulator.
- Output voltage drops under load. The transformer may be undersized, or the filter capacitor is too small. Increase the capacitor to 2200 µF or use a higher-current transformer.
- Buzzing sound from transformer. This is normal for some transformers, but if it's loud, check for loose laminations or overloading.
Frequently Asked Questions
Q: Can I use a 24V DC wall adapter instead of a transformer?
A: Yes, as long as the adapter outputs at least 3V more than your desired maximum output. For example, a 24V adapter gives up to about 21V out, but the LM317's max input is 35V, so it's safe.
Q: What is the maximum current this supply can provide?
A: The LM317 is rated for 1.5A, but with a proper heat sink and input voltage not too high, you can get close to that. For continuous use, 1A is safer.
Q: Can I adjust the voltage while the supply is connected to a load?
A: Yes, that's the purpose of a variable supply. Just turn the knob slowly; sudden large changes might cause voltage spikes, but the LM317 handles it.
Q: Why is my output voltage lower than expected?
A: The LM317 requires a minimum load of about 10 mA to regulate properly. If your load draws less, add a 1 kΩ resistor across the output as a dummy load.
Q: Can I use this to charge a 12V battery?
A: Yes, but you should set the voltage to about 13.8V (float charge) and limit the current with a resistor or a current-limiting circuit, as the LM317 alone doesn't limit current.
Q: What's the difference between linear and switching supplies?
A: This project is a linear supply – it's simple and low-noise but inefficient. A switching supply (like most phone chargers) is more efficient but complex and noisier.