Accelerometer's angle from ground to sky

In summary, the program fails to properly account for the user's arm rotating and for the device being attached to the arm in a non-perfect way.
  • #1
craftingcode
2
0
I'm so over my head that I don't even know how to ask this, but here goes...

The accelerometer in my device (an iPhone) gives an x,y,z vector that points to Earth. I'm using these values to determine the angle of the device relative to the horizon. Visualize a user aiming the device at a point in the sky; the device attempts to calculate the angle from the horizon to the point in the sky. It currently computes this using the "y component to vector magnitude" ratio. Specifically, angle = asin(y / sqrt(x^2 + y^2 + z^2).

Now comes the part that's killing me. The user aims their arm, rather than the device, at a point in the sky. The device is attached, via an armband, to the user's pointing arm. Unless the device is attached EXACTLY parallel to the arm, the angle doesn't truly reflect where the arm is pointing. I'm trying to implement a calibration step to compensate for the difference between the device vector and the arm vector, but it's not going so well.

Right now my calibration step has the user extending their arm straight out in front and parallel to the ground. I hoped this would tell me how closely the arm's and device's y components align. It seemed obvious enough: if the user's arm is parallel to the ground, their arm is at y = 0; therefore, the offset from arm y to device y must be the current device y reading. By negating the current device y reading we have the transform from device y to arm y. Of course my calibration doesn't work. There are at least two problems with it: the user's arm twists (i.e. the elbow angle relative to the ground isn't fixed) and the device is almost guaranteed to slope toward or away from the arm.

Please let me know if you understand what I'm asking (I know I wouldn't) and would like me to elaborate on anything.

Thanks.
 
Physics news on Phys.org
  • #2
craftingcode said:
There are at least two problems with it: the user's arm twists (i.e. the elbow angle relative to the ground isn't fixed)
Calibration : Point the arm down to the ground vertically, and remember that accelerometer vector as your pointing direction vector.

Later, to get the angle over horizon : Compute the angle between the current accelerometer vector and the saved pointing direction vector minus 90°.
craftingcode said:
and the device is almost guaranteed to slope toward or away from the arm.
That cannot be solved by the program. The device must be fixed rigidly to the arm.
 
Last edited:
  • #3
A.T. said:
Calibration : Point the arm down to the ground vertically, and remember that accelerometer vector as your pointing direction vector.

Later, to get the angle over horizon : Compute the angle between the current accelerometer vector and the saved pointing direction vector minus 90°.

That cannot be solved by the program. The device must be fixed rigidly to the arm.

A.T, thanks for taking the time to read and reply to my post.

I tried calibrating with the arm pointing down and had the same problems. The extreme case makes it easiest to visualize. Extreme case: user mounts the device at 90 degrees (i.e. the x reading, rather than the y reading, runs parallel to the arm). Now imagine that the user calibrates with their hand flat (like a karate chop) at their side. As they raise their hand to point to the horizon, consider the case where their hand rotates 90 degrees. Now there is a discrepancy between the device's calibration orientation and its runtime orientation. When calibrated the y acceleration ran along the yz plane; at computation time the y acceleration runs along the xz plane. In this extreme case the computed accelerometer y difference is zero even though the two positions are very different.

Sorry about not being clear with my use of the term slope. I didn't mean that the device vacillates or wobbles; the device is assumed to be rigidly attached to the arm. I meant how flatly the device was attached to the arm. Unless the users arm is perfectly flat, one side of the device, top or bottom, is going to be closer than the other to the arms center. Said differently, the radius of the arm isn't constant; this causes the device to slope toward or away from the elbow when attached via an armband.

Thanks again.
 
  • #4
craftingcode said:
A.T, thanks for taking the time to read and reply to my post.

I tried calibrating with the arm pointing down and had the same problems.

If I understand your calibration correctly, you stored just an offset number (y). That is not enough information. You have to store the entire 3D-vector of down-direction during calibration (hand points down). And during operation compute the 3D-angle between two 3D-vectors: calibration-down-direction and current-down-direction.

With the above method it is completely irrelevant how the device is oriented relative to the arm, as long as it keeps that orientation.
 
Last edited:
  • #5


Dear user,

Thank you for reaching out with your question about the accelerometer's angle from ground to sky. It sounds like you are trying to calibrate the device to accurately measure the angle of the user's arm when aiming at a point in the sky. I can understand your frustration with this process, as it can be challenging to account for all the variables involved.

Firstly, I would like to clarify that the accelerometer measures the acceleration of the device, not the angle. However, by using the x, y, and z values, we can calculate the angle using the equation you provided. This angle represents the orientation of the device relative to the horizon, not the angle of the user's arm.

To accurately measure the angle of the user's arm, we need to consider the orientation of the device in relation to the arm. As you mentioned, the device may not always be perfectly parallel to the arm, which can affect the accuracy of the measurement. One way to address this is to incorporate a gyroscope, which can measure the device's orientation in space and adjust the angle calculation accordingly.

Additionally, as you mentioned, the user's arm may twist or the device may slope, which can also impact the accuracy of the measurement. In these cases, it may be helpful to have the user perform multiple calibration steps in different positions to get a more accurate average reading.

I hope this helps clarify the issue you are facing. If you have any further questions or would like more information, please don't hesitate to ask. As scientists, we are always striving to improve our methods and technologies, and I am confident that with persistence and experimentation, you will be able to find a solution that works for your needs.

Best,
 

1. What is an accelerometer?

An accelerometer is a device that measures acceleration, which is the rate of change of velocity in an object. It typically does so by measuring the force exerted on a mass by a spring or other material.

2. How does an accelerometer measure the angle from ground to sky?

An accelerometer measures the angle from ground to sky by detecting changes in acceleration caused by the gravitational force pulling on the device. By analyzing these changes, the accelerometer can determine the orientation of the device and therefore the angle from ground to sky.

3. What are some common uses for an accelerometer?

Accelerometers are frequently used in smartphones, fitness trackers, and other devices to track movement, orientation, and activity. They are also used in aircrafts, cars, and other vehicles to measure acceleration and detect changes in motion.

4. Can an accelerometer measure angles other than from ground to sky?

Yes, an accelerometer can measure angles in any direction as long as it is able to detect changes in acceleration along that direction. Some accelerometers are specifically designed to measure angles in all three dimensions, while others may only measure along a single axis.

5. How accurate is an accelerometer's measurement of the angle from ground to sky?

The accuracy of an accelerometer's measurement of the angle from ground to sky depends on several factors such as the quality of the device, external factors like temperature and air pressure, and the calibration of the device. Generally, accelerometers have a high level of accuracy and can measure angles with a precision of 0.1 degrees or less.

Similar threads

Replies
4
Views
8K
Replies
8
Views
2K
Replies
14
Views
381
Replies
28
Views
880
  • Programming and Computer Science
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
3
Views
1K
  • Mechanics
Replies
4
Views
3K
  • Calculus and Beyond Homework Help
Replies
8
Views
474
  • Introductory Physics Homework Help
Replies
1
Views
2K
Back
Top