LM317 calculator
- tsp
Last update 21 Oct 2022
3 mins
The LM317 is one of the most common used parts in the history of hobby electronics.
Itβs a flexible linear adjustable voltage regulator that can convert an input voltage
between $3 V$ and $40 V$ into an output voltage in the range of $1.25V$ to $37V$.
Note that itβs a linear regulator so excessive potential is simply thermally converted.
The larger the difference between input and output voltage is the larger your heat sink
needs to be. There even had been 2A $3V$ to $12V$ laboratory power supplies that
just consisted of some resistors that could be dialed using a rotary dial, a
transformer down to around $24 V$, a bridge rectifier, a few capacitors and a
LM317 - mounted of course on a really huge heat sink since in this configuration
the power supply will most likely dump most of the power.
The following information is just a summary and mini calculator for my own
personal convenience - it does not substitute reading the data sheet of course.
Voltage regulation: The basic schematic

Usually the LM317 is used in conjunction with:
- An input and output decoupling / bypass capacitor. These are usually ceramic
or tantalum capacitors in the range of $0.1 \mu F$ on the input side and $1 \mu F$
on the output side. These prevent oscillations of the regulator
- Two protective diodes. $D_2$ provides a discharge path for $C_{adj}$, $D_1$ provides a
discharge path for the output capacitor $C_2$.
- $C_{adj}$ is a ripple rejection mechanism and is basically optional - or should
be chosen on the order of $10 \mu F$
The resistor network $R_1$ and $R_2$ selects the output voltage, usually $R_1 = 240 \Omega$.
The regulator works by keeping the voltage drop over $R_1$ at a constant $1.25V$
above the adjust input.
[
V_0 = V_{ref} * (1 + \frac{R_2}{R_1}) + I_{adj} * R_2
]
Usually $I_{adj} \approx 50 \mu A$ and is thus usually neglected from most design
calculations. With constant $R_1 = 240\Omega$ one can simply derive:
[
V_{Out} = V_{ref} * (1 + \frac{R_2}{240 \Omega}) + \underbrace{I_{adj} * R_2}_{\approx 0} \\
V_{Out} = V_{ref} * (1 + \frac{R_2}{240 \Omega}) \\
V_{Out} = V_{ref} + V_{ref} * \frac{R_2}{240 \Omega} \\
R_2 = \frac{(V_{Out} - 1.25 V) * 240 \Omega}{1.25 V}
]
Of course it doesnβt get much more complicated in case one does not neglect the $I_{adj}$,
usually itβs just not required
[
R_2 = \frac{V_{out} - V_{ref}}{\frac{V_{ref}}{R_1} + I_{adj}}
]
Resistor calculator
In case JavaScript is enabled in your browser the following calculator is able to
calculate one of the three parameters in the input/output section (just leave one
field empty):
Current limiting
One can also use the LM317 to provide current limiting. This is pretty simply and
also exploits the function that the LM317 just tries to maintain $1.25 V$ voltage
difference between itβs output pin and the adjust input. One can simply use an
sense resistor - in the following schematic this has been the potentiometer $R_{V1}$:

[
1.25 V = R_{V1} * I_{out} \\
R_{V1} = \frac{1.25 V}{I_{out}}
]
The idea is really simple - when there is too much current the regulator outputs
less voltage, when there is not enough current the regulator increases the output
voltage as far as possible. One can use this as current regulator or current limiter.
In case the input power supply cannot increase over a given voltage it just caps
there - providing an effective active current limiter. Note that in worst case
the LM317 has to dump the whole power into thermal energy.
For example to provide a $100 mA$ current limit one would require a $12.5 \Omega$
sense resistor. For a $1 mA$ current limit on the other hand it would be a $1.25 k\Omega$
resistor.
This article is tagged: Tutorial, Basics, DIY, Electronics