How to go about controlling and powering 4 x 120mm PWM Fans

Hey guys,

First I want to apologize for my lack of knowledge. I haven't ever looked into building a system with Arduino or anything similar like Raspberry PI. I am working on a carpentry project which is a server isolation cabinet. This cabinet needs intake and exhaust so the thought was to use 4 x 120mm fans.

The problem I am running into: How to power 4 fans without a computer? So I am trying to explore this an option instead of trying to rig something up with another larger computer.

Before I posted I have done quite a bit of reading but I think my ignorance might have me looking in areas I either don't understand or software steps vs. the actual hardware config.

So my question: Can anyone point to tutorials for simple minded folks like myself :D. Or provide any basic information. Maybe even a guesstimate on how long a project like this would take and if there are any alternative options that come to mind.

Thank you,

Edit: I stumbled upon this tutorial Tutorial 02 for Arduino: Buttons, PWM, and Functions - YouTube which seems to explain the software aspect and parts of the hardware. I can understand how I could cut off the 4 pin fan connector and wire it like he is doing in the tutorial but is there a way to do this with using the connectors? How should I assemble the final build so it's not just on a test bench?

I am going to continue looking at the basic tutorials. Looks like I jumped the gun and should have started with these verses looking specifically for fan related information.

Any resources would be appreciated.


PWM computer fans are great with the Arduino. Except for one thing: they never turn completely off when the PWM goes to zero. The standard specifies that the minimum rotational speed should be 30% of max when the PWM is zero. This may or may not be a problem for you.

If you need the Arduino to turn the fan off completely then you need another chip, relay or transistor. I'm guessing for a server cabinet that this won't be necessary.

The connector is a slightly-unusual 4-pin "polarized header" type connector. It's unusual because it also must fit 3-pin plugs on the same connector. This connector at Sparkfun is possibly close enough. Or grab one of this 4-way splitter and cut off the 'head' end.

I've just recently built a custom PCB to do this with a Teensy board. If you like I can even share the PCB design and tell you where to get it made. This is for air circulation in an aircraft cabin but it will work on server cabinets too.

  Analog input, analog output, serial output

 Reads an analog input pin, maps the result to a range from 0 to 255
 and uses the result to set the pulsewidth modulation (PWM) of an output pin.
 Also prints the results to the serial monitor.

 The circuit:
 * potentiometer connected to analog pin 0.
   Center pin of the potentiometer goes to the analog pin.
   side pins of the potentiometer go to 3.3V and Gnd
 * PWM output on pin 10 and built-in LED
   (on Nano, builtin LED has PWM, on Uno and Teensy it doesn't.)

  Aug 2 2016 V2.0 M Sandercock
    Changed to Teensy, on "Dehumidifier Control V1.0" PCB (modified to connect pin 10 to the output)


// These constants won't change.  They're used to give names
// to the pins used:
const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int LEDPin = 13;
const int PWMPin = 10;      //Fan control wire is attached to this pin

int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)

void setup() {
  // initialize serial communications at 9600 bps:

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 1, 1023, 255, 0);
  // change the analog out value:
  analogWrite(LEDPin, outputValue);
  analogWrite(PWMPin, outputValue);

  // print the results to the serial monitor:
  if(Serial) {
    Serial.print("V2.0 (hardware 1.0, with pin 10 modification)");
    Serial.print(" Compiled ");
    Serial.print(" ");
    Serial.print("  sensor = ");
    Serial.print("\t output = ");
  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:

Hello, as already pointed out, you can't power the fans directly from the Arduino. The Pins only provide a Maximum of 40mA and are intended as signals, not power supplies. You have to connect that Signal to a Transistor or MOSFET which acts as a Switch and turns the fan on/off depending on the Signal from the Arduino.

For a beginner, perfboard is sometimes an Option for Assembling the final Project. Check that out. 99% of all Arduino Projects you see on the Internet are done on boards like in that Video and just never looked finished. Once one Begins to get serious about Projects such as These, there is no better alternative than learning how to make your own PCB (printed circuit boards such as they exist in all electronics). It Looks intimidating but can actually be done fairly easily using almost no Special Equipment other than a very fine drill bit and some supplies (like raw boards and some chemicals) which are readily available online (even from Amazon).

Thank you guys for your replies!

I am definitely feeling more confident about this project after last night watching random arduino youtube videos and reading these posts this morning.

I also stumbled upon some schematics for a PWM fan controller for Raspberry PI. I still would like to use Arduino as it seems to be more affordable. Also I assume the physical hardware used could be the same the only difference would be the programming?

Here is what I found:

I am at a point where I am trying to figure out exactly what parts I need and where I should get them from. I have seen the starter kits. Is that the best direction to go or will I ultimately have a lot of parts I need to buy anyways?

Based on the above diagram and my limited knowledge I have put the following list together:
1 x Dallas 18B20
1 x 4.7k Ohm resistor
1 x 1k resistor
4 x 4 pin fan connectors
1 x Arduino Uno
1 x Perf Board

Based on what you are saying I know I need 4 x transistors but not sure what kind/type is recommended.

Other than that what am I missing?


The transistor is not necessary. The Uno can drive the PWM pin directly.

For an initial prototype, a breadboard is the best way to put it together. Buy one of these at Sparkfun[/] along with the matching breadboard and some wires and start playing. All of these are included in most starter kits.

For permanent use, transfer your design onto a proto shield instead of bare perf board.

Thanks again for the reply,

This is what I have added currently:

Anything missing? Or everything I need to get started? Is there a starter kit that would be a better deal?

Thanks again,

What's powering whatever's going into the cabinet?

Identical fans for intake and exhaust is not a good design. Use all 4 as one or the other. Depends on how the layout affects airflow. I usually like exhaust fans up top, but if you know it's going in a dusty environment, intake fans you can put filters on are better and a 'leaky' box isn't going to take in dust from its crevices because there will be pressure working from inside.

What's powering whatever's going into the cabinet?

Identical fans for intake and exhaust is not a good design. Use all 4 as one or the other. Depends on how the layout affects airflow. I usually like exhaust fans up top, but if you know it's going in a dusty environment, intake fans you can put filters on are better and a 'leaky' box isn't going to take in dust from its crevices because there will be pressure working from inside.

Thanks for the reply,

Inside the cabinet will be a couple 1u servers and a tower PC. So they are powered by different PSUs.

Here's the layout for the case so far:

Intake on the bottom left going thru a air duct to kill any sound then being pulled into the case with a second fan.
Out take doing the same thing but pushing air the opposite direction and pushing out in the top right.

The box will be air tight sealed with green glue and silicone so dust shouldn't be an issue unless I put dirty units in there.


The problem I am running into: How to power 4 fans without a computer?

Inside the cabinet will be a couple 1u servers and a tower PC. So they are powered by different PSUs.

Pardon me if I'm missing something here, but what's stopping you from using the PSU of the tower PC to power your fans?

Also, 120mm fans are pretty darn quiet, I think you're wasting space and costing airflow with all of those baffles.

And your baffles do absolutely zilch if you're putting fans on the outside of the case.... It's like taping earplugs to the backside of a computer speaker. Ditch the outer fans if you want to keep your silly baffles.

I'm getting the impression that you're just throwing random designs you've seen from actually engineered designs together.

I’m by no means an acoustical engineer. Just a carpenter and music producer. So basically yes they are different aspects of designs I’ve seen and been trying to go back and forth on some of the other forums on how to put together the venting.

I do realize those vents are a bit elaborate. I actually changed the design to only incorporate a single baffle. Just didn’t have the screenshot handy on mobile.

You aren’t wrong about using one of the PSUs to power the fans. I’m kind of weighing my options at this point. They actually make a molex to 12v power adapter so I could even just go straight into the wall. It wouldn’t have PWM but I’m not sure I really need it.

As far as the baffles the reasoning for them at all was that if air can get in so can sound. So I’ve been told. So wouldn’t I want to diffuse any sound waves before they entered or exited the case? I’ve been looking for some guidance on the vent system in general honestly just haven’t found someone to bounce ideas off yet :-).

This project. Is all in the planning stages no materials have been purchased yet and still in the research stage but hoping to get build by September.


Thanks for being honest with your feeling around in the dark approach and lack of intentionality in the design choices. It establishes that the design is flexible to optimization and that you are a pleasantly unstubborn individual :slight_smile:

Simple, effective approach to the fans- you are on the right track that you want to control them. Having them on all the time is a waste of power. However, what's the point of PWM/ controlling how fast it is they run?
If you treated them as simple on/off to cycle, and they were wired to a simple temperature probe (which is what you should be doing, as the purpose of the fans is to maintain temperature), they would turn on past a certain defined temperature, and turn off at a certain predefined temperature. That's the best approach, imo.

PWM/speed control leads me to believe the goal is "well, we don't need THAT much cooling just before our target temperature, so we'll run the fans just a bit". Sounds like a situation of equilibrium will be reached, perhaps the fan has to run at half speed 24/7 to maintain temperature. Wasteful.

From the noise isolation angle (which I think is completely unnecessary with these fans), treating the fans as full on/off, you can actually design your baffle and tune to the sound the fan makes at full speed. There's inherent compromises when you try to design a baffle that will work with every speed possible, because it will literally make infinitely varying frequencies of sound based on speeds. You can even assume that the designers of the fan have angled the blades in such a way that the optimal airflow to power drawn is at full speed.

Music production? Then you definitely do want super-extra-quiet.

The primary way to reduce noise is to move the air slowly. One large outlet with 4x120mm fans turning slowly will work well. Pushing the same flow rate through the area of one fan will need higher airspeed and more noise. The inlet should be about the same area as the outlet. Then maybe one baffle over the fans so that you can't see them from the outside = no straight lines for noise to escape. But be careful not to reduce the area available for airflow.

If there's just servers in this box and no other heat-producing devices, then I would plug the fans into the servers so that their motherboards can control the fan speeds. This is a problem that's already been solved for regular computer cases.

Thank you both for your replies,

Both are encouraging :D. I like to think I'm not stubborn and really am ultimately just looking for the best way to do this project. I don't pretend to know all the answers :D. But if you ever need tips on building a box I'm your man! LOL

As far as the position of the fan and the baffles this is the design that I had begun to switch to. (just didn't finish the model)
[Dropbox - SketchUp_2016-08-24_14-36-01.png - Simplify your life

So a single baffle with that box roughly 6" square (still need to work that exact measurement).

I agree that these fans would function fine and serve the purpose with just a simple on/off and temperature monitor. Which is really all I am after. @INTP Are you suggesting to get away from the Arduino idea or just saying that I could build a very simple Arduino that would display the temp on and LCD and power the fans?

@MorganS I completely understand where you are going with the idea of just using the server to power and cool the cabinet. I haven't ruled this thought out but I do also like the idea of just having a separate unit for the fans as well.
It is definitely a waste to run these fans 24/7. The plan would be just about 8 hours a day. Basically when I am working.

Hopefully this gets us somewhere :D. But yes you both are on point! And I would love to hear more input so I can move this out to the wood shop!


Yes, this project does not call for an Arduino.
You've got a tower PC for all processing needs. Your biggest noise concern, if this project is related to your music producing, will probably be the PC PSU fan if it has one. Also CPU fan unless it's passively cooled, which I can't imagine being good enough for extensive audio processing.

Yeah the heatsink fans in the servers are super loud. Honestly the reason for the cabinet. My tower is a self built silent machine. Unfortunately because of space issues in the other room the servers need to come into the live room.

I had thought about connecting something like this to the tower in the past.

I will look into this route instead. Thank you guys for the help. Maybe tomorrow I'll go pick up some lumber :-).