Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
georgehanyYohanna Hoepers
Published © MIT

Tachometer

This Tachometer very precise. it measures too fast or slow RPMs and it can be used to measure engine RPM or any thing.

BeginnerFull instructions provided895
Tachometer

Things used in this project

Hardware components

IR Transceiver (Generic)
×1
RGB LCD Shield Kit, 16x2 Character Display
RGB LCD Shield Kit, 16x2 Character Display
×1
ATmega328
Microchip ATmega328
×1
16 MHz Crystal
16 MHz Crystal
×1
Capacitor 22 pF
Capacitor 22 pF
×2
Arduino UNO
Arduino UNO
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
PCB, For DMB-4775
PCB, For DMB-4775
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

schematic

tachometer_video_ORiwCxsKv4.mp4

Code

Tachometer_Code

C/C++
// Tachometer with lcd i2c screen
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define sensor_pin 2
int READ = 0;
int i = 0;
bool mask = 0;
unsigned long timer = 0;
float Time = 0.0;
int RPM = 0;
const int revnum = 20;
void setup()
{
  pinMode(sensor_pin, INPUT);
  //  Wire.begin();
  Serial.begin(115200);
  lcd.begin();
  lcd.backlight();
  timer = millis();
}

void loop()
{
  READ = digitalRead(sensor_pin);
  if (READ == 0 && mask == 0) {
    i++;
    mask = 1;
  }
  if (READ == 1 && mask == 1) mask = 0;
  if (i == revnum) {
    Time = millis() - timer;
    Time = Time / 1000;
    RPM = ( revnum / Time ) * 60;
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(revnum);
    lcd.setCursor(3, 0);
    lcd.print( "revs / ");
    lcd.setCursor(10, 0);
    lcd.print(Time);
    lcd.setCursor(15, 0);
    lcd.print("s");
    lcd.setCursor(0, 1);
    lcd.print("RPM = ");
    lcd.setCursor(6, 1);
    lcd.print(RPM);
    lcd.setCursor(12, 1);
    lcd.print("rpm");
  }
  if (i >= revnum) {
    i = 0;
    timer = millis();
  }
  Serial.print(i);
  Serial.print("  ");
  Serial.print(mask);
  Serial.print("  ");
  Serial.print(Time);
  Serial.print("S");
  Serial.print("  ");
  Serial.print(RPM);
  Serial.println("RPM");

}

Credits

georgehany
1 project • 0 followers
Yohanna Hoepers
0 projects • 0 followers

Comments