The LM317 is one of the most versatile and popular linear voltage regulators. Constructing a variable voltage source with it is straightforward.
Here is a comprehensive guide on how to use the LM317 to construct a voltage source circuit, from the basic formula to practical considerations.
The Fundamental Circuit
The most common configuration for a variable voltage source is as follows. You only need two resistors!
Components Required:
-
LM317 IC
-
Two Resistors: One fixed (
R1
), one variable potentiometer (R2
). Typical values are 240Ω for R1 and a 5kΩ pot for R2. -
Input and Output Capacitors:
C_in
andC_out
(typically 0.1µF to 10µF).
The Golden Formula
The output voltage (Vout
) is set by the ratio of the two resistors using this formula:
Vout = 1.25V * (1 + R2 / R1) + Iadj * R2
Since the adjustment pin current (Iadj
) is very small (typically 50µA) and constant, the Iadj * R2
term is often negligible, simplifying the formula to:
Vout ≈ 1.25V * (1 + R2 / R1)
How it works:
The LM317 is designed to maintain a constant 1.25V reference (Vref
) between its Output (Vout
) and Adjustment (ADJ
) pins. This 1.25V is dropped across resistor R1
. The current flowing through R1
also flows through R2
(ignoring the tiny Iadj
). The voltage drop across R2
is therefore 1.25V * (R2 / R1)
. Adding this to the 1.25V reference gives the total output voltage.
Example Calculation:
Let's use R1 = 240Ω
and R2 = 5000Ω
(a 5kΩ pot).
-
Vout ≈ 1.25 * (1 + 5000 / 240)
-
Vout ≈ 1.25 * (1 + 20.83)
-
Vout ≈ 1.25 * 21.83
-
Vout ≈ 27.29V
By adjusting the potentiometer (R2
), you can vary the output voltage from about 1.25V (when R2 = 0Ω) up to the maximum your input voltage allows (minus dropout voltage).
Step-by-Step Construction Guide
-
Identify the Pins:
-
Input (Vin): Connects to the positive supply.
-
Output (Vout): Provides the regulated output voltage.
-
Adjustment (ADJ): Used to set the output voltage.
-
-
Connect the Resistors:
-
Connect
R1
(240Ω) between the Output and Adjustment pins. -
Connect one end of the potentiometer
R2
to the Adjustment pin and the other end to Ground.
-
-
Add Capacitors (Highly Recommended):
-
Place a 0.1µF to 10µF capacitor (
C_in
) between the Input pin and ground. This improves transient response and stability. -
Place a 1µF to 10µF tantalum or 25µF aluminum electrolytic capacitor (
C_out
) between the Output pin and ground. This is crucial for stability and improves ripple rejection. Without it, the circuit may oscillate.
-
-
Provide Input Power:
-
Connect your unregulated DC input voltage (e.g., from a wall adapter or battery) to the Input pin. The ground of the input supply connects to the circuit's common ground.
-
-
Get Your Output:
-
Your regulated DC voltage is available between the Output pin and ground.
-
Important Considerations & Limitations
-
Input Voltage (Vin): Must be at least 2.5V to 3V higher than the desired output voltage. This is called the dropout voltage. For a 12V output, you need at least ~14.5V input.
-
Maximum Voltage:
-
The LM317 can handle a maximum input-to-output differential voltage of 40V.
-
The absolute maximum voltage between any two pins is 40V.
-
-
Maximum Current: The standard LM317 can provide up to 1.5A of continuous output current.
-
Heat and Power Dissipation (CRITICAL!):
-
A linear regulator like the LM317 dissipates excess power as heat.
-
Power Dissipated (Pd) = (Vin - Vout) * Iload
-
Example: If
Vin=12V
,Vout=5V
, andIload=1A
, the power dissipated is(12V - 5V) * 1A = 7W
. -
You MUST use a heatsink for currents above 100mA or large voltage differences. Without a proper heatsink, the IC will overheat and shut down.
-
Practical Circuit with Protection Diodes
For a more robust design, especially when using large output capacitors, add protection diodes.
-
D1 protects the regulator if the input is shorted while the output capacitor (
C_out
) is still charged. -
D2 protects the regulator from a discharged capacitor on the ADJ pin if the output is shorted.
Fixed Output Voltage Circuit
If you need a fixed voltage, you can calculate and use fixed resistors for R1
and R2
.
Formula for Fixed Output:R2 = R1 * ((Vout / 1.25V) - 1)
Example for a 5V Supply:
Using R1 = 240Ω
:
-
R2 = 240 * ((5 / 1.25) - 1)
-
R2 = 240 * (4 - 1)
-
R2 = 240 * 3
-
R2 = 720Ω
(You can use a standard 680Ω and a 39Ω in series, or a 1kΩ trimpot to set it precisely).
Summary
Using an LM317 to build a voltage source is simple and reliable. Remember the key points:
-
Use the formula
Vout ≈ 1.25V * (1 + R2 / R1)
. -
Always use the output capacitor (
C_out
) for stability. -
Calculate power dissipation and use a heatsink when necessary.
-
Ensure your input voltage is high enough (Vout + ~3V).
This circuit is perfect for benchtop power supplies, battery chargers, and providing a stable voltage for various analog and digital circuits.