Yes you are right, if you put the device into your pocket, it could go horizontal and then generate false alarms.
That's the reason why I use it as a necklace pendant. The center of gravity being rather low it stays vertical.
The detection proccess is double :
- internal motion detection into the MPU6050 (look for Digital Motion Processor :
http://playground.arduino.cc/Main/MPU-6050)
- confirmation of position with the ESP8266
I have tuned the MPU6050 thresholds in order to generate a detection when you jump or sit down "strongly", so I do rely on the second check to avoid "false positives".
The "vertical condition" is in fact a cone of +-45° around the vertical.
And surprisingly it works very very well with no false detection provided you keep the device almost vertically.
I have tested it in various conditions :
- walk (no detectiopn at all)
- run (no detection)
- jump (motion detection only)
- sit normally (no detection)
- sit strongly (motion detection only)
- lie gently (no motion detection)
- lie strongly (motion detection and position) --> alarm
So you can take elevators, drive a car, it will works when you stay "vertical"
you can bend a little, it won't detect an alarm
The only conditions of no detection of a real fall could be :
- you slide on a wall and your chest remains vertical (motion detection but no alarm)
- you collapse "smoothly" without rapid motion (no motion detection).
Most of commercial system rely on a strong motion detection followed by no motion at all and this is not good if you break a leg, still can move your body but are forced to stay of the ground...
I started my researchs on internet and found a very interesting thesis :
Design of a Fall Detection and Prevention System for the Elderly
I have based my design on this paper.