I started a new project, this time for my network equipment in a cabinet, where I want an arduino to control it by pwm, depending on the temperature... While making the sketch for the rpm counter, I then also decided I want to make a readout for it on a website, and want it to interface with my mailbox in the driveway to tell me when I get new mail, control lights, and so on...
First thing is to make an adapter for a fan that will go in the top of the cabinet.
And during the process I will try to describe and show every step of the process from start to end.
http://bld.is-a-geek.com/2010/12/12/from-drawing-to-reality/
So far the only real arduino based is how I connected the fan to an arduino, and how I read the rpm's.
#define fanPin 3 // FAN connected to digital pin 9
volatile byte rpmcount;
unsigned long timeold;
void setup()
{
attachInterrupt(0, count, RISING); //0 = Digital pin 2
analogWrite(fanPin, 25);
Serial.begin(9600);
rpmcount = 0;
timeold = 0;
}
void loop()
{
if ((millis() - timeold) >= 1000)
{
Serial.println(30*1000/(millis() - timeold)*rpmcount, DEC);
timeold = millis();
rpmcount = 0;
}
}
void count()
{
rpmcount++;
}