In this post I will elaborately explain how to build a simple LM317 based adjustable power supply circuit using minimum number of external components.
As the name suggests a variable power supply circuit provides the user with a range of linearly varying output voltages through a manually controlled potentiometer rotation.
A LM317 is a versatile device which helps an electronic hobbyist to build a variable voltage power supply quickly, cheaply and very efficiently.
Introduction
Whether it’s an electronic noob or an expert professional, an adjustable power supply unit is required by everybody in the field.
It is the basic source of power that may be required for various electronic procedures, right from powering intricate electronic circuits to the robust electromechanical devices like motors, relays etc.
A variable power supply unit is a must for every electrical and electronic work bench and it’s available in a variety of shapes and sizes in the market and also in the form of schematics to us.
These may be built using discrete components like transistors, resistors etc. or incorporating a single chip for the active functions.
No matter what the type may be, a power supply unit should incorporate the following features to become a universal and reliable with its nature:
Essential Features
- It should be fully and continuously adjustable with its voltage and current outputs.
- Variable current feature can be taken as an optional feature because it’s not an absolute requirement with a power supply, unless the usage is in the range of critical evaluations.
- The voltage produced should be perfectly regulated.
With the advent of chips or ICs like LM317, L200, LM338, LM723, configuring power supply circuits with variable voltage output with the above exceptional qualities has become very easy nowadays.
How to Use LM317 for Producing a Variable Output
Here I have explained how to construct a simplest power supply circuit using the IC LM317. This IC is normally available in TO-220 package and has three pin outs.
The pin outs are very easy to understand, since it consists of an input, an output and an adjustment pins that just needs to be wired up with the relevant connections.
The input pin is applied with a rectified DC input, preferably with the maximum tolerable input, that’s 24 volts as per the specs of the IC.
The output is received from the “out” pin of the IC while the voltage setting components are connected around the adjustment pin.
How to Connect LM317 in a Adjustable Voltage Power Supply Design
As can be seen the diagram, the assembly needs hardly any components and is in fact a child’s play to get everything in place.
Adjusting the pot produces a linearly varying voltage at the output that may be right from 1.25 volts to the maximum level supplied at the input of the Ic.
Though the shown design is the simplest one and therefore includes only a voltage control feature, a current control feature can also be included with the IC.
Output Voltage Formula
The output voltage (Vout) of the LM317 can be calculated through the two external resistors, R1 and R2, using the formula:
Vout = 1.25 * (1 + R2 / R1)
Where:
- 1.25V is the reference voltage between the Adjust and Output pins.
- R1 is the resistor between the Output pin and the Adjust pin (typically 240Ω).
- R2 is the resistor between the Adjust pin and ground.
Current Through Resistor R1
The current I1 through resistor R1 is approximately:
I1 = 1.25 / R1
If R1 = 240Ω, the current is:
I1 ≈ 5.21 mA
Adjusting the Output Voltage
To set a desired output voltage we can choose the resistors R1 and R2 accordingly. For example if R1 = 240Ω and you want Vout = 5V then you can rearrange the formula for Vout to solve for R2:
5V = 1.25V * (1 + R2 / 240Ω)
Solving for R2 gives:
R2 = 720Ω
Maximum Output Voltage
The output voltage is limited by the input voltage and the LM317's dropout voltage, which is typically around 3V. The maximum output voltage (V_out) is:
Vout = Vin - Vdropout
For example if Vin = 12V and the dropout voltage is 3V then maximum output voltage would be:
Vout = 12V - 3V = 9V
Power Dissipation in the LM317
The LM317 dissipates power as heat, and this power dissipation (Pdiss) is calculated as:
Pdiss = (Vin - Vout) * Iout
Where:
- Vin is the input voltage.
- Vout is the output voltage.
- Iout is the output current.
For example if Vin = 12V, Vout = 5V, and Iout = 1A, then power dissipated by the LM317 would be:
Pdiss = (12V - 5V) * 1A = 7W
Adding a Current Control Feature
The figure above shows, how the IC LM317 can be effectively used for producing variable voltages and currents, as desired by the user.
The 5K pot is used for adjusting the voltage, whereas the 1 Ohm current sensing resistor is selected appropriately to acquire the desired current limit.
Enhancing with High Current Output Facility
The IC can be further enhanced for producing currents higher than its rated values. The diagram below shows how the IC 317 can be used for producing more than 3 amps of current.
LM317 Variable Voltage, Current Regulator
Our versatile IC LM317/338/396 may be used as an adjustable voltage and current regulator through simple configurations.
The idea was built and tested by one of the avid readers of this blog Mr. Steven Chiverton and used for driving special laser diodes which are known to have stringent operating specifications, and could be driven only through specialized driver circuits.
The discussed LM317 configuration is so accurate that it becomes ideally suitable for all such specialist current and voltage regulated applications.
Circuit Operation
Referring to the shown circuit diagram, the configuration looks pretty straightforward, two LM317 IC s can be seen, one configured in its standard voltage regulator mode and the other in a current control mode.
To be precise the upper LM317 forms the current regulator stage while the lower acts like a voltage controller stage.
The input supply source is connected across the Vin and ground of the upper current regulator circuit, the output from this stage goes to the input of the lower LM317 variable voltage regulator stage.
Basically both the stages are connected in series for implementing a complete foolproof voltage and current regulation for the connected load which is a laser diode in the present case.
R2 is selected to acquire a range of around 1.25A max current limit, the minimum allowable being 5mA when the full 250 ohms is set in the path, meaning the current to the laser may be set as desired, anywhere between 5mA to 1 amp.
Calculating the Output Voltage
The output voltage of a LM317 power supply circuit could be determined with the following formula:
VO = VREF (1 + R2 / R1) + (IADJ × R2)
where is = VREF = 1.25
Current ADJ is usually around 50 µA and therefore too negligible in most applications. You can ignore this.
Calculating Current Limit
The above is calculated by using the following formula:
R = 1.25/max allowable current
The current controlled voltage acquired from the upper stage is next applied to the lower LM317 voltage regulator circuit, which enables the desired voltage to be set anywhere from 1.25V to 30V, here the max range being 9V since the source is a 9V battery. This is achieved by adjusting R4.
The discussed circuit is assigned to handle not more than 1.5amps, if higher current is required, both the ICs may be replaced with LM338 for obtaining a max 5amp current or LM396 for a max of 10amp current.
The following lovely pictures were sent by Mr. Steven Chiverton, after the circuit was built and verified successfully by him.
Prototype Images
Upgrading LM317 with Push Button Voltage Control
So far we have learned how to configure an LM317 for producing adjustable output using a pot, now I have explained how push buttons may be used for enabling digitally controlled voltage selection.
We eliminate the use of mechanical pot and replace it with a couple of push buttons for the up/down selection of the desired voltage levels.
The innovation converts the traditional LM317 power supply design into a digital power supply design, by eliminating the low tech potentiometer which might be prone to wear and tear in the long run resulting in erratic operations and incorrect voltage outputs.
The modified LM317 design which would be allow it to respond to the push button selections can be seen in the following diagram:
The R2 resistors associated need to be calculated with respect to R1 (240 ohms) for setting up the intended push button selected voltage outputs.
High Current LM317 Bench Power Supply
This high current LM317 power supply can be used universally for any application that requires a high quality regulated high current DC supply, such as car sub woofer amplifiers, battery charges etc.
This power supply is designed to be as versatile as feasible, while also ensuring that the parts count stays low and affordable.
This simple LM317 fixed os adjustable voltage supply satisfies the conditions superbly and is capable of delivering up to 10 amps.
The voltage output is governed by the circuit stage containing R4, R5 and S3; observe that switch S3 is a part of R4.
For getting a fixed voltage output, R4 must be determined for getting zero ohms (fully counter-clockwise). In this situation, switch S3 should be in the open position.
The preset R5 should in that case be tweaked so that the circuit generates a 12 volt output (or anything your personal application requires).
To have an variable output, R4 can be flipped clockwise, with S3 in the closed position, and getting rid of R5 from the circuit.
The output voltage can now be operated by the R4 resistor solely. When the position of SPDT switch S2 is in 1, the highest output current can be accomplished having the two halves of T1 supplying current to the filter stage, in order to increase the overall current output 2 times more.
Having said that, the highest output voltage will be reduced by 50% in this position. It really is a much productive setting considering that the power transistor does not have to drop a significant amount of potential.
In position 2, the maximum voltage practically equals the power specifications of T1. Here, we employed a 24 volt center-tapped transformer for T1.
Lastly, D1 and D2 had been incorporated to safeguard the LM317 IC in case power was switched off with an inductive load at the output
References: http://www.ti.com/lit/ds/symlink/lm317.pdf
https://en.wikipedia.org/wiki/LM317
Andrew says
I have 4 symmetrical power supplies+42/-42@4.15Amps 300VAC. Need +35/-35 for a parallel LM3886 amplifier x4. Thinking LM317HV/ LM338HV With added transistor for additional current capability. Need small board’s and low part count, not a lot of room left, and price concerns. Already over my budget. Please help!!! Can’t find a viable solution commercially, don’t trust Chinese crap on Ebay. Like to put +/- on 1 board, so just need 4 board’s. Want to have board’s made, so a Gerber file would be invaluable. Thanks in advance, and for all I’ve learned from your site, your a 1st class engineer, but a better teacher.
Swagatam says
You can try the last circuit from the following article:
https://www.homemade-circuits.com/lm317-with-outboard-current-boost/
Make sure to add a series resistor with the base of 2N3055. It can be a 1K 1 watt.
suat kaleli says
Hi Swagatam;
I have made few times circuits all with the parts LM317, BD139 and Tip3055. But unfortunately all were OK at the beginning but then out of order. For instant the latest one at first current control was out of order and then BD139 was out of order and finally the resistance in the circuit was burnt. I need same purpose circuit again and your advice. Best Regards
P.S.: As known there also are 2 pots 5 K (voltage adjustment) and 10 K (current adjustment) in the circuit. However I have been using 5K plus 1 K for fine adjustment.
Swagatam says
Hi Suat,
An electronic circuit will go faulty due to some reason, so you will have to find the reason what is causing your circuits to become faulty. It can never go faulty while it is idle, it can become faulty only while it is being used and due to some specific reason such as an overload or over current.
Unless the transistors are over driven they can never become faulty, or may be the transistors are duplicate and not original that could also cause them to burn prematurely.
I can advise if I can see which schematic you are referring to.
suat kaleli says
Thanks for the detailed information. The video which I had made the circuit is at the youtube LM317-BD139-TIP3055 (By Zafer Yıldız) contents no schematic. However I can draw it but I do not know how to upload to your site.
But all parts are lm317-bd139-tip3055-10k pot-5 k pot and 220 R.
– 220 R is between the adjustment and out pins of the LM317.
– LM317 output connected to BD139 collector.
– LM317 input and TIP3055 collector are common.(As DC input)
– 10 pot, BD139 emitter and TIP3055 Base are common.
-BD139 base to 10 K pot.
– Other pin of the 10 K pot is common with the pins of LM317 out and BD139 collector.
– Ground to 5K pot and 5 K pot to LM317 adjustment.
– Output voltage is from TIP3055 emitter. Best Regards
Swagatam says
If it’s possible for you to draw it, then you can upload it to any “free image hosting site” and provide the link to me here, I will check it out.
Or you can refer to the following article and see if your circuit matches with one of the designs presented in the following article:
https://www.homemade-circuits.com/lm317-with-outboard-current-boost/
suat kaleli says
Hi Swagatam I have uploaded but I am not sure that I made it OK
Best regards
Swagatam says
Hi Suat,
the circuit looks incorrect to me, especially the BD139 connection.
You don’t have to use the BD139, you can connect the LM317 output directly with the base of the 2N3055 through a 1K resistor.
suat kaleli says
Thanks for the response Swagatam;
As I wrote before it works I tested and used first circuit about 3 months and then I made the second one both worked but their lifes were limited in shor period. So that means this project works but not stable since all were upset. In the circuit 5K pot control the voltage and 10 K limits the current. As a result my transformer output is AC 24V and it is 100VA (I think that means it is about 4 Amps.) So please advise me a circuit whic is suitable to my transformer and I can also limit the current if required. Best Regards
Swagatam says
Hi Suat, if the unit was working earlier and then becomes faulty overtime then it is strange. The life of the components can become affected only when there’s a fault in the circuit configuration or if the components are not good.
You can modify your design in the following manner and check how long it lasts.
https://www.homemade-circuits.com/wp-content/uploads/2022/08/LM317-with-2N3055-circuit-1.jpg
The above circuit will also perfectly work with your 24V 4 amp transformer.
You can also refer to the following posts for more options:
https://www.homemade-circuits.com/how-to-make-versatile-variable-voltage/
https://www.homemade-circuits.com/how-to-design-a-stabilized-bench-power-supply-circuit/
Roya says
Hello dear Swagatam,
Firstly, I congratulate you on your informative and excellent website.
I have been using a very good commercial variable 0 to 35V, 4A power supply since 30 years . It includes an LM723 IC and 3 potenciometers. A couple of days ago the IC and 2 of the potenciometers bunrt out. While repairing, I decided to draw its circuit as well. Now I want to send you this circuit I drew via Email, so that you could perhaps publish it on your website, so your visitors can benefit from it.
An important tip about using the device , as you would certainly know yourself, is that If the output voltage is set to a high value, for example 30 volts, we can draw almost 4 amps of current from the power supply without any concern. However, a critical situation arises when we want to take 3 or 4 amps of current from the device while the output of the device is set to low voltages such as 2 or 4 volts. It is in this state that transistors are forced to convert more than 100 watts of electrical power “inside them” into heat; a power that would have a devastating effect on power-transistors and would cause them to burn out.
I have added a 1N5401 diode across the output lines of the circuit for more security, as well as a 100mf electrolite capacitor for more stability of the voltage.
I hope you like it and redraw it more beautifully than what I have done.
Best regards
Roya
Swagatam says
Thank you Dear Roya,
I appreciate your kind response.
You can send me the image by uploading it to any free image hosting site, and then provide the link here.
Yes that’s the problem with all linear regulators, they tend to dissipate a lot of heat when the output voltage is much lower than the input voltage.
If you send me the schematic, I will post it in the following article:
IC 723 Voltage Regulator – Working, Application Circuit
Swagatam says
Thank you dear Roya, I got the schematic image on my email. will post it soon in the following article:
https://www.homemade-circuits.com/ic-723-voltage-regulator-working-application-circuit/
Ersa says
Hello. Thank you for your very interesting and educational site. Could you tell me if it is possible to use TIP35 instead of 2N3055? if yes, do I need to apply any modification in the circuit?
Thanks 😉
Swagatam says
Hi, Glad you liked the article. Yes TIP35 can be used instead of the 2N3055
Ersa Frans says
Thanks a bunch, swagatam ????
Frans says
Thanks a lot, dear Swagatam!
Moe says
Dear Sir Swagatam,
Hello. I have studied all your LM317 based power supply projects and have I have learnt a lot from your wonderful posts. However; I have assembled a very simple circuit similar to this one and it works very well. I have sent you an email with a picture, if you could please take a look and get back at me in case you can kindly offer some modifications.
Best wishes,
Moe
Swagatam says
Thank you Dear Moe,
Yes I have seen the diagram, it is perfect for getting high current variable output from an LM317 power supply and needs no further modifications:
Moe says
Dear Swagatam,
I had another question, if you don’t mind.
I have a 220 to 16 0 16 volt transformer as well, which produces 40 V after rectifying, as you know. Can I use 14 pieces of 1N5408 diodes in series and connect the last diode to the input of this circuit in order to reduce the 40V to about 30 volt ? or is there may be a better way to do this?
Best wishes,
Moe
Swagatam says
Dear Moe,
Yes you can do that, or you can simply use the 0-16V taps of the transformer and get an input voltage 23V after rectification, for the power supply
Moe says
Dear Swagatam
Hello. Thank you for your quick response. If I use one 0 and 16V taps of the transformer I will have only 23v output which will never deliver me 27 v on the output of the circuit. However, the input of the circuit is 30v. Is it possible to use 30v Zener diode across the 40V regulated instead of 14 pieces of 1N5408 diodes? and If your response is positive, would you please do a favor and show me how? if you don’t mind.
Swagatam says
Dear Moe,
Yes that’s correct, however a zener diode cannot be used for converting 40V to 30V in your case. Using 14 pcs of 1N5408 diodes may work but they may also become quite hot in the process.
Moe says
Thanks a lot for your help, dear Swagatam 🙂
Swagatam says
You are welcome Moe!
Frans says
Hello Sir Swagatam
Would you please answer my question?
I have a good heat sink of my old PC’s graphic card which cools down with a high speed 0.12A, 12V fan . I have accomodated 2N3055 on it. Can I accomodate LM317 directly on it too or I should isolate it form heat sink?
Best regards
Swagatam says
Hello Frans, you can connect the LM317 on the same heatsink but only with proper isolation kit. I would rather recommend using separate heatsinks for the two devices and make sure the two never come in contact with each other.
Ersa says
Dear Sir Swagatam
Hello
I have a 18V, 1.4A DC power supply. would you please tell me that the Circuit Posted by Moe (1.25 to 27 Volts P.S. made up of LM317 and 2N3055) would be able to work with it? I do not care if the output voltage does not go above 18v.
Best wishes
Ersa
Swagatam says
Hi Ersa, yes definitely you can use your power supply with the following circuit by Moe:
Ersa says
Thanks a lot for your response and so quick, of course; dear Sir Swagatam. Wish you all the best.
Best regards
Ersa
Swagatam says
It’s my pleasure Ersa…
ERsa says
Dear Sir Swagatam
Hello. I have another question and would be glad to have your response. According to the symbol of the capacitor connected to pin 2 of LM317, it should be a non polar one. Does it matter if I use an electrolyte 10uf 50V capacitor instead?
Thanks a lot Sir engineer
Best regards
Ersa
Swagatam says
Hi Ersa, you can use an electrolytic capacitor rated at 10uF/50V, it is absolutely fine..
Ersa says
Dear Sir Swagatam
Thank you so much for all your favor and kindness. I will do as you have instructed and will share the results of assembling the circuit.
Best wishes
Ersa
Swagatam says
Thank you Ersa, I appreciate your dedicated efforts.
Ersa says
Dear Sir Swagatam
Hello. If I want to use a metal box for accommodating all components of this power supply in it so as to use it as heat sink for 2N3055 as well, should I isolate the 5K pot. from the box?
Thank you in advance for your reply
Best regards
Ersa
Swagatam says
Hello Ersa,
You can enclose the circuit inside a metal box and mount the 2N3055 on the metal box, but you have make sure none of the other parts of the circuit comes in contact with the metal box. As far as the pot is concerned you can fit it on the metal box without any insulation because the pot itself is fully insulated from its contacts.
Ersa says
Hello dear Swagatam
Thank you very much for your very useful response.
Best wishes
Ersa
Swagatam says
You are welcome Ersa!
Ersa says
Dear Sir Swagatam
Hello. I have sent a video and pictures of how I assembled and the way that this power supply works on your Email. In the absence of the load, the maximum voltage on multi meter is 28 Volts. As you will see, when I connected a 24 volts lamp to it, the utmost voltage of P. S. is 20 volts which is certainly due to the wattage of my 220/22 volts transformer.
Thank you very much for all your help to me and publishing this simple and very good circuit.
Wish you healthy and joy.
With best wishes and respect
Ersa
Swagatam says
Thank you so very much Ersa, for your kind contributions! I appreciate it very much.
I have published all the images and the video at the bottom section of the following post:
https://www.homemade-circuits.com/lm317-with-outboard-current-boost/
ERsa says
Dear Sir Swagatam
Hello. I forgot to write you that I added one 1N5408 across the output for more security.
Best regards
Ersa
Swagatam says
No problem Ersa, yes I saw that, it is good for the providing added safety to the transistor and the entire circuit.
ERsa says
Dear Sir Swagatam
Hello. Publishing my video and photos of the power supply on your rich site with many viewers is a sign of your great love and kindness and made me so very happy. I have no doubt that this valuable action of yours, along with the very useful essays that you publish, is aimed at encouraging the viewers to learn and progress in electronic science, and I, for my part, admire your goal and wish you all the best.
By the way, the least and most voltage of the P. S. with no load is 1v and 28volts.
Wish you health and joy my dear Swagatam
Best regards
Ersa
Swagatam says
Thank you so much ERsa, for your generosity and your kind words. Please keep up the good work. Wish you too health and joy. Cheers!
Binoj K says
Hello sir, in search of a better lm317 , current and voltage adjust circuit for 30v ,2amp power supply, I experimented with Mr. Stevens circuit which used 2 LM 317 in series one for current adjust and other for voltage adjust. But the current adjust 317 become very hot even with a 200mA current with heat sink too. I changed both with lm338 but same result. I wonder how Mr Stevens made it for laser diode power supply. And I think with even 200mA current and so much of heat, it’s not wise to dissipate power in lm317. Is there any modifications possible for heat problem. Needs Ur help pls
Swagatam says
Hello Binoj, the heat dissipation is mainly due to the difference between the input voltage and the output voltage. As this difference increases the heat dissipation will also increase.
So first make sure that the input voltage is not higher than 5 V than the output voltage. Meaning, if suppose the output voltage is required to be 3 V, then the input voltage cannot higher than 8 or 9V.
Vee says
Hi Swagatam
Thanks for your reply, I was wondering if I sent the pics and got your email right, its good to know you received them. You must be a very busy person replying to so many questions, I can imagine & wonder how you spend so much time replying to us.
I’ll add the protection circuit you mentioned, you mean the one with the BC 547 & Ry, am I right. Shall send you more pics and thanks for your encouraging words, bless you
All the best to you,
Vee
Swagatam says
No problem Vee, you are most welcome.
Vee says
Hi Swagatam
How could I add on a short circuit protection for the LM317 & MJE2955 Variable power supply, I have added a fuse for the application I use it now
Vee
Swagatam says
Hi Vee, you can provide a current limiter stage to the entire circuit as indicated in the second last diagram from this article:
https://www.homemade-circuits.com/lm317-with-outboard-current-boost/