In a previous video I talked about fixed voltage regulators that take an unregulated voltage
on the input and supply a tightly regulated voltage on the output.
For example the popular 7805 is used to create a constant five volt supply.
In this video I'm going to show you how to use the LM317 adjustable voltage regulator
to create any regulated voltage voltage you want
all the way up to thirty seven volts.
You can use it as a power supply for a lot of projects such as a fan speed controller.
You can get an LM317 from anywhere that sells electronics.
Sometimes they are called LM317T or LM317AT.
Once you've got it put a heatsink on it so it does not melt your breadboard.
The next thing to do is put a couple of capacitors on the input and output pins.
Put a 0.1 microfarad ceramic capacitor on the input and a one microfarad electrolytic
capacitor on the output.
Remember to use capacitors rated higher than the voltages that you are working with.
If you want to use more capacitance that is fine too. These capacitors are not always necessary
but putting them in there guarantees that the output voltage will be stable
in almost any situation.
Next we set the output voltage using two resistors labeled R1 and R2.
You can use this equation to figure out the output voltage.
But to start out with I'll show you the quick and easy way to use an LM317.
Let's make R1 510 ohms and let's use
a 10 kilohm variable resistor for R2.
Doing this gives us a constant voltage supply that we can adjust from 1.25 volts
to 25 volts.
But remember, your input voltage needs to be at least two or three volts higher than the
output voltage. Otherwise the output voltage is limited.
For example here I have a twelve volt lead acid battery and it is
charged up to 13.5 volts.
When I use it to power my adjustable regulator I can get an output range from 1.25 volts
to 12.5 volts when it is under a small load.
The headroom I need is called the "dropout voltage" and it will always be given the datasheet.
So anyway this is a very common way to make an adjustable fan speed controller, or test
circuits at different operating voltages. Or see how
many volts it takes to blow something up.
Alright now let's say you don't want to use a potentiometer, you just want a fixed voltage
using two resistors.
Here's the formula I showed you earlier.
If you are curious about how the equation is derived, read the LM317 datasheets
from National Semiconductor and Texas Instruments.
In order to simplify the equation let's pick a value for R2.
Let's make it 4.7 kilohms and now the equation becomes much easier.
Next you can rearrange the equation like this.
Now you can find out the value of R1 based on the output voltage that you want.
For example let's say you wanted a nine volt output.
Inserting that into the equation gives you R1 = 782 ohms and
R2 is still the 4.7 kilohms we chose.
So I put a 680 ohm resistor in series with a 100 ohm resistor
which gave me 780 ohms
and that was close enough to give me nine volts.
Finally let's talk about wasted heat.
The LM317 is a linear voltage regulator and the efficiency equations are
exactly the same as the 7805's equations.
The bigger the difference between the input voltage in the output voltage
the more heat gets produced.
Let's say you have your output set to 6 volts so you can get more
speed and torque out of a servo.
And lets power it from a nickel metal hydride battery charged to 8.4 volts.
And let's say the servo draws one ampere.
The heat generated in the LM317 would be 2.4 watts.
Now if you powered the LM317 from a higher voltage source
like a lead acid battery charged to 13.8 volts
all of a sudden things get a lot hotter.
7.8 watts is a lot of heat that you'll have to dissipate.
So you should try to keep your input and output voltages fairly close to each other if you
expect to be drawing a significant amount of current.
And that's it!
Check out my other videos to learn more about other electronic components.