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: