How kushdoshi07/accident-detection-and-alert-system works
Project Type and Purpose
• This is an IoT edge-to-cloud application running on an Arduino/ESP-class microcontroller.
• Purpose: Continuously monitor motion (MPU6050), gas concentration, and vibration; detect accident or hazardous conditions; log data in real time to ThingSpeak; and send SMS alerts via Twilio when thresholds are exceeded.
File Structure Analysis
• Only one source file: Final_Code.ino
• Contains all sensor-reading logic, accident-detection algorithms, cloud-communication routines, and alert-triggering code.
• No separate frontend/backend folders—everything lives in embedded firmware.
README Insights
• Lists four feature areas: Sensor Integration, Data Transmission, Accident Detection, Alert System.
• Specifies technologies: MPU6050, gas & vibration sensors, Wi-Fi + TLS 1.2, ThingSpeak, Twilio API.
Main Components
a. Edge Device (Arduino/ESP MCU)
– Sensor Interfaces: I²C for MPU6050 (accel + gyro), analog or digital input for gas sensor, digital input for vibration sensor.
– Local Processing: accident-detection logic (threshold checks, state machine).
– Networking: Wi-Fi radio + TLS 1.2 stack.
b. Cloud Services
– ThingSpeak API endpoint for data ingestion & real-time dashboards.
– Twilio REST API endpoint for SMS alerts.
c. End User
– Receives SMS notifications on mobile device.
– (Optional) Monitors dashboards on ThingSpeak web interface.
Relationships and Data Flow
• Sensors → MCU reads raw data.
• MCU → Local accident-detection module processes sensor values.
• MCU → Periodically pushes sensor readings (HTTP POST over TLS) to ThingSpeak.
• MCU → On detection of hazardous condition, invokes Twilio SMS API (HTTP POST over TLS) to send alerts.
• ThingSpeak → Web dashboards for remote monitoring.
• Twilio → SMS delivery to predefined phone numbers.
Architectural Patterns & Design Principles
• Edge Computing: preliminary processing and decision-making happens on the device to minimize latency.
• Event-Driven Alerts: accident triggers immediate API call for SMS.
• Publish–Subscribe (kind of): device publishes data to cloud channel (ThingSpeak).
• Secure Communication: all cloud interactions use TLS 1.2.
Technologies / Frameworks
• Arduino C++ (Final_Code.ino)
• Sensor libraries: MPU6050, gas sensor driver, vibration sensor read routines
• WiFi + TLS library (e.g., WiFiClientSecure)
• HTTP client for ThingSpeak and Twilio APIs