All articles

    The LM317 Adjustable Regulator: Calculating the Resistors and the Heat

    A complete LM317 guide: pinout, the output voltage equation and ready values, why R1 = 240 Ω, dropout, heat, a variable power supply with a potentiometer, using it as a constant-current source, protection diodes, alternatives, and troubleshooting.

    Updated 6 min read

    The LM317 is a three-pin voltage regulator that delivers almost any voltage from 1.25 V up to about 37 V with just two resistors. That's why it's the usual choice for variable power supplies and for any project that needs a voltage not available from fixed regulators like the 7805.

    Wiring

    The pin order in the TO-220 package, looking at the marking with the legs pointing down, is ADJ, then OUT, then IN from left to right. That's different from the 7805 (IN, GND, OUT), and the most common mistake is fitting an LM317 in place of a 7805 with the same wiring. Always check the datasheet, because other packages (such as SOT-223) have a different order.

    • IN: the input (a voltage higher than the output you want).
    • OUT: the output.
    • ADJ: the adjust pin, connected between the two resistors.
    • R1 between OUT and ADJ, and R2 between ADJ and ground.
    An LM317 delivering 5 V from 12 V: the whole difference, 7 V × 1 A, turns into heat inside the chip
    An LM317 delivering 5 V from 12 V: the whole difference, 7 V × 1 A, turns into heat inside the chip

    The output voltage equation

    The regulator keeps a constant 1.25 V between OUT and ADJ, that is, across R1. From that:

    Vout = 1.25 × (1 + R2 ÷ R1) + Iadj × R2

    The second term (Iadj is about 50 µA) is very small and usually ignored, but the calculator includes it.

    Ready values (R1 = 240 Ω)

    OutputR2Note
    About 5 V720 Ω2 × 360 in series, or a 1 kΩ trimmer
    About 9 V1.5 kΩ≈ 9.1 V
    About 12 V2 kΩ≈ 11.8 V, and the trimmer sets it exactly

    If you need the voltage to the millivolt, use a trimmer (variable resistor) in place of R2 or part of it, and adjust while measuring with a multimeter.

    Why R1 = 240 Ω specifically?

    The regulator needs a minimum load current to stay in regulation (from about 3.5 to 10 mA depending on the manufacturer). R1 = 240 Ω draws 1.25 ÷ 240 ≈ 5.2 mA by itself, so the regulator stays working even with no load. Many people use 120 Ω for more margin.

    Dropout: how much higher must the input be?

    The LM317 needs the input to be at least about 2–3 V above the output (the dropout). So to get a steady 12 V, the input must stay above about 15 V, even at the lowest point of the ripple from the filter capacitor.

    Heat: its weak point

    A linear regulator throws away the excess voltage as heat:

    P = (Vin − Vout) × I

    12 V to 5 V at 1 A = 7 W of heat. That's far too much without a heatsink, and the chip will heat up until its internal protection shuts it down. The practical rule: anything above about 1 W needs a heatsink, and above a few watts the heatsink grows quickly.

    If the voltage difference is large or the current is high, a linear regulator is wasteful. A buck converter does the same job at about 90% efficiency. See the buck vs linear regulator article.

    A variable power supply with a potentiometer

    Put a 5 kΩ potentiometer in place of R2 (one end and the wiper between ADJ and ground), with R1 = 240 Ω:

    • Pot at zero → output 1.25 V.
    • Pot at maximum → 1.25 × (1 + 5000 ÷ 240) ≈ 27 V.

    To really reach 27 V, the input must be about 30 V. And heat is the real challenge here: with 30 V in and 5 V out at 1 A, the regulator burns 25 W! A variable bench supply with an LM317 needs a big heatsink, or a current limit at low voltages. And add a small resistor (say 100 Ω) in series with the pot if you don't want the output to go all the way down to 1.25 V. Potentiometers and their types are in the potentiometer article.

    The LM317 as a constant-current source

    Connect a single resistor R between OUT and ADJ, and take the output from the ADJ pin. The regulator keeps 1.25 V across R, which means a constant current:

    I = 1.25 ÷ R

    Example: a 1 W power LED that needs 350 mA:

    • R = 1.25 ÷ 0.35 ≈ 3.6 Ω.
    • Power in R = 1.25 × 0.35 ≈ 0.44 W → a 1 W resistor.
    • The input must be roughly higher than (LED Vf + 1.25 + 2), so about 7 V for a white LED.

    That's exactly the driver the LED resistor article recommends for power LEDs, and it's also used for constant-current battery charging. But its efficiency is poor if the excess voltage is large, like any linear regulator.

    Protection diodes

    The datasheet recommends two diodes in certain cases:

    • A diode from OUT to IN (cathode to IN): if the output capacitor is large and the input is suddenly shorted, the capacitor would discharge into the regulator the wrong way. The diode routes that charge around it.
    • A diode from ADJ to OUT: if you put a capacitor on the ADJ pin, this diode discharges it safely if the output is shorted.

    In small circuits with small output capacitors you can do without them, but a 1N4002 costs next to nothing. Diode types are in the diodes article.

    Alternatives

    • LM338: the same idea up to 5 A.
    • LM337: the negative version, for when you need a negative voltage (say ±12 V for op-amp circuits).
    • AMS1117-ADJ or LM1117-ADJ: a much lower dropout (about 1.1 V), suitable when the input is close to the output, such as 5 V to 3.3 V.
    • 7805 and 7812: if the voltage you want is standard, simpler and with fewer parts. The comparison is in the 7805 and LDO regulators article.

    Not working?

    • The output is close to the input minus 2 V: R2 is open or the ADJ pin isn't connected.
    • The output is only 1.25 V: R2 is shorted, or R1 and R2 are swapped.
    • The voltage oscillates or jumps around: the input and output capacitors are missing, or the wires to them are long.
    • It shuts off after a while: heat. Calculate P = (Vin − Vout) × I, and see whether you need a heatsink.

    Tips

    • Capacitors: 0.1 µF on the input close to the chip, and 1 µF or more on the output, improve stability.
    • A capacitor on ADJ (about 10 µF to ground) reduces ripple on the output. If you use it, add a protection diode as the datasheet shows.
    • Maximum current is about 1.5 A in the TO-220 package with good cooling.
    • The metal tab on the back of the chip is connected to the output, so if the heatsink touches the chassis, use an insulator.

    Calculate it in a second

    The LM317 calculator works out the output voltage from R1 and R2, or tells you the R2 for a given voltage and gives you the nearest standard value and the actual voltage with it.

    Circuits Nerd
    © 2026 Circuits Nerd. All rights reserved.