jegatheesan
Published © GPL3+

Portable Noncontact Tachometer

We use tachometer in our industry. So I'd like to make some tachometer to check it in home with available resource.

IntermediateFull instructions provided1,184
Portable Noncontact Tachometer

Things used in this project

Hardware components

Serial 16X2 LCD Display
×1
Pcb Push Button
×1
IR Diode and Receiver
×1
270 ohms Resistor
×1
33K Resistor
×1
Multi-Turn Precision Potentiometer- 1k ohms (25 Turn)
Multi-Turn Precision Potentiometer- 1k ohms (25 Turn)
×1
Double Sided Tape
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

IR Sensor circuit

Code

Tachometer.ino

Arduino
const int buttonPin = 12;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin
int rpmcnt=0;
int sensorstatus=0;
int Buttonstatus=0;

long previoustakentime;
long rpm;
long maxrpm;
String Display2; 

void setup() {
  Serial1.begin(9600);
//  attachInterrupt(0, Count, RISING);
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);  
  Buttonstatus=0;
  Serial1.write(22);
  Serial1.write(12);
}

void lcddisplay(){
    Serial1.write(128);
    Serial1.println("***Tachometer***");    
    Serial1.write(148);    
    if(digitalRead(buttonPin) == HIGH){
      Display2="RPM : ";
      Display2=Display2 + rpm;
      Display2=Display2 + "          ";
    }
    else
    {
      Display2="MAX RPM :";
      Display2=Display2 + maxrpm;    
      Display2=Display2 + "       ";      
    }
    Serial1.println(Display2);
}

void loop() {
  int sensorValue = analogRead(A0);
  if(digitalRead(buttonPin) == HIGH){
    if (Buttonstatus==0)
    {
      maxrpm=0;
      Buttonstatus=1;
      rpmcnt=0;
      previoustakentime=millis();
    }
    digitalWrite(ledPin, HIGH);  
    if(sensorValue>200 && sensorstatus==0)
    {
      sensorstatus=1;
      rpmcnt=rpmcnt+1;
    }
    else if(sensorValue<200 && sensorstatus==1) 
    {
      sensorstatus=0;
    }     

    if (rpmcnt >= 5)
    {
      rpm = (60000/(millis() - previoustakentime))*rpmcnt;
      if (rpm>maxrpm)
      {
        maxrpm=rpm;
      }
      lcddisplay();
      rpmcnt=0;
      previoustakentime=millis();
    }
  }
  else{
    rpm = 0;
    lcddisplay();
    digitalWrite(ledPin, LOW);
  }
}

Credits

jegatheesan

jegatheesan

18 projects • 67 followers
Simply A Mechatronics Lover.

Comments