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.
Output voltage from a resistor pair you already have; R2 for the output you want, rounded to a value you can buy; or the one-resistor current regulator of the datasheet's section 7.3.3.
The resistor from OUTPUT to ADJUST. The regulator holds 1.25 V across it, so it sets the current down the divider: 240 Ω, the datasheet's value, draws 5.2 mA.
The resistor from ADJUST to ground. It carries the R1 current plus the ADJUST pin current, and the voltage across it adds to the 1.25 V. The typical application uses 5 kΩ.
The lowest input the regulator will see, ripple trough included. It must stay at least 3 V above the output: 12 V for a 5 V rail leaves 7 V.
The current the load draws, not counting the divider. The LM317 is rated for 1.5 A; 500 mA is a typical rail.
Resistor tolerance, applied against the output at the low end and for it at the high end. 1 % for chip resistors; 5 % for the E24 through-hole drawer.
- 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)
- 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.
- 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.
- 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.
- 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.
- 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
- The typical output uses V_REF = 1.25 V and I_ADJ = 50 µA. The worst-case band takes 1.2 V with the resistors at the tolerance that lowers the output and I_ADJ = 0, and 1.3 V with the tolerance the other way and I_ADJ = 100 µA. The datasheet gives no minimum for I_ADJ, so zero is a bound, not a prediction.
- The 1.2 V to 1.3 V limits hold for 3 V ≤ V_IN − V_OUT ≤ 40 V, 10 mA ≤ I_OUT ≤ 1.5 A and P_D ≤ 20 W (section 6.6). Outside those conditions the band is not specified.
- The headroom check uses the flat 3 V of sections 6.3 and 7.4.2. The real dropout is lower at light load, and is plotted, not tabulated, in Figure 6-18; section 7.3.1 recommends the 3 V "to support maximum current and lowest temperature", the worst corner.
- The dissipation is the steady-state figure. Ripple on the input moves V_IN − V_O, and the minimum input is the one to enter for the headroom while the maximum is the one that sets the heat.
- Load regulation, temperature stability and long-term drift are not added to the band. Section 6.6 gives load regulation of up to 1.5 % of V_O over temperature, temperature stability of 0.7 % (legacy chip) and 1 % (new chip), and long-term stability of 0.3 % typical per thousand hours; add them when the budget is tight.
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 wanted | R2 exact | E24 R2 | VO, E24 | E96 R2 | VO, E96 | VIN min |
|---|---|---|---|---|---|---|
| 1.8 V | 104.6 Ω | 100 Ω | 1.776 V (−1.34 %) | 105 Ω | 1.802 V (+0.12 %) | 4.8 V |
| 2.5 V | 237.7 Ω | 240 Ω | 2.512 V (+0.48 %) | 237 Ω | 2.496 V (−0.15 %) | 5.5 V |
| 3.3 V | 389.9 Ω | 390 Ω | 3.301 V (+0.02 %) | 392 Ω | 3.311 V (+0.34 %) | 6.3 V |
| 5 V | 713.2 Ω | 680 Ω | 4.826 V (−3.49 %) | 715 Ω | 5.010 V (+0.19 %) | 8 V |
| 6 V | 903.3 Ω | 910 Ω | 6.035 V (+0.58 %) | 909 Ω | 6.030 V (+0.50 %) | 9 V |
| 9 V | 1.474 kΩ | 1.5 kΩ | 9.137 V (+1.53 %) | 1.47 kΩ | 8.980 V (−0.23 %) | 12 V |
| 12 V | 2.044 kΩ | 2 kΩ | 11.767 V (−1.94 %) | 2.05 kΩ | 12.030 V (+0.25 %) | 15 V |
| 15 V | 2.615 kΩ | 2.7 kΩ | 15.447 V (+2.98 %) | 2.61 kΩ | 14.974 V (−0.17 %) | 18 V |
| 24 V | 4.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 WThe 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
- Choosing R1 by habit from a feedback divider. A 10 kΩ R1 draws125 µA, far below the minimum load current, and the ADJUST current becomes a large fraction of R2's current. The output then depends on the load being connected and on a spread the datasheet only bounds at 100 µA.
- Asking for too little headroom. 5 V to 3.3 V leaves 1.7 V, and 12 V to 10 V leaves 2 V; both are short of the 3 V section 7.4.2 asks for. A low-dropout part is the answer, and the LDO dropout calculator checks it.
- Sizing the heat sink at the nominal setting of an adjustable supply. The dissipation is worst at the lowest output, as the worked example shows, and the guaranteed current limit shrinks at the same time.
- Adding the ADJUST capacitor without its diode. Section 8.2.1: "Use CADJ to improve ripple rejection", and "Protection diode D2 is recommended if CADJ is used. The diode provides a low-impedance discharge path to prevent the capacitor from discharging into the output of the regulator." D1 is recommended, for the same reason, if the output capacitor CO is used.
- In the current regulator, rating R1 for the current and not the power. Section 7.3.3 asks for "a power rating greater than (1.25V)2 / R": 65.1 mW for the datasheet's 24 Ω, and 1.56 W for a 1 Ω set resistor at 1.25 A. Section 8.3.7 adds that the input must exceed the load voltage by 4.25 V, the reference plus the headroom.
Further reading
- TI LM317 datasheet, SLVS044Z — Equation 2 and the ADJUST current in section 8.2.2, the reference and minimum load current in the electrical characteristics of section 6.6, the headroom and light-load behaviour in section 7.4, the current regulator in 7.3.3 and 8.3.7, and the heat sink procedure in 8.5.1.1.
- Heat sink calculator — the dissipation from this page, turned into the sink-to-ambient rating the junction limit allows.
- LDO thermal calculator — the same power as a junction temperature, with the board copper a surface-mount package needs.
- LDO dropout calculator — for the rails where 3 V of headroom is not available.
- Voltage divider calculator — the plain divider, and why the source impedance matters as much as the ratio.
- E-series calculator — two-resistor combinations when a single E24 or E96 value misses the output by too much.