What it does
Lifeguard AI is an intelligent accident detection and emergency response platform that integrates vehicle-mounted hardware, IoT communication, cloud processing, and automated emergency alert systems.
The system installs a smart vehicle black box that continuously monitors motion, acceleration, and impact events. When a collision is detected, the device immediately captures the vehicle’s GPS location, evaluates passenger presence using onboard computer vision, and transmits accident telemetry data to the cloud infrastructure.
The backend system processes the incoming data, validates the accident event, and determines the nearest emergency services using geospatial calculations. Once verified, the system automatically sends SMS alerts and AI-powered voice calls to nearby hospitals, police stations, and emergency responders.
Each alert includes:
- Accident type
- Passenger count estimation
- Real-time GPS coordinates
- Google Maps navigation link
This enables emergency responders to reach the accident location significantly faster.
How we built it
The system follows a distributed IoT architecture consisting of three major layers.
1. Edge Layer – Vehicle Black Box
The vehicle hardware acts as an intelligent edge computing device responsible for detecting accident events and transmitting telemetry data.
The black box includes:
- ESP8266 Microcontroller – device control and communication
- MPU6050 Accelerometer & Gyroscope – impact and rollover detection
- GPS Module – real-time location tracking
- Camera Module – passenger detection and movement monitoring
- Impact Sensors – additional collision validation
- GSM Module – cellular data communication
When an accident is detected, the system constructs a secure JSON packet containing accident telemetry data such as location, vehicle ID, impact type, and passenger information.
This data is transmitted to the cloud using the MQTT communication protocol.
2. Communication Layer – IoT Messaging Infrastructure
The system uses MQTT as the core communication protocol to enable lightweight and real-time communication between edge devices and cloud services.
A HiveMQ MQTT broker acts as the bridge server that securely receives telemetry messages from vehicle devices.
The MQTT infrastructure ensures:
- Reliable message delivery
- Low latency communication
- Scalable IoT device connectivity
For cloud integration, the MQTT pipeline connects to AWS IoT Core, which manages device authentication and secure message routing.
3. Cloud Processing Layer – Server & Event Engine
The backend system processes accident events and triggers emergency responses.
Incoming MQTT events are forwarded to the root server API, where the system:
- Authenticates the device using a car_id and authentication key
- Stores accident data in the server database
- Executes geospatial calculations to determine the nearest responders
To identify nearby emergency services, the system uses the Haversine distance algorithm:
$$ a = \sin^2(\Delta \phi /2) + \cos(\phi_1)\cos(\phi_2)\sin^2(\Delta \lambda /2) $$
$$ c = 2 \cdot \tan^{-1}(\sqrt{a},\sqrt{1-a}) $$
$$ d = R \cdot c $$
Where:
- ( \phi ) = latitude
- ( \lambda ) = longitude
- ( R ) = Earth radius
AWS Lambda functions process accident events using a serverless architecture, enabling automatic execution when new telemetry data is received.
4. Emergency Decision & Alert Engine
Once an accident event is verified, the system activates the Emergency Alert Engine.
The alert engine performs the following tasks:
- Identifies nearest hospitals, police stations, and ambulance services
- Generates an emergency notification message
- Attaches accident details and Google Maps navigation link
- Sends alerts through SMS and automated voice calls
The system also includes:
- Retry mechanisms
- Delivery logging
This ensures alerts are delivered even during unstable network conditions.
Challenges we ran into
Developing a real-world accident response system introduced several technical challenges.
One of the main difficulties was avoiding false accident triggers caused by sudden braking, potholes, or road bumps. This problem was solved using sensor fusion, combining accelerometer readings with impact sensors and motion thresholds.
Another challenge was unreliable connectivity in remote areas, where stable internet connections are not always available. To address this, the system uses cellular GSM communication combined with MQTT message queuing, allowing accident data to be transmitted even under unstable network conditions.
Designing an autonomous decision pipeline that could quickly analyze accident events and trigger emergency alerts without manual verification also required careful architecture design.
Impact
Lifeguard AI aims to transform vehicles into intelligent emergency response systems capable of automatically reporting accidents and summoning help during the most critical moments.
By reducing the delay between accident occurrence and emergency response, the system has the potential to significantly improve survival rates and make roads safer for everyone.
Built With
- aws-iot-core
- aws-lambda
- computer-vision
- embedded-systems
- gps
- gsm
- haversine-algorithm
- hivemq
- iot
- machine-learning
- mqtt
- python
- react
- transformer
- tts
- twilio
- typescript
Log in or sign up for Devpost to join the conversation.