An Arduino sketch to detect a fall based pitch and roll tilt calculations using the MPU6050 accelerometer.


The MPU6050 has 6 degrees of freedom. It has a 3D accelerometer and a 3D gyroscope. This sketch only uses the accelerometer to to detect tilt and catastrophic tilt. A more complex algorithm would make use of the gyroscope.

The MPU6050

Nb: The Z axis is vertical from the device, Y is up and X is to the right.

The Algorithm


  • Set fallcount = 0;


  • Calculate Pitch and Roll
  • If Pitch or Roll are greater than lesser trigger
    • Increment fallcount
    • If fallcount > large trigger
      • Report fallen on ground
    • Else if fallcount > medium trigger
      • Report has fallen
  • Else if fallcount >0
    • Report Stumble
    • Set fallcount = 0

The Circuit

The Sketch, as illustrated uses a RPi Pico W with Arduino installed (see previous posts here) using I2C to communicate with the MPU6050.

The circuit


As discussed in the previous post here with respect to Age-Care, there is much to be gained by the individual and at a government level, both in terms of quality of life and economically, by assisting aged citizens to remain in independent living for as long as possible, with the aid of sensors and monitoring software. Sensors can be wearable or fixed in the person’s environment. The data and/or warning can be relayed to the cloud where triggers can be activated when required, or data consulted upon demand.

This project demonstrates a simple device to monitor for falls. It has a number of parameters that can be fine tuned to improve effectiveness. Indeed, data could be collected and AI applied to further fine tune the parameters and the algorithm decision making. The device could be wearable or placed on a person’s walking frame.

At issue is differentiating between such things as walking up or down a steep slope and a fall. Integrating in the gyroscope, a magnetometer and GPS data would improve this functionality.

  Next: > Jekyll
<  Prev:   GPS
 This Category Links 
Category:AgedCare Monitor Index:AgedCare Monitor
<  Prev:   Aged Care Independent Living