4

Is it possible to use the accelerometer to detect height? For instance, if I'm holding the phone on my hand and then detect the height after raising my arm?

Thanks

Rui
  • 63
  • 1
  • 1
  • 4

5 Answers5

5

Assuming you mean you want to detect the height the phone was raised from its staring point, yes. The android accelerometer measures force, more info on how to use it can be found here. Keep in mind that the accelerometer isn't a perfect device, and so your results will be approximations of how much the phone was really moved.

brc
  • 5,281
  • 2
  • 29
  • 30
  • 1
    This is a good-enough answer. The main thing you should know is that using the accelerometer for this purpose will be at best a bit painful to implement on various devices and at worst, extremely inaccurate. – Jon Willis Sep 18 '11 at 16:58
5

The inaccuracy of the accelerometer will be insignificant when compared to the error caused by an unstable accelerometer. What I mean by this is the fact that as you move your phone you will not be able to keep the accelerometer orientated perfectly i.e. you will 'naturally' rotate it about its longitudinal,lateral and azimuth axes. This means that a vertical acceleration will partly be felt in all the above axes and result in an error if you were to just integrate twice the vertical acceleration measurement.

There are ways to eliminate this error which involve gyroscopes but that requires some complicated mathematics and gyros to be fitted in your phone as well.

In theory you can integrate an accelerometer's output but in a real-world device there are practical issues you must overcome.

D-Dᴙum
  • 7,689
  • 8
  • 58
  • 97
1

Yes, bt you need to integrate the output twice and add in the two integration constants - initial velocity and displacement.

Rgds, Martin

Martin James
  • 24,453
  • 3
  • 36
  • 60
0

First of all you measure Linear acceleration and gravity together (also some noise) So it means when you are using accelerometer you will get Accelerometer Readings = Linear Acc. + Gravity + Noise Here you just only need Linear Acc. but the Accelerometer reads all the values

fakturk
  • 415
  • 7
  • 16