We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4
Omar Hatem
Omar Farouk
Shahd Abdallah
Make a Report for Rpm meter Arduino project
Arduino RPM Meter Project Report
Introduction This project involves creating a digital tachometer using an Arduino and an IR sensor module to measure the revolutions per minute (RPM) of a rotating object. The tachometer will display the RPM on an OLED display. This project is useful for applications where monitoring the speed of a motor or any rotating device is necessary. Components Required Arduino Uno or Nano IR Sensor Module (IR Transmitter and Receiver) OLED Display (e.g., SH1106 or SSD1306) Connecting wires Breadboard Resistors (if necessary) Circuit Diagram The IR sensor module is connected to the Arduino to detect the rotation of an object. The OLED display is used to show the RPM value. Below is the basic connection setup: 1. IR Sensor Module: o VCC to 5V on Arduino o GND to GND on Arduino o OUT to Digital Pin 2 on Arduino 2. OLED Display: o VCC to 5V on Arduino o GND to GND on Arduino o SDA to A4 on Arduino o SCL to A5 on Arduino Working Principle The IR sensor module consists of an IR transmitter and receiver. When the rotating object passes between the transmitter and receiver, it interrupts the IR beam, causing a change in the sensor's output. This change is detected by the Arduino, which counts the number of interruptions over a specific period to calculate the RPM. Formula for RPM Calculation The RPM is calculated using the formula: RPM=(Count×60Time (in seconds))RPM=(Time (in s econds)Count×60) Where "Count" is the number of interruptions detected by the IR sensor. Arduino Code Here is a sample code to implement the RPM meter: cpp 1#include <Wire.h> 2#include <Adafruit_GFX.h> 3#include <Adafruit_SH1106.h> 45#define OLED_RESET 4 6Adafruit_SH1106 display(OLED_RESET); 78#define sensor 2 910volatile unsigned int count = 0; 11unsigned long timePrevious = 0; 12unsigned int rpm = 0; 1314void setup() { 15 pinMode(sensor, INPUT); 16 attachInterrupt(digitalPinToInterrupt(sensor), countRpm, FALLING); 1718 display.begin(SH1106_SWITCHCAPVCC, 0x3C); 19 display.clearDisplay(); 20 display.setTextSize(2); 21 display.setTextColor(WHITE); 22 display.setCursor(0,0); 23 display.println("RPM Meter"); 24 display.display(); 25 delay(2000); 26} 2728void loop() { 29 unsigned long timeNow = millis(); 30 if (timeNow - timePrevious >= 1000) { 31 detachInterrupt(digitalPinToInterrupt(sensor)); 32 rpm = (count * 60) / 1; // Calculate RPM 33 count = 0; 34 timePrevious = timeNow; 35 attachInterrupt(digitalPinToInterrupt(sensor), countRpm, FALLING); 3637 display.clearDisplay(); 38 display.setCursor(0,0); 39 display.println("RPM:"); 40 display.setTextSize(5); 41 display.setCursor(0,25); 42 display.println(rpm); 43 display.display(); 44 } 45} 4647void countRpm() { 48 count++; 49} 50 Explanation of the Code 1. Libraries and Definitions: o The code includes libraries for the OLED display. o Defines the reset pin for the OLED and the sensor pin. 2. Setup Function: o Initializes the sensor pin as input. o Attaches an interrupt to the sensor pin to count the interruptions. o Initializes the OLED display and shows a welcome message. 3. Loop Function: o Checks if one second has passed. o Detaches the interrupt to safely calculate the RPM. o Calculates the RPM using the count of interruptions. o Resets the count and reattaches the interrupt. o Updates the OLED display with the current RPM value. 4. Interrupt Service Routine: o Increments the count each time an interruption is detected. Conclusion This project demonstrates how to build a simple yet effective RPM meter using an Arduino and an IR sensor module. The RPM value is displayed on an OLED screen, making it easy to monitor the speed of any rotating object. This project can be further enhanced by adding features such as data logging or wireless transmission of RPM