NEARFIELD·TOOLS

LM317 calculator

Two resistors set an LM317's output, and every LM317 calculator stops there. This one also shows what the datasheet actually guarantees: the output at every worst-case corner, the minimum load the classic 240 Ω resistor doesn't meet, the input voltage it needs and the heat it makes. It also sizes the one resistor of an LM317 current source.

From the datasheet

The datasheet defaults are the LM317's guaranteed limits (TI SLVS044): reference 1.20–1.30 V over line, load and temperature, adjust-pin current 50 µA typical and 100 µA maximum, up to 10 mA minimum load, and regulation specified from 3 V of headroom. Other makers and variants (LM317L, LM338, LM350) differ, so check yours.

—
resistors to buy
—
output, typical
—
output, every corner
—
input it needs
—
LM317 dissipation, worst case
—
divider current
can pull it down can push it up

How this is calculated

An LM317 holds its output exactly one reference voltage above its adjust pin. R1 sits across that reference, from the output to the adjust pin, so it carries a fixed current, Vref/R1. That current flows on down through R2 to ground, joined by the small current that leaves the adjust pin itself, so

Vout = Vref · (1 + R2/R1) + Iadj · R2

Most calculators drop the last term. It is small with the low resistances this page picks: 50 µA through 330 Ω adds 17 mV. It is not small with the 1 kΩ and 3 kΩ some circuits use to save current, where it adds 150 mV, and its spread from one part to the next is as large as the term itself. The page includes it at its typical value when choosing R2, and at zero and at its maximum for the worst case, since the datasheet gives no minimum.

To find the resistors, the page takes every catalogue value of R1 in the range the minimum load allows (next section), works out the exact R2 each one needs, and tries the catalogue values either side. The pair closest to the target wins. Pairs within 0.1 % of each other count as a tie, and the larger R1 wins it, because it wastes less current. Every figure for the chosen pair is then evaluated at all sixteen corners of reference voltage, adjust-pin current and the two resistor tolerances.

The reference sets the accuracy, not the resistors

The LM317's reference is guaranteed only to 1.20–1.30 V, which is ±4 %, and the whole output scales with it. No choice of resistors gets an LM317 closer than that. At the defaults the page buys 110 Ω and 330 Ω, whose typical output is 5.017 V. At the corners the same parts give anything from 4.73 V to 5.31 V. The reference is 400 mV of that 583 mV spread, and the bar chart shows each share.

The resistors' share shrinks as the output approaches the reference. Their tolerance acts only on the R2/R1 part of the gain, which is three-quarters of it at 5 V. So 0.1 % resistors would narrow the default range to 4.79–5.24 V and no further. Where the output has to be right, two cheaper answers work. Put a trimmer in R2 and set it once. Or use a fixed regulator, whose output is trimmed at the factory: a 7805 is specified to ±4 % too, while many modern LDOs reach ±1 %.

The 240 Ω question: minimum load

An LM317 has no ground pin. Its own operating current leaves through the output, and it needs some load to stay in regulation: the datasheet says 3.5 mA typical, and up to 10 mA. Unloaded, the output of a part that needs more than it gets drifts upward. In a power supply the load is often disconnected, so R1 has to carry that current on its own.

The application circuit everyone copies uses R1 = 240 Ω. That gives 5.2 mA, comfortably above the typical figure but only half the 10 mA maximum. At the low corner of the reference and the high end of a 1 % resistor it is 4.95 mA. The value comes from the LM117, the military part, whose minimum load is specified lower. TI's LM317 datasheet now suggests 120 Ω. Even that sits just short of the worst case: 1.20 V across 121.2 Ω is 9.9 mA. So with the defaults the page caps R1 at 118.8 Ω and buys 110 Ω, 10.8 mA at the worst corner.

If your load never falls below the minimum on its own, enter that, and the divider only has to make up the difference. It is still kept to at least 5 mA, because the adjust-pin current's spread is a share of the divider current, and that share grows as the divider current shrinks. In check the ones I have mode the page tells you if your R1 falls short.

Headroom and the input it needs

The datasheet specifies regulation for 3 V to 40 V between input and output. Typical parts keep regulating down to about 1.5–2.5 V, depending on current and temperature, but that is a curve, not a promise. The page adds your headroom to the highest output at the corners, so the minimum input it reports holds for any part from the reel. If your supply has ripple, its minimum is the bottom of the ripple trough, not the average.

The 40 V limit applies to the difference, so a 37 V output from 40 V in is fine. With the output shorted, though, or while a large output capacitor charges at power-up, the whole input appears across the regulator. Above 40 V in, use a high-voltage variant.

Heat

Everything the LM317 drops, it burns: (Vin − Vout) times the load and divider current, plus the adjust-pin current across the input. The worst case is the highest input, the lowest output and the full load. At the defaults that is 4.0 W. A TO-220 in free air, around 50 °C/W from junction to air, would climb about 200 °C above ambient, so this design needs a heatsink. The figure links straight to the heatsink calculator with the dissipation filled in. The LM317's thermal shutdown protects the part, not the design. A regulator that shuts down on a hot day still fails.

When the drop is large and the current is too, a buck converter does the same job and wastes a fraction of the power. For loads of a few milliamps that never change, a zener regulator may be enough. For a fixed fraction of a voltage with no load at all, a plain voltage divider is.

The LM317 as a current source

Put one resistor between the output and the adjust pin and take the load from the adjust pin. The regulator then holds the reference across the resistor, so the current is fixed whatever the load does:

I = Vref / R + Iadj

For 350 mA that is 3.57 Ω. The page rounds the resistor up to the next catalogue value (3.6 Ω in E24), so the typical current never exceeds what you asked for. An LED or a battery is rated for a maximum, not a target. The worst-case range is wide, 330–365 mA here, and once again it comes from the reference. The resistor dissipates the reference voltage times the current, about 0.47 W at the worst corner, so it needs a 1 W part.

The current source costs more headroom than the regulator. The input must cover the load's highest voltage, the reference across the resistor and the regulator's own headroom: 7.9 V for the default LED. The minimum load applies as well, now to the set current itself. An LM317 set to 5 mA for an indicator LED is outside its datasheet, which is why the page warns below 10 mA. For the LED's own series resistor, when the supply is steady, the LED resistor calculator is simpler.

FAQ

What resistors do I need for 5 V from an LM317?

With E24 values and the minimum load covered at every corner: R1 = 110 Ω and R2 = 330 Ω, a typical 5.017 V. The familiar 240 Ω and 720 Ω (or 750 Ω) set the same ratio but may not keep a worst-case LM317 in regulation with no load.

What resistors give 12 V or 3.3 V?

For 3.3 V in E24: R1 = 110 Ω and R2 = 180 Ω, a typical 3.304 V. For 12 V the closest E24 pair that covers the minimum load is R1 = 82 Ω and R2 = 680 Ω, a typical 11.65 V: 2.9 % low, because E24 has no closer ratio among the small R1 values the minimum load allows. E96 gets within 0.8 %: 115 Ω and 976 Ω, 11.91 V. The reference's ±4 % is larger than either error, so to land on 12.00 V, put a trimmer in R2. Enter the output and the page shows the next-best pairs too, in case one value isn't in the drawer.

Why is my LM317's output higher than calculated with no load?

Because nothing draws the regulator's minimum load current. With R1 at 240 Ω or more the divider carries 5 mA or less, and a part that needs more lets its output rise. Lower R1 (and R2 in proportion), or add a load resistor. The adjust-pin current adds a fixed offset too, which is large with kilohm resistors.

What is the minimum input voltage for an LM317?

The highest output plus the headroom: the datasheet guarantees regulation from 3 V of headroom, and typical parts drop out somewhere around 1.5–2.5 V. For a dependable 5 V output, plan for at least 8.3 V at the bottom of the input's ripple.

Do I need the capacitors and the protection diodes?

A 0.1 µF input capacitor is needed if the regulator sits far from the supply's filter capacitor. An output capacitor of 1 µF or more improves the transient response. A 10 µF capacitor from the adjust pin to ground raises ripple rejection by about 15 dB. With that adjust capacitor, or a large output capacitor, the datasheet adds diodes that discharge them around the regulator if the input is shorted. They cost cents.