Accurate speed measurement is essential in vehicle monitoring and safety systems. In this project, motorcycle speed is measured using a Hall Effect sensor combined with interrupt-based pulse counting on a microcontroller.
A magnet attached to the wheel generates pulses as the wheel rotates. These pulses are detected by the sensor and converted into speed using wheel dimension parameters.
System Overview
The system uses a Hall Effect sensor mounted near the rotating wheel. Each time the magnet passes the sensor, a pulse is generated.

Hardware Architecture
Main components:
- Hall Effect sensor (NJK-5002C)
- ESP32 microcontroller
- LCD display
- Power supply (battery + step-down)
- Additional sensors (distance monitoring system)
The wiring configuration is shown in the system diagram.

Interrupt-Based Pulse Detection
To ensure accurate measurement, pulse detection is handled using interrupts.
Each pulse corresponds to one wheel rotation (or fraction, depending on magnet count).
Basic logic:
- Sensor detects magnet → generates pulse
- Interrupt triggers on rising/falling edge
- Pulse counter increments
- Speed calculated over time interval
This approach ensures no pulses are missed, even at high speeds.
Speed Calculation Method
Speed is calculated using wheel circumference.
From the configuration procedure:
- Tire width
- Tire height
- Wheel diameter
These parameters are used to calculate effective wheel circumference.
Formula:

Where:

Final output is converted to km/h.
System Calibration
Accurate speed depends on proper calibration.
Key parameters:
- Tire width and aspect ratio
- Wheel diameter
- Unit system (metric or imperial)
Incorrect values will result in inaccurate speed readings.
Integration with Safety System
This speed measurement is integrated into a safe distance warning system.
Based on system logic:
- Speed affects warning level
- Distance sensors monitor front and rear
- System outputs:

Engineering Considerations
Important design factors:
- Sensor alignment affects detection accuracy
- Noise filtering may be required
- Debouncing needed for stable pulse detection
- Interrupt handling must be efficient
Using interrupt-based detection significantly improves reliability compared to polling methods.
Conclusion
The implementation demonstrates how Hall Effect sensors and interrupt-based pulse counting can be used for accurate real-time speed measurement in vehicles.
By combining mechanical calibration, embedded processing, and system integration, the design provides a reliable foundation for advanced automotive monitoring systems.
#TestAndMeasurement#
#HallEffectSensor#
#RPMMeasurement#
#EmbeddedSystem#
#ESP32#
#Automation#