The project involves the design and implementation of a system that measures the rotational speed (RPM) of a spinner using a hall magnetic sensor. The measured RPM is then displayed in real-time on an LCD screen, providing an intuitive interface for monitoring rotational speed.
Hall Magnetic Sensor: Detects the presence of a magnetic field, generating pulses with each rotation.
Microcontroller: Processes signals from the Hall sensor and calculates the RPM.
LCD Display: Shows the calculated RPM in a readable format.
🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)
Whether you are matching spindle speeds on a CNC machine or testing an RC motor, you need an exact RPM readout. The RPM Tracker utilizes light reflection and high-speed hardware interrupts to build a digital tachometer.
Optical Interrupt Mathematics
- The Setup: You place a tiny strip of highly reflective silver tape onto the black spinning shaft of your motor.
- The Sensor: You point a TCRT5000 IR Reflective Sensor at the shaft. Every time the silver tape spins past the laser, the sensor pin flashes
HIGHfor a microsecond. - The Hardware Interrupt: To ensure the Arduino doesn't "miss" the flash, you attach the pin to
attachInterrupt(0, countPulse, RISING);. The Arduino increments ahitsvariable every single time it sees a flash. - The Calculation: Every 1,000 milliseconds (using
millis()), the code stops counting.RPM = (hits / holes_in_disc) * 60;- It prints
3400 RPMto an LCD, resets thehitsvariable to 0, and starts counting again!
Hall Effect Alternative
If the environment is covered in dirt or oil (like a real car engine), optical IR sensors will get blocked. You swap the sensor for a Magnetic Hall Effect Sensor and glue a tiny neodymium magnet to the spinning shaft. The code remains exactly the same!
Required Parts
- Arduino Uno/Nano: The calculator.
- TCRT5000 IR Obstacle Sensor OR Hall Effect Sensor.
- 16x2 Text LCD Screen.
- A 12V PC Fan or DC motor to test it on!