Fall detection app: How I made people fall
People falling, sitting, walking, and laying down to create the dataset
Defining issue
During our existence in the real world, we do a lot of different movements, like sitting on the sofa, traveling on the bus, playing catch with kids and others. At our disposal to track activity, we have sensors like an accelerometer and gyroscope, which give us a perspective of the phone in these situations.
The change of speed of our body results in a change in acceleration. E.g. we move to sit down on the chair, our acceleration changes because we change speed to move to a chair. If we sit on the chair, the speed changes to zero and evokes a change in acceleration. 🕺
Every type of activity has its distinct signal, which we can measure with smartphone’s sensors and classify them accordingly.
Creating constraints
Firstly, we can reduce the problem to 4 different types of movement. Even though, at first glance, there are diverse environments. However, from a phone perspective, they are similar.
- walking/running — we walk in the park, bus, street, stairs, … 🚶
- sitting — we sit on the sofa, bed, chair, bench, … 🪑
- laying down — we lay down on the couch, bed, ground, … 🛏️
- collapse/fall 🆘
Secondly, the phone is usually in the pocket of trousers or jackets. The detection does not need to be active if the phone is outside the pocket. It would lead to ambiguous detections and false positive alarms. The responsible sensor is called the proximity sensor, which dims your screen during a phone call and is available on all phones. Moreover, we can eliminate the event of falling phone on the ground. 📱
Used tools
During experiments with Android sensors, I discovered that the sensors are not reliable and unified as anyone would expect from newcomers in Android development. 😔
The sampling frequency is interchangeable in dependence on the smartphone state. If smartphone is not moving or battery is low, some models of the phones can lower sampling frequency or even stop giving you sensor samples. You do not have capability to change it, because Android has full control.
Some sensor tracking apps interpolate samples to get a stable sampling frequency. I would recommend avoiding interpolation as it requires more steps to get a signal and does not equal the raw output of the sensors.
Because of that, I created my custom Android app called SensorBox, which can record sensors in raw format and place samples into CSV files. The app also provides multiple customisable settings. You can set timers, customise the sensor settings, and add notes and custom annotations. 📄
The app supports also Wear Os, but the limitations implied by battery settings can be harsh. Moreover, the app, which you see in the playstore took to create multiple iterations. It was not the first try success building it 😄
Links to repositories:
Fall time!
With the SensorBox, I needed to find people willing to fall on the ground. Luckily, family and friends helped me out. I found 23 people ready to help.
The length of the measurements was 10 seconds, during which the volunteer did one of the mentioned events. The phone was usually placed in the pocket of trousers or jackets. We swapped multiple settings: multiple apartments with their furniture, and also we went outside.
We walked, ran, jumped, sat down on couches, beds, sofas, chairs, and laid on beds or the ground. And … of course, we simulated falling on the floor! Kind of. The ethical committee of my university approved the research under one condition: no one would get harmed. So volunteers got the fitness mats. 🏋️
They were not the softest, but soft enough to avoid bruises and other injuries. We did multiple versions of falling from standing up, walking, falling from a chair, tripping on the rope and others.
If someone is reading this from the volunteers, big thank you!
Just to be sure: No one got harmed and we had a lot of fun during the process. How many times in life, do you have opportunity to throw yourself on the ground for the sake of science 😄
Final dataset
In the end, we managed to produce a total of 3260 measurements. 131 measurements were excluded because of the invalid properties (described in the next post). In total 3129 measurements:
- 667 walks
- 840 falls
- 551 lays
- 1071 sits
With this dataset, I started working on cleaning the data, extracting features and creating a model, which we will do in the next post. See you there!