I had wanted to build a power supply for so long, and had never really understood the calculations involving the LM317. I had found a kit (pcb+parts) online and it had renewed my interests in using it for a simple power supply that is adjustable: (LM317T) datasheet here:

Schematic the PCB is using here:
Schematic of the regulator

I understand that R2 acts as a voltage divider of sorts, And R1 is to send a specific current to the ADJ pin (1.25V ref / 240 on R1 = 0.0052A)

The issue is that using the stated formula the output is this:

$$ V_{OUT} = 1.25 \cdot \Big(1 + \frac{R2}{R1} \Big) + I_{ADJ} \cdot R2$$ $$ 1.25 \cdot \Big(1 + \frac{1k}{240}\Big) + 0.0052 \cdot 1k = 12V? $$ $$ 1.25 \cdot \Big(1 + \frac{5k}{240}\Big) + 0.0052 \cdot 5k = 55V? $$

Why does the formula fail, just using 1K (near minimum on the voltage adjustment pot) and 5k which is recommended maximum R2 value?

Now assuming I can get 5V in example after adjusting the pot in real use, will the 240 ohm resistor limit the current, or do I have to add something else on top of that afterwards? If it does (I can have var. voltage + current limit) I assume I will need to up the resistor power specifications as the current will flow through them (or my after-regulator limiter)

Specifically, I do not want a constant current source, because testing a home-made solenoid or a random LED I assume the upper current limit I set will let them work and not be destroyed. I want this because I wish to set a limit rather than force 500mA to go through something it does not want to by raising the voltage well above 5V for example.

  • See amended answer - opamp and MOSFET current limit added. – Russell McMahon Mar 3 '12 at 12:08
up vote 5 down vote accepted

The LM317 power supply shown will not provide variable current limiting.
A separate LM317 can be added to provide this feature.

An LM317 current limits at a maximum value which it can survive and if this causes its temperature to rise to a manufacturer set upper limit it will progressively reduce the current to maintain itself at or below the maximum allowed temperature.

A current limiting LM317 can be added between the 28V supply and the voltage regulating LM317. During normal operation the CL LM317 will drop about 3 to 4 volts but otherwise have no effect. When its maximum preset current is reached it will drop whatever voltage is required to maintain current at or below the present limit.

The current limiter shown below is from the bottom of page 17 in the LM317 data sheet that you referenced.
The IC acts to maintain 1.25V across R1.
So Ilimit = V/R = 1.25/R and Resistor = V/I = 1.25/I

eg ir R1 = 5 ohms then Ilimit = 1.25/I = 1.25/5 = 0.25 Amp.
And to set a 500 mA current limit R = V/I = 1.25/0.5 = 2.5 ohm.

Place this circuit between Vsupply (28v) and the input to the voltage regulator. Note that either or both ICs may require heatsinking.

enter image description here The pot drops 1.25V (= Vref) across it in all cases. So Power dissipation in the pot = 1.25 x Ilimit. For say 1A max current dissipation = 1.25 x 1 = 1.25 Watt.
As they note, R1 minimum = 0.8 ohm (based on the assumed maximum current ratin of the LM317 of a nominal 1.5A in some versions). Power then would be about 1.2 Watt. Now assume that the full pot value was 10 times as high allowing a 150 mA minimum current limit. IF the maximum current flowed through the whole pot (which is can'tr in this case) the pot dissipation would be about 12 Watts (10 x the minimum resistance dissipation. So an eg 10 Watt wirewound linear pot would probably do an acceptable job.
If Imax = 1.5A then Rpot at 1.5A = V/I = 1.25/1.5 = 0.83 ohm = sanity checks OK. So full pot value = 8 ohms. Now cheap and put a 0.8 ohm resistor in series with the pot and get a little less dissipation in the pot worst case.

For $US4.37/1 Digikey has this 5 Watt, 10 ohm linear rotary pot - lets see how it works out.
Sadly, the data sheet says little about allowable max currents, overload allowances etc. So ...
10 ohms, 5W. P= I^2R. I5w = sqrt(P/R) = sqrt(5/10) = 0.71 A.
Any section of the resistive element should tolerate 0.7A and you can hope fervently that using only part of the track at max current means that heat dissipation will be better and you can rate it somewhat more highly. It may even work. If we decide to limit Ilim max to 1A say the Rmin = Vref/Ilim = 1.25/1 = 1.25 ohm. Use a fixed series 1.25 ohm resistor of at least 2 W rating and the pot can be set at zero for 1A limiting.


There are other ways.
A FET can be used to replace the resistor in the LM317 circuit and gate voltage varied. This is not hard to do but needs designing.

A binary codes switch can be used to select power resistors in 1:2:4:8 ratio allowing a stepped current selection.

BUT ...

The LM317 circuit was an easy introduction to what can be done. By instead using a series MOSFET and a low value fixed sense resistor in the main circuit and an op amp plus variable resistor that carries minimal current, an infinitely variable current limit can be provided at reasonably modest cost and complexity.

Ugly diagram below by way of example. Main merit is that diagram already existed on net :-). I may draw up a low side more complete version if time allows.

Current is drawn via Rs. Pot Vr1 sets a voltage point below Vin that drop across Vs is intended to match. If Vs drop is not large enough (ie current below limit) then FET is driven hard on and current limiter has no effect apart from drop in Rs.
If current exceeds Ilim then drop across Vs exceeds drop across pot and opamp switches to turn off MOSFET as required.

MOSFET can be either N Channel provided opamp power supply is enough > Vi that MOSFET gate can be driven on. Or MOSFET can be P channel and MOSFET needs only be able to drive to close enough to Vin to turn FET off when required. R2 limits range of Vr1 to a useful range.
Q1 needs to be able to dissipate up to about Ilim x Vin if you want to be able to short circuit system continually with Vout = Vin. Fold back current limiting or thermal shutdown is probably needed for longer term shorting but as is will save equipment.

UGLY!!! example diagram

enter image description here

  • Ignoring the regulator ICs, can I assume that R1 on the CL portion is the only resistor needing higher max power dissipation? Can pots be "that" high power? 28v^2/5 ohms=+150W! May only feed in ~12V to use 0..7 ish in real use, however still a concern. – Hopeful Hobbyist Mar 3 '12 at 8:34
  • When using V^2/R, the relevant voltage is not the supply voltage, but the voltage drop across the resistor/potentiometer itself. I'd use I^2 R instead - for 5 ohms, which gives 0.25 A, the wattage would be 0.25^2 * 5 = 0.3125 W. However, my understanding is that potentiometer wattage ratings are only valid when you use the entire "track", so if you use a 50 ohm 5 W pot, at 5 ohms, it's only rated for (50/5) % of the full power, or 0.5 W. Turn it lower, and more current will flow, AND less of the track will be used. – exscape Mar 3 '12 at 8:44
  • @exscape that makes much more sense. Grr, there aren't really any low value pots out there that have higher power ratings. A power resistor pot @ digikey costs $20+! I see why one of the example apps. used a "selector" to select different resistors for different currents. – Hopeful Hobbyist Mar 3 '12 at 8:53
  • Log pots bad (makes sense, only useful in low powered apps, input and stuff), linears seem to go from 1-8W @ 5-50 ohms for $<5. This answers my question perfectly, thank you Russell. :) – Hopeful Hobbyist Mar 3 '12 at 8:56
  • @TheodoreRenolds Note that you don't want a log pot, as it's much harder to regulate the current with the logarithmic one...Maybe an anti-logaritmic could make sense, if you want fine tuning on smaller currents – clabacchio Mar 3 '12 at 11:08

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.