The LM317 is the classic adjustable three terminal regulator with a 1.25 V reference and 1.25 to 37 V set by an external divider. This page covers divider math, current setting and stability notes.
Inside the LM317 the voltage between the adjust pin and output is held at 1.25 V. With R1 to ground and R2 from output to adjust, the same current flows in both, so Uout equals 1.25 times (1 plus R2 over R1) plus Iadj times R2. Iadj is tiny, about 50 microamp, so the common form is 1.25 times (1 plus R2 over R1). With R1 at 240 ohm, R2 is 240 times (Uout over 1.25 minus 1); for 12 V R2 is about 2070 ohm.
The LM317 needs a minimum current through R1, about 3.5 to 10 mA, to regulate, so R1 must not be large; 240 ohm gives about 5 mA. With R1 at several kiloohm light load current is insufficient and it loses regulation. A pot on R2 gives adjustability but at zero it floors at 1.25 V, never 0; an open or floating adjust pin lets output spike to maximum.
| Output | R1 | R2 |
|---|---|---|
| 5 V | 240 ohm | about 720 |
| 9 V | 240 ohm | about 1490 |
| 12 V | 240 ohm | about 2070 |
| 15 V | 240 ohm | about 2640 |
| 24 V | 240 ohm | about 4350 |
| Ref | dash | 1.25 V |
LM317 output is set by R2 over R1; keep R1 at 240 ohm for minimum load current and trim R2 to the wanted voltage. Add output capacitance, keep dropout 3 V or more, never float the adjust pin, and put a fixed resistor in series with the pot so an open end cannot spike.
The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Adjustable regulator per GB/T 5226.1; device to IEC 60747 and GB/T 12350. Always check the device datasheet and the product design file for ratings and derating.
Locate the issue with the approach above, then confirm with measurements; safety-related circuits must follow the standards and manufacturer requirements.