Fall alarm device

Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.


This project implements an edge-based fall detection system built on the Quectel Pi H1 smart single-board computer. It captures real-time video via a USB camera, utilizes YOLOv8-Pose to extract human keypoints, and feeds them into a multi-person fall classifier for posture estimation and fall detection.

Upon detecting a fall event, notifications can be viewed remotely via a companion mobile app. The system can also trigger an external siren/alarm light for local perimeter alerts. This project serves as a reference implementation for eldercare, patient monitoring, and early warning fall detection systems.

../../../_images/image_RKDWbO02Qo918xx5Q91cDW3HnJe.webp

Development resources

Development accessory list

Accessory name

Quantity

Specifications

Quectel Pi H1 smart single-board computer

1

Quectel Pi H1 smart single-board computer

USB camera module

1

Recommended resolution: 1280 × 720 or higher; Output format: MJPG/ YUYV

USB-C power adapter

1

USB type-C power supply

Micro HDMI cable

1

HDMI 2.0; Length: 1 m; HDMI-A (male) to HDMI-D (male)

CPU cooling fan (optional)

1

Active cooler (B) for Raspberry Pi 5 with thermal pad

Display

1

HDMI monitor

USB programmable alarm light (optional)

1

LED alarm light controlled through the serial port (/dev/ttyUSB0)

Ethernet cable

1

Pre-terminated Cat 6 Ethernet patch cable

Accessory reference images

Quectel kit

../../../_images/image_CUJQbFnKAoJtaFxwyyDc21E9nLg.webp

Quick start

Development preparation

The Quectel Pi H1 comes pre-installed with Debian 13, so reflashing the OS image is typically not required. Follow the steps below to get started:

Hardware connections

Display connection

Connect the Micro-HDMI end of the Micro-HDMI to HDMI cable to the Micro-HDMI port on the board, and plug the HDMI end into the monitor's HDMI port.

../../../_images/image_IJDNb4Meoo8pG4x0ES0cIybNnka.webp

USB camera module connection

../../../_images/image_Qc0gb0PvooLe5KxNcWUcdSxnnPD.webp

Input device connection (optional)

Connect a USB keyboard and mouse to the board’s two USB-A ports (wireless input devices paired via Bluetooth are recommended). Alternatively, you can interact directly using the touchscreen without a physical keyboard or mouse.

../../../_images/image_Jsmvbkfr7ogtARxMS4wceOhbnnh.webp

Network connection

Connect one end of the Ethernet cable to the Gigabit Ethernet port of the board and the other end to a LAN port of the router (make sure the router is connected to the Internet).

../../../_images/image_G3O7bARZ3oqv4Bxh50Ocl2v6neg.webp

USB alarm light connection (optional)

Connect the alarm light to a free USB port of the board with a USB cable (refer to the documentation of your alarm light for details).

Power connection

Plug the power adapter into a power outlet, then connect the USB-C end to the board's power port (labeled POWER IN).

../../../_images/image_XAFJb9jf2oCzgqx9ZKFc8hH3nuf.webp

Project implementation

Install prerequisites

After confirming that the network is connected, open a terminal and run the following command:

sudo apt update && sudo apt install -y \
    python3-pip \
    python3-venv \
    libopenblas-dev \
    libgl1 \
    libglx-mesa0 \
    libglib2.0-0t64 \
    v4l-utils

Get the code

Click Download code, extract the archive onto the board, and execute cd into the project directory.

Install Python dependencies

cd <project-directory>
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Description of the dependency packages:

  • PySide6: Python bindings for Qt6, used to build the graphical user interface (GUI).

  • opencv-python: OpenCV image processing library, used for camera video capture and image processing.

  • ultralytics: Computer vision framework providing YOLOv8 pose estimation and CV algorithms, used for human keypoint detection.

  • numpy: Numerical computing library, used for matrix operations and feature extraction.

  • scikit-learn: Machine learning library, used to provide the Random Forest classifier.

  • joblib: Object serialization library, used to serialize and load pre-trained models.

Prepare model files

Before running the fall detection application, ensure the following files are placed in the model/ directory:

  1. yolov8n-pose.pt:YOLOv8-Nano Pose model for detecting 17 human body keypoints. Can be downloaded from the official Ultralytics GitHub repository or fetched automatically via code.

  2. fall_multi_person_model.pkl:Random Forest classifier used for fall detection; already located in the model/ directory.

  3. feature_scaler_multi.pkl:Feature scaler used to standardize/normalize input features; already located in the model/ directory.

Run the application

After preparing the model files, run the main program:

cd src
python3 main.py

After the program starts, a graphical interface with the following functions is displayed:

../../../_images/image_BR1rb1m35olEm2xLgkicYHbBnqc.webp

UI overview

UI component

Description

Camera preview area

Displays the real-time camera feed, annotating detected persons and their fall status.

Log output area

Displays real-time runtime logs and detection information while the application is active.

Fall alarm alert

Displays fall detection results at the top of the interface, automatically triggers the external strobe/ alarm light, and saves incident snapshot images.

Start Camera

Starts the camera feed and initiates real-time fall detection.

Stop Camera

Stops video capture.

Log display area

The area on the right outputs log information while the application is running, including:

  • Model loading logs: Whether the YOLOv8 model and the classifier were loaded successfully.

  • Detection logs: The number of detected persons and the fall status.

  • Alarm logs: Fall alarms and the image upload status.

Real-time detection parameters

The application uses the following configuration parameters for fall detection (tunable based on your specific use case):

Parameter

Description

Default value

Source file

MIN_CONFIDENCE

Confidence threshold for keypoint detection

0.4

src/fall_detector.py

MIN_KEYPOINTS

Minimum number of valid keypoints required

10

src/fall_detector.py

YOLO_IMG_SIZE

YOLOv8 input resolution (smaller values increase inference speed but may lead to missed detections for distant subjects)

320

src/fall_detector.py

FALL_BODY_ANGLE_THRESHOLD

Body tilt/ inclination angle threshold

55°

src/fall_detector.py

FALL_HEIGHT_RATIO_THRESHOLD

Ratio of vertical bounding height to shoulder width (H/ W)

1.2

src/fall_detector.py

FALL_CONFIDENCE_THRESHOLD

Fall classifier confidence threshold

0.75

src/fall_detector.py

DETECT_INTERVAL

Detection interval (in seconds)

0.15

src/camera_manager.py

Fall detection principle

Keypoint detection

The application uses the 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 the keypoints for classification:

  1. Keypoint coordinates: (x, y) coordinates and confidence scores for the 17 keypoints (51 dimensions in total).

  2. Body angles: Angular features computed between 8 keypoints (8 dimensions in total).

  3. Relative coordinates: Keypoint positions relative to the hip center. Only 13 primary joints (nose, shoulders, elbows, wrists, hips, knees, and ankles) are selected to compute 2D offsets (dx, dy) relative to the mid-hip point, yielding 13 × 2 = 26 dimensions.

  4. Body shape: Bounding height, width, and aspect ratio (H/ W) (3 dimensions in total).

Fall detection logic

The system employs a dual-stage verification mechanism: a Random Forest classifier first predicts the posture class, followed by a secondary validation using heuristic geometric rules (torso inclination angle, aspect ratio, and keypoint distribution). A fall event is confirmed only when both conditions are met simultaneously.

# Feature extraction + standardization
features = detector.extract_features(keypoints, confidences)
if detector.scaler is not None:
    features = detector.scaler.transform(features)

# Stage 1: Random Forest classifier infers posture class (label 2 = DOWN)
pred_label = classifier.predict(features)[0]
pred_state = LABEL_NAMES.get(pred_label, "UNKNOWN")   # LABEL_NAMES 
= {2: "DOWN"}
if pred_state != "DOWN":
    return False

# Stage 2: Secondary validation via geometric heuristics (passes if score ≥ 3.0 / 5.0)
is_valid_fall, fall_conf = detector._verify_fall_pose(keypoints, 
confidences, img_h, img_w)
if not is_valid_fall:
    return False

# Trigger alert if both stages pass and confidence meets the threshold
confidence = max(classifier.predict_proba(features)[0][pred_label], 
fall_conf)
if confidence >= FALL_CONFIDENCE_THRESHOLD:   # 0.75
    trigger_alarm()
return True

Alarm and viewing

When a fall is detected, the application does the following:

  1. Activates the alarm light: Sends flash and alarm commands to the alarm light through the serial port.

  2. Saves the alarm image: Saves a timestamped JPEG image in the picture/ directory.

  3. Uploads it to the server: Uploads the alarm image to the specified server address.

    • Upload address: * http://SERVER_IP:8000/upload_fall* (replace the server address and upload API with your own).

    • The upload runs asynchronously in the background and does not block the main program.

  4. APK viewing: The user receives fall notifications in real time through the APK and can view the alarm images.

Application demo

fall_down

FAQs

Model loading issues

Model file not found

Symptom:

ERROR - Pose model not found: /path/to/model/yolov8n-pose.pt
ERROR - Classifier model not found: /path/to/model/fall_multi_person_model.pkl

Solution:

  • Make sure yolov8n-pose.pt, fall_multi_person_model.pkl, and feature_scaler_multi.pkl are all in the model/ directory.

  • Check that the file paths are correct; Test with absolute paths.

  • On the first run, the program can download the YOLOv8 model automatically (requires a network connection).

Camera issues

Camera not recognized

Symptom:

Warning: No available cameras detected

Solutions:

  • Check that the camera is properly connected to the USB port.

  • Use the following commands to check whether the camera is recognized:

ls -la /dev/video*            # List video device nodes
lsusb                         # Inspect USB bus enumeration
dmesg | grep -i uvc           # Check uvcvideo driver kernel logs

# Query detailed device info using v4l2-ctl
v4l2-ctl --list-devices
v4l2-ctl --list-formats -d /dev/video0
  • Try another USB port.

  • If it still does not work, use a powered USB hub.

Camera feed stuttering or high latency

Symptom:

Video stream latency exceeds 1 second, or the camera preview feed is choppy/ stuttering.

Possible causes:

  • Camera resolution is set too high, introducing processing overhead and latency.

  • High CPU utilization.

Solutions:

  • Lower the camera resolution (use 1280 × 720; avoid higher resolutions).

  • Adjust DETECT_INTERVAL to increase the sampling interval:

DETECT_INTERVAL = 0.25  # Increase from 0.15 s to 0.25 s
  • Reduce YOLO_IMG_SIZE to accelerate inference speed. Note that setting the resolution too low may reduce detection confidence for distant subjects or occluded poses. Be sure to thoroughly evaluate the fall detection recall rate in your target deployment environment after making adjustments.

YOLO_IMG_SIZE = 320  # Can be reduced to 256

Fall detection issues

High false positive rate (normal activities misclassified as falls)

Symptom:

The system triggers false positive fall alerts when subjects are bending over, sitting down, or resting.

Solutions:

  1. Tune the classifier confidence threshold: Increasing the threshold reduces false positives.

FALL_MIN_CONFIDENCE = 0.80  # Increased from 0.75 to 0.80
  1. Increase the number of confirmation frames: A fall is reported only when it is detected in several consecutive frames.

FALL_CONFIRM_FRAMES = 5  # Increase from 3 to 5
  1. Optimize angle and ratio thresholds:

FALL_BODY_ANGLE_THRESHOLD = 65  # Increase inclination angle threshold
FALL_HEIGHT_RATIO_THRESHOLD = 1.4  # Increase vertical height-to-shoulder-width ratio
  1. Retrain the classifier: Train on a more diverse dataset.

    • Add negative samples of non-fall actions (e.g., sitting down, bending over).

    • Ensure fall sample diversity across varying angles, velocities, and subjects.

    • Scale up the overall training dataset volume.

High false negative rate (actual falls fail to trigger alerts)

Symptom:

Actual fall incidents fail to trigger an alert.

Solutions:

Relax the evaluation criteria across both pipelines simultaneously: the ML classifier and the heuristic geometric rules.

  1. Lower the classifier confidence threshold (src/camera_manager.py**):**

FALL_CONFIDENCE_THRESHOLD = 0.65   # Decreased from 0.75
  1. Relax geometric rule thresholds (src/fall_detector.py**):**

FALL_BODY_ANGLE_THRESHOLD = 50     # Previously 55; condition is angle > threshold, lower to relax
FALL_HEIGHT_RATIO_THRESHOLD = 1.4  # Previously 1.2; condition is H/W < threshold, increase to relax
  1. Lower the overall geometric score threshold (return statement*in _verify_fall_poseinside*src/fall_detector.py**):**

return fall_score >= 2.0, confidence   # Previously 3.0 out of 5.0 max
  1. Relax keypoint detection thresholds (src/fall_detector.py**):**

MIN_CONFIDENCE = 0.3   # Decreased from 0.4
MIN_KEYPOINTS = 8      # Decreased from 10 (relaxes valid keypoint count threshold)
  1. Optimize camera angle and positioning: Ensure the full body is visible in the frame.

  • Maintain a distance of 1–3 meters between the camera and the target subject.

  • Mount the camera at an installation height of 1.5–2 meters.

  • Avoid purely profile (side) or near-vertical (overhead/top-down) camera angles.

  1. Improve lighting conditions:

  • Ensure adequate illumination; avoid harsh shadows and backlighting.

  • Use uniform ambient lighting rather than localized glare or spotlights.

Alarm and upload issues

Alarm light fails to trigger

Symptom:

A fall is detected, but the alarm light does not illuminate.

Solutions:

  • Verify that the serial cable connection is securely connected.

  • Confirm that the alarm light hardware is powered and functioning properly.

  • Check the serial port configuration in src/light_control.py:

port = '/dev/ttyUSB0'        # Modify according to actual device
baudrate = 9600              # Modify according to device specifications
  • Verify serial port access permissions:

sudo chmod 666 /dev/ttyUSB0
  • Consult the documentation for your specific alarm light model to debug and verify that the serial control command format/ payload is correct.

Image upload fails

Symptom:

ERROR - Upload failed: fall_20240326_143022.jpg

Possible causes:

  • The network connection is unstable.

  • The server address is wrong or the server is unavailable.

  • The request timed out.

Solutions:

  • Check the network connection: ping -c 4 <SERVER_IP>.

  • Verify that the server is running: curl -I -X POST http://`<SERVER_IP>`:8000/upload_fall.

  • Ensure the receiving host (including cloud virtual instances and security groups) allows inbound traffic on port 8000.

  • Update the server IP address in src/camera_manager.py:

SERVER_IP = "your.server.ip"

Performance issues

High CPU utilization

Symptom:

CPU usage exceeds 80% while the application is running, resulting in sluggish system responsiveness.

Solutions:

  • Lower detection frequency (increase DETECT_INTERVAL).

  • Reduce video resolution (downscale to 640 × 480 or lower).

  • Disable real-time log rendering or throttle the log update/ refresh rate.

  • Enable GPU acceleration (if supported by the hardware).

Memory leak leading to continual usage growth

Symptom:

Memory footprint climbs from 200 MB to 1 GB after running for several hours.

Solutions:

  • Check whether unreleased objects are repeatedly instantiated inside loops.

  • Periodically flush the log buffer:

if len(LogManager._logs) > 100:
    LogManager.clear_logs()
  • Ensure threads terminate gracefully upon shutdown or task completion.

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 repository: https://github.com/Quectel-Pi/demo-fall-alarm-device

Issues and pull requests are welcome.