Home » AC to DC Adapter » LM317 Variable Switch Mode Power Supply (SMPS)
LM317 Variable Switch Mode Power Supply (SMPS)

LM317 Variable Switch Mode Power Supply (SMPS)

So far in this website we have studied LM317 based linear power supply circuits, here we will learn how an LM317 can be executed as a variable switch mode power or SMPS with zero loss.

LM317 as Linear Regulator

We all know that an LM317 IC is internally designed to work as a linear voltage regulator IC, which has a serious drawback of power dissipation through heating. Moreover such topology also requires the input to be minimum 3V higher than the desired output, adding further restrictions to the given regulator configuration.

Here we discuss how the same IC could be simply implemented as a 0-40V variable power supply using SMPS topology and therefore eliminating the losses mentioned in the above paragraph.

Modifying LM317 Circuit into a PWM Switching Regulator Circuit

The LM317 variable SMPS circuit explained here effortlessly converts an ordinary LM317 IC into an inductor based switching regulator power supply counterpart, as exhibited in the following diagram:

Circuit Diagram

Referring to the above shown diagram we can see that the LM317 is configured in its usual variable regulator mode but with some additional parts in the form of  R6, C3, and D1.

We can also see an inductor attached with D1 and an associated power BJT Q1.

How it Works

Here the LM317 IC performs two tasks together. It varies the output voltage through the indicated pot R4, and in turn causes a PWM to initiate for the base of Q1.

Basically, the introduction of R6/C3 transforms the LM317 regulator circuit into a high frequency oscillator circuit, forcing the output of the LM317 to switch ON/OFF rapidly with a varying PWM, which is dependent on the setting of R4.

The BJT Q1 along with the inductor L1 and D1 forms a standard buck converter circuit which is controlled by the above explained PWM generated by the LM317 circuit.

This implies that while the pot R4 is varied, the voltage pulse width developed across R1 also varies proportionately causing Q1 to switch L1 in accordance with the varying PWMs.

Higher pulse widths enable the inductor to produce higher voltages and vice versa.

Capacitor C4 makes sure that the fluctuating output from L1 at the output is adequately smoothed and eliminated, this consequently enhances the ripple current into a stable DC.

In the proposed LM317 switch mode power supply circuit since the IC LM317 is not directly involved with the handling of the load current, it's restricted from dissipating current, and thus ensures an efficient regulation of the high input voltage into the desired low output voltage levels.

The design also allows the user to upgrade the circuit into a high current SMPS circuit simply by changing the Q1, L1, D1 rating as per the required output current specifications.

L1 can be built by winding bifilar enameled copper wire over any suitable ferrite core.

Although this LM317 SMPS circuit promises a near zero loss output, Q1 must be mounted on a heatsink and some degree of dissipation may be expected from it.

Interesting Feedback from one of the Avid Readers:

Mr. Swagatam:

I am a retired EE, but continue to have an interest in various areas.  Happened to come across your website when I was researching power  supplies using LM317. 

Saw the interesting switch mode power supply schematic using the LM317. 

As it turns out, the exact circuit shows up in the 1978 National Semiconductor Voltage Regulator Handbook, with additional verbiage to explain its behavior.

However, I found it even more helpful to simulate the circuit using LTSpiceVII (which is free to download and use) to get a better idea of how the circuit operates with component value changes. 

Anyway, I decided to scan the two pages from the 1978 Handbook and email to you in the event you care to post them with the schematic for others who might be interested in a little more detail.


Denton Conrad

Raleigh, NC


About the Author

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials. If you have any circuit related query, you may interact through comments, I'll be most happy to help!

31 thoughts on “LM317 Variable Switch Mode Power Supply (SMPS)”

  1. can i replace pnp transistor with npn transistor? and instead of connecting base of npn to input of lm317t i rather connect it to vout

  2. Sir good morning! I can’t find tip127 sir could I use 2 tip 32 as darlington configuration? any suggestion for any parts changes Sir? tnx!

    • Jindro, try a single TIP32 first, if it doesn’t work efficiently then you can upgrade it into a Darlington with a 2N2907 transistor

  3. Hello Swagatam,
    I first want to say I enjoy reading your articles and how toys. I’ve watched you on YouTube and read your Instructables for a long time now and they are vey informative.
    I have a question about power and voltage in this circuit, how to apply the changes and if this would work for a diy bench top variable psu?
    If I were to change q1 to a higher current transistor, do I only need to satisfy l1 and d1 voltage and current requirement for the circuit, or is a consideration needed for the base current of q1 in relation to lm317’s output driving q1’s base?
    I am still a novice electronics hobbyist, and though I have firm understanding of application and mechanics, the equations are still elusive.
    Thank you for all of your wonderful advice and instruction.
    H. Foster

    • Thank you H. Foster, I am glad you liked my site, and I appreciate your involvement very much!

      For acquiring more output current the base resistor of Q1 can be ignored to an extent, unless the output current requirement is significantly high, in that case the 22 ohms will need to be increased a bit and experimented. Or a Darlington BJT can be used for Q1 which will allow the 22 ohm value to be consistently without any change for any output current.

      However, Q1, L1 and D1 will need to upgraded accordingly. For L1, the average wire surface area will need to be increased by winding bunch of thinner wires together, whose mass may be equivalent to the calculated single thick wire’s mass approximately.
      Q1 rating will also need to be enhanced as per the required output amp specs….

      Similarly D1’s current handling capacity will need to be upgraded as per Q1’s specs.

      If you have any further questions, please feel free to discuss with me here…

      • I was thinking on using 2n5683 or MJ11015 to get up to 30 amps. I plan on using it in this circuit with a computer psu to make a diy variable bench power supply output. I believe the MJ11015 is a Darlington, not sure about the other. Am I exceeding their specs for this application or would line be better than the other. They are both inexpensive, which is what I’m going for. ?
        And I’m correct in thinking I need a pnp, not an non, yes?
        Thanks again for the assistance.

          • Thanks again for the discussion Swagatam. I was looking at the mj11015g specifically because it is a pnp in a Darlington setup. Here’s the datasheet link at alldatasheets – http://www.alldatasheet.com/datasheet-pdf/pdf/426442/ONSEMI/MJ11015G.html
            This way I don’t have to about current and voltage changes on the base and its resistor and its all in one package.
            So am I correct in thinking the only additional considerations needed are for d1 and l1 current and voltage requirements? If I pick those to conform to the 30 amp max of q1 I should be set to build?
            You have been most helpful and I truly appreciate it.
            Thank you.

            • oh yes MJ11015g is a PNP, I am sorry, I mistakenly saw the search description for MJ11016 and assumed it wrongly.

              In that case it can be definitely used for the discussed purpose, and the only factors that will need to be considered are L1, and D1, according to my knowledge.

              you are absolutely correct with your conclusions regarding picking 30 amp specs for D1 and L1, and you can proceed with the assembly.

              If you have more doubts, let me know, I’ll be most happy to help!

          • Sir can I use tip127 for q1? I want to build this for 5 li ion batt parallel charger or cellphone charger. Your other circuit is better but parts here in my town is so hard to find, I need simple and less parts like this tnx

  4. hello sir,please i have a project i would love you to help me with.will love to e-mail the details to you.i wouldnt mind if you give me your email.thanks alot

  5. HI sir what about curent limitation of lm317 !how much power can give this socket ? what i have to do if i want to use li ion battery 3.7 volt whit this !thank you à lot !you are the best

    • Hi Rabie, current is supplied by Q1 not by the LM317, LM317 is used just for initialization of the buck converter and for the PWM control.
      the output current is dependent on the inductor specs and the input supply current range.

  6. Sir i have make an an inverter instant to rate at 220v but it rating at 320. what shall i do to decrease it to 220 ?? And later that i just observe that may be because i am using 6-0-6 transformer 12v battery but last time u say if going to use 6-0-6 transfer the battery also must be 6v so please how shall i reduce the battery from 12v to 6v ??

    • Wouldnt that be low voltage at the output if he is to use a 9v battery with a 12-0-12v transformer.

      He has a 12v battery wouldnt it be best for him to use a 10-0-10v transformer?

    • hello chucks, you can use it as a power supply circuit for getting an efficient power output and also as a solar charger. It can be also modified to work as an MPPT

  7. Sir can I replace bjt/pnp transistor with MOSFET P-channel? sure i will try this after work ^_^
    by the way sir is this circuit applicable also on LM7812 or 7805 regulator??
    Thanks again Sir. Have a nice day.

    • Joseph, if you are using a mosfet then the 22 ohm resistor will need to be increased proportionately such that it develops the required 9V for the mosfet gate to trigger it satisfactorily.

      No, it is applicable only with LM317 or LM338.

Leave a Comment