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.)
MODIFICATION HISTORY
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:
Serial.begin(9600);
}
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(__DATE__);
Serial.print(" ");
Serial.print(__TIME__);
Serial.print(" sensor = ");
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
}
// wait 2 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(2);
}