0

I'm trying to write an android code that uses the device sensors to detect freefall scenario. I searched the web a lot for a solution to this problem but I was unable to find anything useful. I did see that there are several apps that does exactly this so it is possible, but i didn't find any code sample or tutorial on how to do that. Can anyone please help me with a code snippet or even with a mathematical calculation using the sensors data?

Thanks in advance

useruser
  • 21
  • 1
  • 2

4 Answers4

1

The device is in free fall if the length of the vector given by TYPE_ACCELEROMETER is approximately zero. In theory, it should be exactly zero, in practice, it well be only near zero. So you need to come up with some threshold by trial and error and declare that the device is in free fall if the length of that vector is below this threshold.

Ali
  • 56,466
  • 29
  • 168
  • 265
0

Check out the API here SensorEvent Values and the math behind FreeFall here Wikipedia.

You are trying to detect speed in some direction. Look at the motion equations on wikipedia. You are detecting acceleration over time that is normalized for the gyroscopic rotation of the device.

Also see: How to approach Fall Detection Algorithm

Community
  • 1
  • 1
Jeremy Lyman
  • 3,084
  • 1
  • 27
  • 35
0

From what I've read, the accelerometer normally measures gravity. Thus, if you're in freefall and the device is not being moved laterally, all accelerometer readings should be zero. (Disclaimer: I have not written any accelerometer code.)

Peri Hartman
  • 19,314
  • 18
  • 55
  • 101
0

Google the iFall project by a group at Florida State University. The have published a paper describiing the approach they took for their Android iFall application, which gives a host of references for further/extended study. They also have an API available and explain how to use it, if you want a fast shortcut approach. (To use their API, I believe you just need to download and install their iFall app form the Playstore)

paulkayuk
  • 1,052
  • 1
  • 8
  • 15