• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Making a display for fan RPM

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.
Played with the Servo and my Arduino a bit. With the internal pullup resistor any fan RPM sensing is a lost cause at high RPM as you can see from my post-of-pics due to the internal cap taking too long to fill.
A 10k resistor works decently with the sketch I'll post later in this post, but there are still occasional glitches to >1m RPM.
A 940ohm resistor and it works perfectly. Add a 0.1uF cap and it's even smoother (and reads 100rpm lower...).
Sketch:
Code:
long ticks;
long rpm;

void setup(){
  pinMode(2,INPUT);
  Serial.begin(57600);
}

void loop(){
  ticks = pulseIn(2,LOW);
  rpm = 15000000 / ticks;
  Serial.println(rpm);
  delay(500);
}
Interupt type sensing is a lost cause in general as far as I can tell, I get results absolutely everywhere. If you want an alarm for zero RPM when the fan stops, this code will work for you:
Code:
long ticks;
long rpm;

void setup(){
  pinMode(2,INPUT);
  Serial.begin(57600);
}

void loop(){
  ticks = pulseIn(2,LOW);
  rpm = 15000000 / ticks;
  if (rpm < 0){
    rpm = 0;
  }
  Serial.println(rpm);
  delay(500);
}
The RPM calculation has the amusing result that if the fan RPM is zero the RPM shows as -1.
Next will be testing the far noisier San Ace fan.
 
Last edited:
The much electrically noisier San Ace fan requires one of two things for a filter. Either setup requires a 1k pullup resistor, or something close to it.

One option is to have a 1k pullup between 5v and the fan TACH pin and then a ~9k resistor between the Arduino pin and the fan TACH line. This works great.

The other option is to have the same ~1k pullup between 5v and the TACH pin (or the Arduino pin), a straight jumper between TACH and Arduino and a 0.1uF cap between the Arduino pin and GND.

If you combine the two you get a wonderful cap charge/discharge waveform, but the RPM reading is off a bit. It is, however, very smooth!

If you want to protect the Arduino a bit, something in the ~2nF range between the Arduino pin and GND, when combined with the first filter option, results in a very a lovely (and safe) scope picture. No negative voltages at all.
That's what I'd recommend if you want to be really snazzy. Here's the serial output (output every 250ms) of me ramping the speed up and down with this setup:

Code:
-1
-1
-1
950
1561
1901
2373
2654
2899
3311
3812
4325
4829
5319
5827
6087
6218
6284
6278
6310
6289
6302
6294
6318
6302
6139
5798
5572
5466
5351
5114
4940
4835
4677
4368
4042
3824
3650
3382
3106
2886
2692
2470
2261
2066
1895
1746
1617
1493
1380
1279
1191
1098
1016
946
870
804
747
685
633
579
523
475
421
377
328
275
229
172
124
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
 
Back