Tachometer

A tachometer is a device used in cars and rotatory machines to measure the rpm of the motor. I made a hand-held Arduino-based optical tachometer that uses infrared LEDs to measure the rpm. A tachometer is a useful instrument to have around while experimenting with motors and any moving mechanics.

IMG_20141226_095146

It consists of an infrared LED to emit light in the infrared spectrum, a receiver diode that conducts electricity only when infrared light is incident on it, and an Arduino microcontroller that does the computing.

The black diode continuously emits light in the infrared region. Initially the light beam does not fall on the propeller. As no light is reflected to the receiving diode, it remains non-conducting and the state of pin 3 is LOW. When the infrared light from the LED is reflected off the piece of white tape on the propeller, and is incident on the receiving diode, the diode conducts electricity. This changes the state of pin 3 from LOW to HIGH. When the propeller moves out of the way, no light is incident on the receiving diode and the pin state becomes LOW again. I programmed the Arduino microcontroller to count the number of times the state of pin 3 becomes HIGH in one second. This gives us the number of revolutions per second and hence the rpm of the motor.

rpm= revolutions per second * 60

CODE:

int ledpin=13,statuspin=10,inpin=8,stat=1;
unsigned int t[10]={1,1,1,1,1,1,1,1,1,1};
long int t1,counter;
float avg, rpm;
void setup() {
 pinMode(ledpin, OUTPUT);
 pinMode(statuspin, OUTPUT);
 pinMode(inpin, INPUT_PULLUP);

 Serial.begin(9600);

 digitalWrite(ledpin, HIGH);

 t1=micros();
 counter=0;
 // put your setup code here, to run once:

}

void loop() 
{
 if(digitalRead(inpin)==LOW)
 {
 t1=micros()-t1;
 counter++;
 stat=!(stat);
 digitalWrite(statuspin,stat);
 //array stores previous 10 values
 for(int i=9;i>0;i--) //loop push last value out and accepts latest value
 {
 t[i]=t[i-1];
 }
 t[0]=t1;
 avg=0;
 for(int i=0;i<10;i++) //loop does weighted avg. of time intervals
 {
 avg+=(10-i)*t[i];
 }
 avg=avg/55; //avg time in microseconds
 if(avg!=0)rpm=1000000*60/avg; //divide avg by 10^6 
 Serial.print("\navg time is: ");
 Serial.print(avg,DEC);
 if(counter%7==0)
 {Serial.print("\nrpm is: ");
 Serial.print(rpm,DEC);
 }
 }
 
 

}

A tachometer is a useful tool to accurately calculate rpm. I used it to plot graphs of current vs rpm for various dc motors to check how much the graph deviates from the linear behaviour expected. These graphs give us the efficiencies of the motors at various rpms.

GRAPHS