# accelerometer g force/vectors

• Apr 7th 2007, 04:19 AM
IMK
accelerometer g force/vectors
Hello,

I was wondering is someone can help me please with the mathematics of forces/vectors and acceleration. Now I realize that I have a good deal to learn on the subject but as I am starting out on this venture the challenge is find the right reference,. Hence I need more than just a little help; so to the problem.

I have an accelerometer that I can read the x, y, z g forces from, and I have record two sets of data that can be found below. The first set is the static, and the second set are reading taken when the device was accelerating. The device is tiled over at 45 degrees around the y axis thus the orientation of the device is x=45, y=0, z=45 for both sets of measurements.

I can calculate the total g force from the device thus:
sqrt(x*x+y*y+z*z) and the angle of an axis thus by the cos-1 thus 0.7 g = 45 degrees.
Now this works for the static case, but does not work for the dynamic (accelerating) case. I have tried to scale the x, y, z g forces by the total g force but the cos-1 produces an incorrect result as the orientation of the device has not changed..

Can you help?

Many thanks in advance IMK

Static Data acceleromter at rest
------------------------
X | Y | Z |
------------------------
45 | 0 | 45 | Device Orientation
------------------------
0.7 | 0.0 | 0.7 | x,y,z g's. Thus sqrt(x*x+y*y+z*z)=1.0 (Scale=1/1=1)
------------------------
0.7*1 | 0.0*1 | 0.7*1 | Scale each g value thus
------------------------
0.7 | 0.0 | 0.7 | cos-1 eg acos( 0.7 ) = 45
------------------------
45 | 0 | 45 | Degress
------------------------

Dynamic Data acceleromter moved horizontally
------------------------
X | Y | Z |
------------------------
45 | 0 | 45 | Device Orientation
------------------------
1.2 | 0.0 | 0.45 | x,y,z g's. Thus sqrt(x*x+y*y+z*z)=1.28 (Scale=1/1=0.78)
------------------------
1.2*.78| 0*0.78|.45*.78| Scale each g value thus
------------------------
0.93 | 0.0 | 0.35 | cos-1 eg acos( n ) = are incorrect ?
------------------------
21 | 0 | 69 | Degress
------------------------
As the orientation of the device has not changed these angles should be:
------------------------
45 | 0 | 45 |
------------------------

• Apr 7th 2007, 04:45 AM
topsquark
x, y, and z are forces? If so, how can you be measuring a force that isn't purely in the downward direction for the static case? There is no net force because it isn't moving!

I'm rather confused. Could you please give a bit more detail about what x, y, and z are and what your "static" case is?

-Dan
• Apr 7th 2007, 05:13 AM
IMK
http://www.freescale.com/files/senso...MMA7260QFS.pdf
Above is the device, I have post processed the outputs thus my input data is calibrated to +- 1g on each of is axes. Thus the device is on my desk and I can rotate it around to axis and read plus or minus g from that axis.
If as in the example I have rotated the device at around the y axis at 45 degrees, I get 0.7g from the x and z axis and 0 g from the y axis. If I sum these I get 1 g as expected, now if I take the cos-1 of 0.7 I get 45 degress. Which compare to the device actual orientation.
If however I slide the device across my desk I get a set of dynamic values these sum to 1.28g in total as the device is accelerating, however the cos-1 of the value does not come to 45 degress. So this simple method of pridicting the device orientation does not work.
What I want to know is what is the device orientation when it is moving
• Apr 7th 2007, 05:56 AM
topsquark
Quote:

Originally Posted by IMK
http://www.freescale.com/files/senso...MMA7260QFS.pdf
Above is the device, I have post processed the outputs thus my input data is calibrated to +- 1g on each of is axes. Thus the device is on my desk and I can rotate it around to axis and read plus or minus g from that axis.
If as in the example I have rotated the device at around the y axis at 45 degrees, I get 0.7g from the x and z axis and 0 g from the y axis. If I sum these I get 1 g as expected, now if I take the cos-1 of 0.7 I get 45 degress. Which compare to the device actual orientation.
If however I slide the device across my desk I get a set of dynamic values these sum to 1.28g in total as the device is accelerating, however the cos-1 of the value does not come to 45 degress. So this simple method of pridicting the device orientation does not work.
What I want to know is what is the device orientation when it is moving

Okay, I think I see what you are trying to do here.

This example won't be your accelerometer (which is digital) but the principle involved is identical. Consider a simple pendulum: a string attached to a support and a mass (of size "m") on the bottom of the string. This is a simple accelerometer: If the string is vertical there is no acceleration in the horizontal direction.

Say there is an accleration. Netwon's 2nd says that the string will no longer be vertical: it will make an angle theta with the vertical. How do we find the acceleration?

In this case we draw a Free-Body Diagram and use Newton's 2nd to figure the horizontal component of the acceleration in terms of the measured angle. (The tension on the string is what applies the horizontal force to the pendulum mass. We calculate the horizontal component of the tension and divide by m.) The acceleration will be:
a = g*tan(theta)

As this result doesn't depend on m it will be universal in the sense that ANY accelerometer can be used and this formula applies.

If I understand your experimental setup, the answer to your question is to determine the angle your device is at by doing the static case. Then do the acceleration experiment and theta will be the difference between the measured angle of "down" and the angle you measure with the (accelerating) accelerometer. Then apply the formula.

-Dan
• Apr 7th 2007, 06:56 AM
IMK
Hello Dan, and many thanks for your reply.
Mmm again I seemed to have explained my problem poorly.
What I am trying to figure out is what this orientation of the device is when it is moving.

The two sets of example data I have used are my poor atampt at keeping the problem simple. For the static set of data the device is sitting on my desk stationary, the g values are 0.7, 0.0, 0.7 and from the cos-1 and can tell
the device is tilted over at 45 degress.
What I need is the formula by how I can tell the orientation of the device when it is in motion. As moving the device produces different g forces, however there must be a way of finding the devices orientation by the relative force to each other as the axes are all at 90 degrees to each other.

And many thanks IMK
• Apr 7th 2007, 10:08 AM
topsquark
Quote:

Originally Posted by IMK
Hello Dan, and many thanks for your reply.
Mmm again I seemed to have explained my problem poorly.
What I am trying to figure out is what this orientation of the device is when it is moving.

The two sets of example data I have used are my poor atampt at keeping the problem simple. For the static set of data the device is sitting on my desk stationary, the g values are 0.7, 0.0, 0.7 and from the cos-1 and can tell
the device is tilted over at 45 degress.
What I need is the formula by how I can tell the orientation of the device when it is in motion. As moving the device produces different g forces, however there must be a way of finding the devices orientation by the relative force to each other as the axes are all at 90 degrees to each other.

And many thanks IMK

If you know the acceleration it is under, then you can reverse what I did:
Use the acceleration to figure out what theta is, then theta is the difference between what your device measures and vertical. (This, of course, assumes all your motion is horizontal. If you are moving it through space, you'll have different "thetas" in different directions.)

-Dan