Current source with LM317
Current source
A current source is an electrical or electronic device that delivers or absorbs
electric current. A current source is the dual of a voltage source. Current sources can be theoretical or pratical. I will handle only the practical
with the use of a LM317.
Why using a current source instead of just a simple cheap resistor?
In many situations a resistor will be enough but also some devices need a constant current irrespective
of the voltage: ex. a 20mA current loop transmitter.
Also LEDs are currentdriven devices that require current limiting when driven from a voltage source.
In most applications, it is desirable to drive leds with a constant current source. The current source is used to regulate the current through the led regardless
of powersupply voltage variations or changes in forward voltage drops(Vf) between LEDs.
LM317
The LM317 is a monolitic integrated circuit.
It's a 3 terminal positive voltage regulator designed to supply more than 1.5A of load current with an output voltage adjustable over a 1.2 to 37V.
It employs internal current liniting, thermal shutdown and safe area compensation.
The LM317 is cheap, thermal protected, up to 1.5A and easy available.


The schematic
Power dissipation
Because the LM317 is a linear regulator and needs a voltage drop of about 3V, the dissipated power will be
the voltage drop over the LM317 multiplied by the current of the circuit.
 P=power loss
 U=supply voltage
 Uf=voltage drop device
 I=current
P = ( U  Uf ) * I
Tip: When you have a device with a specific voltage drop and a relative high current(ex. a white lumiled: 3.2V, 0,35A 1W) keep the input voltage
as low as possible, but keep in mindthat the LM317 needs a voltage drop of 3V.
Example with a white lumiled: The led needs a forward voltage of 3.2V.
To minimize the power losses we will connect the led to a voltage of +7V (Voltage drop LM317+forward voltage led+1V reserve)
A bad example with a white lumiled: What is the power loss when we connect the led to 11.7V: Well when the the forward voltage of the led is 3,2V and the current is 350mA by a power voltage of 11,7V then with the law of ohm we can find a power loss of +3W: 3 times the led power (certainly not economical).
I'm sure the LM317 will become very hot. The LM317 devices have internal shutdown to protect from overheating but in all working conditions the junction temperature must be within the range of 0 to 125 deg celcius. So a heatsink maybe required at maximum power loads and
maximum ambient temperature.
P = ( U  Uf ) * I
P = ( 12V  3.2V ) * 0.35A
P = 3W
When it's impossible to lower the voltage of the powersupply and the current is high maybe a switched current source will be better.<>
I will explain this in the future.
Current adjustment:
Now we know the needed input voltages but still don't have a constant output current. For this we gone abuse the voltage regulator.
We place a resistor in series with the LM317 and the output device (ex. a led) and connect the adj pin over the resistor. Because the LM317 will regulate the voltage on the adj input allways
to 1.25V, we become a constant current through the resistor and connected device
How it works: Over the resistor there is always a voltage present of 1.25V
This means when the current decrease, normaly the voltage over the resistor will be lower also but what happens now: the regulator lets increase his output voltage to adjust a constant voltage
over the resistor of 1.2V
So we can calculate with ohms law what resistor is needed to get a specific current.
R = U / I
R = 1.25V / I
Example:
We will supply 3 lumileds 1W power rated in serie with a 12V battery. The nominal current for the leds is 0,35A
We can find the proper resistor value with the formula above:
R = 1.25V / I
R = 1.25V /0,35A = 3.57 ohm
Thus we need a resistor of 3.57 ohm but will not find one with this value. To solve this problem take a value that's higher.
Here in the example we will take one of 3,9 ohm.
The real current will be then I = U / R = 1,25V / 3.9ohm = 0,32A what not will be a problem (it extends the lifetime of the leds)
Power rating of the resistor:
It's easy because:
P = U * I
P = 1,25 * 0.32A = 0.4W
In real we take a resistor with a 10% higher power rating: here we find 1/2 Watt.
Going further:
Back to homepage