I can not get this to work. I have tried 4 different fans including a CPU fan I know has a working RPM sensor. As it is right now the arduino is just printing random RPM numbers out to the serial console. I can stop the fan with my fingers and nothing changes. Disconnecting the fan all together from the arduino makes no change in the serial output.
Here is how I have tings wired up.
And this is the sketch I am using. (found on page 1 of this thread)
volatile byte NbTopsFan;
int hallsensor = 2;
void rpm()
{
NbTopsFan++;
}
/***************************************/
void setup()
{
// pinMode(hallsensor, INPUT);
Serial.begin(9600);
attachInterrupt(0, rpm, RISING);
};
void loop ()
{
NbTopsFan = 0;
delay (1000);
NbTopsFan = NbTopsFan * 30;
Serial.print (" ");
Serial.print (NbTopsFan, DEC);
Serial.print (" rpm");
};