I am trying to make an adjustable power supply with an LM317 and a potentiometer. The only problem was that there were some conflicting schematics online about how to connect everything. Can some please verify that it is correct or identify what I need to change?
-
\$\begingroup\$ The answers are all good, but heres a quick hint. Voltage regulators usually provide a constant reference between the out and the "ground pin", meaning they will do whatever is necessary to keep that voltage constant. Right now your ground pin is still referenced to system ground, with the resistor/pot mereley estalbishing a resistive load on the output that will source .5mA to ground. In order to get adjustable voltage, as the answers note, you need to "elevate" the "ground" potential above the system ground. System ground is what Vin is referenced to. \$\endgroup\$– crasicJul 30, 2013 at 22:56
3 Answers
When in doubt, look at the datasheet. Specifically, take a look at the Application Hints
section.
TI provides this general schematic:
note: even though it's labeled as LM117, the LM317A is pin-compatible and functions similarly from an electrical analysis standpoint that we may as well treat the two as equivalent devices. There will be differences when it comes to PCB layout, thermal cooling solutions, and exact loading limits between the two chips, but that's beyond the scope of my answer.
This doesn't quite capture all major considerations, as it leaves out input/output decoupling capacitors. It also forgoes any reverse current protection diodes, which may or may not be important to you. The datasheet recommends protection diodes if you're expecting outputs greater than 25V, or if you're using capacitors larger than 10uF (keep in mind capacitors in parallel add capacitance). Otherwise, you're probably safe to omit D1 and D2.
Following the datasheet's recommendations on decoupling capacitors and protection diodes, here's a basic schematic which would probably work most of the time:
simulate this circuit – Schematic created using CircuitLab
As far as picking the resistor's values go, you can use the following equation for picking resistor values:
\begin{equation} V_{out} = V_{ref} \left ( 1 + \frac{R_2}{R_1} \right ) + I_{ADJ} R_2\\ V_{ref} = 1.25V\\ I_{ADJ} = 100uA \end{equation}
The datasheet recommends picking R1 = 240 ohms
, for good load regulation (loosely speaking). Since you have a potentiometer for R2, picking it's value isn't terribly important, but you'll want to be somewhere in the ballpark of the range you're expecting the output to be so you can use the full turn range of the pot.
For example, say I want 2V < Vout < 12V
, and I chose R1 = 240 ohms
.
The range R2 should be able to cover is then:
\begin{equation} R_2 = \frac{V_{out} - V_{ref}}{\frac{1}{R_1} + I_{ADJ}} = \frac{V_{out} - V_{ref}}{1 + R_1 \cdot I_{ADJ}} R_1\\ 175 \Omega < R_2 < 2520 \Omega \end{equation}
The nearest "common" potentiometer values would be 4.7kohms
, or 5kohms
(you might be able to get away with a 2.5kohm
pot, at the expense of guaranteeing you can reach 12V output). Note that a 10kohm
or larger pot will still work, but it will be more fiddly to adjust because a smaller twist on the pot will result in a greater output voltage change.
The last major consideration would probably be minimum load requirements; either guarantee you will satisfy this with your load, or you can add a simple constant current source between the output and ground (constant current sources work better than a simple resistor if the output voltage could cover a wide range, something like an LM334 would work lovely).
-
\$\begingroup\$ CAUTION: LM317 is not a straight-forward "drop-in" replacement for LM117! LM317 is a "commercial" grade device suitable for a limited range of operating temperatures (−40°C ≤ TJ ≤ +125°C). LM117 is an extended range device (comes with a price premium) suitable for a wider range of temperatures (−55°C ≤ TJ ≤ +150°C). \$\endgroup\$ Jul 30, 2013 at 21:09
-
\$\begingroup\$ Thanks, that's good information to know. Thermal cooling solutions, PCB layout, and exact loading limits will change, but I'm not considering these here so for the most part my answer is exactly the same. \$\endgroup\$ Jul 30, 2013 at 21:19
-
\$\begingroup\$ @shimofuri TI uses the same datasheet for the LM117 as they do the LM317. For practical purposes and use, reference designs/layouts are exactly the same. \$\endgroup\$– PasserbyJul 30, 2013 at 22:35
The way you have drawn your schematic will give you a constant output voltage of 1.25 volts. The LM317 pin you have marked "GND" is actually the \$V_{ADJ}\$ pin. You need to connect the 240 ohm resistor between OUT and \$V_{ADJ}\$, then connect the pot between \$V_{ADJ}\$ and ground. Note that with the 240 ohm resistor you get a current of about 5 mA flowing through the pot, so you may want to use a lower resistance range unless you are trying to get 50 volts out of the regulator.
-
\$\begingroup\$ like this?builtbybendotnet.files.wordpress.com/2013/07/… \$\endgroup\$– benJul 30, 2013 at 23:31
-
\$\begingroup\$ Yes, but I still think you should reconsider the value of the potentiometer. You will have about 5mA going through it, so you should pick the smallest resistance value that will give you the desired output voltage. \$\endgroup\$– Joe HassJul 31, 2013 at 0:30
-
\$\begingroup\$ Do you know what would happen if I were to use a 10K pot? \$\endgroup\$– benJul 30, 2013 at 17:52
-
\$\begingroup\$ @ben, it will still work, but the adjustment will be fussier if you are trying to get a precise output value. Depending on your VIN value, there is likely also some part of your adjustment range where the output voltage doesn't change because of the drop-out limit of the 317. \$\endgroup\$ Jul 30, 2013 at 18:06
-
\$\begingroup\$ It'll still work because Iadj is very low. \$\endgroup\$ Jul 30, 2013 at 18:07
-
\$\begingroup\$ @NothinRandom The current through the pot is determined by the 240 ohm resistor and it should be much larger than Iadj for reliable operation. With a 1k pot the maximum output voltage is about 6 volts and you have much better control of the voltage. \$\endgroup\$– Joe HassJul 30, 2013 at 18:12
-
\$\begingroup\$ @Ben using a 10k pot with a 240Ω r1 resistor is too much. That's a ratio of 10000/240 or 41.6:1. With the basic voltage out formula of 1.25 * (1 + R2/R1)), you would have 53 volt output at the top end of the 10k pot. One small turn and you might fry something. You need a larger R1 resistor. 1k or 1.1k would make the top end 12~13 volts, and the low end 1.3~2.3 volts, which is good enough for most hobby uses. \$\endgroup\$– PasserbyJul 30, 2013 at 22:39