Professional Documents
Culture Documents
An Inertial-Measurement-Unit-Based Pen With A Trajectory Reconstruction Algorithm and Its Applications
An Inertial-Measurement-Unit-Based Pen With A Trajectory Reconstruction Algorithm and Its Applications
Abstract—This paper presents an inertial-measurement- the portability of devices without introducing additional dimen-
unit-based pen (IMUPEN) and its associated trajectory reconstruc- sion and weight for HCI devices, most existing products have
tion algorithm for motion trajectory reconstruction and relied on a liquid crystal display (LCD) screen with a touch
handwritten digit recognition applications. The IMUPEN is com-
posed of a triaxial accelerometer, two gyroscopes, a microcon- panel to provide an intuitive graphical user interface (GUI). In
troller, and an RF wireless transmission module. Users can addition, many researchers have focused on developing novel
hold the IMUPEN to write numerals or draw simple symbols HCI methods based on human behaviors [4], [8], [10], [12].
at normal speed. During writing or drawing movements, the Recently, pen-based input devices embedded with inertial
inertial signals generated for the movements are transmitted to sensors have been provided for hand gestures or handwriting
a computer via the wireless module. A trajectory reconstruction
algorithm composed of the procedures of data collection, signal [2], [3], [5], [6], [9], [24]. A salient superiority of inertial
preprocessing, and trajectory reconstruction has been developed sensors for general motion sensing is that they can be operated
for reconstructing the trajectories of movements. In order to without any external reference (such as infrared, radar, or video
minimize the cumulative errors caused by the intrinsic noise/drift motion-sensing technologies) or limitation in working condi-
of sensors, we have developed an orientation error compensation tions (such as friction, wind, directions, or dimensions) [20].
method and a multiaxis dynamic switch. The advantages of the
IMUPEN include the following: 1) It is portable and can be This kind of device usually comprises two types of sensors:
used anywhere without any external reference device or writing accelerometers for sensing translational accelerations and gyro-
ambit limitations, and 2) its trajectory reconstruction algorithm scopes for detecting angular velocities. However, most inertial-
can reduce orientation and integral errors effectively and thus sensor-based recognition systems suffer from low recognition
can reconstruct the trajectories of movements accurately. Our rates due to various errors generated by the inertial sensors.
experimental results on motion trajectory reconstruction and
handwritten digit recognition have successfully validated the The errors not only involve the effects of sensor uncertainty,
effectiveness of the IMUPEN and its trajectory reconstruction namely, sensitivity and offset, but also include contingent error
algorithm. sources, such as intrinsic drift of inertial sensors, circuit thermal
Index Terms—Handwritten digit recognition, inertial sensing, noise, time discretization, quantization error, vibration, friction,
multiaxis dynamic (MAD) switch, orientation error compensation, etc. To improve the recognition accuracy, many researchers
pen-type input devices, trajectory reconstruction algorithm. have focused on the subject of error compensation of iner-
tial sensors to develop effective algorithms. To name a few,
I. I NTRODUCTION Bang et al. [2] used an error compensation method, called zero
velocity compensation, to compensate the acceleration signals.
R ECENTLY, tremendous progress in miniaturization tech-
nology in electronic circuits and components has greatly
reduced the dimension and weight of computers and per-
Luo et al. [15] designed an extended Kalman filter based on a
micro inertial measurement unit (IMU) with magnetometers for
real-time attitude compensation. Zhang et al. [23] showed that
sonal digital assistants, thus making them extremely powerful,
the Kalman filter is an effective technique to reduce noise of in-
portable, and convenient. Due to the revolutionary paradigm
ertial sensors. Tsang et al. [19] utilized an electromagnetic reso-
shift in computer technology, human–computer interaction
nance motion detection board to improve the tracking accuracy
(HCI) techniques have become an important part of our daily
of a digital writing instrument. Yun and Bachmann [22] pro-
lives. For the past decades, fusing emerging technologies to
posed a quaternion-based Kalman filter which combines with
create more user-friendly interfaces has been a continuing rev-
acceleration, angular velocity, and local magnetic field for hu-
olution in the HCI research community. Particularly to enhance
man body motion tracking. Suh [17] proposed a multiple-mode
Kalman filter for 1-D attitude estimation using accelerometers
Manuscript received June 27, 2009; revised August 22, 2009; accepted and gyroscopes. Won et al. [21] used a Kalman filter with IMU
October 30, 2009. Date of publication December 31, 2009; date of current sensors to estimate the orientation and reduce the orientation
version September 10, 2010.
The authors are with the Department of Electrical Engineering, National error caused by the integration of angular velocity error.
Cheng Kung University, Tainan 701, Taiwan (e-mail: jeenshin@mail.ncku. An inertial-measurement-unit-based pen-type input device,
edu.tw). named IMUPEN, and a trajectory reconstruction algorithm
Color versions of one or more of the figures in this paper are available online
at http://ieeexplore.ieee.org. have been developed in this paper. The IMUPEN is composed
Digital Object Identifier 10.1109/TIE.2009.2038339 of a triaxial accelerometer, two gyroscopes, a microcontroller,
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
WANG et al.: IMUPEN WITH A TRAJECTORY RECONSTRUCTION ALGORITHM AND ITS APPLICATIONS 3509
Fig. 1. IMUPEN hardware device. (a) Front view of the circuit. (b) Back view
of the circuit.
Fig. 2. Schematic diagram of the IMUPEN.
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
3510 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 57, NO. 10, OCTOBER 2010
velocity signals. Based on the detection, the corresponding alternately upward and downward. The SF and the bias in
filtered acceleration and angular velocity are then used to obtain each axis of the triaxial accelerometer can be expressed as
the static and dynamic orientation angles of the IMUPEN. In follows:
addition, an orientation error compensation method is used to
V (+g) − V (−g)
reduce the orientation error and to improve the accuracy of the SFacc = (1)
orientation. Once we obtain the quaternion-based orientation, 2g
the filtered acceleration can be transformed from the body V (+g) + V (−g)
Bacc = (2)
coordinate to the reference coordinate, and the gravitational 2
acceleration can then be removed. In the position estimation
step, a MAD switch is used to detect the integration interval of where V (+g) and V (−g) are the voltage outputs in each axis
the compensated acceleration based on the adaptive magnitude of the accelerometer when it is aligned with the direction of
thresholds of the acceleration and the velocity. Finally, the final the Earth’s gravity and with the opposite direction of Earth’s
acceleration is doubly integrated to obtain the trajectories of gravity, respectively. SFacc is expressed in volts per g (V/g),
handwriting motions. The trajectory reconstruction process of while Bacc is in volts, where g is the gravitational acceleration.
the IMUPEN is shown in Fig. 3. The acceleration in each axis can be calibrated by the following
equation:
Vacc − Bacc
A. Signal Preprocessing Ac = (3)
SFacc
Signal preprocessing is a required procedure for the sig-
nals measured by inertial sensors embedded in the IMUPEN where Vacc is the output voltage in each axis of the accelerom-
because the signals are always contaminated not only by the eter. As a result of (3), the outputs of the three axes of the
aforementioned error sources but also with users’ unconscious triaxial accelerometer (Acx , Acy , and Acz ) can be converted
trembles. Since a relatively small drift error or offset on the ac- from voltage to acceleration (in terms of g). In general, the
celeration or angular velocity will produce large integral errors, outputs of each axis of the accelerometer are +1g and −1g
obtaining signals that contain no undesired signal component when the IMUPEN is stationary.
has become an importance issue for trajectory reconstruction. In the procedure of the gyroscope calibration, we use the
In our approach, we first calibrate the accelerometer and gyro- sensitivity in each axis of the gyroscopes presented in the
scopes. After obtaining the calibrated measurements, a digital datasheet as the SF of the gyroscopes (SFgyro ). The SFgyro
filter is used to filter the high-frequency noise of the raw data is expressed in volts per degree per second (V/◦ /s), where ◦ /s
generated by the IMU. is the angular velocity. If the IMUPEN is stationary without
Calibration of IMU: Two important factors are usually used any rotation, the ideal outputs of the gyroscopes should be
to calibrate inertial sensors: a scale factor (SF) and a bias [1]. zero. However, there is a nonzero offset and drift signals in
The SF (or sensitivity) denotes the ratio of change in the sensor the output of the gyroscopes due to temperature and stress
output to change in the sensor input, and the bias (B) (or variations. In this paper, the bias of each axis of the gyroscopes
offset) denotes the average sensor output over a specific time. (Bgyro ) is set as the mean of the angular velocities collected
This has no correlation with the input. The detailed calculation by keeping the IMUPEN stationary in the beginning. Thus, the
of the SF and bias of the IMU can be found in [18]. When angular velocity in each axis can be calibrated by the following
the IMUPEN is stationary, the output of each sensitive axis equation:
of the triaxial accelerometer contains only the gravitational Vgyro − Bgyro
acceleration. According to this fact, we calibrate the triaxial ωc = (4)
SFgyro
accelerometer to align each axis with the Earth’s gravity [11],
[14]. To perform the calibration, we first mount the triaxial where Vgyro is the output voltage of each axis of the gyroscopes
accelerometer on a leveled surface and then point each axis and Bgyro is expressed in volts. With (4), we can convert the
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
WANG et al.: IMUPEN WITH A TRAJECTORY RECONSTRUCTION ALGORITHM AND ITS APPLICATIONS 3511
outputs of the three axes of the gyroscopes (ωcx , ωcy , and using the information of the acceleration. The aforementioned
ωcz ) from voltage to angular velocity (in terms of degrees per three computational phases are based on the quaternion repre-
second). sentation [7]. The proposed orientation estimation algorithm is
Low-Pass Filter: After we obtain the six calibrated measure- elaborated as follows.
ments (Acx , Acy , Acz , ωcx , ωcy , and ωcz ) from the aforemen- Rotation Detection: The filtered gyroscope signals are still
tioned calibration process, a moving average filter is used to contaminated with drift errors and user’s unconscious trembles.
reduce the high-frequency noise of the six signals from the Therefore, the filtered signals from the gyroscopes are not
IMU. The representation of the filter is expressed as always equal to zero, while the IMUPEN is stationary. In
N
order to avoid this problem, a thresholding method is used to
1 determine the start and end points of the rotation interval of the
y[n] = x[n − i] (5)
N i=1 IMUPEN. We developed an adaptive magnitude thresholding
method for detecting if the IMUPEN is rotated during hand-
where x[n] is the input signal, y[n] is the output signal, and N writing motions. That is, the thresholds for discriminating the
is the number of points in the average filter (N = 15 is used in rotation signals from the nonrotation signals are determined
this paper). The six filtered signals of the IMU are denoted as dynamically according to different motions.
Abx , Aby , Abz , ωbx , ωby , and ωbz . The filtered acceleration and gyroscope signals at the be-
ginning of a motion, denoted as tinitial , are used to determine
the thresholds. The magnitudes of the filtered acceleration and
B. Quaternion-Based Orientation Estimation
gyroscope signals are defined as follows:
Once we obtain the filtered signals of the IMU, we can use
them to estimate the orientation and position (or trajectory) EAb (k) = A2bx (k) + A2by (k) + A2bz (k) − 1 (6)
of the IMUPEN via the integral operations. To reconstruct a
spatial trajectory, we first transfer the filtered acceleration from
Eωb (k) = ωbx
2 (k) + ω 2 (k) + ω 2 (k)
by bz (7)
the body coordinate to the reference coordinate. For the spatial
trajectory reconstruction, the corresponding orientation of the
signal is required to perform the coordinate transformation. where EAb (k) and Eωb (k) are the magnitudes of the filtered
Note that the more accurate the orientation estimation is, the acceleration and gyroscope signals, respectively, and k denotes
better the trajectory reconstruction result we can obtain. In this the time steps. Note that the filtered acceleration in (6) includes
paper, we utilize the quaternions to represent the orientation of the gravitational acceleration that should be subtracted
the IMUPEN. from the filtered acceleration. We set the multiples of the
For the orientation estimation, we use two kinds of sensors: maximum values of EAb (k) and Eωb (k) in the interval of tinitial
rate and direct sensors. We choose two gyroscopes, one uniaxial as thresholds in the following equations:
and one biaxial, as our rate sensors. Since the initial orientation
angles cannot be obtained by gyroscopes, we need to obtain TA = Kt max (EAb (k)) (8)
k
initial orientation angles from a direct sensor which can pro-
vide direct information about the orientation of the objects. Tω = Kt max (Eωb (k)) (9)
k
Fortunately, an accelerometer can measure two orientation
angles directly without any integral operation; therefore, the where k denotes the time steps in the interval of tinitial and Kt
accelerometer embedded in the IMUPEN is used as the direct is an empirical value (Kt = 2 is used in this paper). Once we
sensor. During the course of the trajectory reconstruction, we obtain the thresholds, the rotation interval can be determined
have to decide which sensor to use for the orientation estimation by selecting the start and end points (or time steps) whose
at each time step. We partition the whole time interval into magnitudes are higher and lower than the thresholds, respec-
three phases: a prior static attitude estimation phase, a dynamic tively. With the two thresholds of the filtered acceleration and
attitude estimation phase, and a posterior static attitude esti- gyroscope signals, we can obtain two sets of start and end points
mation phase. In the two static attitude estimation phases, the for the rotation interval. The first set, tA A
start and tend , is obtained
orientation of the IMUPEN is computed through the acceler- from the acceleration signals, and the second set, tω start and
ation signals measured by the triaxial accelerometer. The first tω
end , is obtained from the gyroscope signals. We then determine
static attitude estimation phase decides the initial orientation the rotation interval of a motion by choosing the minimum
angles for the latter dynamic attitude estimation phase, while value of the two start points, tstart = min(tA ω
start , tstart ), and the
the second one calculates the final orientation angles at the maximum value of the two end points, tend = max(tA ω
end , tend ),
end of the pen motion. The dynamic attitude estimation phase to avoid inaccuracy in the attitude estimation of the prior and
calculates the orientation angles when the IMUPEN is being posterior static phases. After defining the rotation interval, we
rotated. The calculation within the dynamic attitude estimation can separate the whole interval into the following three phases:
phase involves both the rate and direct sensors. The orientation the prior static attitude estimation phase, the dynamic attitude
angles within the dynamic attitude estimation phase are first estimation phase, and the posterior static attitude estimation
calculated by the filtered reading from the gyroscopes, and phase. The curves in Fig. 4 are acceleration and angular ve-
then, an orientation error compensation method is employed locity signals obtained from the accelerometer and gyroscopes
to further improve the accuracy of the orientation estimation directly. Fig. 4 shows how to obtain the partition of the rotation
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
3512 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 57, NO. 10, OCTOBER 2010
Fig. 4. Partition of the rotation interval by the proposed rotation detection method. (a) Detection of the start and end points of the rotation interval based on
TA . (b) Detection of the start and end points of the rotation interval based on Tω . (c) Partition of the rotation interval into three phases based on TA and Tω
simultaneously.
interval into the aforementioned three phases by the proposed the body coordinate through the sequence of rotation of yaw
rotation detection method. The region with a gray color and the angle (ψ) about the Z-axis, rotation of pitch angle (θ) about
region with no color represent the static and dynamic attitude the Y -axis, and rotation of roll angle (φ) about the X-axis
estimation intervals, respectively. sequentially.
Prior Static Attitude Estimation Phase: Static estimation In the prior static attitude estimation phase, the roll angle (φ)
plays the following two important roles: 1) obtaining the initial and pitch angle (θ) of the IMUPEN can be derived directly from
orientation angles for the dynamic attitude estimation phase and the filtered acceleration signals. To obtain the roll angle (φ),
2) obtaining the final orientation angles for the orientation error the following three different cases are defined to cope with the
compensation method. Under ideal circumstances, the filtered range limitation of the arctangent:
gyroscope signals should be zero in the two static phases. In
Aby (k)
practice, however, the gyroscope signals are still contaminated φ(k) = tan−1 ,
with drift errors and user’s unconscious trembles, which will Abz (k)
cause a significant error in the orientation estimation. If we
estimate the orientation based on the gyroscopes, we may end for Abz (k) < 0 (10)
up with a random walk in orientation rather than the actual
Aby (k)
orientation due to a cumulative error over a time interval. More- φ(k) = −π + tan−1 ,
Abz (k)
over, the initial orientation angles cannot be directly obtained
from the gyroscopes. Hence, the accelerometer is utilized in for Abz (k) > 0 and Aby (k) > 0 (11)
the two static attitude estimation phases. In this paper, we use
the Euler angles to represent the orientation angles first. The Aby (k)
yaw, pitch, and roll angles are related to the reference and φ(k) = π + tan−1 ,
Abz (k)
body coordinates through a rotation sequence of (ZY X). That
is, the reference coordinate can be rotated to coincide with for Abz (k) > 0 and Aby (k) < 0. (12)
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
WANG et al.: IMUPEN WITH A TRAJECTORY RECONSTRUCTION ALGORITHM AND ITS APPLICATIONS 3513
Once the roll angle is determined, the pitch angle can be filtered acceleration signals via (10)–(13). Then, the yaw angle
computed by the following equation: (ψ) is set according to the quaternion representation of the last
⎛ ⎞ time step in the dynamic attitude estimation phase. The yaw
A bx (k) angle (ψ) is equal to
θ(k) = tan−1 ⎝ ⎠. (13)
A2by (k) + A2bz (k) 2q1 q2 + 2q0 q3
ψ = tan−1 . (17)
2q02 + 2q12 − 1
In this phase, the yaw angle (ψ) can be set at zero de-
grees [16]. After obtaining the Euler angles (φ, θ, ψ), we can After the Euler angles (φ, θ, ψ) of the posterior static attitude
compute the parameters of the quaternion representation, q = estimation phase are obtained, the corresponding quaternion
[q0 , q1 , q2 , q3 ]T , by the following equations: representation of the posterior static attitude estimation phase
can be found via (14).
q0 = cos(α) cos(β) cos(γ) + sin(α) sin(β) sin(γ) Orientation Error Compensation: Due to inaccurate estima-
tion of the orientation angles, orientation errors are inevitable.
q1 = cos(α) cos(β) sin(γ) − sin(α) sin(β) cos(γ) Particularly, the integration of the drift errors from the gyro-
q2 = cos(α) sin(β) cos(γ) + sin(α) cos(β) sin(γ) scopes causes a cumulative error that is extremely large after a
time interval. After the motion of the IMUPEN is completed,
q3 = sin(α) cos(β) cos(γ) − cos(α) sin(β) sin(γ) (14) the orientation angles obtained in the posterior static attitude
estimation phase can be used to compensate the orientation
where α = ψ/2, β = θ/2, and γ = φ/2. The quaternion is error within the dynamic attitude estimation phase. In this
normalized to ensure its unity. That is, the four parameters are paper, we developed an orientation error compensation method
constrained to satisfy the following condition [13]: to compensate the IMUPEN’s orientation error. First, we model
the orientation error accumulation by a linear function in the
q02 + q12 + q22 + q32 = 1. (15) quaternion space. By finding the difference between the last
quaternion representation of the dynamic attitude estimation
The normalized unit quaternion serves as the initial unit phase and the first quaternion representation from the posterior
quaternion in the dynamic attitude estimation phase. static attitude estimation phase, the slope of the linear error
Dynamic Attitude Estimation Phase: During the dynamic model can be obtained by (18). The offset term of the linear
attitude estimation phase, the IMUPEN is rotated during a error model is set to zero
motion. The rotation always involves translational motion.
Therefore, the acceleration measurements are no longer reliable q(tend ) − q(tend + 1)
m= (18)
for the orientation estimation. The angular velocities measured tend − tstart
from the gyroscopes are then used to determine the dynamic
orientation during a motion. Once the initial unit quaternion where m = [m0 , m1 , m2 , m3 ]T represents the slopes of the
of the IMUPEN’s orientation is obtained in the prior static four components of the quaternion and tstart and tend represent
attitude estimation phase, we can use the following equation the start and end time indices of the dynamic attitude estimation
to obtain the quaternion at each time step for the orientation phase. Once the linear error model is derived, the error caused
angles within the dynamic attitude estimation phase by using by the drift can be compensated by the following equation:
the filtered angular velocity signals:
q(k) = q(k) − mk (19)
1
q(k + 1) = exp Ω(k)Ts q(k) (16)
2 where k is the time steps in the dynamic attitude estimation
phase. Fig. 5 shows an illustrative example of the proposed
where orientation error compensation method.
q(k) = [q0 (k), q1 (k), q2 (k), q3 (k)]T
⎡ ⎤ C. Coordinate Transformation and Gravity Compensation
0 −ωbx (k) −ωby (k) −ωbz (k)
⎢ ωbx (k) 0 ωbz (k) −ωby (k) ⎥ Due to the fact that the output of an accelerometer always
Ω(k) = ⎣ ⎦
ωby (k) −ωbz (k) 0 ωbx (k) has an offset (1g) because of local gravity, this offset must be
ωbz (k) ωby (k) −ωbx (k) 0 subtracted from the filtered acceleration signals to obtain the
acceleration generated by motion alone. Since the orientation of
and Ts is the system’s sampling time (Ts = 1/fs ). The afore- the IMUPEN changes dynamically during a motion to perform
mentioned equation is then expanded as a first-order Taylor the aforementioned subtraction, all the filtered acceleration sig-
series. For details about the quaternion, please refer to [13]. nals have to transfer from the body coordinate to the reference
Accordingly, the dynamic orientation of the IMUPEN can be coordinate. The coordinate system of the IMUPEN is shown
obtained by the expansion. in Fig. 6. To transform the acceleration from the body coor-
Posterior Static Attitude Estimation Phase: In the posterior dinate to the reference coordinate, we need to derive a trans-
static attitude estimation phase, the roll angle (φ) and pitch formation matrix based on the quaternion that represents the
angle (θ) of the IMUPEN can also be derived directly from the IMUPEN’s orientation in the reference coordinate. To derive
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
3514 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 57, NO. 10, OCTOBER 2010
Fig. 5. Illustrative example of the proposed orientation error compensation method. (a) Quaternion before the orientation error compensation. (b) Quaternion
after the orientation error compensation.
Fig. 6. Coordinate transformation between the body coordinate and the refer- where I ∈ R3×3 ⎤is an identity matrix and [u×] =
⎡
ence coordinate. Rx : Roll angle. Ry : Pitch angle. Rz : Yaw angle. 0 −q3 q2
⎣ q3 0 −q1 ⎦. With the transformation matrix T, we
the transformation matrix, the quaternion is written in the fol- −q2 q1 0
lowing special expression that comprises a scalar and a vector can transfer the filtered acceleration signals from the body
part: coordinate to the reference coordinate through
q = q0 + u (20) Ar = TAb (23)
where u = q1 i + q2 j + q3 k. q0 , q1 , q2 , and q3 are all real where Ab = [Abx , Aby , Abz ]T is the filtered acceleration in the
numbers, and i, j, and k represent the standard orthonormal body coordinate and Ar = [Arx , Ary , Arz ]T is the transformed
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
WANG et al.: IMUPEN WITH A TRAJECTORY RECONSTRUCTION ALGORITHM AND ITS APPLICATIONS 3515
acceleration in the reference coordinate. The compensated ac- 1) Turning on the Switch: At first, the switches of the three
celeration vectors in the reference coordinate generated from axes are all turned off and are waiting to be turned on. The
the pen motion are then expressed as follows: magnitude of the compensated acceleration signals of each axis
is defined as
A = Ar − G (24)
EAi (k) = |Ai (k)| (25)
where A = [Ax , Ay , Az ]T is the compensated acceleration in
the reference coordinate and G = [0, 0, 1]T is the gravitational where Ai (k) and EAi (k) are the compensated acceleration and
acceleration in the reference coordinate. the compensated acceleration magnitude of the i-axis, respec-
tively, k denotes the time steps, and i denotes the X-, Y -, or
D. Position Estimation Z-axis of the reference coordinate. The acceleration magnitude
The velocities and positions of the IMUPEN in a motion can threshold is determined through the following equation by
be obtained through the single integral and double integral of finding the maximum acceleration magnitude in the beginning
the compensated acceleration signals, respectively. Ideally, the of a motion, tinitial , where the IMUPEN is stationary:
acceleration should be zero when the IMUPEN is stationary.
TAi = KA max (EAi (k)) (26)
However, in practice, the acceleration measurements are not k
always equal to zero when the IMUPEN is stationary due to
the inherent sensor noise and drift which may originate from where k is the time steps in the interval of tinitial , TAi is
temperature changes and sensor imperfections. Besides the the adaptive acceleration magnitude threshold of the i-axis for
noise and drift, when the IMUPEN is held by a user, his/her the compensated acceleration signals, and KA is an empirical
unconscious trembles may cause relatively small variations in value which is equal to two in this paper. Once the acceleration
acceleration. If we integrate all the compensated acceleration magnitude of one axis exceeds TAi , a motion in that axis is said
signals, all these inevitable small errors would be accumu- to be detected, and the dynamic switch of that axis is turned on.
lated. To minimize this undesirable error accumulation, we That is, the start point of the integration interval of each axis of
developed an effective position estimation algorithm, named the compensated acceleration can be determined based on the
MAD switch. The concept of the MAD switch is to integrate individual TAi of each axis.
acceleration measurements only when the IMUPEN is moving 2) Finding the Velocity Magnitude Threshold Adaptively:
and to reset the velocity to zero when the IMUPEN is stationary. Right after the dynamic switch is turned on, it will then keep
This can prevent undesired error accumulation. To determine looking for the maximum magnitude of velocity for setting the
whether the IMUPEN is stationary or in motion, two important velocity threshold while integrating the compensated accelera-
thresholds are defined in the MAD switch: 1) an acceleration tion signals. Because each switch for each axis is mutually inde-
magnitude threshold and 2) a velocity magnitude threshold. pendent, the velocity magnitude is also calculated individually
The underlying reason for using the two aforementioned for each axis by the following equation:
thresholds is elaborated as follows. To produce or stop a motion,
EV i (k) = |Vi (k)| (27)
a user has to exert force on the IMUPEN. Hence, it is straight-
forward to set an acceleration threshold to determine whether where Vi (k) and EV i (k) are the velocity and the velocity mag-
the IMUPEN is in motion. However, between the start and end nitude of each axis, respectively, k denotes the time steps, and
of a motion, it is possible that the IMUPEN may move at a i denotes the X-, Y -, or Z-axis of the reference coordinate. To
fixed speed momentarily when the acceleration measurement is find the maximum velocity magnitude, we allocate a variable,
fairly close to zero. If we only use the acceleration threshold, EV i,max , to keep the maximum-so-far velocity. If a successive
we would make a huge mistake by taking the moving IMUPEN velocity is smaller than the maximum-so-far velocity, the maxi-
a stationary one. Thus, there is a need to define the velocity mum velocity magnitude is then set to be that maximum-so-far
magnitude threshold to avoid such a mistake. value, and the adaptive velocity magnitude threshold of each
The MAD switch consists of three individual switches, and axis can be obtained by
each switch is responsible for one axis of the acceleration in the
reference coordinate. The switches are mutually independent TV i = KV EV i,max (k) (28)
and operatively identical to one another. That is, the magni-
tudes and magnitude thresholds for each axis are calculated where k is the time steps in the integration interval, TV i is the
independently. The two thresholds for each switch are adjusted adaptive velocity magnitude threshold of the i-axis, and KV is
adaptively according to different writing conditions, and the an empirical value which is equal to 0.5 in this paper.
IMUPEN is regarded as stationary when acceleration and ve- 3) Turning off the Switch: If the magnitude of the com-
locity measurements are both below their respective thresholds. pensated acceleration and the corresponding velocity are both
There are three phases in the operational procedure of each below their respective thresholds, the switch is then turned
switch: 1) turning on the switch; 2) finding the velocity mag- off, and the velocity is reset to zero to prevent further error
nitude threshold adaptively; and 3) turning off the switch. After accumulation. Otherwise, the integration continues. That is,
the MAD switch is applied to reject the undesired errors, the the end point of the integration interval of each axis of the
final acceleration signals are obtained. The detailed description compensated acceleration is determined by both TAi and TV i
of the procedure is given hereinafter. of each axis simultaneously.
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
3516 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 57, NO. 10, OCTOBER 2010
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
WANG et al.: IMUPEN WITH A TRAJECTORY RECONSTRUCTION ALGORITHM AND ITS APPLICATIONS 3517
where n is the number of time steps Δt, and pref and pact are
the reference and reconstructed trajectories, respectively. The
average APE (ea_mean ) and average RPE (er_mean ) are defined
as follows:
N
1
ea_mean = ea (nΔt) (31)
N n=1
N
1
er_mean = er (nΔt) (32)
N n=1
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
3518 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 57, NO. 10, OCTOBER 2010
Fig. 9. Acceleration at each procedure of the proposed trajectory reconstruction algorithm for the square motion. (a) Raw data. (b) Filtered acceleration in the
body coordinate. (c) Filtered acceleration in the reference coordinate. (d) Compensated acceleration.
to the recognizer for digit recognition. Fig. 8(b) and (c) shows handwritten digit recognition performance with that of our
the GUI and the experimental setups for the handwritten digit IMUPEN and the associated trajectory reconstruction algo-
recognition experiments. rithm. The basic components of the Wacom Cintiq 12WX
Digit Trajectory Comparison Between Tablet Digitizer Pen interactive pen display include a pen tablet internally mounted
and the IMUPEN: In this experiment, the Wacom Cintiq behind a thin-film transistor color display and a tablet digitizer
12WX interactive pen display was selected to compare its pen. In order to generate the trajectory for the same motion
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
WANG et al.: IMUPEN WITH A TRAJECTORY RECONSTRUCTION ALGORITHM AND ITS APPLICATIONS 3519
Fig. 10. Final acceleration signals obtained by applying the MAD switch to the compensated acceleration signals for the square motion. (a) X-axis. (b) Y -axis.
(c) Z-axis. (The region with a gray color and the region with no color represent that the switch is turned off and on, respectively.)
Fig. 11. Results of the trajectory reconstruction. (a) Square shape. (b) Circle shape. Black color: Reference trajectory. Red color: With no switch. Green
color: Start–stop switch. Blue color: MAD switch.
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
3520 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 57, NO. 10, OCTOBER 2010
TABLE IV
C ONFUSION M ATRIX FOR H ANDWRITTEN D IGIT R ECOGNITION
U SING THE IMUPEN W ITH ITS A SSOCIATED T RAJECTORY
R ECONSTRUCTION A LGORITHM
Fig. 12. Trajectories of the ten digits. (a) Pictorial digit trajectories. (b) Digit
trajectories using the tablet digitizer pen. (c) Digit trajectories reconstructed
using the IMUPEN and its associated trajectory reconstruction algorithm.
TABLE II
C ONFUSION M ATRIX FOR H ANDWRITTEN D IGIT R ECOGNITION
U SING THE TABLET D IGITIZER P EN
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.
WANG et al.: IMUPEN WITH A TRAJECTORY RECONSTRUCTION ALGORITHM AND ITS APPLICATIONS 3521
method to reduce the orientation errors and the MAD switch [17] Y. S. Suh, “Attitude estimation by multiple-mode Kalman filters,” IEEE
so as to minimize the undesirable error accumulation. In the Trans. Ind. Electron., vol. 53, no. 4, pp. 1386–1389, Jun. 2006.
[18] Z. F. Syed, P. Aggarwal, C. Goodall, X. Niu, and N. El-Sheimy, “A new
motion trajectory reconstruction experiments, the trajectory multi-position calibration method for MEMS inertial navigation systems,”
reconstructed by our algorithm is close to the desired trajectory. Meas. Sci. Technol., vol. 18, no. 7, pp. 1897–1907, Jul. 2007.
In the handwriting digit recognition application, the overall [19] C. C. Tsang, P. H. W. Leong, G. Zhang, C. F. Chung, Z. Dong, G. Shi, and
W. J. Li, “Handwriting tracking based on coupled µIMU/Electromagnetic
recognition accuracy is 90.4% with a limited writing ambit and resonance motion detection,” in Proc. IEEE Int. Conf. Robot. Biomimet-
94.6% without any writing restriction. The effectiveness of the ics, 2007, pp. 377–381.
IMUPEN and its trajectory reconstruction algorithm has been [20] C. Verplaetse, “Inertial proprioceptive devices: Self-motion-sensing toys
and tools,” IBM Syst. J., vol. 35, no. 3/4, pp. 639–650, 1996.
successfully validated by the experiments. We believe that the [21] S.-H. P. Won, F. Golnaraghi, and W. W. Melek, “A fastening tool tracking
IMUPEN and its associated trajectory reconstruction algorithm system using an IMU and a position sensor with Kalman filters and a fuzzy
can be regarded as a novel and effective HCI device. expert system,” IEEE Trans. Ind. Electron., vol. 56, no. 5, pp. 1782–1792,
May 2009.
[22] X. Yun and E. R. Bachmann, “Design, implementation, and experimental
R EFERENCES results of a quaternion-based Kalman filter for human body motion track-
ing,” IEEE Trans. Robot., vol. 22, no. 6, pp. 1216–1227, Dec. 2006.
[1] W. T. Ang, P. K. Khosla, and C. N. Riviere, “Nonlinear regression model [23] G. Zhang, G. Shi, Y. Luo, H. Wong, W. J. Li, P. H. W. Leong, and
of a low-g MEMS accelerometer,” IEEE Sensor J., vol. 7, no. 1, pp. 81– M. Y. Wong, “Towards an ubiquitous wireless digital writing instrument
88, Jan. 2007. using MEMS motion sensing technology,” in Proc. IEEE/ASME Int. Conf.
[2] W. C. Bang, W. Chang, K. H. Kang, E. S. Choi, A. Potanin, and Adv. Intell. Mechatronics, 2005, pp. 795–800.
D. Y. Kim, “Self-contained spatial input device for wearable computers,” [24] S. Zhou, Z. Dong, W. J. Li, and C. P. Kwong, “Hand-written char-
in Proc. IEEE Int. Conf. Wearable Comput., 2003, pp. 26–34. acter recognition using MEMS motion sensing technology,” in Proc.
[3] R. Baron and R. Plamondon, “Acceleration measurement with an instru- IEEE/ASME Int. Conf. Adv. Intell. Mechatronics, 2008, pp. 1418–1423.
mented pen for signature verification and handwriting analysis,” IEEE [25] [Online]. Available: http://www.newport.com/
Trans. Instrum. Meas., vol. 38, no. 6, pp. 1132–1138, Dec. 1989.
[4] Z. Z. Bien, K.-H. Park, J.-W. Jung, and J.-H. Do, “Intention reading is es-
sential in human-friendly interfaces for the elderly and the handicapped,”
IEEE Trans. Ind. Electron., vol. 52, no. 6, pp. 1500–1505, Dec. 2005.
[5] E. S. Choi, W. C. Bang, S. J. Cho, J. Yang, D. Y. Kim, and S. R. Kim, Jeen-Shing Wang (S’94–M’02) received the B.S.
“Beatbox music phone: Gesture-based interactive mobile phone using and M.S. degrees in electrical engineering from the
a tri-axis accelerometer,” in Proc. IEEE Int. Conf. Ind. Technol., 2005, University of Missouri, Columbia, in 1996 and 1997,
pp. 97–102. respectively, and the Ph.D. degree from Purdue Uni-
[6] S. D. Choi, A. S. Lee, and S. Y. Lee, “On-line handwritten character recog- versity, West Lafayette, IN, in 2001.
nition with 3D accelerometer,” in Proc. IEEE Int. Conf. Inf. Acquisition, He is currently an Associate Professor with
2006, pp. 845–850. the Department of Electrical Engineering, Na-
[7] J. C. K. Chou, “Quaternion kinematic and dynamic differential equa- tional Cheng Kung University, Tainan, Taiwan.
tions,” IEEE Trans. Robot. Autom., vol. 8, no. 1, pp. 53–64, Feb. 1992. His research interests include computational intel-
[8] A. D. Cheok, Y. Qiu, K. Xu, and K. G. Kumar, “Combined wireless hard- ligence, intelligent control, clustering analysis, and
ware and real-time computer vision interface for tangible mixed reality,” optimization.
IEEE Trans. Ind. Electron., vol. 54, no. 4, pp. 2174–2189, Aug. 2007.
[9] Z. Dong, G. Zhang, C. C. Tsang, G. Shi, W. J. Li, P. H. W. Leong, and
M. Y. Wong, “µIMU-based handwriting recognition calibration by op-
tical tracking,” in Proc. IEEE Int. Conf. Robot. Biomimetics, 2007, Yu-Liang Hsu received the B.S. degree in auto-
pp. 382–387. matic control engineering from Feng Chia Univer-
[10] C.-S. Fahn and H. Sun, “Development of a data glove with reducing sity, Taichung, Taiwan, in 2004 and the M.S. degree
sensors based on magnetic induction,” IEEE Trans. Ind. Electron., vol. 52, in electrical engineering from the National Cheng
no. 2, pp. 585–594, Apr. 2005. Kung University, Tainan, Taiwan, in 2007. He is
[11] W. T. Fong, S. K. Ong, and A. Y. C. Nee, “Methods for in-field user currently working toward the Ph.D. degree in elec-
calibration of an inertial measurement unit without external equipment,” trical engineering in the Department of Electrical
Meas. Sci. Technol., vol. 19, no. 8, pp. 1–11, Aug. 2008. Engineering, National Cheng Kung University.
[12] Y. S. Kim, B. S. Soh, and S.-G. Lee, “A new wearable input device: His research interests include intelligent control,
SCURRY,” IEEE Trans. Ind. Electron., vol. 52, no. 6, pp. 1490–1499, nonlinear system identification, and inertial sensing.
Dec. 2005.
[13] J. B. Kuipers, Quaternions and Rotation Sequences. Princeton, NJ:
Princeton Univ. Press, 1999.
[14] J. C. Lötters, J. Schipper, P. H. Veltink, W. Olthius, and P. Bergveld,
“Procedure for in-use calibration of triaxial accelerometers in medical Jiun-Nan Liu received the B.S. degree in aeronau-
applications,” Sens. Actuators A, Phys., vol. 68, no. 1–3, pp. 221–228, tics and astronautics and the M.S. degree in electrical
Jun. 1998. engineering from the National Cheng Kung Univer-
[15] Y. Luo, C. C. Tsang, G. Zhang, Z. Dong, G. Shi, S. Y. Kwok, W. J. Li, sity, Tainan, Taiwan, in 2007 and 2009, respectively.
P. H. W. Leong, and M. Y. Wong, “An attitude compensation technique He is currently with the Department of Electrical
for a MEMS motion sensor based digital writing instrument,” in Proc. Engineering, National Cheng Kung University. His
IEEE Int. Conf. Nano/Micro Eng. Molecular Syst., 2006, pp. 909–914. research interests include signal processing and iner-
[16] A. M. Sabatini, “Quaternion-based strap-down integration method for tial sensing.
applications of inertial sensing to gait analysis,” Med. Biol. Eng. Comput.,
vol. 43, no. 1, pp. 94–101, Feb. 2005.
Authorized licensed use limited to: Access paid by The UC Irvine Libraries. Downloaded on September 15,2021 at 00:22:28 UTC from IEEE Xplore. Restrictions apply.