About the LM317
The LM317 is a three-terminal adjustable linear voltage regulator (IN, OUT, ADJ). Instead of a fixed output like a 7805, it lets you set any output voltage from about 1.25V up to 37V using two external resistors, R1 and R2. The chip holds a constant reference voltage (nominally 1.25V) between its OUT and ADJ pins, and that reference across R1 sets a current that also flows through R2, producing a predictable, adjustable output.
The standard formula
The datasheet formula for output voltage is:
- Vout = Vref × (1 + R2 / R1) + Iadj × R2
- Vref is the reference voltage between OUT and ADJ — nominally 1.25V (datasheet spread roughly 1.20-1.30V).
- R1 is the fixed resistor between OUT and ADJ, commonly 220Ω or 240Ω.
- R2 is the adjustable resistor between ADJ and ground, chosen to set your target voltage.
- Iadj is the small current that leaks out of the ADJ pin, typically about 50µA. Because this term is tiny compared to Vref × (1 + R2/R1), many quick designs approximate it as zero.
Two other numbers that matter
Voltage alone does not tell you whether a design will actually work. Two more checks matter in practice:
- Minimum load current. The LM317 needs roughly 3.5-10mA flowing through R1 and R2 to bias its internal reference. If your real load plus the R1/R2 divider draws less than that, the output can drift high. Keeping R1 near 220-240Ω is the standard way to guarantee the divider alone supplies enough current.
- Dropout headroom. Vin must sit above Vout by roughly 2-3V at rated current or the regulator falls out of regulation and the output sags. Any extra headroom above that minimum is dissipated as heat inside the package, calculated as (Vin − Vout) × Iout.
Choosing R2 for a target voltage
To solve for R2 given a desired output, rearrange the formula (ignoring the small Iadj term for a first pass): R2 = R1 × (Vout / Vref − 1). For example, with R1 = 240Ω and a 5V target, R2 ≈ 240 × (5/1.25 − 1) = 240 × 3 = 720Ω — the default values in this calculator.