- Joined
- May 10, 2009
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:
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:
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.
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);
}
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);
}
Next will be testing the far noisier San Ace fan.
Last edited: