Skip to content

The Over-Speed-Detection software is a physical hardware device which detectes the over-speeding vehicles by using IR sensors.

License

Notifications You must be signed in to change notification settings

vivekjutture/Over-Speed-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🚨 Over-Speed-Detection

License Platform Language

A lightweight Arduino project that measures object speed between two sensors and raises a servo "speed breaker" when the speed exceeds a threshold. Perfect as a classroom demo or a small physical prototype. βš™οΈπŸ›‘


πŸ“Œ Quick Snapshot

  • Purpose: detect overspeed and trigger a servo barrier
  • Distance used in code: 18 cm (fixed)
  • Default threshold: 10 cm/sec
  • Measured unit: cm/sec

✨ Table of Contents


How it works βš™οΈ

  1. Two digital sensors (pins 2 and 3) are placed a known distance apart (18 cm in the sketch).
  2. The sketch timestamps when each sensor is triggered and calculates elapsed time.
  3. Speed is calculated as distance / time (cm/sec).
  4. If measured speed > threshold (default 10 cm/sec), the servo on pin 5 raises the speed breaker and the red LED signals overspeed.

Hardware & Wiring 🧰

  • Microcontroller: Arduino Uno (or compatible)
  • Sensors: 2 Γ— IR break-beam or digital switches
  • Actuator: 1 Γ— Servo motor (SG90 or similar)
  • Indicators: 2 Γ— LEDs (Red for overspeed, Green for normal) + resistors
  • Misc: Jumper wires, breadboard, stable 5V power for servo

Pin mapping (in sketch):

  • Sensor 1: pin 2 (sen1)
  • Sensor 2: pin 3 (sen2)
  • Servo signal: pin 5
  • Red LED (overspeed): pin 6 (l1)
  • Green LED (normal): pin 7 (l2)

Wiring notes:

  • Sensor outputs β†’ pins 2 and 3 (ensure correct Vcc/GND)
  • Servo signal β†’ pin 5, servo Vcc β†’ 5V, servo GND β†’ GND
  • LED anode β†’ respective pin through resistor, LED cathode β†’ GND

⚠️ Note: the original sketch sets the LED pins with pinMode(..., INPUT) in setup(). Those should be OUTPUT for digitalWrite() to work properly.


Quick Start β€” Uploading the Sketch πŸš€

  1. Open Speed_Detection.ino in the Arduino IDE.
  2. Select board Arduino Uno and the correct COM port.
  3. Click Upload.
  4. Open Serial Monitor at 9600 baud to view messages.

Example: open the Serial Monitor to see messages like:

Speed Measurement
Overspeed detected
12.3 cm/sec
Speed Breaker Raised

Configuration & Tuning πŸ”§

  • Distance: change the 18.0 value in the code to match your real sensor spacing.
  • Threshold: update the if (Speed > 10) comparison to your chosen limit.
  • Debounce: for noisy sensors, add simple debouncing or use interrupts for better accuracy.

Code hints:

  • Edit the distance here in the sketch: Speed = (18.0 / Speed);
  • Edit the threshold here: if (Speed > 10)

Fixes & Improvements πŸ› οΈ

  • Change LED pin modes to OUTPUT in setup():
pinMode(l1, OUTPUT);
pinMode(l2, OUTPUT);
  • Consider using pin change interrupts for precise timing instead of blocking while() loops.
  • Add debouncing or filtering to avoid false triggers.
  • Add logging or data export (CSV over serial) for offline analysis.

Troubleshooting 🐞

  • No serial output: ensure Serial Monitor is set to 9600 baud.
  • LED not lighting: confirm pinMode uses OUTPUT and wiring is correct.
  • Servo jitter: use a dedicated power source for the servo if noisy.

About

The Over-Speed-Detection software is a physical hardware device which detectes the over-speeding vehicles by using IR sensors.

Topics

Resources

License

Stars

Watchers

Forks

Languages