Today I'm going to explain what a constant
current source is, and show you how to use one to safely power LEDs and laser diodes.
This video builds upon material I covered in my voltage regulator tutorials so make
sure you have watched those first. Most of the time in electronics you will find
yourself working with constant voltage sources Wall warts,
voltage regulators, and other types of power supplies can all have small
variations in voltage, but they are basically constant voltage sources.
So what is a constant current source? Well, as the name implies, it's a circuit that creates
a constant current regardless of what the load is. This is the schematic symbol of a
current source connected to a resistor. If you have an ideal 1 amp constant current source
it doesn't matter if you connect it to a 1 ohm resistor or a 100 ohm resistor, it will
always shove 1 amp through the resistor. Don't want to use a resistor? Put an LED in the
circuit, and regardless of what color the LED is, it will push 1 amp through the LED.
This may or may not be a good thing, depending on how much current your load can handle. Certain devices, like high powered LEDs, are
best used when they are fed a constant current, because they will maintain the same brightness
regardless of how much they heat up. You could also use a constant current source to drive
a string of LEDs in series. Here I have a 12 mA constant current source I built and
it doesn't matter how many LEDs I put on it, they all get 12mA.
So how do we build this? Well, the easiest way to build a constant current source is
using an LM317. I'll put a link in the video description section.
Here's the circuit diagram - it's very simple. You connect your power source to the
input pin, and then you have a resistor between the output and the adjustment pins on the
LM317. A pair of 10uF capacitors will help stabilize the current source during sudden
load changes. The value of the resistor determines what the constant current will be.
In the example I showed you, I used a 100 ohm resistor, which gave me a theoretical
current value of 12.5mA. Now let's see what we are getting in real life!
Here I'm pushing 12.6mA through an LED. If I add another LED, I still get 12.6mA. Let's
add a laser diode to switch things up. It doesn't matter what the load is, the current
stays the same. And the other cool thing is that even if the input voltage increases to
24V, the current stays constant. The input voltage is still important though. If we go
from 12V down to 5V, we no longer have enough voltage to turn on all the LEDs. You need
to make sure that the input voltage is at least 2 volts higher than what the load requires
to overcome the dropout voltage issue. I explained this in more detail in my video about voltage
regulators. Now how does all this magic work? Isn't the
LM317 supposed to be an adjustable voltage regulator? Well, it is! But we are using a
special trick to make it behave like a constant current source.
Inside the LM317 is some special circuitry that creates a feedback loop. This feedback loop is set up to maintain a difference of 1.25 volts between
the adjust pin and the output pin. If the input voltage suddenly changes, it doesn't
matter. The LM317 quickly adjusts the output voltage to maintain a difference of 1.25 volts
between the adjust pin and the output. If the load changes, it doesn't matter, the LM317
reacts and maintains the 1.25 volt difference. You can use this behavior to build an adjustable
voltage source, or you can use it to build an adjustable current
source. This equation is basically ohm's law. Volts
divided by resistance = current, and since you know the LM317 is giving you a 1.25 volt
difference, by changing the resistor value, you can choose the current.
Now there is one more thing you should know about. The LM317 is a linear voltage regulator,
and our current is passing through a relatively large resistance value. In other words, this
design is not very efficient. I wouldn't recommend using it for currents higher than 200mA, otherwise
your components are going to get really hot. If you want more current, search for switch
mode constant current supply designs, or visit Amazon for a premade solution.
Thank you for watching, and check out my other videos if you want to learn more about electronics!