13
$\begingroup$

I am working on an Android app to use its 3-axis inbuilt accelerometer to find if the phone falls.

I googled and found that if the following value is less than 2:

$$a = \sqrt{x^2 + y^2 + z^2}$$

(where $x, y, z$ are the readings from accelerometer)

Then the device is considered to be free-falling.

I'm not sure how does this approach detect free-falling and where does the condition $a < 2$ come from.

Could anyone explain it?

$\endgroup$
1
  • 2
    $\begingroup$ Hello! To have a discussion with an answerer, please comment under their answer. Check the edit history (by clicking the “edited X ago” link) to find your remarks. $\endgroup$
    – rob
    Commented Apr 3, 2022 at 12:36

1 Answer 1

34
$\begingroup$

TL;DR: Accelerometer records the $x,y,z$ projections of acceleration $\vec{a_r} = \vec{a} - \vec{g}$, where $\vec{a}$ is the total acceleration of the object.

When the object is free-falling, the recorded acceleration $\vec{a_r}$ is zero until air resistance force is large enough. Speed increase could lead to air resistance acceleration being as much as 1 $\frac{m}{s^2}$ (0.1 G) on the drops around 1 - 1.5 meters. Recorded acceleration modulo is calculated as $\sqrt{x^2 + y^2 + z^2}$ ($x,y,z$ - the readings from accelerometer). This is essential info to detect free-fall of your phone.

When your device rests on your desk, or in the palm of your hand, or on anything which causes it not to fall, there're two forces applied to the object: the force of gravity and the normal (ground reaction) force. Having opposite direction and being equal by modulo, these forces essentially compensate each other (so the object doesn't move) while "squeezing" the object, sort of.

I mean, consider this simple image, which you could have seen in a school book:

How can we describe these pics?

  1. The object is static. If this object is you, you can feel that you're pushed against the ground. That's the normal force. You can definitely feel the gravity, but you do feel it just because the normal force is present.

  2. The object is falling. Again, if that's you, you would feel like you're floating (if we don't account the air resistance for simplicity). You can't feel the gravity, since there's nothing that stops your movement - all the gravity force goes into accelerating you and nothing prevents it.

That's because we're under a constant (for a fixed height above the Earth) gravitational force. What does it imply?

  1. If an object doesn't move, that means something prevents it. In this case, something stops an object with an acceleration of $g = 9.8$ $\frac{m}{s^2}$, with the direction of acceleration vector being opposite to the vector of gravity.
  2. If an object falls, that means that either nothing stops it (that's free-falling), or something stops the object with an acceleration less than $g = 9.8$ $\frac{m}{s^2}$ (to be more specific, the projection of stopping acceleration on the $z$ axis is less than $g = 9.8$ $\frac{m}{s^2}$)

Thanks to this definition, we could now move on to the next step:

What data an accelerometer gives to us?

Basically, accelerometer is giving us an information for the 3 projections (x, y, z) of the recorded acceleration.

Important note: although I've stated that already, it's necessary to understand the actual acceleration of the object is not the acceleration, recorded by the accelerometer. Accelerometer records the force $\vec{F} = (\vec{a} - \vec{g})m$ that stops it from free-falling, that could include the ground reaction force or the air resistance force, or any other force applied to the object.

But for the sake of simpleness let's consider a 2D world, with just two axis: x and y. Here you can see what data captures an accelerometer when an object stays on the ground and when it's tilted by 45 degrees (although still static):

There's much fun drawing this and all, but an important conclusion would be: the accelerometer will calculate an acceleration of approx $g = 9.8$ $\frac{m}{s^2}$ (vector parallel to gravity force) if it's static, i.e. when it's not falling

Let's consider another two examples:

  1. An object is moving towards the ground with an acceleration less than $g = 9.8$ (falling). This means that the platform under the object is also accelerating towards the ground, but not free-falling either.

  2. An object is moving towards the ground with an acceleration of approx $g = 9.8$ (free-falling). This means there's no platform or any support under the object.

In the first case, the total acceleration obtained from accelerometer would be approx $6.8$ $\frac{m}{s^2}$, in the second case - approx $0$ $\frac{m}{s^2}$.

In the both cases the object can be considered as falling, since the acceleration is less than $g = 9.8$ $\frac{m}{s^2}$

So, what's the formula?

Now we can finally understand a formula.

An total modulo acceleration, obtained from the acceleration, would be:

$$|a| = \sqrt{x^2 + y^2 + z^2} $$

If the formula is unclear, you could refer Pythagorean theorem, one of our favorite school theorems:

In the same way you can calculate the acceleration vector length, where x, y, z are the projections. If the term "projection" is unclear, here's a quick explanation: take a stick in the sunny day, its shadow will be its projection.

As we remember, we can consider that the device is falling if $|a|$ is less than 9.8, but that doesn't account for a calculation error and air resistance.

Experiment

In your case, you're mentioning that a phone can be considered to be falling if $|a|$ is less than $2$. That is valid for a rough approximation (20%), but not necessary at least for iPhones on small drops (without much air resistance). I have dropped my iPhone on the bed and measured the following accelerations during the 1.5 meter fall:

X Y Z t (time)
-0.016 -0.03 -0.151 0.00s
-0.021 0.015 -0.13 0.04s
-0.023 0.013 -0.202 0.08s
-0.016 0.014 -0.245 0.12s
-0.017 0.017 -0.308 0.16s
-0.028 0.02 -0.399 0.20s
-0.017 0.026 -0.462 0.24s
-0.019 0.023 -0.545 0.28s
-0.023 0.023 -0.622 0.32s
-0.031 0.021 -0.717 0.36s

Table 1. Raw X/Y/Z accelerometer input.

Upon calculating the acceleration with formula, we get these values for the beginning of the fall:

Acceleration Mistake or/and air resistance hit
0.154 ~ 1.5%
0.132 ~ 1.3%
0.203 ~ 2%
0.245 ~ 2.4%
0.308 ~ 3.1%
0.4 ~ 4%
0.463 ~ 4.7%
0.545 ~ 5.5%
0.622 ~ 6.3%
0.739 ~ 7.2%

Table 2. Calculated acceleration and its mistake.

Mistake (Y) and the time (X) plotted

As we can see, the mistake varies with a increasing pattern.

Interesting observations

I believe that an increasing mistake is present because of air resistance. My phone is huge, and I dropped it flat parallel to the ground, that accounts for the maximal possible air resistance - that's exactly what the $Z$ axis values tell us (I mean, check the last column of the table 1).

I realize I could also drop it on the side to prove the point, but I'm just afraid that it jumps of the bed (or could it? that's another question...).

Conclusion

A mistake of 20% sounds like an overkill to detect a start of falling.

Although, if you would like to account the whole process of falling, it could be just enough - it just depends on how much the acceleration slows down during the fall. That said, I doubt that there's any point accounting for mile-height drops, because well... the phone's not likely to last.

Another interesting task would be to record the end of falling. That's not that difficult - an impact will make an acceleration to suddenly jump to 5G's (50 $\frac{m}{s^2}$) and even more, which would make it easy to detect. I have got about 7.5 G's peak while dropping my phone onto the bed from the height of about 1 meter.

$\endgroup$
14
  • 6
    $\begingroup$ 888 words, that would likely make a longest answer of mine $\endgroup$
    – nicael
    Commented Apr 1, 2022 at 12:54
  • 2
    $\begingroup$ I haven't managed to understand why the error/time graph looks pretty linear at least during the 0.12 - 0.36s of the fall (isn't air resistance supposed to be like v^2?). As for the first 0.00s - 0.12s, I believe there maybe there's a little friction width my fingers after I've almost released the iPhone but it hasn't left the "starting" position completely. $\endgroup$
    – nicael
    Commented Apr 1, 2022 at 17:06
  • 4
    $\begingroup$ OK, thanks! I upvoted. It is a thorough answer. $\endgroup$
    – hft
    Commented Apr 1, 2022 at 19:26
  • 2
    $\begingroup$ @Rhino hello! Unfortunately I do not have an android phone, I have downloaded "Accelerometer" app on my iPhone. But you could search Play Store (or any other app store that your phone suppors) for the application with a name similar to "Accelerometer" $\endgroup$
    – nicael
    Commented Apr 1, 2022 at 19:35
  • 2
    $\begingroup$ @nicael. Thank you very much for your well elaborate answer and it means a lot to me , I have summarise my understanding in my question , can you please correct me if I understood wrong $\endgroup$
    – tomtom
    Commented Apr 2, 2022 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.