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

    Otáčkomer na platforme Arduino - ATmega328P
    Remenica klukovej hriadele s lesklou plochou pre detekciu IR senzorom

    Knižnica / Library

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

    Pri záujme o rozšírenú verziu otáčkomera s implementovaným SW ošetrením zákmitov: martinius96@gmail.com
    In case of interest in extended version of RPM with implemented SW debouncing: martinius96@gmail.com
    //Martin Chlebovec (martinius96@gmail.com)
    //Základná implementácia pre otáčkomer na platforme Arduino Uno / Nano (ATmega328P)
    //Neobsahuje ošetrenie zákmitov, volatile premenné v interrupt rutine (negarantované obslúženie premennej)
    //Verzia zdarma pre orientačné meranie, chybovost meraní do: 30%
    #include <LiquidCrystal_I2C.h>
    LiquidCrystal_I2C lcd(0x3F, 20, 4);     //alebo 0x27 (najpouzivanejsie I2C komunikacne adresy)
    int rev = 0;
    int rpm;
    unsigned long oldtime = 0;
    unsigned long time;
    
    void isr() {
      rev++;
    }
    
    void setup() {
      lcd.begin(); //100 kHz I2C speed - Standard Mode
      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);
    }