dm00119044

AN4508
Application note
Parameters and calibration of a low-g 3-axis accelerometer
Introduction
This application note describes the parameters and calibration 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.
Section 1 of this application note introduces the terminology and parameters related to the
accelerometer, while Section 2 presents the accelerometer calibration techniques.
June 2014
DocID026444 Rev 1
1/13
www.st.com
Contents
AN4508
Contents
1
2
Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1
Accelerometer datasheet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2
Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Calibrating the accelerometer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Appendix A Least square method. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2/13
DocID026444 Rev 1
AN4508
List of figures
List of figures
Figure 1.
Figure 2.
Figure 3.
Accelerometer inside a handheld device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Pitch definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Roll definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
DocID026444 Rev 1
3/13
13
Terminology
AN4508
1
Terminology
1.1
Accelerometer datasheet
The first step is to examine the accelerometer specifications and understand the meaning of
each parameter.
Understanding the parameters










4/13
Vdd - Power supply: This parameter defines the accelerometer operating DC power
supply. Correct operation of the accelerometer using a power supply voltage outside of
this range is not guaranteed. The parameters are provided by the accelerometer
manufacturer under Vdd = +2.5 V at a room temperature of T = 25 °C. It is
recommended to keep Vdd clean, with minimum ripple. One possible way to do this is
to use an ultra-low-noise low-dropout regulator to power the accelerometer.
Idd - Current consumption in normal mode: lower ODR corresponds to lower current
consumption.
ODR - Output data rate in normal mode: This parameter shows the possible output
data rates in normal mode from which the user may select.
BW - System bandwidth: This parameter defines the bandwidth of the system. When
ODR = 100 Hz, BW is typically 50 Hz with a built-in low pass filter. The system
recognizes any motion below 50 Hz. If the system has dynamic motion higher than
50 Hz, then the ODR needs to be increased to a higher setting in order to cover all
useful system signals.
Ton - Turn-on time: This parameter defines the time required before the accelerometer
is ready to output measured acceleration data after exiting power-down mode.
Top - operating temperature range: This parameter defines the operating temperature
range. When the device is operated inside the specified range, proper behavior of the
sensor is guaranteed.
FS - Full-scale measurement range: For tilt sensing applications, a ±2.0 g range is
sufficient because the Earth’s gravity is ±1 g only. If the application requires
measurement of higher g acceleration, the user can set the device to a higher full-scale
range which results in lower sensitivity.
So - Sensitivity: This parameter defines the value of 1 LSB with respect to mg in the
digital representation.
TCSo - Sensitivity change vs. temperature: This parameter defines how sensitivity
changes with temperature. For example, at a ±2.0 g full-scale range, the sensitivity
changes within ±0.01%/°C. Therefore, if the environmental temperature changes
40 °C, from 25 °C to 65 °C, then the sensitivity changes within the range of ±0.01% * 40
= ±0.4%, which means the sensitivity change over 40 °C is within 0.996 mg/LSB and
1.004 mg/LSB, which shows that the sensitivity is very stable versus temperature
change. Thus, temperature compensation for sensitivity can be ignored.
TyOff - Typical zero-g level offset accuracy: This parameter defines the zero-g
accuracy at room temperature of 25 °C. For example, at a ±2.0 g full-scale range, the
DocID026444 Rev 1
AN4508
Terminology




1.2
zero-g accuracy of ±20 mg means that the zero-g output varies typically in the range of
±20 mg around the expected ideal value.
TCOff - Zero-g level change vs. temperature: This parameter defines how much the
zero-g level is affected by temperature variations.
An - Acceleration noise density: This parameter defines the standard resolution the
user can obtain from the accelerometer (once the desired BW is selected).
1  resolution = A n  g  Hz   BW  Hz  . The higher BW leads to lower resolution.
NL - Non linearity: This parameter defines the maximum error between the outputs and
the best-fit straight line. For example, at ±2.0 g full-scale range, the non-linearity of
0.5% of FS means the largest error is 0.5% * 4000 mg = 2 mg, which corresponds to
0.1°. When the application requires measurements around the 0 g condition (as with tilt
measurement), the non-linearity effect is negligible and can be ignored.
CrossAx - Cross-axis sensitivity: The cross-axis effect arises due to natural
misalignment of die positioning on the package substrate. Even if negligible in most
applications, for very accurate tilt measurement the cross-axis sensitivity effect can be
easily compensated for by following the procedure in Section 2: Calibrating the
accelerometer. Moreover, when the device is placed on the final application board, the
accelerometer calibration compensates both the device cross-axis sensitivity, and the
misalignment between the accelerometer sensing axes and the board axes.
Definitions
Assume that the accelerometer is installed in a handheld device, such as a cell phone, a
PDA or simply on a PCB board as shown in Figure 1.
Figure 1. Accelerometer inside a handheld device
;E
5ROO
=$
;$
3LWFK
<$
<E
+DQGKHOGGHYLFH
=E
$0Y
Xb, Yb and Zb are the handheld device body axes with a forward-right-down configuration.
XA, YA and ZA are the accelerometer sensing axes, respectively. Note that the sign of YA
and ZA from the sensor measurements need to be reversed to have the sensing axes in the
same direction as the device body axes.
Pitch and roll angles are referenced to the local horizontal plane, which is perpendicular to
the Earth's gravity.

Pitch () is defined as the angle between the Xb axis and the horizontal plane. Assume
that the pitch angle resolution is 0.1°, then it goes from 0° to +179.9° when rotating
around the Yb axis with the Xb axis moving upwards from a flat level, and then keeps
DocID026444 Rev 1
5/13
13
Terminology

AN4508
moving from a vertical position (+90°) back to a flat level again. The pitch angle goes
from 0° to -180° when the Xb axis is moving downwards from a flat level, and then
keeps moving from a vertical position (-90°) back to a flat level again. For example, in
Figure 2, Yb is fixed, Xb is rotating from Pitch = 0° to +30°, +90°, +150° and +179.9° for
a positive direction.
Roll () is defined as the angle between the Yb axis and the horizontal plane. Assume
that the roll angle resolution is 0.1°, then it goes from 0° to +179.9° when rotating
around the Xb axis with the Yb axis moving downwards from a flat level, and then keeps
moving from a vertical position (+90°) back to a flat level again. The roll angle goes
from 0° to -180° when the Yb axis is moving upwards from a flat level, and then keeps
moving from a vertical position (-90°) back to a flat level again. For example, in
Figure 3, Xb is fixed, Yb is rotating from roll = 0° to +30°, +90°, +150° and +179.9° for a
positive direction.
Figure 2. Pitch definition
3LWFK ž
;E 3LWFK ž
3LWFK ž
3LWFK ž
<E
3LWFK ž
3LWFK ž
3LWFK ž
3LWFK ž
$0Y
Figure 3. Roll definition
5ROO ž
3LWFK ž
;E
5ROO ž
5ROO ž
<E 5ROO ž
5ROO ž
5ROO ž
3LWFK ž
5ROO ž
$0Y
Assume Ax, Ay, Az is the accelerometer raw measurement in the format of LSBs. Table 1
shows the sign definition of the raw sensor data at 6 stationary positions with respect to the
known Earth gravity vector. For example, in Figure 1, Xb and Yb are level and Zb is pointing
down. Therefore, Ax = Ay = 0, Az = +1 g.
6/13
DocID026444 Rev 1
AN4508
Terminology
Table 1. Sign definition of sensor raw measurements
Accelerometer (signed integer)
Stationary position
Ax
Ay
Az
Zb down
0
0
+1 g
Zb up
0
0
-1 g
Yb down
0
+1 g
0
Yb up
0
-1 g
0
Xb down
+1 g
0
0
Xb up
-1 g
0
0
DocID026444 Rev 1
7/13
13
Calibrating the accelerometer
2
AN4508
Calibrating the accelerometer
Section 1 describes the accelerometer parameters, the next step is to calibrate the
accelerometer.
Please note that all accelerometers from ST have been factory-calibrated. For most
applications, such as screen portrait/landscape rotation and laptop lid open/close detection,
accelerometer calibration is not necessary. This means that users can use the zero-g level
and sensitivity parameters from the datasheet directly to convert raw measurements Ax, Ay
and Az to normalized measurements Ax1, Ay1 and Az1. For applications that require better
than 1° tilt-measurement accuracy, such as automobile alert systems, tilt-compensated
electronic compasses and level monitoring systems, accelerometer calibration is
recommended.
The relationship between the normalized Ax1, Ay1 and Az1 and the accelerometer raw
measurements Ax, Ay and Az can be expressed as,
Equation 1
where [A_m] is the 3 x 3 misalignment matrix between the accelerometer sensing axes and
the device body axes, A_SCi (i = x, y, z) is the sensitivity (or scale factor) and A_OSi is the
zero-g level (or offset).
The goal of accelerometer calibration is to determine 12 parameters from ACC10 to ACC33,
so that with any given raw measurements at arbitrary positions, the normalized values Ax1,
Ay1 and Az1 can be obtained, resulting in:
Equation 2
Calibration can be performed at 6 stationary positions as shown in Table 1. Collect 5 to 10
seconds of accelerometer raw data with ODR = 100 Hz at each position with known Ax1, Ay1
and Az1. Then apply the least square method to obtain the 12 accelerometer calibration
parameters. Refer to Appendix A for additional details.
8/13
DocID026444 Rev 1
AN4508
Least square method
Appendix A
Least square method
Let's consider accelerometer calibration at the 6 stationary positions shown in Table 1.
Equation 1 can be rewritten as:
Equation 3
Or
Equation 4
where:

Matrix X is the 12 calibration parameters that need to be determined


Matrix w is sensor raw data LSBs collected at 6 stationary positions
Matrix Y is the known normalized Earth gravity vector
For example,

At Zb down position (P1 position),
, and assume that at Zb down
position, n1 sets of accelerometer raw data Ax, Ay and Az have been collected. Then,
Equation 5
where:
Matrix Y1 has the same row of [0 0 1].
Matrix w1 contains raw data in the format of LSBs.

At Zb up position (P2 position),
, and assume that at Zb up
position, n2 sets of accelerometer raw data Ax, Ay and Az have been collected. Then,
Equation 6

At Yb down position (P3 position),
, and assume that at Yb down
position, n3 sets of accelerometer raw data Ax, Ay and Az have been collected. Then,
Equation 7
DocID026444 Rev 1
9/13
13
Least square method

AN4508
At Yb up position (P4 position),
, and assume that at Yb up
position, n4 sets of accelerometer raw data Ax, Ay and Az have been collected. Then,
Equation 8

At Xb down position (P5 position),
, and assume that at Xb
down position, n5 sets of accelerometer raw data Ax, Ay and Az have been collected.
Then,
Equation 9

At Xb up position (P6 position),
, and assume that at Xb up
position, n6 sets of accelerometer raw data Ax, Ay and Az have been collected. Then,
Equation 10
Combine Equation 5 to 10 and let n = n1 + n2 + n3 + n4 + n5 + n6, then Equation 4
becomes:
Equation 11
where:
Equation 12
10/13
DocID026444 Rev 1
AN4508
Least square method
Therefore, the calibration parameter matrix X can be determined by the least square
method as:
Equation 13
where:
Equation 14
means matrix transpose
means matrix inverse
DocID026444 Rev 1
11/13
13
Revision history
AN4508
Revision history
Table 2. Document revision history
12/13
Date
Revision
10-Jun-2014
1
Changes
Initial release.
DocID026444 Rev 1
AN4508
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
DocID026444 Rev 1
13/13
13