Hardware Reference
In-Depth Information
roll
surge
yaw
pitch
heave
sway
Figure 8-14
Rotations and translations of a body
in three dimensions.
Determining Pitch and Roll
from an Accelerometer
Three-axis accelerometers like the one you're using
measure the linear acceleration of a body on each axis—in
other words, the surge, sway, or heave of a body. They
don't give you the roll, pitch, or yaw. However, you can
calculate the roll and pitch when you know the accel-
eration along each axis. That calculation takes some
tricky trigonometry. For a full explanation, see Freescale
Semiconductor's application note on accelerometers at
http://cache.freescale.com/files/sensors/doc/app_note/
AN3461.pdf . Here are the highlights:
Figure 8-15
Calculating the portion of the force of
gravity based on the angle of tilt.
Z
X
The force of gravity always acts perpendicular to the
earth's surface. So when an object is tilted at an angle
(called theta, or q ), part of that force acts along the X axis
of the object, and part acts along the Y axis (see Figure
8-15). The X-axis acceleration and the Y-axis acceleration
add up to the total force of gravity using the Pythagorean
Theorem: x 2 + y 2 = z 2 .
Y
gravity
Θ
Since you know that, you can calculate the portions of the
acceleration using sines and cosines. The X-axis portion
of the acceleration is gravity * sin q , and the Y-axis portion
is gravity * cos q (remember, sine = opposite/hypotenuse,
and cosine = adjacent/hypotenuse).
 
Search WWH ::




Custom Search