Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
Resource icon

Fan Control Circuit (LM317) 2013-05-19

This is an illustrated tutorial on building a variable voltage control for fans and other units, based on the LM317 regulator. It efficiently allows voltage adjustment from 1.25V to 11.5V with the turn of a knob.

The LM317T is an extremely common positive voltage regulator - many laboratory supplies and other equipment are based on it. It can produce any amount between 1.25V and up to 35V by adjusting the resistance (opposition to current) between its adjustment pin and ground.

There are two important things to keep in mind when working with an LM317T: First, the internal circuitry of the LM317T can only handle 1.5 A of current as an absolute maximum. More on this below. Secondly, and this is IMPORTANT, the LM317T is a linear regulator. This means that it dissipates the excess voltage as heat, with more heat produced as the voltage is set lower and lower. You MUST have a heatsink mounted on the regulator that is capable of dissipating the heat produced.

Most fans give their total output in watts - if they give it in amps, multiply that by 12. Your heatsink MUST be capable of dissipating the total wattage of all fans on the regulator safely. Heatsinks can get BIG at the upper wattages. (Be careful with published heatsink ratings; most sinks will say they dissipate 5W, but will heat up to 20 or 30 degrees above ambient at that wattage.)

Here's one last thing to keep in mind; fans pull more amperage when they're run at a lower voltage, on account of having less torque. For example, a Panaflo 120mm H1A pulls 0.6 A at full 12V. However, at 6V, it pulls closer to 0.85 A. You need to account for the highest possible current draw (usually occurs at 6V) from each fan connected to the regulator, and make sure you keep under the 1.5A limit.

If you need more than 1.5A of current, and have a heatsink large enough to handle the wattage (old stereos and amplifiers are great for finding massive heatsinks, btw), you can use an LM350, which is rated up to 3 A and is identical to the LM317 in all other respects. The LM338 is also compatible, and is rated up to 5 A.

View attachment 80755
Once you've decided how many fans you're going to run on the regulator, and how big a heatsink you need, you can start gathering parts:

  • The heatsink (I'm using a small 3W sink here, since this one is driving the tiny 60mm Panaflo on my CPU heatsink.)
  • The regulator itself. LM317/350/338s come in a variety of packaging; I suggest using the TO-220 package, it's the most common. (You may also find the TO-3 can package, which is much larger and heavier and has a different pinout, but dissipates heat better).
  • A 1KΩ (kiloohm) resistor. This will never have more than 100 microamps going through it, as such you can safely get this as small as 1/8 watt. However, I suggest 1/4 watt.
  • A 0.1 μF (microfarad, sometimes also called MFD) ceramic capacitor. This will go across the incoming power leads and smooth out any ripples before it enters the regulator. You can also use mica, monolithic, or any other kind of unpolarized capacitor.
  • A 1 μF polarized aluminum or tantalum capacitor. This will go across the output leads, and give you a smooth buffer effect when you adjust the output. You can use larger capacitors if you want a larger buffer, although anything over 10 uF is probably overkill.
  • Heatsink paste/compound - this is a REQUIREMENT, just like a CPU. I'm using cheap zinc silicone stuff here, but if you have leftover Arctic Silver from your CPU or other paste, that's fine.
  • A 10KΩ potentiometer or rheostat - this will be the knob for adjusting the output voltage. Again, you can safely go down to 1/8 watt here, but I suggest 1/4 watt.
  • Finally, a board to assemble it on.

Once assembled, the output voltage of the LM317 is equal to 1.25V x (1 + R2/R1). Since we're feeding it 12V, a R2 (potentiometer) of 10K and an R1 (resistor) of 1K will give us the full possible range of the LM317 (minimum of 1.25V, maximum of 11.5V).


First off, grease up the back of the regulator. It's pretty similar to greasing a CPU - put on enough to fill up cracks between the heatsink and regulator, a tiny tiny bit of squeeze-out is fine, but don't go overkill.

Then, screw on or clip on the heatsink, and solder it to the board. If your heatsink has pins to solder to the PCB, make sure you use those; you should somehow try to make sure the heatsink is properly supported and doesn't bend or rip out the regulator.

Caveat: The tab is connected to the output voltage pin. DON'T ground the heatsink, unless you enjoy watching a PSU emit blue smoke and/or a regulator crack in half/explode/catch on fire.


Next, bend one of the leads of the resistor over, and back, so it fits in two slots.

Mount it directly in front of the regulator. It needs to connect across the voltage out and adjustment pins - these are pins 1 and 2. (If you hold the regulator by the pins with the metal on bottom facing away, the pins from left to right are adjustment, voltage out, and voltage in.)

Draw solder blobs between the regulator pins and resistor pins (along the green lines drawn on the picture above).


Next, attach two wires, which will attach to the potentiometer/rheostat.

One wire will go to ground, which we attach later. The other wire needs to connect to the adjustment pin, along with the resistor. My suggestion is to put one wire right below the resistor, and put the other wire two holes below.

Extend the solder blob between the adjustment pins and resistor pin to include the potentiometer wire. (See annotated picture above.)

If the potentiometer/rheostat has two leads, use those; most, however, will have three. In this case, use the middle lead and either of the outer ones. (Don't ground or otherwise the leftover connection; I suggest cutting it off and/or taping it over.)


Next, attach the output capacitor. This needs to connect from the output voltage pin to ground.

This capacitor is polarized - it has to be oriented correctly. (If inserted the wrong way, it'll not work in best case, and overheat/explode in worst case.) Most polarized capacitors have the negative lead marked on their package/case; that lead should go to ground.

I suggest sticking it right in front, in the middle of the regulator, so that the leads sit exactly parallel with the potentiometer wires.

Draw solder blobs between output voltage pin and capacitor, and connect the ground pin of the capacitor to the potentiometer ground wire. (See annotated picture above.)


Finally, attach the input capacitor. This needs to connect from the input voltage pin to ground.

This capacitor is not polarized - it will work no matter which way it's plugged in.

I suggest sticking it on the other side and parallel to the output capacitor, in line with the pin on the regulator.

Draw solder blobs between input voltage pin and capacitor, and extend the ground line to the capacitor. (See annotated picture above.)


The last part of construction is to attach molex plugs to the bottom side of the board for the fan and power supply to plug into. The power supply 12V line (usually yellow or blue, NEVER red) should plug into the input pin of the regulator, near the ceramic cap; the fan output should plug into the output pin in the middle. Both ground leads (take the middle black wire nearest the 12V wire) should plug into the ground line at bottom.

Finally, trim down the board to an acceptable size, and you're done!
  • schematic.png
    9.5 KB · Views: 18,657
  • parts.jpg
    25.7 KB · Views: 12,074
  • parts2.jpg
    27.1 KB · Views: 10,386
  • assembly-grease.jpg
    14.6 KB · Views: 10,168
  • assembly-heatsink.jpg
    10 KB · Views: 10,085
  • assembly-vreg.jpg
    14.9 KB · Views: 10,164
  • assembly-resistor-top.jpg
    13.4 KB · Views: 9,995
  • assembly-resistor-bottom.jpg
    14.2 KB · Views: 9,973
  • assembly-potwires-top.jpg
    19.4 KB · Views: 9,972
  • assembly-potwires-bottom.jpg
    25 KB · Views: 9,823
  • assembly-pot.jpg
    15.6 KB · Views: 10,440
  • assembly-polarcap-top.jpg
    16.1 KB · Views: 9,982
  • assembly-polarcap-bottom.jpg
    22.2 KB · Views: 9,871
  • assembly-npcap-top.jpg
    12.7 KB · Views: 9,960
  • assembly-npcap-bottom.jpg
    29.6 KB · Views: 9,957
  • assembly-molex.jpg
    30.2 KB · Views: 10,174
  • finished.jpg
    18.4 KB · Views: 11,032
  • Like
Reactions: Phyo Mg Mg Latt
First release
Last update
5.00 star(s) 1 ratings

More resources from ElectroMaster

Latest threads