LM317 Based DIY Variable Benchtop Power Supply




Introduction: LM317 Based DIY Variable Benchtop Power Supply

About: Curious and passionate.

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. In this tutorial I'll show you how I built an LM317 linear positive regulator based variable 1.2-30V (1.2V to input voltage-2.7V actually) power supply.

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.

The power supply doesn't use any transformer instead it reduces constant input voltage in the range of 15-35V to many different voltages at the output. So you can power this unit by any SMPS with a rated voltage 15-35V and current 2-5A OR a transformer supply with the same specs.

Step 1: Getting Ready

  1. Go to https://www.autodesk.com/products/eagle/free-download and download Eagle schematic capture software for your operating system.
  2. Go to https://www.sketchup.com/download and download latest version of SketchUp and install it.
  3. Find a good SMPS with a voltage rating between 15-36V OR make a transformer based supply with 15-36V DC output voltage.

Step 2: Schematic

The schematic will give you an insight on my plan. But it was not designed to generate a PCB file as I usually perfboard for my one off designs. So I didn't care about the component packages. You have to select proper packages if you want to create a PCB layout. There are three LM317s and three TIP2955 PNP pass transistors for each. Each of those LM317s 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, LM317 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 they do not alter the output voltage as NPN transistors would do (output will be +0.7V higher when NPN is used). PNP transistors are used as pass elements in low dropout and ultra-low dropout regulators. But they exhibit some output stability issues which can be mitigated by adding capacitors at the output.

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 (tutorial on my website) voltmeter module is connected to the variable output to display the voltage at front panel. See the "Wiring" section to see the modifications to be made to the voltmeter module. You can use any other V or A modules without much modifications.

Download high resolution PNG image of the schematic here.

Or download different sizes from Instructables : https://www.instructables.com/file/F278MX2J4IQ00GW/

Step 3: 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 the file below. You're free to download, modify and redistribute this material.

Step 4: Gather Tools and Parts

These are the material, tools and components required.

For PSU box,

  • MDF board of thickness 6 mm.
  • Aluminium Angled Extrusions - size 25 mm, thickness 2mm.
  • 25 mm machine screws with slotted, round head and compatible nuts and washers.
  • Acrylic or ABS sheet of thickness 3-4 mm.
  • Old CPU Aluminium heatsink and fan.
  • PVC feet of size 1.5 cm.
  • Matte black spray paint.
  • MDF primer.

For circuit board,

  • 3x TIP2955 (TO-247 package)
  • Mica insulators for TO-247 transistors
  • 3x LM317T
  • 3x LM2940
  • 1x AMS1117-3.3
  • 3x 2W, 100 Ohm resistors
  • 10x 100 nF ceramic capacitors
  • 6x 1N4007 diodes
  • 470 uF, 40V electrolytic caps
  • 1x 6A4 diode
  • 3x 1K resistors
  • 3x 200 Ohm resistors
  • 1x 3-4A fuses and fuse holders
  • 100 uF, 10V electrolytic caps
  • 1x 1K linear potentiometer
  • 1x 5K linear potentiometer
  • 2x Potentiometer knobs
  • 2 pin terminal blocks
  • Heatsinks for TO220 packages
  • Heat sink paste
  • 4x SPST Toggle/Lever switches
  • Cables and wires from old PC power supplies
  • Heat shrink tubes of 3mm and 5mm
  • Perforated matrix PCB
  • Male pin headers
  • 2x Female USB type A receptors
  • 4x Speaker connectors OR 8x binding posts
  • 1x SPST/DPDT rocker switch
  • 4x 3mm/5mm LEDs
  • 1x DSN-DVM-368 voltmeter
  • 5x Female DC barrel connectors (screwable)
  • Plastic standoffs


  • Hacksaw blades
  • Drilling machine
  • Nose player
  • Different types of files
  • Different types of spanners
  • Measuring tape
  • Black permanent CD marker
  • Many types of Philips and slotted screw drivers (buy a kit)
  • Retractable knife and blades
  • Rotary tool (not necessary if you have skill)
  • 300 and 400 grit size sand papers
  • Nipper (for copper wires)
  • Multimeter
  • Soldering iron
  • Solder wire and flux
  • Wire strippers
  • Tweezers
  • And any tool you can find.
  • Pollution/Dust mask to protect from paint.

Step 5: Building the Circuit Board

Cut the perfboard as per your requirement. Then place and solder components as per the schematic. I didn't make a PCB file for etching. But you can use the Eagle schematic file below to make a PCB on your own. Otherwise use your ingenuity to plan the placements and routing and solder everything nicely. Wash the PCB with IPA (Isopropyl Alcohol) solution to clean any solder residue.

Step 6: Building the Box

All the dimensions with which the MDF board, aluminium channels are to be cut, hole dimensions, hole placements and all are in the SketchUp model. Just open the file in SketchUp. I've grouped parts together, so you can easily hide parts of the model and use the Measure tool to measure the dimensions. All dimensions are in mm or cm. Use 5mm bits for drilling holes. Always check for alignment of holes and other parts to make sure everything will easily match together. Use sand papers to smooth out the surface of MDF and Aluminium channels.

You'll get the idea to how to build the box once you examine the 3D model. You can modify it as per your needs. This is a place where you can put your creativity and imagination to maximum use.

For the front panel, use acrylic or ABS sheet and cut holes in it using a laser cutter if you can access one. 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. A hacksaw and a drilling machine was my main tools.

Due to the specific design of the box, you may face some problem attaching the front panel to the rest of the box. I glued plastic pieces of ABS plastic behind the front facing angles and screwed to them directly without needing nuts. You will need to do something like this or something better.

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 (THIS IS IMPORTANT!) 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.

Step 7: Painting the Box

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 and let it dry for 1 or 2 days. You have to sand the primer layer before you can spray the paint. Painting is easy using compressed paint cans.

Step 8: Wiring

Fix the board you soldered in the center of the bottom sheet and screw it using small machine screws and standoffs between them. I used wires from old computer power supplies as they are of good quality. You can either solder wires directly to the board or use connectors or pin headers. I made the PSU in a hurry so I didn't use any connectors. But it's recommended to use connectors whenever and wherever possible, to make everything modular and easy to assemble and disassemble.

I had come across some rather strange problems while wiring and the initial testing. First one was the instability of the output. As we're 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.

We only need the DSN-DVM-368 voltmeter for the variable output as all other outputs are fixed. First you have to disconnect (IMPORTANT!) the jumper (Jumper 1) as shown in the figure then use the three wires as in the schematic. The voltmeter has already a 5V regulator inside. Feeding 12V directly to it will cause undesired heating. So we use a 7809, 9V regulator between the AUX 12V and the Vcc input of the voltmeter. I had to make the 7809 a "floating" component as it was added after I soldered the board.

Step 9: Testing

Connect an SMPS with a voltage rating between 15-35V and current of minimum 2A, to input of the board though a DC barrel jack. I used 36V 2A SMPS with over-current protection (shutdown) built-in. See above the table of measurements from the load test.

Load regulation in here 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.24A. At #10, the loaded voltage is half of the set voltage at 3.24A 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. So, as long as you keep the output current low, the output voltage will stay where it is supposed to. Always keep an eye on the voltage, current and the temperature of the heatsink as a significant amount of power will be dissipated there.

Step 10: Finishing

Once you finish the tests, assemble everything and label the front panel the way you like. I painted the front panel with silver paint and used a permanent marker to label things (not a nice way to do). I put a DIY sticker I got with my first Arduino, on the front.

Step 11: Pros and Cons

There are many advantages and as well as disadvantages with this power supply design. It's always worth studying them.


  • Easy to design, build and modify as it's a linear regulated power supply.
  • Less undesired ripples at the output compared to ordinary SMPS units.
  • Less EM/RF interference produced.


  • Poor efficiency - most of the power is wasted as heat at the heatsinks.
  • Poor load regulation compared to SMPS power supply design.
  • Large in size compared to similar power SMPSs.
  • No current measurement or limiting.

Step 12: Troubleshooting

A digital multimeter is the best tool to troubleshoot power supply problems. Check all the regulators before soldering using a breadboard. If you have two DMMs, then it's possible to measure the current and voltage simultaneously.

  1. If there's no power at the output, check voltages from the input pin, at regulator input pins and double check if PCB connections are correct.
  2. If you find the output is oscillating, add an electrolytic capacitor of value not less than 47uF near the output terminals. You can solder them directly to the output terminals.
  3. Do not short the outputs or connect low impedance load at the outputs. It could cause the regulators to fail as there's no current limiting in our design. Use an appropriate value fuse at the main input.

Step 13: Improvements

This is a basic linear power supply. So there's a lot you can improve. I built this in a hurry becasue I needed some kind of variable power supply so badly. With the help of this, I can build a better "Precision Digital Power Supply" in future. Now here are some ways you can improve the current design,

  1. We used linear regulators like LM317, LM2940 etc. As I said before these are so inefficient and can't be used for a battery powered setup. So what you can do is, find one of those cheap DC-DC buck modules from any online shops and replace the linear regulators with them. They're more efficient (>90%), has better load regulation, more current capability, current limiting, short circuit protection and all. LM2596 is one of that kind. The buck (step down) modules will have a precision potentiometer on top. You can replace it with a "multi-turn potentiometer" and use it at the front panel instead of normal linear pots. That'll give you more control over the output voltage.
  2. We only have used a voltmeter here, so we're blind about the current our PSU is supplying. There are available cheap "Voltage and Current" measuring modules. Buy one and add to the output, may be one for each output.
  3. There are no current limiting feature in our design. So try improving it by adding a current limiting function.
  4. If your heatsink fan is noisy, try adding a temperature sensitive fan controller may be with speed control.
  5. A battery charging function can be easily added.
  6. Separate outputs for LED testing.
Power Supply Contest

First Prize in the
Power Supply Contest

Be the First to Share


    • Teach With Tinkercad Contest

      Teach With Tinkercad Contest
    • Fandom Contest

      Fandom Contest
    • Microcontroller Contest

      Microcontroller Contest



    4 years ago

    Thank you for your question.
    Assuming that the SMPS is one of the type used for building-in to computers or other end products. Power supplies such as these may have been evaluated by safety agencies but the safety investigation in most cases is not complete unless they are designated as “Listed ITE Product”.
    In the case of non-Listed supply (i.e. UL Recognized) there are certain Conditions of Acceptibility (CoA) that must be addressed in the end product. Basically, the CoA’s address shock, fire, mechanical and energy hazards. There may be others such as excessive heat.

    An energy hazard exists when the available voltage and current exceeds a level that may cause an explosive result if the output of the source was to be shorted. This level is defined in standard for safety UL/CSA/IEC 60950 as 240VA. Such a hazard may result in blindness or severe burns. As you may know, a supply of <36vdc may not be a shock hazard but if it’s capable of delivering >6.67Amps (36x6.67=240) it’s now an energy hazard. It is the general consensus between the US, CA, EU and other countries that any source exceeding the 240VA limits shall not be made accessible to an end user.
    Best regards, I hope this helps.


    Reply 2 years ago

    Very good information. However I feel it is not very realistic, as a common Canadian outlet can deliver 115v @ 15A == 1,725W / VA! Which can be accessible simply by plugging something into the outlet. Or a car battery which is capable of 200A @ 12v. Watch ElectroBoom. I do enjoy a good beefy power supply to power large loads, and it is easy to overcome 250W. Just don't tell the police!


    5 years ago


    sum simple suggestions

    connect a 2n3055 Power Transistor to the output of the LM317 you will get 5 Amps of current

    use DIGITAL VOLTMETER AMMETER instead of simple voltmeter

    buck converters are efficient but thy have high ripple


    Reply 4 years ago

    your "si,ple suggestions" are great however,

    "buck converters are efficient but they have high ripple" a lot of people show their ignorance by saying that.

    define "high ripple" 20mV, 30mV, 50mV. Is that high ripple? SMPS designs commonly use 20mV. even 50mV will not affect most electronic projects.

    have you ever looked at the output voltage of a buck regulator on the scope?


    Reply 4 years ago

    Yes you are right, even 50 mV is not problem if you are using your power supply for takes like checking a light is working

    but if you are using the power supply for any series business 20 mV is "VERY HIGH" a 20mV ripple can make unwanted noise in a sound recording device

    an example wen i was trying to check my DIY FM transmitter with my buck converter power supply i get lots of unwanted noise.to eliminate that i forced to use a battery


    Reply 4 years ago

    You can use a linear regulator on the output of a switching regulator to smooth it out. Set it to minimum dissipation by minimizing the input to output drop.


    Reply 4 years ago

    yes BUT Is that make any sense? if i need a low ripple output i can use a linear output,if i want efficiency i can use smps.why i need to use two regulators?


    Reply 4 years ago

    Say you were building an audio amplifier. You might use a switcher to feed the output stage, then use a linear to feed the preamp. The switcher gives you high efficiency, the linear smoothes out the fuzz. Usually you don't need as high a voltage on a preamp anyway.

    I've had to use this two-step regulation on sensitive RF circuits. Newer switchers are much less noisy than in the olden days, though, and a filter is simpler.


    Reply 4 years ago

    yeah, i agree.

    linear is ok for around 1 amp or less, so its simple and ok for the preamp.


    Reply 4 years ago

    actually with smps you do not need a separate p/s. just add
    one more or two or three, winding(s) to the coil (inductor or transformer) rectifier(s) and diode(s) and u will
    have another output.


    Reply 4 years ago

    you are correct. you use the p/s for the application. not everybody is making an FM transmitter. also FM does not react to changes in amplitude. only AM does that, so obviously there was something wrong in what u were doing. so it was causing noise and u changed to batteries. battery internal impedance high and you may not have noticed the differences. but again, you must use the correct p/s for the application.


    Reply 4 years ago

    did you look at the specs for ripple rejection for the LM317? most smps run at or above 100KHz and the rejection at that frequency is almost nothing. so whatever noise is atthe input will be seen at the output. instead of adding a linear, just add a very small LC 10uH+10uF (ceramic) filter to the output of the smps and u will have almost no ripple to talk about.


    Reply 4 years ago

    "but if you are using the power supply for any serious business 20 mV is "VERY HIGH" a 20mV ripple can make unwanted noise in a sound recording device"

    the switching ripple is usually at or above 100KHz and is so easily filtered. who can hear that frequency?

    people look for ways to reject stuff without actually testing and trying to understand why noise occurs in their system. just hit and miss blindly always costs more and u learn less. study the problem and u will find that smps is ok in almost any application. a small filter works wonders in cases where the equipment is noise sensitive. when people dont want to think or analyze or are just impatient or just dont have the knowledge of how to do it they, revert to linear p/s cos its easy. Linear is ok for about 1 amp or less, and when u get to high power then u have to go to smps.


    Reply 4 years ago

    it was not the ripple that was disrupting it. the transmitter was picking up radiated and conducted emissions. look in the AARL handbook and they tips on how to use a switcher for radio.


    Reply 5 years ago

    Thanks for your words :)

    Yes, I could've used 2N3055 or TIP3055 as pass elements but then the output voltage will be 0.6 to 0.7V greater than the actual regulator fixed output (output = fixed regulator voltage + Vbe). For that reason I always use PNP transistors as pass elements and it serves the same purpose as a NPN transistor would do.

    The above power supply can deliver currents greater than 5A, but the SMPS I'm using has a current limit of 2A at 36V. So it's not a limitation of the design.

    Yeah, a digital V, A meter would've been better, but I didn't have one at the time of building this.

    Yes you're right. Buck converters produce switching noise. But that can be eliminated to an extent with proper filtering circuits and will work fine with any digital circuits. For analog circuits, the switching noise must be restrained to the requirement.


    Reply 4 years ago

    There are pros/cons between digital and analog meters, you can't just swap them (well, you can ), but analog gives better visual indication on ratio of amperage and voltage, and how they fluctuate, digital ones might not show fast enough so users' mind would register it.


    4 years ago

    "Poor load regulation compared to SMPS power supply design."

    why do you say that? unless u are doing something wrong in the output wiring, or violating the minimum Vin-Vout approx 2V requirement, this is not the case. It has 0.3% load and line regulation capability which is better that what most engineers make with smps.

    VO ≥5 V,
    IO = 10 mA to IMAX
    TJ = 25°C typical 0.1%, max 0.3

    check the datasheet



    Reply 4 years ago

    I agree with what you said. But I must clarify. If you look at the table with test results, at higher voltages, the design does not maintain the required voltage. This is not being a problem at lower voltages and currents. But as we start draining more power, the regulator can't keep up due to the SMPS throttling the current. I've already mentioned this up there. Thanks :)

    uncle frogy
    uncle frogy

    4 years ago

    nice box design and feature set very useful it would appear.

    as noted the details are lacking the schematic is useless and there are no pictures of the solder side of the board I appreciate that it was a rush job but still a few more closeups might be helpful. as inspiration great!

    I am in the middle of designing a new bench supply myself so was interested in how you solved problems.

    question since the power comes from a SMPS ( which has some transformers in it) is there any reason besides cost that a suitable step-down transformer and bridge and filters could not be substituted (a linear power supply) when compared to the total cost the difference is not that bad and it would work very well for audio circuits as well.

    uncle frogy


    Reply 4 years ago

    Hi. As you said, it was a quick build and I couldn't take many pictures. But I'll add some more images soon.

    I used SMPS becasue I had a good one in the first place. I do not have any direct for a 36V SMPS. So I decided to use it for this power supply. You can also use transformers externally or internally. The design will work fine with it.

    Can you please explain a bit why you found the schematic unusable ? The schematic was not designed to make a PCB, and so I randomly selected the packages. If there's something you can't interpret, please reply.

    Thanks for the comment :)