Small fan and RPM

Hi,

I have a small CPU 12V fan. It has 3 wires: red+, black-, yelllow to count rpm.
Could you guys please tell me how can I count these revolutions using Arduino…

Thanks!

I don’t know personally how that type of motor tracks RPMs, but you could try powering up the red and black wires to 5v through a potentiometer (so not to damage the arduino just in case, don’t want >5v) and connecting the yellow to an analog input. adjust the speed up and down (again not exceeding 5v) and measure what you get from the yellow. I don’t know how you’d convert this to an actual RPM, it’d depend on your results. It could be that the yellow wire sends a pulse once per revolution. If that’s the case it’s pretty easy to use one of the counter/timers to measure the time between pulses and calculate the RPMs.

If that’s the case it’s pretty easy to use one of the counter/timers to measure the time between pulses and calculate the RPMs.

I’ve found some code here:http://www.arduino.cc/playground/Main/ReadingRPM

It works but…
The fan works now with 5V.
When I try to stop the fan with my finger (I just slow the fan down) it works great and shows the RPM.
When I put some resistors between fan + and Arduino +5V it does not work correctly. I can hear that the fan works slower, but Arduino shows some stupid values 50.000 RPM etc.

I tried with 12V too…

Do you have any idea?
Maybe the resistors make the current too low?

By the way, this is my code, I think a bit more simple, do not use the attachInterrupt() function.

  if(digitalRead(9)==HIGH && reset==0){
    reset=1;
    count++;
  }  
  if(digitalRead(9)==LOW) reset=0;


  if(count>100) count=0;
  
  if(count==0){
    timeStart=millis();
  }

  if(count>=100){
    timeStop=millis();
    rmp = (6000000/(timeStop-timeStart))/2;
  }