Online Calibration of 3-Axis Accelerometers
Online Calibration of 3-Axis Accelerometers
Abstract—Inexpensive inertial/magnetic measurement units can [4], and measurement of human body kinematics [5], where
be found in numerous applications and are typically used to IMUs can replace optical measurement systems, which mea-
determine orientation. Due to the presence of nonidealities in sure body part orientations. [6]. Consisting of accelerometers,
measurement systems, the calibration of the sensor is thus needed
to determine sensor parameters such as bias, misalignment, and gyroscopes, and (optionally) magnetometers, IMUs can achieve
gain/sensitivity. In this paper, an online automatic calibration good dynamic specifications with a relatively low investment.
method for a three-axial accelerometer is presented. Parameters Several IMUs are commercially available; however, custom
are estimated using an unscented Kalman filter. The sensor is developed IMUs have some advantages such us small size,
placed in a number of different orientations using a robotic arm. which allows integration in various applications, custom wire-
These orientations are calculated online from the parameter co-
variance matrix and represent estimated optimal sensor orienta- less connectivity, and open architecture, which allows different
tions for parameter estimation. Numerous simulations are run to modifications and implementations of algorithms. However,
evaluate the proposed calibration method, and a comparison is similar to any measurement systems, IMUs also suffer from
made with an offline least mean squares calibration method. The numerous disadvantages such as sensor misalignment, large
simulation results show that calibration with the proposed method offset, nonlinearity, drift, and random noise.
results in higher accuracy of parameter estimation when using
less than 100 iterations. The proposed calibration method is also These disadvantages are generally addressed using sensor
applied to a real accelerometer using a low number of iterations. calibration. Several offline calibration methods exist. One sim-
The results show only slight (less than 0.4%) changes in parame- ple method proposes the calibration of two main parameters
ter values between different calibration runs. The proposed cali- with manual sensor movement in six different orientations with
bration method provides an accurate parameter estimation using a relatively simple mathematical algorithm (the sum of output
a small number of iterations without the need for manually pre-
defining orientations of the sensor, and the method can be used in signals is equal to the gravity vector) [7]. Similar approaches
combination with other offline calibration methods to achieve even that demand several different sensor orientations are described
higher accuracy. in [8], where all three parameters are determined through the
Index Terms—Accelerometer calibration, orientation determi- Levenberg–Marquardt algorithm, similar to [9], where the pa-
nation, sensor parameter estimation, unscented Kalman filtering rameters are determined using the Newton iterative arithmetic.
(UKF). More sophisticated methods are described in [10], where sensor
parameters are estimated using optical alignment and a least
I. I NTRODUCTION mean squares algorithm, and in [11], the reference orientation
of the sensor is also included in determining the sensor param-
y =s·T·u+b+N (1)
where vector v represents the output of the sensor for the x-, y-,
and z-axes, vector s = [sx sy sz ] denotes the sensitivity factor
for each axis, and matrix T is described as
⎡ ⎤
1 0 0
T = ⎣ cos α 1 0 ⎦ (2)
cos β cos γ 1
A complete transformation of the gravity vector is presented of the distribution of ŵk̄ and is usually set to 2 for Gaussian
in Fig. 2. With the transformation matrix specified, the output (c) (m)
distributions. The weights wi and wi are calculated using
of the accelerometer can be described as
(m) λ
w0 =
y = s · T · R−1 −1 −1
6_i · R6 Re_b · m + b + N. (9) L+λ
(c) λ
w0 = + 1 − αkf
2
+ βkf
L+λ
1
C. Parameter Estimation wi (c) =wi (m) = . (15)
2(L + λ)
The UKF is an extension of the traditional Kalman filter
for the estimation of nonlinear systems that attempt to re- The matrix χk|k−1 can be described as
⎡ ⎤
move some of the shortcomings of the extended Kalman filter s0 s1 ··· s2L
(EKF) in the estimation of nonlinear systems. For parameter ⎢ t0 t1 ··· t2L ⎥
⎢ ⎥
estimation, the EKF can be used, because the computation ⎢ b0 b1 ··· b2L ⎥
χk|k−1 = ⎢ (6_i) ⎥ (16)
time of the UKF is greater than the computation time of the ⎢r 0 r(6_i) 1 · · · r(6_i) 2L ⎥
⎣ (e_i) ⎦
EKF. However, because there are no limitations with regard r 0 r(e_b) 1 · · · r(e_b) 2L
to computation time and it has been shown that the UKF n0 n1 ··· n2L
outperforms the EKF in numerous examples, the UKF was
chosen for parameter estimation. More detailed discussion of where vector s0 = ŵk̄,(1...3) consists of the first three ele-
the UKF can be found in [16]–[18]. The UKF uses deterministic ments of vector ŵk̄ . Vectors si = s0 + γ Ŝw̄k i and sL+i =
sampling to approximate the state distribution. The unscented s0 − γ Ŝw¯k i , where i = 1 . . . L are calculated by adding the
transformation uses a set of sample or sigma points that are sigma-point value that was calculated from the ith column of
determined from the a priori mean and covariance of the state. the covariance matrix. A similar approach is applied to vectors
The sigma points are propagated through the nonlinear system. (6_i) (6e_b)
ti , bi , ri and ri . Noise vectors are defined as n0 =
The posterior mean and covariance are then calculated [0 0 0], ni = +γ Ŝw̄k i and nL+i = −γ Ŝw̄k i , where i = 1 . . . L.
from the propagated sigma points. Parameter estimation equa- The output of the sensor model is described as
tions for the UKF are similar to the state estimation. This
section expounds on the differences. yi = si · Ti · R−1 −1 −1
6_i i · R6 k · Re_b i · m + bi + ni (17)
The filter is initialized with the predicted mean and covari-
ance of the parameters, i.e., where values for the matrix Ti are derived from the vector
ti , values for the matrix R6_ii are derived from the vector
ŵ0 = E{w}
(10) r(6_i) i , and values for the matrix Re_bi are derived from the
Pŵ0 = E w − ŵ0 )(w − ŵ0 )T (11) vector r(6e_b) i . Values for the matrix R6k are obtained from
the orientation of the robotic arm. The expected measurement
where E{ } is the expectation operator, (w − ŵ0 ) is the esti-
values are determined in the matrix Y k|k−1 as
mation error of initial value, w is the unknown true parameter,
and ŵ0 is the estimated initial parameter value. The UKF time Y k|k−1 = [ y0 · · · y2L ]. (18)
update is described as
The measurement mean d̂k̄ and the measurement covariance
ŵk̄= ŵk−1 (12)
Pd̃k are calculated based on the statistics of the expected
P̂w¯k = ηn Pwk−1 + Rwk (13) measurements as
where parameter vector ŵk̄ = [sx sy sz α β γ bx by 2L
bz ϕx ϕz φx φz ] is updated using previous values, and the d̂k̄ = wi (m) Y i,k|k−1 (19)
covariance matrix P̂w¯k is calculated by scaling the previous i=0
value with ηn ∈ (0, 1] and by adding fixed system process noise 2L T
Rwk . The sigma points χk are calculated from the values of the Pd̃k = wi (c) Y i,k|k−1 − d̂k Y i,k|k−1 − d̂k̄ + Rek .
i=0
mean and covariance of the parameters, i.e.,
(20)
χk|k−1 = ŵk̄ ŵk̄ + γ Ŝw¯k ŵk̄ − γ Ŝw¯k (14)
The cross-correlation covariance Pwk dk is calculated using
Fig. 4. Initial sensor orientation is noted with axes xe , ye , and ze . After one
iteration is completed, the sensor must reach the new orientation noted with
axes xe , ye , and ze . Additional rotation is applied around the ze -axis.
the gravitational field. In Fig. 3(b), the robot will position the
sensor in the orientation for which the principle axes s1 of the
Fig. 5. Flowchart of the simulation procedure of the calibration method.
error ellipse will be aligned with the gravitational field. After
several steps [see Fig. 3(c)], the variance will decrease, and
principle axes of error ellipse will move to different orienta- E. Simulation and Measurements
tions, and therefore, the robot will reorient the sensor to align Simulation is used to verify the kinematic model and pro-
the principle axes s1 with the gravitational field. The final result posed procedure, because the true parameters of the sensor are
is a sequence of movements of rotations around the principle not known. All sensor parameters are manually predefined in
axis, which maximizes the sensitivity of the sensor axis with the the kinematic model and later compared with the simulation
largest variances of the parameter estimation error. After each results, thus allowing us to validate the calibration method. The
new measurement, a new principle axis is computed, and the simulation is built and run in MATLAB. Because the calibration
movement of the robot is updated with the new axis of rotation method is also based on the movement of the robot arm, a
to reduce the variance along the axis with the largest uncertainty simulation of the robot must also be included. The simulation
(see Fig. 4). process can be segmented into the following three parts.
Singular values σi are used to determine the validity of the
• The output of the sensor is calculated (simulated) using
estimated parameters gathered from the UKF filter, because
manually predefined parameters and known rotational ma-
they represent the dispersion around the associated axis. A
trices, i.e., R6 , Re_b and R6_i .
validation criterion for the selected parameter estimation is
• The calculated output of the sensor is fed into the UKF
presented by
algorithm. The orientation result given by the UKF kine-
3 · σ3 matics is described as a unit vector. Estimated parameters
Cpar = . (28)
3 are temporarily stored and used for the next iteration.
σi
i=1
• A fixed rotation is applied over a unit vector that results
in a 3 × 3 rotational matrix that represents the robot end
Three criterion functions Cpar are calculated, because three effector R6 . With the orientation matrix known, the next
parameters are determined through calibration. The closer Cpar simulation step can be performed.
is to 1, the lower the largest variance is compared to the sum of
Because initial values are needed by the UKF, they are set
variances. A value of 1 also implies that the variance is lowest
close to ideal values with a small offset. For example, the initial
as possible, because there is no axis that would further reduce
parameter for bias is set as ba = [0.15 0.2 −0.12]. Although
the variance. This case is shown in Fig. 3(d), where variances of
the ideal parameter is ba = [0 0 0], a small offset allows the
both principle axes of error ellipse are approximately equal. The
parameters to more quickly converge to the true value. After
criterion functions are also used as a weight for determining the
numerous runs of the simulation, the UKF parameters are
rotation axis of the sensor by
adjusted to ensure rapid convergence of the criterion function.
u = (1 − Cb ) · ue_b + (1 − Cs ) · ue_s (29) The flowchart of the calibration is shown in Fig. 5.
Once the simulation parameters are determined, 300 simula-
where u represents the axis of sensor rotation, Cb and Cs tion runs are performed. Because the model of the sensor and
represent the criterion functions of bias and gain/sensitivity, the UKF algorithm have a fixed noise parameter, different simu-
and ue_b and ue_s represent the estimated axis of rotation for lation runs output different sensor and parameter estimates. The
both parameters. When all criterion functions are close to 1, the dispersion of the parameter values around the true predefined
calibration procedure can be completed, because the variance value can be used to evaluate the CEMS calibration method.
is the lowest, and further measurement will not improve the After the simulations are successfully completed, the pro-
estimation of parameters. posed calibration method is applied using the IMU described
BERAVS et al.: ACCELEROMETER CALIBRATION USING KF MATRIX FOR ESTIMATION OF SENSOR ORIENTATION 2507
TABLE I TABLE II
S IMULATION R ESULTS OF E STIMATING G AIN , M ISALIGNMENT, AND B IAS S IMULATION R ESULTS OF E STIMATING A NGLES IN C OORDINATE
PARAMETERS W ITH THE P ROPOSED C ALIBRATION M ETHOD U SING 400 S YSTEMS Oe and OR6 W ITH THE P ROPOSED C ALIBRATION M ETHOD
I TERATIONS . T HE F IRST C OLUMN P RESENTS THE P REDEFINED VALUES , U SING 400 I TERATIONS . T HE F IRST C OLUMN P RESENTS THE
THE S ECOND C OLUMN P RESENTS THE C ALCULATED M EAN VALUES , THE P REDEFINED VALUES , THE S ECOND C OLUMN P RESENTS THE
T HIRD AND F OURTH C OLUMNS P RESENT THE M INIMUM AND M AXIMUM C ALCULATED M EAN VALUES , THE T HIRD AND F OURTH C OLUMNS
VALUES , THE F IFTH C OLUMN P RESENTS THE M EDIAN VALUES , AND P RESENT THE M INIMUM AND M AXIMUM VALUES , THE F IFTH C OLUMN
THE S IXTH C OLUMN P RESENTS THE S TANDARD D EVIATION P RESENTS THE M EDIAN VALUES , AND THE S IXTH C OLUMN
P RESENTS THE S TANDARD D EVIATION
Fig. 7. Mean and maximum errors of gain and misalignment parameter esti- Fig. 9. Mean and maximum gain and misalignment errors using the least
mations using the proposed calibration method. Dashed lines present maximum mean squares method. Dashed lines present maximum errors that occurred
errors that occurred during simulations, and solid lines present mean relative during simulations, and solid lines present mean relative errors.
errors.
Fig. 10. Mean and maximum bias offsets using the least mean squares
Fig. 8. Mean and maximum bias offsets using the proposed calibration method. The dashed line presents the maximum error that occurred during
method. The dashed line presents the maximum error that occurred during simulations, and the solid line presents the mean relative error.
simulations, and the solid line presents the mean relative error.
TABLE IV
To present an overview of how the number of measurements E STIMATED PARAMETERS OF THE R EAL IMU U SING F IVE D IFFERENT
M EASUREMENTS W ITH 400 I TERATIONS
or iterations influences the accuracy of the parameter estima-
tion, a new series of simulations is run with a variable number of
iterations within the range of 20–500 iterations. Fig. 7 presents
the mean and maximum relative error of gain and misalignment
parameters as solid and dashed lines. The error is calculated by
running 100 simulations for each selected number of iterations.
The bias, misalignment, and gain parameters are calculated
for each axis, and the success of the calibration is determined
by the worst parameter estimated. Thus, only the maximum
relative error that occurred on any of three axes during a single
simulation run is used for the calculation of a mean relative proposed calibration method. The maximum number of offline
error of 100 simulation runs. The maximum relative errors (more than 5000) iterations is used to calculate the values
that occurred during simulation runs at different numbers of of parameters. For each number of movements, 100 offline
iterations are also presented in Fig. 7, dashed lines. iterations are run. The same method for the calculation of the
Because the preset bias parameters are near zero, Fig. 8, mean parameter estimation error is used. The mean parameter
solid line, presents the mean offsets between the calculated and estimation errors and the maximum relative errors that occurred
preset values during 100 simulations at different numbers of during simulation runs at different numbers of iterations are
iterations. Values are calculated using the maximum offset that presented in Fig. 9, dashed and solid lines. The mean and
occurred on any of three axes during simulation runs. Similar to maximum bias offsets at different numbers of iterations are
the previous figure, the maximum values that occurred during presented in Fig. 10.
simulation runs are also presented as a dashed line.
Further evaluation of the CEMS calibration method is done
B. Real IMU
compared with the commonly used least mean squares method,
which is an offline method that requires a different approach. Measurements of a real IMU are performed using a robotic
Because this method cannot set the orientation of the sensor, arm. Because precise parameters of a real sensor are unknown,
a random movement is generated. For better comparison, the Table IV presents the estimated values. Comparison between
number of movements is equal to the number of iterations in our five measurements is made, each with 400 iterations.
BERAVS et al.: ACCELEROMETER CALIBRATION USING KF MATRIX FOR ESTIMATION OF SENSOR ORIENTATION 2509
up to 100 greatly reduces the mean and maximum relative parameter estimation accuracy as a function of the number of
errors and offsets. Nonetheless, at 100 iterations, the errors iterations. High accuracy was achieved after a relatively low
of the offline least mean squares calibration method are still number of iterations compared to an offline calibration method
significantly higher than in our proposed calibration method with randomly generated sensor orientations. The proposed
(except for the misalignment maximum relative error, which is calibration method was then applied to a real accelerometer,
lower by 1%). Increasing the number of different orientations where a parameter estimation relative error of less than 0.3%
makes the maximum relative errors converge to 2.4% and 1.1%, was achieved. Although other offline methods could potentially
whereas the maximum offset converges to 0.01 g. The gain and achieve higher accuracies, our approach represents a promising
misalignment mean relative error also decrease by 0.9% and method that can automatically determine appropriate sensor
0.5%, respectively, whereas the mean bias offset is decreased orientations for calibration and thus rapidly produce accu-
to 0.005 g. rate sensor parameters online, without the need for operator
Our proposed calibration method, thus, has an advantage in involvement.
parameter estimation when less than 100 iterations are used,
because the mean and maximum errors are significantly lower
than the errors calculated by the offline calibration method ACKNOWLEDGMENT
with random orientations. Fig. 11 clearly shows that criterion
The authors would like to thank D. Novak for the complete
functions for all three parameters begin to converge to 1 after
overview of this paper and for the grammatical corrections.
50 iterations, which means that the errors are close to their
minimum. In Fig. 12, the parameter values similarly settle
after 50 iterations, and only slight adjustments are made in R EFERENCES
further iterations. Because the optimal sensor orientations are [1] G. Grenon, P. An, S. Smith, and A. Healey, “Enhancement of the inertial
determined by the calibration method, there is no need to navigation system for the Morpheus autonomous underwater vehicles,”
manually find and move the sensor to appropriate orientations, IEEE J. Ocean. Eng., vol. 26, no. 4, pp. 548–560, Oct. 2001.
[2] C. Tan and S. Park, “Design of accelerometer-based inertial navigation
thus automating and shortening the time of calibration. systems,” IEEE Trans. Instrum. Meas., vol. 54, no. 6, pp. 2520–2530,
However, the disadvantage of this method is that it uses Dec. 2005.
relatively expensive equipment for sensor manipulation. Better [3] E. Bachmann, I. Duman, U. Usta, R. McGhee, X. Yun, and M. Zyda,
“Orientation tracking for humans and robots using inertial sensors,” in
accuracy can be achieved with offline calibration methods when Proc. IEEE Int. Symp. CIRA, 1999, pp. 187–194.
a large number of sensor orientations or carefully predefined [4] M. Mathie, B. Celler, N. Lovell, and A. Coster, “Classification of basic
sensor orientations are used. A combination of both methods daily movements using a triaxial accelerometer,” Med. Biol. Eng. Com-
put., vol. 42, no. 5, pp. 679–687, Sep. 2004.
could therefore result in better accuracy of parameter estima- [5] M. Mihelj, “Inverse kinematics of human arm based on multisensor data
tion. However, this approach would extend the total calibration integration,” J. Intell. Robot. Syst., vol. 47, no. 2, pp. 139–153, Oct. 2006.
time, creating a disadvantage compared to our online cali- [6] R. Mayagoitia, A. Nene, and P. Veltink, “Accelerometer and rate gyro-
scope measurement of kinematics: An inexpensive alternative to opti-
bration method, where the parameter estimation is complete cal motion analysis systems,” J. Biomech., vol. 35, no. 4, pp. 537–542,
immediately after the final iteration. Apr. 2002.
The CEMS calibration method, in the future, can also [7] S. Won and F. Golnaraghi, “A triaxial accelerometer calibration method
using a mathematical model,” IEEE Trans. Instrum. Meas., vol. 59, no. 8,
be applied to three-axial magnetometer calibration. Because pp. 2144–2153, Aug. 2010.
the manipulation of the magnetic sensor is not ideal due to [8] F. Camps, S. Harasse, and A. Monin, “Numerical calibration for three-
magnetic-field disturbances around the robotic arm, a modified axis accelerometers and magnetometers,” in Proc. IEEE EIT Conf., 2009,
pp. 217–221.
method that involves a three-axial magnetic coil can be used. [9] J. Wang, Y. Liu, and W. Fan, “Design and calibration of a smart inertial
In this case, the direction of the magnetic field would also be measurement unit for autonomous helicopters using MEMS sensors,” in
determined by the calibration method. Because there would be Proc. IEEE Int. Conf. Mechatron. Autom., 2006, pp. 956–961.
[10] R. Zhu and Z. Zhou, “Calibration of three-dimensional integrated sensors
no need for physically moving the sensor and the change in for improved system accuracy,” Sens. Actuators A: Phys., vol. 127, no. 2,
the magnetic field can instantly be done, this approach could pp. 340–344, Mar. 2006.
represent a very fast method of magnetometer calibration. [11] A. Kim and M. Golnaraghi, “Initial calibration of an inertial measurement
unit using an optical position tracking system,” in Proc. IEEE PLANS,
2004, pp. 96–101.
[12] E. Renk, M. Rizzo, W. Collins, F. Lee, and D. Bernstein, “Calibrating
a triaxial accelerometer-magnetometer-using robotic actuation for sensor
V. C ONCLUSION reorientation during data collection,” IEEE Control Syst. Mag., vol. 25,
no. 6, pp. 86–95, Dec. 2005.
This paper has presented an online automatic calibration [13] P. Batista, C. Silvestre, P. Oliveira, and B. Cardeira, “Accelerometer cal-
method for a three-axial accelerometer. A robotic arm is used ibration and dynamic bias and gravity estimation: Analysis, design, and
experimental evaluation,” IEEE Trans. Control Syst. Technol., vol. 19,
to rapidly place the sensor in a number of different orientations, no. 5, pp. 1128–1137, Sep. 2011.
and the UKF estimates the three main accelerometer parame- [14] H. Kuga, R. da Fonseca Lopes, and W. Einwoegerer, “Experimental static
ters (gain, misalignment, and bias) in each orientation. These calibration of an IMU (inertial measurement unit) based on MEMS,” in
Proc. XIX COBEM, Brasília, DF, Brazil, 2007.
orientations are automatically calculated during calibration us- [15] D. Jurman, M. Jankovec, and R. Kamnik, “Calibration and data fusion
ing the parameter covariance matrix to represent the optimal solution for the miniature attitude and heading reference system,” Sens.
orientations for parameter estimation. Actuators A: Phys., vol. 138, no. 2, pp. 411–420, Aug. 2007.
[16] R. Van Der Merwe, “Sigma-point Kalman filters for probabilistic infer-
Several simulations were performed to evaluate the CEMS ence in dynamic state-space models,” Ph.D. dissertation, Oregon Health
calibration method. Its success was measured by observing Sci. Univ., Portland, OR, 2004.
BERAVS et al.: ACCELEROMETER CALIBRATION USING KF MATRIX FOR ESTIMATION OF SENSOR ORIENTATION 2511
[17] J. Ambadan and Y. Tang, “Sigma-point Kalman filter data assimilation Janez Podobnik received the B.S. degree in elec-
methods for strongly nonlinear systems,” J. Atmos. Sci., vol. 66, no. 2, trical engineering and the Ph.D. degree from the
pp. 261–285, Feb. 2009. University of Ljubljana, Ljubljana, Slovenia, in 2004
[18] M. VanDyke, J. Schwartz, and C. Hall, Unscented Kalman Filtering for and 2009, respectively.
Spacecraft Attitude State and Parameter Estimation, Blacksburg, VA2004. He is currently a Researcher and Teaching Assis-
[19] S. Bonnet, C. Bassompierre, C. Godin, S. Lesecq, and A. Barraud, “Cal- tant with the University of Ljubljana. His research
ibration methods for inertial and magnetic sensors,” Sens. Actuators A: interests include haptic interfaces, real-time control
Phys., vol. 156, no. 2, pp. 302–311, 2009. of robots for virtual-reality-supported rehabilitation,
[20] C. Bishop and S. S. en Ligne, Pattern Recognition and Machine Learning. and sensory fusion techniques.
New York: Springer, 2006.