LM317 Current Regulator Circuit | DIY & Theory

This tutorial describes how to easily create an LM317 current regulator circuit or a constant current source. An example circuit is explained on how to drive an LED. An ideal constant current source can power a load with a constant current regardless of the nature of the load. The LM317 is a three-terminal integrated circuit. While commonly used as a fixed or variable voltage regulator, its internal design allows it to be used as a current limit circuit.

Why We Need a Constant Current Source?

Constant current sources are an integral building block of many electronic circuits. Here are some of the common uses of constant current source circuits:

  • Powering LEDs requires LED drivers that are constant current sources.
  • Transistors are biased with constant current sources to improve linearity.
  • Trickel charging of batteries utilizes a constant current source. A small current is supplied under lo-load conditions while trickle charging.
  • In differential amplifiers, adding a constant current source improves linearity and helps in helps in achieving a high Common-Mode Rejection Ratio (CMRR).

LM317 Current Regulator Circuit

The circuit diagram below shows the simplest form of the LM317 precision current regulator consisting of a resistor (R1) between the Adjust and Output pins.

Note that the output current is obtained not from the Output pin but from the Adjust pin. The output current IOUT depends on the value of resistor R1. Mathematically, they are related by the equation:

$$I_{OUT}=\frac{1.25}{R_{1}}$$

The more we increase the value of R1, the less the output current. This circuit can give an output current between 10mA and 1.5 A.

Selecting the Resistor

The resistor R1 must be adequately sized to handle the current flowing through it. The power rating of the resistor must be greater than (1.25 V)2/R1.

For example, if the value of R1 is 1 Ω, then by the formula described above, IOUT is 1.25 Amperes. The power loss (P) across the resistor will be:

$$P=I_{OUT}^{2}\times R_{1}=1.25^{2}\times 1=1.56 \;Watts$$

So for this case, we need at least a 2 Watt rated resistor, or else the resistor might overheat and burn. Here are some examples of resistors with same resistance but different power ratings:

Use a precision resistor with lower tolerance values to get precise current output. Commonly used resistors can have a 5% tolerance or more, while precision resistors can go as low as 0.01%.

Here is a table of different output currents of the LM317 current regulator corresponding to different values of the resistor R1:

Resistance (R1)Output Current
125 Ω10 mA
62.5 Ω20 mA
41.67 Ω30 mA
12.5 Ω100 mA
2.5 Ω500 mA
1.25 Ω1 A
1 Ω1.25 A
Table: Current vs resistance in LM317 current regulator circuit

ⓘ The resistance of a resistor increases with increase in temperature. Hence, a rise in the temperature of the resistor R1 will decrease the current output of the regulator.

Selecting the Power Supply & Voltage Headroom

The power supply must provide sufficient voltage and current to get the desired current at the output of the LM317 current regulator.

According to the datasheet, the input voltage to the LM317 IC should be at least 3 Volts more than the output voltage i.e. VOUT-VIN =3 V.

Consider the example above of a 1 Amp current regulator using LM317. Here a 1.25 Ω resistor is used to get 1 A output current.

Sending 1 A current through a 1 Ω load will develop a voltage of 1 V across the load (by Ohm’s law, V=IR). For 1 V across the output, the the input voltage should be at least 4 V (1 V+3 V headroom) for reliable current regulation.

Therefore, we can know the input voltage required by LM317 by calculating the voltage across the load and adding a headroom of at least 3 V.

LM317 Current Regulator Circuit Demonstration

Below is an image of an LM317 precision current regulator I built with a 10 Ω resistor across the Adjustand Output pins. The actual resistance between the leads of the resistor was measured to be 10.2 Ω. Hence the current output of the circuit is around 0.122 A or 122 mA (1.25 V/10.2 Ω ).

The above circuit is powered by a USB cable connected to a 5V AC to DC power adapter.

Adjustable Current Limit Circuit Using LM317

By replacing the fixed resistor R1 with a potentiometer, we can effectively create a variable and regulated current source using LM317.

Similar to the examples discussed earlier, the power rating of the potentiometer must be adequate to handle the current flowing through it.

Advertisement

How the LM317 Current Regulator Works

For an in-depth understanding of how the LM317 precision current regulator works, we need to peek inside the internal workings of LM317. Below is the internal block diagram of LM317:

Internal Block Diagram of LM317 IC

A breakdown of how the LM317 current limit circuit works:

  • The operational amplifier inside operates in a negative-feedback configuration i.e. the output voltage is fed back to the inverting input of the opamp. In a negative feedback scenario, an opamp tries to keep the voltage at inverting input equal to non-inverting input.
  • A 1.25 V voltage reference (Vref) is present internally between the Adjust pin and the non-inverting input (V+) of the opamp. So, the voltage at V+ stays 1.25 V above the voltage at the Adjust pin (Vadj).
  • Due to its negative feedback configuration, the opamp tries to maintain the voltage at the inverting (V) terminal equal to V+. The inverting terminal is shorted internally with the Output. In other words, the opamp continuously adjusts the output voltage to make it equal to the voltage at the V+ terminal.
  • As V+ stays 1.25 V above Vadj, and the opamp tries to make Vout = V+, the voltage difference between the Output pin and Adjust pin becomes 1.25 V i.e. Vout-Vadj =1.25 V.
  • As the resistor R1 in the LM317 current regulator circuit is connected between the Adjust pin and Output pin, the voltage across it is 1.25 V.
  • Since the voltage across R1 remains 1.25 V, changing R1 gives different currents at the output which can be understood by Ohm’s law.

In a nutshell, the internal opamp in LM317 tries to maintain a null voltage difference between V+ and V inputs. Due to negative feedback and an offset of 1.25 V in the non-inverting output, the opamp tries to make the OUTPUT pin 1.25 V higher than the ADJUST pin and pushes as much current as required through the output to satisfy this condition.

Drive LED Using LM317 Constant Current Source

LEDs or light-emitting diodes are current-driven devices. Different LEDs have different forward voltage (Vf) and current requirements depending on the semiconductor used in manufacturing. Generally, the Vf ranges between 1.2 V and 3.6 V, and the forward current ranges from 10 mA to 30 mA. Exceeding the recommended current can damage an LED.

To drive an LED safely, we should limit the current. A resistor such as 220 Ω or 330 Ω is commonly used to limit the current to an LED. Combined with a voltage source, the resistor functions as a rudimentary current source.

But powering an LED with a resistor has a few drawbacks:

  • The brightness of the LED will vary with varying voltage as the current will change.
  • The resistor cannot protect the LED from wide fluctuations in input voltage.

These issues can be solved by using a constant current source to drive LEDs. Below is the circuit diagram for an LM317 current regulator circuit that can source a current of around 20mA to drive an LED using a 62 Ω resistor.

If 2 or more LEDs are in a series connection, the current required from the current source will stay the same, but the input voltage to the LM317 current limit circuit has to increase proportionally.

For example, a red LED may have a forward voltage (Vf) of around 1.8 V at 20mA. If 3 such red LEDs are in series, the output voltage will be 1.8×3 V = 5.4 V. The input voltage supply should be more than the headroom of 3V for driving 20mA through these LEDs. Also, be mindful not to exceed the maximum input voltage i.e. 40 V for the LM317.

Design Considerations

  • The LM317 datasheet specifies an operating virtual junction temperature of 125°C. Although LM317 features over-current and over-temperature shutdown, care must be taken not to exceed the recommended temperature. Add a suitable heatsink to keep the IC from overheating.
  • Solder the resistor as close to the IC as possible to keep the resistance from the traces at a minimum.
  • Add a 10uF and 0.1uF capacitor to the Input pin if the input voltage source is noise.
  • The output traces must be wide enough to support the output current.

Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *