henmina53
Posts: 20
Joined: Thu Apr 05, 2018 4:49 am

Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 5:05 am

Hi
I am using Accelerometer sensor https://store.ncd.io/product/lsm9ds0-3d ... ni-module/ using IC LSM9DS0 and was trying to detect the free fall by using this sensor but I am not aware about how can I detect the free fall, till now I have only detect the motion which is also done by using arduino Uno but for internet connectivity I have been thinking to use raspberry pi and send the sensor data to Firebase,

if any ever worked on this kind of sensor, your suggestion will be much helpful.

Note: Accelerometer is using IC LSM9DS0 which sense is also known as 3D Accelerometer Gyroscope Magnetometer IC

Heater
Posts: 12654
Joined: Tue Jul 17, 2012 3:02 pm

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 7:15 am

When an object is at rest on the surface of the Earth, say sitting stationary on your desk, it experiences a 1g downward acceleration. You can easily see this, if one of your accelerometer axis is vertically aligned it will read minus 1g (In whatever units the device is using). Meanwhile the other axis will read zero.

Contrary to popular misconception when an object is in free fall it experiences no acceleration in any direction. All axis will read zero.

This is counter intuitive as the object will of course now be accelerating downwards with the acceleration due to gravity. The object itself does not know this, it may as well be just floating in free space, so all will axis read zero.

This is also true if you were to throw the thing across the room. As it flies up, reaches a maximum height and then falls down again it will experience no acceleration, all accelerometer axis will read zero.

W. H. Heydt
Posts: 10317
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 5:24 pm

Plus a small acceleration caused by drag from air.... (For true zero g, you need to be in a vacuum. Being on the ISS counts as being in a vacuum for this purpose. There is an exception for powered flight designed to counteract the air drag, as practiced by the Vomit Comet.)

Heater
Posts: 12654
Joined: Tue Jul 17, 2012 3:02 pm

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 6:14 pm

Yeah, that as well.

Also if your object is spinning whilst free falling and the accelerometer is not exactly at the center of mass of the object it will read some acceleration due to centrifugal force.

But hey, let's start from basics.

W. H. Heydt
Posts: 10317
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 6:23 pm

Heater wrote:
Tue Jul 17, 2018 6:14 pm
Yeah, that as well.

Also if your object is spinning whilst free falling and the accelerometer is not exactly at the center of mass of the object it will read some acceleration due to centrifugal force.
Centripetal force, actually.
But hey, let's start from basics.
Yes...apply the old programming trick when it comes to floating point numbers. Don't look for an exact value (zero in this case), but check for a value within some small increment of the number. One could conclude that the device is in free fall if the absolute value of the acceleration on each axis is less that, say, 0.01 or even 0.001 g (the latter being about 1 cm/sec/sec).

User avatar
bensimmo
Posts: 4065
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 6:53 pm

While this has drifted and centripetal is a resultant "force"...
And an accelerometer is measuring in all three axis anyway..

I think you are missing something (possibly). Many of these sensors have in built free fall detection. I don't think this is one of them.
ADXL345 does have this.


Of course you could just check in software quickly (not as fast as, and more CPU intensive than an inbuilt interrupt I would guess).
That either the resultant of all three axis is close to 0 (you'll need a trigger threshold).
Or forget the maths and just check all three axis are below said threshold at the same time.
Trial and error on the threshold will be needed.
Last edited by bensimmo on Tue Jul 17, 2018 7:08 pm, edited 2 times in total.

Heater
Posts: 12654
Joined: Tue Jul 17, 2012 3:02 pm

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 6:55 pm

W. H. Heydt,
Centripetal force, actually.
I was certain someone would pick up on that when I wrote it. They always do. It's some silly thing kids get taught in school.

You know, if you tie a rock to a rope and get it spinning around and around over your head, that rope does not know or care if it's "centrifugal" or "centripetal" that is stretching it out. Cut the rope and tie a spring balance in there and it will measure the force. It cannot tell you which way it is going either.

So, I say, meh, "centripetal", "centrifugal", makes no odds. Just be sure to get your signs right in any calculations.

What one should really do is for a vector in 3D space from the three components of acceleration reported by the accelerometer and check that the magnitude of that vector is small enough to indicate a free fall condition.

Amag = sqrt(Ax^2 + Ay^2 + Az^2)

Heater
Posts: 12654
Joined: Tue Jul 17, 2012 3:02 pm

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 6:56 pm

bensimmo,
Many of these sensors have in built free fall detection.
That is cheating :)

User avatar
bensimmo
Posts: 4065
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 7:07 pm

I edited with a bit and cannot type quick enough.
You don't really need the maths, just a basic check. But fast polling is CPU intensive and you need to ommit false positives, maybe not the best word, but brief passthrough moments of 'freefall' and you ahooen to measure it.

I don't think anything can be made useful from the gyroscope other than to detect rotation.

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: Free Fall detection through Accelerometer using raspberry pi

Tue Jul 17, 2018 11:30 pm

Centrifugal force is the apparent effect of a centripetal acceleration. An accelerometer would measure the acceleration, not a force.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

henmina53
Posts: 20
Joined: Thu Apr 05, 2018 4:49 am

Re: Free Fall detection through Accelerometer using raspberry pi

Thu Jul 19, 2018 11:39 am

Hello All,
thanks a lot for your reply finally after searching as well as going with your suggestion I finally found a code which i am modifying as per your suggestions but still no progress but any suggestions to give modification will help me a lot.
bensimmo wrote:
Tue Jul 17, 2018 6:53 pm

I think you are missing something (possibly). Many of these sensors have in built free fall detection. I don't think this is one of them.
ADXL345 does have this.
Yes ADXL345 has register and by some conversion will be able to achieve but as per me this kind of sensor will be much more useful to vibration as well free fall analysis which has limitless uses with different types of electrical machines.

User avatar
bensimmo
Posts: 4065
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Free Fall detection through Accelerometer using raspberry pi

Thu Jul 19, 2018 12:06 pm

The LSM9DS0 is also the IC on the SenseHAT, for that they use RTIMULib to do the hard work and initialise it.

https://github.com/mrbichel/RTIMULib
https://github.com/richardstechnotes/RTIMULib2
possibly a different way to go about it ?

Return to “General discussion”