Project is available for free download! - Support the author of this project to unlock other currently paid projects in the future: PayPal
Arduino IR LCD RPM

Infrared tachometer on Arduino platform


  • The tachometer on the Arduino platform uses an infrared obstacle sensor that can detect an obstacle at a distance set by a potentiometer.
  •       
  • A secondary use of a similar sensor is basically a counter that can respond to the pulley speed from the crankshaft.
  •       
  • A reflective surface (on the order of millimeters, max 1 centimeter) is placed on the pulley - sheet, tape, aluminum foil, which can reflect infrared light from the emitting diode into the receiving diode.
  •       
  • The sensor does not respond to the distance as such. It only responds to the reflection of light from the reflective surface.
  •       
  • The result is a relatively reliable tachometer that represents the result on a character LCD display with an I2C converter.
  •       
  • Can be used to record pulleys (harvesters, tractors), but also for bicycles, car wheel (can also be recalculated to the speed of motion at a known wheel circumference).
  •       

    Project hardware:

  • Arduino Uno R3
  • IR Obstacle sensor
  • LCD 20x4 or 16x2
  • I2C converter
  • Result

    Schematics

    Knižnica / Library

  • https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
  • Program

    #include <LiquidCrystal_I2C.h>
    LiquidCrystal_I2C lcd(0x3F, 20, 4);     //alebo 0x27 --> I2C adresy sa mozu roznit
    int rev = 0;
    int rpm;
    unsigned long oldtime = 0;
    unsigned long time;
    
    void isr() {
      rev++;
    }
    
    void setup() {
      lcd.begin();
      lcd.backlight();
      lcd.setCursor(0, 0);
      lcd.print("-----ZETOR 4011-----");
      attachInterrupt(digitalPinToInterrupt (2), isr, RISING); //interrupt pin
    }
    
    void loop() {
      delay(1000);
      detachInterrupt(digitalPinToInterrupt(2));      
      time = millis() - oldtime;    //rozdiel casov
      rpm = (rev / time) * 60000;   //vyrataj otacky/min
      oldtime = millis();           //uloz aktualny cas
      rev = 0;
      lcd.setCursor(0, 1);
      lcd.print(rpm);
      lcd.print(" ot/min   ");
      attachInterrupt(digitalPinToInterrupt (2), isr, RISING);
    }