Inspiration

This project is deeply personal.

My grandmother suffered two stroke-related incidents, both of which caused her to lose balance and fall from her bed. Fortunately, she was not alone at the time. But it made me realize something unsettling:

What if no one had been there?

Beyond personal experience, I have seen and heard about many elderly individuals who fall in bathrooms, bedrooms, or while walking alone and remain unattended for long periods. In such cases, the fall itself is not always fatal, but the delay in assistance often is.

Stroke patients and individuals with heart conditions are especially vulnerable. Many of these events are preceded by subtle signs; instability, imbalance, or sudden drops in posture, but current systems often fail to capture this.

That realization led to a simple question:

Can we build a system that doesn't just detect a fall, but understands when one is about to happen?


What It Does

GaitGuard is a real-time fall detection system designed to monitor motion, posture, and risk continuously.

Instead of relying on simple threshold triggers, the system:

  • Tracks posture deviation from a personal calibrated baseline
  • Analyzes motion patterns using a 25-sample rolling sensor window
  • Estimates fall probability using Machine Learning
  • Makes stable decisions using a Finite State Machine (FSM)

The system operates across four states:

  • NORMAL - person is moving safely
  • SUSPECT - sudden impact or unusual instability detected
  • FALL - high confidence fall confirmed
  • CANCELLED - wearer manually reset the alert

A physical 600-LED panel changes color in real time to reflect the current system state - making behavior immediately visible to anyone in the room without needing a screen.

When a fall is confirmed, an instant push notification fires via ntfy to the caregiver's phone, including fall direction and location.


How I Built It

The system is a multi-layer pipeline:

Sensors → Signal Processing → Feature Extraction → ML Model → FSM → Dashboard + Alerts

Hardware

  • ESP32 - runs the full embedded FSM and sensor logic
  • ADXL335 analog accelerometer - X, Y, Z acceleration at 12-bit resolution
  • PIR sensor - secondary motion confirmation to reduce false positives
  • RGB LED + buzzer - on-device state feedback
  • Push button - instant false alarm cancellation
  • Arduino Uno + 600 WS2812B LEDs - physical state display panel

Signal Processing

At startup, 120 samples are collected to build a personal X/Y/Z baseline. All deviation is measured relative to this — making detection robust to individual differences in how the device is worn.

An exponential low-pass filter smooths sensor noise without lag:

x_filtered = 0.85 × x_prev + 0.15 × x_raw

Machine Learning

A Logistic Regression model estimates fall probability from five features:

  • Posture deviation from baseline
  • Current motion magnitude
  • Peak deviation in rolling window
  • Minimum motion in rolling window
  • Accelerometer magnitude in g

The probability is blended with a rule-based score into a final risk metric:

Risk = 0.4 × Rule Score + 0.6 × P(fall)

This is then passed into the FSM, which ensures stable and interpretable decisions - not just raw numbers.

FSM Logic

  • NORMAL → SUSPECT - motion spike above impact threshold
  • SUSPECT → FALL - abnormal posture + sustained stillness confirmed by PIR
  • SUSPECT → NORMAL - posture recovers, or high motion continues (exercise abort)
  • FALL → CANCELLED - wearer presses button

Fall direction (LEFT / RIGHT / FORWARD / BACKWARD) is classified from the dominant X/Y deviation axis at the moment of impact.


LED Panel - Physical State Display

600 WS2812B addressable LEDs arranged in a serpentine grid on cardboard, driven by an Arduino Uno receiving serial commands from the ESP32.

The panel changes color instantly with every state change:

  • 🟢 Green - NORMAL, person is safe
  • 🟡 Yellow blinking - SUSPECT, instability detected
  • 🔴 Red blinking - FALL confirmed, alert sent
  • 🔵 Blue — CANCELLED, wearer is okay

This gives anyone in the room an immediate visual signal - no dashboard, no phone needed.


Challenges I Faced

  • Eliminating false positives from bending, sitting, and exercise without missing real falls
  • Handling noisy analog data from the ADXL335 through the ESP32's ADC in real time
  • Fitting 550+ LED state data within the Arduino Uno's 2KB RAM limit
  • Building meaningful ML features without labeled real-world fall data
  • Integrating firmware, ML, dashboard, alerts, and LED panel as a solo build in 36 hours

What I Learned

  • Multi-layer systems combining rule-based logic with ML are far more reliable than either alone
  • Hardware constraints force real understanding - the Uno's memory limit taught me more about WS2812B data transmission than any tutorial
  • Safety systems require trust calibration - too many false alerts and people ignore the system; missed events are dangerous
  • A solo 36-hour hardware + software + ML build is hard but very possible with clean architecture

Final Thought

For many elderly individuals, independence comes with risk.

A fall is not always avoidable - but being unnoticed after a fall is.

GaitGuard ensures that even when no one is around, someone is always watching out.

Built With

Share this project:

Updates