In this Blog you will get a complete Arduino code for tachometer. You can able to make your own DIY tachometer and able to measure RPM of any moving Object. The range of this tachometer is from 200 to 50000 RPM. Its cheap in price and easy to make. The items you need
Arduino UNO/ NANO
IR sensor
OTG Cable
Here you just need to connect the arduino with IR sensor. No power supply required. connect Arduino 5V pin to IR sensor VCC, and arduino GND to IR sensor GND. Arduino Digital pin 2 to IR Signal pin. Connection is complete. Now you need to upload the code to arduino. After that you need to install an app on your mobile. connect arduino cord to your mobile using OTG cable. Any arduino Display app will works good. after connect the app open the app and reading starts showing. use a white tape on the rotating object so that ir sensor can identify the object. distance from the ir sensor and object should be max 2 to 3 cm and not more than that.
Get full tutorial video link --
Items purchase Link --
arduino UNO - https://www.myinnovation.in/product-page/arduino-uno
arduino Nano - https://www.myinnovation.in/product-page/arduino-nano
full tachometer - https://www.myinnovation.in/product-page/digital-tachometer
Here is the Code -
float value=0;
float rev=0;
int rpm;
int oldtime=0;
int time;
void isr() //interrupt service routine
{
rev++;
}
void setup()
{
Serial.begin(9600);
attachInterrupt(0,isr,RISING); //attaching the interrupt
}
void loop()
{
delay(1000);
detachInterrupt(0); //detaches the interrupt
time=millis()-oldtime; //finds the time
rpm=(rev/time)*52000; //calculates rpm
oldtime=millis(); //saves the current time
rev=0;
Serial.print( rpm);
Serial.print(" RPM\n");
attachInterrupt(0,isr,RISING);
}
Thanks you
what 52000?