Fall Detection with
This is my 3rd blog post for the "IoT on Wheels Design Challenge. I've explored MQTT connectivity from the STM32L476RG Nucleo board using mbed cloud environment in my previous blogIOT on Wheels Design Challenge - Smart Drive - First Steps with mbed os - Blog #2post.
There are several type of events I'd like to detect from the MCU and its sensors in my project One of them is Fall Detected event I was very happy to discover that mbed has MultiEventIKS01A2 demo application It demonstrates capabilities of different sensors including Free Fall Detection
I've compiled it and was able to run successfully on my board.
Standalone Data Logging
We are frequently taking Internet connectivity for granted. It not necessary the case everywhere in the world, and definitely may be limited or absent on the roads. As result I decided to look how can I store data on the board as it has some flash. I was not able to find examples of standalone data logging for STM32 family on mbed. It seems mbed OS 5 doesn't provide the same easy way to access persistent memory as I've got used to on popular x86 or ARM based Linux boards.
Then I've read documentation on X-CUBE-MEMS1 package for expansion board on a or development boards It as well comes with MotionFD fall detection library which receives the data acquired from the accelerometer and
pressure sensor to detect fall event; it features:
- possibility to distinguish whether the user fall occurred or not
- recognition based only on accelerometer and pressure sensor data
- required accelerometer and pressure sensor data sampling frequency is 25 Hz
- occupies 2.4kByte of code memory and 3.4kByte of data memory
But the most interesting for me feature was standalone data logging. It is using the flash sector dedicated to data storage (128 KB), allowing memorization of more than 16,000 data sets.
The documentation for X-CUBE-MEMS1 describes use of Unicleo-GUI to visualize in real-time data captured from the board/sensors. I've compiled and loaded Fall Detection application form X-CUBE-MEMS1 to the board. Unicleo-GUI was able to recognize my board.
It provides different visualization tools for different sensor types. The following one was for magnetometer:
There is one for environment:
I was a bit surprised by humidity sensor as it fluctuated a lot without any changes in the environment other then my attempts to emulate falls..
There is another visualization tool for motion sensors:
You can see there some large green spikes at times when I was trying to test falls. Unicleo-GUI has as well a GUI for fall detection:
But for some reason it hasn't detected falls compare to mbed sample, which was able to detect them quite reliably.
In addition Unicleo-GUI allows to record all sensor reading in CSV format, so they can be analyzed to tune parameters of the algorithms.
I've found the following STM User Manuals very useful in my exploration:
UM2275, Getting started with MotionFD real-time fall detection library in XCUBE-MEMS1 expansion for STM32Cube
UM1859, Getting started with the X-CUBE-MEMS1 motion MEMS and environmental sensor software expansion for STM32Cube
UM2128, Getting started with Unicleo-GUI for motion MEMS and environmental sensor software expansion for STM32Cube