LM317 constant-current power supply

LM317 constant-current power supply.
LM317 constant-current power supply.

The LM317 adjustable voltage regulator can be used to make a simple constant-current power supply. The device is over forty years old but is still very popular with beginners due to it’s low cost, availability and thousands of practical applications. LM317 datasheet.

Constant current

The LM317 regulates by adjusting it’s output until it is 1.25 V higher than the voltage on the adjust pin. For a constant current supply we just need to add in a series resistor to drop 1.25 V at the required current.

The LM317 can handle currents up to 1.5 A but be careful to so some power dissipation calculations and heatsink adequately if the power goes over a watt or two. (See ‘Temperature rise’ below.)

Voltage drop and headroom

For the LM317 to regulate properly it must have adequate supply voltage to allow for the sum of the voltage drops in the circuit. These are:

  • The minimum voltage drop across the regulator itself. This is quoted in the datasheet as the difference between input and output voltage, \( V_I – V_O \) = 3 V.
  • The voltage drop across R1. This is always 1.25 V.
  • The voltage drop across the load. For LEDs it will be \( V_f \times n \) where  \( V_f  \)  is the forward voltage drop of each LED and  \( n \) is the number of series LEDs.

Explaining the ‘headroom’ voltage

LM317 functional block diagram.
LM317 functional block diagram.
  1. The \( I_{adj} \) reference current generator feeds 50 to 100 µA through the 1.25 V voltage reference.
  2. The built-in Zener means that the op-amp inputs won’t equalise until the voltage on the output is 1.25 V above the adjust pin.
  3. If the output voltage is low then the op-amp inverting input voltage will fall below that of the non-inverting input and the op-amp output will rise.
  4. As (3) rises the Darlington transistor will turn on …
  5. … turning on the second transistor. The Darlington arrangement will cause about 2 × 0.7 = 1.4 V of the voltage drop between the input and output due to the forward voltage of the two base-emitter junctions.
  6. Finally the internal current sense resistor will account for most of the remainder of the voltage drop. (The op-amp may require a little more than 4, 5 and 6.)

Calculation example

Calculate the value of R1 to supply 100 mA to 5 series-connected blue LEDs with \( V_f  \) = 3.1 V. The circuit will be powered from a 24 V supply.

First the resistor: \(R = \frac {V_{REF}}{I} = \frac {1.25}{0.1} = 12.5 \ \Omega \).

Now check the required input voltage:

\( V_{IN\ min} = 3 + 1.25 +  3.1 \times 5 = 19.75 \ \mathrm V \) minimum. Our 24 V supply is above this so it is fine.

We need to do one more thing: calculate the power dissipated in the LM317. This will be the voltage across the LM317 times the current:

\( P = ( V_{IN} – V_{OUT}) I = (24 – 19.75) \times 0.1 = 4.25 \times 0.1 = 0.425 \ \mathrm{W} \)

Temperature rise

LM317 thermal information.
LM317 thermal information.

 

We’ll take a simple approach and use the LM317’s \( R_{\theta (JA)} \), the Junction to Ambient thermal resistance parameter (and abuse it as complained about in TI’s Application Report SPRA953C). Frot the KCT TO-220 package this is 37.9°C/W. This results in a temperature rise of \(\) 37.9 \times 0.425 = 16.1°C. Even with reasonably high ambient surroundings the junction temperature will come nowhere near its 125°C maximum.

Power supplies

LEDs require careful consideration of power supplies. This is mainly due to their non-linear relationship between applied voltage and current. As a result of this LEDs are usually driven with a current limited or constant-current supply.

Simple constant current driver.

Simple constant-current driver

How it works On power-up Q1 and Q2 are off. There is no collector current so L1 is off. If the digital control input on the left is brought high (5 V) Q1 will turn on. Current will flow through L1, Q1 and R2. As the voltage drop across R2 increases to about 0.6 V Q2 … Continue reading "Simple constant-current driver"
LM317 constant-current power supply.

LM317 constant-current power supply

The LM317 adjustable voltage regulator can be used to make a simple constant-current power supply. The device is over forty years old but is still very popular with beginners due to it’s low cost, availability and thousands of practical applications. LM317 datasheet. Constant current The LM317 regulates by adjusting it’s output until it is 1.25 V … Continue reading "LM317 constant-current power supply"
GPIO voltage booster with enable.

GPIO voltage booster

In certain circumstances the supply voltage is not high enough to light the LED – particularly with blue or white types which have a higher forward voltage. For example, a 3.3 V micro-controller will not light an LED that has a forward voltage of 3.6 V at 20 mA. We can get around this by using a voltage … Continue reading "GPIO voltage booster"
Mean Well HLG-80H-15A dimmable PSU.

Dimmable mains PSU control

Many of the LED power supplies such as those by Mean Well, etc., offer three modes of control: output constant current level can be adjusted through the control input by connecting a variable or fixed resistance to the control terminals, using a 0 ~ 10 V DC control signal, using a 10 V PWM signal … Continue reading "Dimmable mains PSU control"

AL5809 constant current driver

The AL5809 series of devices are a very convenient two-terminal constant current driver and ideal for many LED applications. The AL5809 turns on when the voltage between IN and OUT swings from 2.5V up to 60V enabling it drive long LED chains. The floating ground, 60V Voltage rating between Input and Output pins designed to withstand the high … Continue reading "AL5809 constant current driver"

Simple constant-current driver

Simple constant current driver.
This switched constant-current driver provides a constant-current to the LED over a range of supply voltages and independent of the LED’s forward voltage.

How it works

  1. On power-up Q1 and Q2 are off. There is no collector current so L1 is off.
  2. If the digital control input on the left is brought high (5 V) Q1 will turn on. Current will flow through L1, Q1 and R2.
  3. As the voltage drop across R2 increases to about 0.6 V Q2 will start to turn on and shunt some of the base current away from Q1.
  4. The result is that the circuit will settle at whatever Q1 emitter current will drop 0.6 V across R2.
  5. When the input signal drops to zero Q1 and L1 turn off.
  6. If an unswitched version is required then just connect R1 to Vbb.

Note that the usual series resistor is not present with the LED. Q1 acts as a variable resistor in this case adjusting to maintain the required current.

Example

Calculate R2 value to set L1 current at 30 mA.

\( R = \frac [V][I] = \frac [600m][30m] = 20\ \Omega\).

(We’re using ‘m’ as shorthand for ‘milli’.)