Reading PWN Fan Speed

I'm trying to read the rotation speed of a 12V PC fan (Brushless) using this example:

http://playground.arduino.cc/Main/ReadingRPM:

 volatile byte half_revolutions;
 unsigned int rpm;
 unsigned long timeold;
 void setup()
 {
   Serial.begin(9600);
   digitalWrite(2, HIGH);
   attachInterrupt(0, rpm_fun, RISING);
   half_revolutions = 0;
   rpm = 0;
   timeold = 0;
 }
 void loop()
 {
   if (half_revolutions >= 20) { 
     //Update RPM every 20 counts, increase this for better RPM resolution,
     //decrease for faster update
     rpm = 30*1000/(millis() - timeold)*half_revolutions;
     timeold = millis();
     half_revolutions = 0;
     Serial.println(rpm,DEC);
   }
 }
 void rpm_fun()
 {
   half_revolutions++;
   //Each rotation, this interrupt function is run twice
 }

However the reading is always the same value (720 - 860) regardless of fan speed (3.3v - 12v).

I've opened up one of the fans and found a single AH211 hall effect sensor (https://www.diodes.com/assets/Datasheets/AH211.pdf).

Am I missing something obvious? This looks like a standard unipole hall effect sensor.

Thanks
Alan

Did you install the pull-up resistor? Post a wiring diagram of your setup!

However the reading is always the same value (720 - 860)

I don't know your definition of "same value" but in my opinion this quite a wide range. Did the value inside the range at least correspond somehow to the expected fan speed?

Thanks for your prompt reply Pylon.

I (was) using the internal pull up, with the signal line direct to pin 2 from the fan. I've just changed to an external resistor and it appears to be working ok now - defective pull up (a very old and abused Arduino Mega)?

pylon:
Did you install the pull-up resistor? Post a wiring diagram of your setup!

I don't know your definition of "same value" but in my opinion this quite a wide range. Did the value inside the range at least correspond somehow to the expected fan speed?

I (was) using the internal pull up, with the signal line direct to pin 2 from the fan.

No, you don’t. At least not with the posted code. If you use other code, post the code you use!