dm00119046

AN4509
Application note
Tilt measurement using a low-g 3-axis accelerometer
Introduction
This application note describes tilt sensing theory and the methods of determining tilt angle
measurement of a low-g 3-axis accelerometer. In general, the procedures described here
may also be applied to 3-axis analog or digital accelerometers, depending on their
respective specifications.
June 2014
DocID026445 Rev 1
1/10
www.st.com
Contents
AN4509
Contents
1
2
2/10
Calculating tilt angles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1
Theory of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2
Tilt sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.1
Single-axis tilt sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.2
Dual-axis tilt sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2.3
Tri-axis tilt sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
DocID026445 Rev 1
AN4509
List of figures
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Tilt measurement using a single axis of the accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . 4
360° rotation of a single axis of the accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Plot of 360° rotation of a single axis of the accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Tilt sensitivity of a dual-axis accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Tilt angles from a tri-axis accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Tilt sensitivity of a tri-axis accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
DocID026445 Rev 1
3/10
10
Calculating tilt angles
1
AN4509
Calculating tilt angles
Low-g MEMS accelerometers are widely used for tilt sensing in consumer electronics and
industrial applications, such as screen rotation and automobile security alert systems.
Another popular application for low-g accelerometers is tilt-compensated electronic
compasses for map rotation and personal navigation devices. This application note
describes how to obtain accurate tilt measurements with respect to local Earth horizontal
plane, by compensating for a few non idealities that may cause angular tilt calculation error.
For detailed information and device specifications, refer to the respective accelerometer
datasheet available at http://www.st.com. In general, 3-axis analog or digital accelerometers
may also be used, in accordance with their respective specifications.
1.1
Theory of operation
Figure 1 shows the single sensing axis of the accelerometer for tilt measurement.
Figure 1. Tilt measurement using a single axis of the accelerometer
6HQVLQJ$[LVRIWKHDFFHOHURPHWHU
Į
$
J
Į
Į
+RUL]RQWDOSODQH
$0Y
The accelerometer measures the projection of the gravity vector on the sensing axis. The
amplitude of the sensed acceleration changes according to the sine of the angle  between
the sensing axis and the horizontal plane.
Equation 1
Using Equation 1, it is possible to estimate the tilt angle,
Equation 2
where:

A = acceleration measured

g = Earth’s gravity vector
4/10
DocID026445 Rev 1
AN4509
Calculating tilt angles
A single axis of the accelerometer with 360° rotation is shown in Figure 2 and 3.
Figure 2. 360° rotation of a single axis of the accelerometer
J
D[ J ƒ
;
Į
D[ ƒ
D[ J ƒ
$0Y
Figure 3. Plot of 360° rotation of a single axis of the accelerometer
$FFHOHUDWLRQ>J@
$QJOH>ƒ@
$0Y
1.2
Tilt sensing
1.2.1
Single-axis tilt sensing
From Figure 2 and 3, it can be observed that the sensor is most responsive to changes in tilt
angle when the sensing axis is perpendicular to the force of gravity. In this case, the
sensitivity is approximately 17.45 mg/° [= sin(1°) - sin(0°)]. Due to the derivate function of
the sine function, the sensor has lower sensitivity (less responsive to tilt angle changes)
when the sensing axis is close to its +1 g or -1 g position. In this case, sensitivity is only
0.15 mg/° [= sin(90°) - sin(89°)]. Table 1 shows the sensitivity at different tilt angles. In other
words, the sine function has good linearity at [0° 45°], [135° 225°] and [315° 360°] as shown
in Figure 3.
DocID026445 Rev 1
5/10
10
Calculating tilt angles
AN4509
Table 1. Tilt sensitivity of single axis accelerometer
1.2.2
Tilt [°]
Acceleration [g]
g /° [mg/°]
0
0.000
17.452
15
0.259
16.818
30
0.500
15.038
45
0.707
12.233
60
0.866
8.594
75
0.966
4.37
90
1.000
0.152
Dual-axis tilt sensing
When a dual-axis tilt sensing approach is used, the user should be aware of two different
situations in which this approach could limit overall accuracy or even inhibit tilt calculation.

Figure 4, Example A: Rotate the accelerometer counter-clockwise around the dotted
arrow with  angle. When  is less than 45°, the X-axis has higher sensitivity, while the
Y-axis has lower sensitivity. And when  is greater than 45°, the X-axis has lower
sensitivity while the Y-axis has higher sensitivity. Therefore, when the two-axis
approach is used, it is always recommended to calculate the angle based on the
orthogonal axis to a ±1 g condition.

Figure 4, Example B: At this position, both the X and Y axes have high sensitivity.
However, without the help of a third axis (for example the Z-axis), it is impossible to
distinguish a tilt angle of 30° from one of 150° because the X-axis has the same
outputs at these two tilt angles.
Figure 4. Tilt sensitivity of a dual-axis accelerometer
([DPSOH%
([DPSOH $
ȕƒ 6\PJƒ
ȕ!ƒ 6\!PJƒ
ƒ
<
ƒ
J
J
ȕ
;
;
<
$0Y
6/10
DocID026445 Rev 1
AN4509
1.2.3
Calculating tilt angles
Tri-axis tilt sensing
With a 3-axis accelerometer, the user can use the Z-axis to combine with the X and Y axes
for tilt sensing in order to improve tilt sensitivity and accuracy (see Figure 5).
There are two ways to calculate 3 tilt angles in Figure 5. The first is to use basic
trigonometric Equation 3, 4 and 5, where Ax1, Ay1 and Az1 are the values obtained after
applying accelerometer calibration on raw measurement data (Ax, Ay, Az):
Equation 3
Equation 4
Equation 5
Figure 5. Tilt angles from a tri-axis accelerometer
Į
;
ȕ
<
Ȗ
=
$0Y
The second way is to use trigonometric Equation 6 and 7 to calculate pitch and roll tilt angle,
which produces constant sensitivity over 360° of rotation, as shown in Figure 6.
Equation 6
Equation 7
DocID026445 Rev 1
7/10
10
Calculating tilt angles
AN4509
Figure 6. Tilt sensitivity of a tri-axis accelerometer
$UFVLQ;
$UFFRV=
$UFWDQ;=
7LOWVHQVLWLYLW\>PJƒ@
8/10
7LOWLQJ>ƒ@
DocID026445 Rev 1
$0Y
AN4509
2
Revision history
Revision history
Table 2. Document revision history
Date
Revision
10-Jun-2014
1
Changes
Initial release.
DocID026445 Rev 1
9/10
10
AN4509
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
ST PRODUCTS ARE NOT DESIGNED OR AUTHORIZED FOR USE IN: (A) SAFETY CRITICAL APPLICATIONS SUCH AS LIFE
SUPPORTING, ACTIVE IMPLANTED DEVICES OR SYSTEMS WITH PRODUCT FUNCTIONAL SAFETY REQUIREMENTS; (B)
AERONAUTIC APPLICATIONS; (C) AUTOMOTIVE APPLICATIONS OR ENVIRONMENTS, AND/OR (D) AEROSPACE APPLICATIONS
OR ENVIRONMENTS. WHERE ST PRODUCTS ARE NOT DESIGNED FOR SUCH USE, THE PURCHASER SHALL USE PRODUCTS AT
PURCHASER’S SOLE RISK, EVEN IF ST HAS BEEN INFORMED IN WRITING OF SUCH USAGE, UNLESS A PRODUCT IS
EXPRESSLY DESIGNATED BY ST AS BEING INTENDED FOR “AUTOMOTIVE, AUTOMOTIVE SAFETY OR MEDICAL” INDUSTRY
DOMAINS ACCORDING TO ST PRODUCT DESIGN SPECIFICATIONS. PRODUCTS FORMALLY ESCC, QML OR JAN QUALIFIED ARE
DEEMED SUITABLE FOR USE IN AEROSPACE BY THE CORRESPONDING GOVERNMENTAL AGENCY.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
© 2014 STMicroelectronics - All rights reserved
STMicroelectronics group of companies
Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Philippines - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America
www.st.com
10/10
DocID026445 Rev 1