100nF

LM317 calculator

The output voltage an LM317 gives from its two resistors, or the R2 a target voltage needs rounded to a value you can buy, with the ADJUST current left in, the spread the reference tolerance allows, the 3 V of headroom the datasheet asks for, and the power the regulator has to get rid of. That last number goes straight into the heat sink calculator or the LDO thermal calculator.

V_IN − V_O = 6.99 VP_D = 3.53 WV_IN 12.0 VLM317INOUTADJR1240 ΩI_R1 5.21 mAV_REF 1.25 VI_ADJ 50.0 µAR2715 ΩV_O 5.01 VI_OUT 500 mA
Fig 1 — 5.01 V out from R1 = 240 Ω and R2 = 715 Ω: the regulator holds 1.25 V across R1, so 5.21 mA runs down the divider and R2 carries that plus the 50.0 µA ADJUST current. 6.99 V of headroom meets the 3 V the datasheet asks for; the regulator dissipates 3.53 W.
Output voltage V_O, Eq 2
5.010 V · 4.974 V without I_ADJ
Worst case: V_REF 1.2–1.3 V, ±1 % resistors, I_ADJ 0–100 µA
4.704 V to 5.323 V
Headroom V_IN − V_O
6.99 V · V_IN ≥ 8.01 V for 3 V
V_IN for 3 V at the top of the worst-case band
8.32 V
Divider current V_REF / R1 · total out of OUTPUT
5.21 mA · 505 mA
Regulator dissipation (V_IN − V_O) × (I_OUT + I_R1)
3.53 W
Resistor dissipation R1 · R2
6.51 mW · 19.8 mW

R1 draws 5.21 mA: above the 3.50 mA typical minimum load current but under its 10 mA maximum (section 6.6, specified at a 40 V differential). With the load disconnected, regulation rests on the part being typical; 125 Ω or less for R1 removes the doubt.

How this is calculated

Standard: TI LM317 datasheet (SLVS044Z)

VO=VREF(1+R2R1)+IADJ R2V_O = V_{REF}\left(1 + \frac{R_2}{R_1}\right) + I_{ADJ}\, R_2
Equation 2 (section 8.2.2), Equation 1 on page 1. "IADJ is typically 50µA and negligible in most applications." V_REF is 1.25 V typical, 1.2 V to 1.3 V over the conditions of section 6.6; I_ADJ is 50 µA typical and 100 µA maximum.
R2=VO−VREFVREF/R1+IADJR_2 = \frac{V_O - V_{REF}}{V_{REF}/R_1 + I_{ADJ}}
Equation 2 solved for R2, at the typical V_REF and I_ADJ. The stocked value offered is the E24 or E96 neighbour whose output lands closest to the target.
VIN−VO≥3 V,IR1=VREFR1V_{IN} - V_O \ge 3\ \text{V}, \qquad I_{R1} = \frac{V_{REF}}{R_1}
Section 7.4.2: "The device requires up to 3V headroom (VI – VO) to operate in regulation." Section 7.4.3: the device passes its bias current to OUTPUT, so "the load or feedback" must draw the minimum load current, 3.5 mA typical and 10 mA maximum in section 6.6.
PD=(VIN−VO) (IOUT+IR1)P_D = (V_{IN} - V_O)\,(I_{OUT} + I_{R1})
The first term of Equation 9 (section 8.5.1.1.1), P_D = (V_IN − V_OUT) × I_L + V_IN × I_G, with I_L everything that leaves OUTPUT. The LM317 has no ground pin, so the I_G term has no current to carry.
I=VREFR1+IADJ,PR1=(1.25 V)2R1I = \frac{V_{REF}}{R_1} + I_{ADJ}, \qquad P_{R1} = \frac{(1.25\ \text{V})^2}{R_1}
Section 7.3.3: "For current regulation applications, use a single resistor whose resistance value is 1.25V / IO and a power rating greater than (1.25V)2 / R." The ADJUST current joins the resistor current at the load, which is Kirchhoff, not the datasheet; section 8.3.7 asks for V_I greater than V_BAT + 4.25 V.

Assumptions

What sets an LM317's output voltage

The LM317 is a regulator that knows only one voltage: the difference between its OUTPUT and ADJUST pins. The datasheet puts it in a sentence (section 7.4.1): "The device OUTPUT pin sources current necessary to make the OUTPUT pin 1.25V greater than ADJUST pin to provide output regulation." Everything else follows from where the two resistors put the ADJUST pin.

R1 sits between OUTPUT and ADJUST, so it always has the reference across it, and the current through it is fixed at VREF/R1 whatever the output voltage: 5.21 mA for the datasheet's 240 Ω. That current continues down through R2 to ground, joined by the small current that flows out of the ADJUST pin itself. The output is the reference plus the drop across R2, which is Equation 2 of the datasheet, the first formula under How this is calculated above. Its second term, IADJ × R2, is the one most calculators leave out, and the datasheet explains why they get away with it (section 8.2.2): "IADJ is typically 50µA and negligible in most applications."

Most, not all. With R1 = 240 Ω the ADJUST current is about 1 % of the current in R2, and the term moves the output by about the same fraction. The overview (section 7.1) is candid about what it is: "The LM317 is designed to minimize the I ADJUST current and make this current constant with line and load changes. A 100μA current from the ADJUST pin represents an error term." Section 6.6 gives it as 50 µA typical and 100 µA maximum over temperature, and it changes by up to 5 µA across load and line. The error it causes scales with R2, so it matters exactly when the resistors are large.

The reference itself is 1.25 V typical and between 1.2 V and 1.3 V over the conditions section 6.6 attaches to it: 3 V to 40 V across the part, 10 mA to 1500 mA of output current, and no more than 20 W of dissipation. That is ±4 %, and it multiplies straight through to the output: a 0.1 % divider under an LM317 still gives a ±4 % rail. The calculator reports that band, with the resistor tolerance and the ADJUST current's range folded in.

LM317 resistor chart: R2 for common output voltages

R1 = 240 Ω, the datasheet's value, and R2 solved from Equation 2 with the 50 µA ADJUST current included, then rounded to the E24 or E96 value whose output lands closest. The output columns are what those real resistors give at the typical reference, computed by the calculator above; the last column is the least input that keeps the 3 V of headroom at the typical output. The divider draws 5.21 mA in every row, since R1 and the reference do not change.

VO wantedR2 exactE24 R2VO, E24E96 R2VO, E96VIN min
1.8 V104.6 Ω100 Ω1.776 V (−1.34 %)105 Ω1.802 V (+0.12 %)4.8 V
2.5 V237.7 Ω240 Ω2.512 V (+0.48 %)237 Ω2.496 V (−0.15 %)5.5 V
3.3 V389.9 Ω390 Ω3.301 V (+0.02 %)392 Ω3.311 V (+0.34 %)6.3 V
5 V713.2 Ω680 Ω4.826 V (−3.49 %)715 Ω5.010 V (+0.19 %)8 V
6 V903.3 Ω910 Ω6.035 V (+0.58 %)909 Ω6.030 V (+0.50 %)9 V
9 V1.474 kΩ1.5 kΩ9.137 V (+1.53 %)1.47 kΩ8.980 V (−0.23 %)12 V
12 V2.044 kΩ2 kΩ11.767 V (−1.94 %)2.05 kΩ12.030 V (+0.25 %)15 V
15 V2.615 kΩ2.7 kΩ15.447 V (+2.98 %)2.61 kΩ14.974 V (−0.17 %)18 V
24 V4.326 kΩ4.3 kΩ23.861 V (−0.58 %)4.32 kΩ23.966 V (−0.14 %)27 V

Two rows reward a second look. At 5 V the exact R2 falls almost midway between the E24 neighbours, and the better of them, 680 Ω, still misses by −3.49 %; E96's 715 Ω lands within +0.19 %. At 3.3 V the order reverses: E24's390 Ω gives 3.301 V, while E96, which does not contain 390 Ω, can only offer 392 Ω and3.311 V. The 1 % series has more values per decade, not every value; E24 is not a subset of it.

No E96 row misses by more than 0.50 %, well inside the ±4 % the reference allows, so past that point a closer resistor buys nothing. The E24 errors are a different matter: 2 kΩ for 12 V gives11.767 V, −1.94 % before the reference has had its say. Where an E24 value misses by more than a per cent or two, the fix is a second resistor in series with R2, or a different R1 — the ratio is what matters, and 220 Ω or 270 Ω for R1 moves every row.

Worked example: the datasheet's typical application, 240 Ω and 5 kΩ

The drawing on the first page of the datasheet is its typical application: R1 = 240 Ω from OUTPUT to ADJUST, a 5 kΩ potentiometer from ADJUST to ground, 0.1 µF on the input "if the device is more than 6 inches from filter capacitors", an optional 1 µF on the output, and the input labelled VIN ≥ 28 V. Take R2 at the top of its travel, 1 % resistors, and an assumed 500 mA of load.

V_O   = 1.25 × (1 + 5000/240) + 50 µA × 5 kΩ  = 27.292 + 0.250 = 27.542 V
band  = 1.2 V, R1 +1 %, R2 −1 %, I_ADJ 0       → 25.705 V
        1.3 V, R1 −1 %, R2 +1 %, I_ADJ 100 µA  → 29.435 V
I_R1  = 1.25 / 240                          = 5.21 mA   (3.5 mA typ, 10 mA max needed)

at V_IN = 28 V:  headroom = 28 − 27.54       = 458 mV    (3 V needed)
3 V headroom needs  V_IN ≥ 27.54 + 3        = 30.5 V
            and for the top of the band  = 32.4 V

at V_IN = 32.5 V, 500 mA load:
  R2 at the top,    V_O = 27.54 V:  P_D = 4.96 V × 505 mA = 2.50 W
  R2 at the bottom, V_O = 1.25 V:  P_D = 31.3 V × 505 mA = 15.8 W

The IADJ term is 250 mV here, about 1 % of the output, which is the datasheet's "negligible in most applications" in numbers. The reference band is not negligible: a part at one end of it and 1 % resistors at the other give anything from25.705 V to 29.435 V for the same pot setting.

The headroom line is the one to read twice. The drawing's VIN ≥ 28 V leaves 458 mV across the regulator with R2 at the top of its travel, well short of the 3 V the recommended operating conditions give as the minimum VI − VO (section 6.3). The label is the least the input can be, not a value that holds regulation at every setting of the pot; 30.5 V does that for a typical part and32.4 V for any part.

The two dissipation lines are the lesson of any adjustable supply. With the input fixed at 32.5 V, turning the output down does not reduce the regulator's work; it increases it, from2.50 W at the top to15.8 W at 1.25 V, because the whole difference now sits across the part. That lower figure is the one the heat sink has to be sized for, and it is past what section 6.6 guarantees in another way too: the current limit is specified at 1.5 A minimum only for differentials up to 15 V, and at 40 V the minimum is 0.15 A. A bench supply built this way may not deliver its rated current at low output settings at all.

Finally, the divider current. 5.21 mA clears the 3.5 mA typical minimum load current of section 6.6 but not its 10 mA maximum, so with the load disconnected a part at that limit is not guaranteed to regulate. A 120 Ω R1, the value the datasheet uses in Figures 8-6 and 8-17, draws 10.4 mA and settles it, at the cost of halving R2 for the same output.

Where the LM317 equations stop being valid

Below 3 V of headroom. Section 7.4.2: "The device requires up to 3V headroom (VI – VO) to operate in regulation. The device potentially drops out and OUTPUT voltage becomes the INPUT voltage minus the dropout voltage with less headroom." Once that happens R1 and R2 no longer set anything. Figure 6-18 plots the dropout, lower at light load than at 1.5 A, and section 7.3.1 explains the round figure: "A 3V headroom is recommended (VI – VO) to support maximum current and lowest temperature." Enter the lowest input the regulator will see, including the trough of any ripple on it.

At light load. The LM317 has no ground pin, so its own operating current has nowhere to go but the output. Section 7.4.3: "The device passes the bias current to the OUTPUT pin. Make sure the load or feedback consumes this minimum current for regulation or the output is potentially too high." Section 6.6 specifies that minimum at a 40 V differential, 3.5 mA typical and 10 mA maximum, and Figure 6-20 plots it rising with the differential. The calculator compares the R1 current against both figures, because the divider is the only load that is certain to be there.

Large resistors. Figure 8-10 in the datasheet, the "1.25V to 20V Regulator Circuit With Minimum Program Current", uses R1 = 1.2 kΩ and R2 = 20 kΩ, and its Equation 4 omits the ADJUST term. At the top of the travel that equation gives 22.083 V; with the typical 50 µA added the output is 23.083 V, and at the 100 µA maximum the term alone is 2.00 V. The divider draws1.04 mA, under the minimum load current, so the load has to make up the rest. Low program current is a legitimate choice; it is also the one in which both effects stop being small.

More than 40 V across the part. The absolute maximum input-output differential is 40 V (section 6.1), and the regulator measures nothing else. The description spells out the consequence: "The regulator is floating and detects only the input-to-output differential voltage. Thus, supplies of several hundred volts are regulated as long as the maximum input-to-output differential is not exceeded. That is, avoid short-circuiting the output." A short on a high-voltage output puts the whole input across the part.

Common LM317 mistakes

Further reading