Lack of moov with accelerometre

I have to detect a fall and after a lack of moov of (0.2g during 30s) but I detect a fall and never a lack of moov.AccelerometerTimed.aia (6.7 KB)
Can you help me?

Please show your relevant blocks…

Right click on the blocks editor and download blocks as image, post that instead of a screenshot to show all your relevant blocks

A developer recently had a similar request Erwan.

There are three possibilities to achieve this:

  • Accelerometer
  • Orientation Sensor
  • Gyroscope

All three tools are described in the post and the links within the post. Something their might be appropriate in your app.

Regards,
Steve

There are my relevant blocks
blocks(1)

I detect a fall but never a lack of moov.
Can you help me?
Erwan

Your app will detect zero acceleration in space, away from gravity.

ok, but what i have to do for detect zero acceleration in earth?

You might need a Clock Timer and some global list variables to track the 3 accelerations over a period of time, and calculate the variation from the mean for each acceleration. The mean won't be small because of gravity, but it should be steady.

If the variation from the mean of the acceleration sensor stays small, you are probably not moving.

You probably should not do anything Erway with the z-axis. The Earth’s gravity, at any one location does not vary significantly . It is not reasonable to use the z-axis as a criteria for movement of a person. Use the x and y, those variations should be sufficient in your app. Do not make your app more complicated than it needs to be. It it is impossible to tell the difference between gravity and a change in velocity using an accelerometer (what you have to do to detect movement using the z-axis).

My previous post shows a way to use the accelerometer to detect motion over a period of time. Did you try the example?

Regards,
Steve

You will probably need to keep

  • a global variable LastFallMS that should be set to Clock1.SystemTime each time a fall is detected,
  • a global variable LastMoveMS that is set to Clock1.SystemTime each move of 0.2g,
  • and a Clock Timer (default 1/second is okay) to compare the duration between LastMoveMS and LastFallMS to see if 30 seconds has been reached between LastFallMS and LastMoveMS.

I can't vouch for distinguishing among the x,y,z axes unless I were to know how the phone is carried (like a waiter carries a tray of drinks, or stuffed into a pocket?)

Here is an algorithm to detect a fall using an accelerometer. Try that with App Inventor to detect a fall. You can code the AI blocks.

Here is an app that can be used to determine if the Android moves during a 30 second period using the accellerator.

The sensitivity set for x and y acceleration (0.4 and -0.4) works with the hardware in my Android 8.1 tablet. With these settings, if the Android doesn’t move (sitting on a desk perhaps); it says so. If the app is on my chest and I am not breathing, it shows no movement. As soon as I stop holding my breathe, it knows I am breathing (well that my body is moving) providing the Tablet is on my chest and not in my hand. Will this work with your device? I don’t know. I hope so. If it doesn’t vary the 0.4 to higher or lower values and see what works.

AccelerometerTimed .aia (5.0 KB)

Regards,
Steve

It’s not exactly that i want, the algorithm has to progress during all a bike trek and stop just when biker falls and stays unconscious (more than 30s with an acceleration lower than 0.2g). If the biker falls, and can continuous the trek then the algorithm has to restart and will perhaps detect and other fall.
thanks for the help with the z-axis.
The phone will be in a pocket of a bag during the bike trek.

Sorry, this is not possible if you build the app with App Inventor. You need to build a Service app (one that runs in the background). App Inventor cannot do that. You could use a StayAwake routine to force the cell phone to never sleep (close the screen) but other aspects will cause issues. The other issue is ensuring the determining an acceleration lower than 0.2g (presumably so you can establish if falling is happening).

Continue to experiment certainly. My experience is you cannot reliably "stop just when biker falls and stays unconscious (more than 30s with an acceleration lower than 0.2g)" using a cell phone and App Inventor.

Good luck. Let us know what you are able to build.

But, currently It may be possible in mit ai2.

But, how? Accelerometer readings never work as we expect when the position of the phone is changed.

You may be able to do this if you include pedometer sensor as well. There is block in pedometer to stop itself if there is no movement in device. So, if there is any way to arrange blocks in such a way that If pedometer stopped, then alert 'Bike is Not Moving'.