Fall Alarm Device¶
Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.
This application is a smart solution based on Quectel Pi H1 intelligent main board, using USB camera for real-time human pose recognition, employing YOLOv8-Pose and multi-person fall classifier to automatically detect whether a user has fallen.
This project collects real-time footage via a camera. When a fall event is detected, it triggers a local alarm and sends a notification to a mobile phone. Users can view fall-related images through an APK on their mobile devices. It can serve as a reference example for safety monitoring and fall warning systems for the elderly or patients.
Development Resources Summary¶
Development Accessories List¶
Accessory Name |
Quantity |
Specifications |
|---|---|---|
Quectel Pi H1 smart single-board computer |
1 board |
Quectel Pi H1 Smart Ecosystem Development Board |
USB Camera |
1 unit |
Recommended resolution: 1280×720 or higher; Output format: MJPG/YUYV |
USB-C Power Cable Charger |
1 unit |
27W USB Type-C Interface Charger 1.2m Cable Length Standard Power PD Power Supply Suitable for Raspberry Pi 5 |
USB-C DP Display Cable / Micro HDMI Cable |
1 unit |
Specifications: DP 1.4; Cable length: 1m; Interface: USB-C (male) - USB-C (male) |
CPU Cooling Fan (Optional) |
1 unit |
Raspberry Pi 5 Official Active Cooler with Heatsink and Thermal Pad |
Display |
1 unit |
24-inch HDMI monitor |
USB Programmable Alarm Light (Optional) |
1 unit |
LED alarm light controlled via serial port (/dev/ttyUSB0) |
Accessories Reference¶
Quectel Kit¶
Quick Start¶
Development Preparation¶
Quectel Pi H1 intelligent main board comes with Debian 13 system image by default, so there’s no need to flash the image again. Just follow the steps below.
Hardware Connection¶
Display Connection¶
Connect one end of the Micro HDMI cable to the Micro HDMI port on the intelligent main board, and the other end to the HDMI port on the monitor.
Input Device Connection¶
Connect USB keyboard and mouse to the two USB-A ports on the intelligent main board. For wireless input devices, simply plug the receiver into the USB port.
Network Cable Connection¶
Connect one end of the network cable to the Gigabit Ethernet port on the intelligent main board, and the other end to a router port (ensure the router has internet access).
USB Alarm Light Connection (Optional)¶
Connect the alarm light to an available USB port on the intelligent main board using a USB cable (refer to your alarm device documentation)
Power Connection¶
Connect the USB-A end of the power cable to the power adapter, and the USB-C end to the power port on the intelligent main board (usually labeled POWER IN).
Project Implementation¶
Prerequisites Installation¶
After confirming network connection, open the terminal and enter the command:
sudo apt update && sudo apt install -y python3-pip libatlas-base-dev libjasper-dev
The above command will update the software sources and install some libraries required for the project, including:
libatlas-base-dev and libjasper-dev: Dependencies for scientific computing libraries;
python3-pip: Python package manager for installing project dependencies.
Get the Code¶
Extract the code to the device
Install Python Dependencies¶
pip install -r requirements.txt
Dependency package descriptions:
PySide6: Python bindings for Qt6, used for building graphical user interfaces;
opencv-python: OpenCV image processing library, used for camera capture and image processing;
ultralytics: YOLOv8 object detection framework, used for human keypoint detection;
numpy: Numerical computing library, used for matrix operations and feature extraction;
scikit-learn: Machine learning library, used for providing random forest classifier;
joblib: Serialization library, used for loading pre-trained models.
Prepare Model Files¶
The fall detection application requires the following model files to be pre-loaded, please place them in the model/ directory:
yolov8n-pose.pt - YOLOv8-Nano Pose model, used for detecting 17 human keypoints
fall_multi_person_model.pkl - Random forest classifier, used for determining falls
feature_scaler_multi.pkl - Feature scaler, used for standardizing input features
These model files can be obtained from:
yolov8n-pose.pt: Download from Ultralytics official GitHub or auto-download via code
fall_multi_person_model.pkl and feature_scaler_multi.pkl are placed in the model directory
Run the Application¶
After preparing the models, run the main program:
cd src
python3 main.py
After the program starts, it will display a graphical interface with the following features:
Interface Description¶
Interface Area |
Function Description |
|---|---|
Camera Preview Area |
Real-time display of camera captured footage, with detected humans and fall status annotated |
Log Output Area |
Display real-time logs and detection information during application runtime |
Fall Alarm Alert |
Display fall detection results at the top, automatically trigger alarm light and save alarm images |
Camera Selection |
Supports multiple USB cameras, can automatically detect and select available cameras |
Log Display Area¶
The right side area can output log information during application runtime, including:
Model Loading Logs: Shows whether YOLOv8 model and classifier loaded successfully
Detection Logs: Shows number of detected humans and fall status
Alarm Logs: Shows fall alarms and image upload status
Real-time Detection Parameters¶
The program uses the following parameters for fall detection (can be adjusted according to actual needs):
Parameter |
Description |
Default Value |
|---|---|---|
MIN_CONFIDENCE |
Keypoint confidence threshold |
0.4 |
MIN_KEYPOINTS |
Minimum number of valid keypoints |
10 |
FALL_BODY_ANGLE_THRESHOLD |
Body tilt angle threshold |
55° |
FALL_HEIGHT_RATIO_THRESHOLD |
Body height-to-width ratio threshold |
1.2 |
FALL_MIN_CONFIDENCE |
Classifier confidence threshold |
0.75 |
FALL_CONFIRM_FRAMES |
Fall confirmation frame count |
3 |
DETECT_INTERVAL |
Detection interval (seconds) |
0.15 |
Fall Detection Principle¶
Keypoint Detection¶
The application uses YOLOv8-Pose model to detect 17 human keypoints:
0: Nose 1: Left Eye 2: Right Eye 3: Left Ear 4: Right Ear
5: Left Shoulder 6: Right Shoulder 7: Left Elbow 8: Right Elbow 9: Left Wrist
10: Right Wrist 11: Left Hip 12: Right Hip 13: Left Knee 14: Right Knee
15: Left Ankle 16: Right Ankle
Feature Extraction¶
The following features are extracted from keypoints for classification:
Keypoint Coordinates: (x, y) coordinates and confidence of 17 keypoints, 51 dimensions total
Body Angles: Calculate angle features between 8 keypoints, 8 dimensions total
Relative Coordinates: Relative coordinates to the hip center point, 26 dimensions total
Body Morphology: Body height, width and height-to-width ratio, 3 dimensions total
Fall Judgment Logic¶
The application uses multiple methods to determine if a fall has occurred:
# Feature extraction and classification
features = detector.extract_features(keypoints, confidences)if scaler is available:
features_scaled = scaler.transform(features)else:
features_scaled = features
# Get classifier prediction
probabilities = classifier.predict_proba(features_scaled)
is_falling = probabilities[0, 1] > FALL_MIN_CONFIDENCE # Class 1 indicates fall# Confirmation frame count (reduce false alarms)if is_falling:
fall_count += 1if fall_count >= FALL_CONFIRM_FRAMES:
trigger_alarm()
Judgment Criteria:
Random forest classifier probability > 0.75 and fall detected for 3 consecutive frames
Or both body angle > 55° and body height-to-width ratio > 1.2 are satisfied
Alarm and Viewing¶
When a fall is detected, the application will:
Activate Alarm Light: Send flash and alarm commands to the alarm light device via serial port
Save Alarm Image: Save JPEG image with timestamp in the
picture/directoryUpload to Server: Upload alarm image to specified server address
Upload address:
http://SERVER_IP:8000/upload_fall(replace with your server address and upload interface)Supports background asynchronous upload, does not block main program execution
APK Viewing: Users can receive fall notifications in real-time via APK and view alarm images
Application Demo¶
Common Issues and Solutions¶
Performance Optimization Issues¶
High CPU Usage¶
Symptom:
Application CPU usage > 80% during runtime, system response slow
Solution:
Lower detection frequency (increase
DETECT_INTERVAL)Reduce video resolution (change to 640×480 or lower)
Disable real-time log display or reduce log update frequency
Use GPU acceleration (if hardware supports)
Memory Leak Causing Continuous Memory Increase¶
Symptom:
Application memory usage grows from 200MB to 1GB after running for several hours
Solution:
Check if unreleased objects are created in loops
Periodically clear log buffer:
if len(LogManager._logs) > 100:
LogManager.clear_logs()
Ensure threads are properly closed
Use memory analysis tool to detect leaks:
python3 -m memory_profiler
Technical Support and Contributions¶
If you encounter any issues during use, please submit technical inquiries on the Quectel Official Forum. Our technical support team will respond promptly.
Project open-source repository: https://github.com/Quectel-Pi/demo-fall-alarm-device
We welcome you to submit Issues to report problems or Pull Requests to contribute code improvements!