0
$\begingroup$

I am taking readings from the accelerometer of a smartphone and want to account for gravity. My device reports residual gravity as "10g" (device stationary, screen facing up).

  • As the angle of the device is adjusted to ~45° in the Z-Y plane (stationary, screen angled back) the Z-plane reads ~7g and the Y-plane reads ~7g for a total of ~14g.
  • As the angle is flattened to ~22° (or when raised to ~67°) the figures change to ~8g/~4g respectively for a sum of ~12g.
  • And as the angle lowers to 0° (or raises to 90°) the sum approaches the residual 10g in a single plane.

This change appears very rhythmic, is there a constant formula using the relationship of the Z & Y values where I can calculate the residual gravity of each the Z & Y planes no matter the angle of the device (assumed only between 0° and 90°)?

There are similar accelerometer questions pertaining to the complexities of calculating velocity too. I only seek a simple method to calculate residual gravity in 2 planes from a fixed position.

$\endgroup$
1
$\begingroup$

As the angle of the device is adjusted to ~45° in the Z-Y plane (stationary, screen angled back) the Z-plane reads ~7g and the Y-plane reads ~7g for a total of ~14g.

The device is sending you the component of the net acceleration in that direction. If you want the magnitude of the total acceleration, you have to do vector addition. In your example:

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

If this value differs from the value you have when static, then the device is accelerating. Without knowing the orientation, that's about all the information you have.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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