Projects > Hardware Projects >

LM317 Variable Benchtop Power Supply

A power supply is unquestionably an absolutely necessary equipment for any electronics lab or anyone who wants to do electronics projects, especially a variable power supply, which I've been missing since I started with electronics. I'd usually power my circuits from Pb-Acid batteries and wall adapters which you know, sucks ! So I planned to build a variable power supply about three years ago ! But I couldn't do it due to reasons I don't even remember now. A power supply is very essential and it's to be well designed and well built, may be that's why. Whatever that is, I've finally made a basic variable benchtop power supply to fulfill my current needs. Actually I wanted to build an advanced power supply, a precise and full featured one. But to build such one I have to do lot of experiments for which I'll need a power supply in the first place; it's a "tail in the mouth" problem, it's recursive. So I decided to build a basic one based around the well-known LM317 linear adjustable positive regulator, and then use it to build my dream PSU. OK, enough history. Here's how I built it.

These are the features I wanted my PSU to have.
  • One variable output with minimum current 2 A.
  • Fixed 12 V output with 2A.
  • Fixed 5 V output with 2 A.
  • Fixed 3.3 V output with 1A.
  • Two USB ports for charging phones at 1A.

I had got a 36V 2A SMPS from one of my uncle. So I decided to use it as a source and use linear regulators to reduce the voltage. I know, such a setup would be insanely inefficient. But I had no other choice.


Here's a reference schematics I made.

The schematic will give you an insight on my plan. There are three LM317s and three TIP2955 PNP pass transistors for each. Each of those 317s will reduce the 36V input to programmed voltages. U2 will output a constant 12V, U3 will output a variable voltage and U1 will produce an auxiliary 12V for other 5V and 3.3 regulators so as to reduce the heat dissipated by them.

LM317 can provide output current in excess of 1.5A. But in this case, with large difference in input and output voltages, 317 will have to dissipate the excess power as heat; so much heat. So we use pass elements. Here I've used TIP2955 power transistor as pass element on the positive side. You could use TIP3055 or 2N3055 as pass element on the negative side or the output side, But the reason I chose PNP ones is because the drop in voltage they create is low compared to NPN. PNP transistors are used as pass elements in low dropout and ultra-low dropout regulators for this reason. But they exhibit some output stability issues which I had encountered while building this. I'll talk about that later.

The 2W resistors R5, R7 and R9 will produce enough voltage to bias the pass transistors at low currents. The auxiliary 12V output is connected to inputs of three LM2940 ultra-low dropout 5V 1A regulators of which two are used for USB outputs and the other is for front panel output. One of the 5V output is connected to a AMS1117 regulator for 3.3V output. So it's a series network of different regulators.

The variable output is taken from U3 as shown in the schematic. I used a 5K potentiometer in series with a 1K pot to have coarse and fine adjustment of output voltage. A DSN DVM-368 voltmeter module is connected to the variable output to display the voltage at front panel (not shown in the schematic).

SketchUp 3D Model

To plan the placement of connectors, switches etc and to get correct dimensions to cut MDF board, aluminium channel etc, I first designed a 3D model of the PSU box in SketchUp. I already had all the components with me. So designing the model was easy. I used MDF board of thickness 6 mm and aluminium extrusions (angle) of size 25 mm and thickness 2 mm. You can download the SketchUp model file using the link below.

LM317 PSU SketchUp 2014 file : Download - You're free to download, modify and redistribute this material.

Circuit Board

I soldered all the through-hole components to a perforated general purpose PCB as per my schematic. I used pin headers to solder the program resistors so that I can change them later.

Building the Box

This is where I had to work really hard. I used the measurements from my 3D model and cut the MDF boards, cut aluminium channels, drilled holes in them, filed and polished them. I had to make sure everything goes to the right place and everything is aligned especially the screw holes because otherwise I wouldn't be able to assemble them at the end. I had to do all these with limited tools and setup. The only power tool I had was an old driller. I didn't even have a wise ! But I think I like working in limited setting because I could try out my other skills. So that's what I did. Therefore the final output is not that perfect as you would see in the 3D model. But I'm satisfied with it. I need no one else's judgement on that :)

All photographs were taken with Moto G2 <3

For the front panel, I first decided to use acrylic sheet and cut holes in it using a laser cutter. But unfortunately I didn't have a laser machine and finding one would be a tedious task. So I decided to stick with the traditional approach. I found plastic frames and boxes from old fridges from a scrap shop. Actually I bought them for an unreasonable price. One of that frame was thick and flat enough to be used as front panel; it was not too thick nor too thin. I cut it with correct measurements and drilled and cut holes in it, to accommodate all the switches and output connectors. It went well.

Due to the specific design of the PSU box, I had to join all the MDF pieces using 25 mm screws from the outside and nuts and washers from the inside. But there's a problem. I could attach all those pieces in the same way I just said except one. Because I can't tight a screw without clutching the nut and preventing it from freely rotating. I resolved this issue by gluing plastic pieces to the inside of the mounting clamps on the front. So I can attach the front panel just with screws which will pierce through the plastic medium.

For the heatsink, I used one from an old CPU cooler. I drilled holes in it and attached all three pass transistors with mica insulators between them for electrical isolation. Realizing the heatsink alone wouldn't do the job, I later added a cooling fan from the outside of the heatsink and connected it to the auxiliary 12V.

Painting the Box

I learned a lot of things here. First one is "never paint an MDF board without applying primer first" ! I knew nothing about painting MDF. I even wasted a full can of spray paint doing so and it seemed like I put black powder on them. After that regretful event I learned how to paint MDF from the web and started painting it. I had bought spray paint cans of matte black and silver.

First you have to sand the MDF with 300 or 400 grit size sandpaper. Then apply thin, uniform layer of wood primer or MDF primer. Apply another layer after the first layer is dried enough. Repeat this as per your requirement. You have to sand the primer layer before you can paint (I didn't, I couldn't wait !) Painting is easy using compressed paint cans.


I fixed the circuit board on the middle of the bottom board using long screws and some plastic standoffs. I used multi-strand wires from old SMPS as they were the best I could get. As I built this PSU in a hurry and I didn't want much perfection inside, I soldered all the wires directly to the board and other components except the power input. So the wiring is messed up inside and confusing even for me. 

I had come across some rather strange problems while wiring and the initial testing. First one was the instability of the output. As I'm using PNP pass elements, the output would oscillate giving reduced effective DC voltage on the meter. I had to connect high value electrolytic capacitors to rectify this problem. Next problem was the difference in output voltage in the board and at the output connectors ! I still don't know what exactly the problem is, but I solved this by soldering some high value resistors, 1K, 4.7K etc, at the output terminals directly. I used 2K (1K+1K) resistor value to program the aux 12V and main 12V outputs.


The PSU worked as I expected. The SMPS I have can deliver continuous current of up to 2A. It has over-current protection (shutdown) built-in. So I don't have to worry about any short circuit issue. Below is a table of measurements from the load test.

# Sl. No.

Set Voltage (V)
Load (Ohms)
Current (A)
Loaded Voltage (V)
Power (W)
1 8.1   6V Pb-Acid  0.6  7.68 4.60
2 5.06 2.2  1.96  4.53  8.87
3 6.02 2.2  2.33  5.45  12.69 
4 8.01 2.2  3.12  7.43  23.18
10.02 4.4  2.08  9.45  19.65 
12.01  4.4 2.46  11.48  28.24 
7 15.05  4.4 3.1  14.47  44.85 
8 18.05 4.4 3.24  15.55  50.38 
9 24.07 4.4  3.24  15.52  50.28
10  30.12 4.4 3.24  15.4  49.89 
11  30.17 6.6  2.9  20.1  58.29 
12 12.09 6.6   1.73 11.6  20.06
13 5.03 6.6  0.71 4.66  3.30 

Power (W) = Loaded Voltage x Current

Load regulation is not that good due to the output power limitation of the SMPS I'm using. It'll limit the current and shutdown at high currents. So I couldn't conduct surge current tests. Upto 14V, the load regulation seemed good. But above 15V set voltage (#8, #9, #10), when I connect the load, the output voltage will diminish to around 15V with a constant current of 3.24 A. At #10, the loaded voltage is half of the set voltage at 3,24 A current ! So it looked like my SMPS was not providing enough current to keep the voltage at what is set. The maximum power I was able to get was at #11, of 58W. But I don't think I'll need that much amount of power for any of my simple projects. So, as long as I keep the output current low, the output voltage will stay where it is supposed to.

Also as I'm using single power supply for different outputs, ie. 5V, 12, variable, too much load on one output could cause variation in other outputs. I have to be careful with that too.


After everything was tested, I fully assembled it and labelled the front panel. I put a DIY sticker I got with my first Arduino, on the front. With that the project was completed. The actual build is a bit different from my 3D model. It took me more than a month to design, gather requirements, build and finally finish and test it. One more thing to put on my table. Except I don't have much space on my table :(

So what are you waiting for ? Start building one now. Happy DIY :)