Research of handwriting detecting system for space pen

A handwriting detecting system based on Microaccelerometer and Micro-gyros is proposed. And the algorithm of the detecting system is also described in detail. And the error analysis of the detecting system is also described in detail. The motion contrail of the handwriting detecting in the 3-D space can be recognized through compute the matrix of attitude angles and the dynamic information of the handwriting detecting which is mapped on the 2-D plane. Then the information of contrail can be recurred on the writing plane by integral. There were good results in the actual experiment.


INTRODUCTION
MEMS (Micro-Electro-Mechanical Systems) inertial sensors because of its small size, lightweight and low power characteristic etc, in the portable device Human-Computer Interaction pay close attention.Acceleration sensor has been loaded in the mobile and through its gesture to replace parts of the keyboard input, such as implementation in applications of menu selection.However, these function are through contact with the touch screen under the situation, how to off-line and without the case of optical instruments to achieve the above function is a problem to be resolved.
The article introduces a contrail detecting system in 3-D space, which does not need a pad below.The system based on spatial navigation technology, which computes the dynamic information of the handheld devices in the mapping plane through detecting the acceleration of the handheld devices in the space relative to the writing plane [1][2][3].The system uses three Micro-accelerometer and three Micro-gyros as the sensor unit, through computation the attitude angles of the handheld devices in 3-D space in real time, the linear acceleration of each axis of the handheld device's coordinates can be gotten, then the contrail information on the mapping plane also can be gotten after mapping and integration [4,5].

SYSTEM STRUCTURE
The handheld devices uses a single DSP chip as the control unit, its function is computation of attitude angles of the pen in 3-D space and the linear acceleration.The data sample unit is constituted by one tri-axis Microgyros and one tri-axis accelerometer ADSI16350, both of the two kinds of sensors are manufactured by ADI company, and there also is a 16-bit A/D converter LTC1867 which is made by Linear company.The handheld device communicates with PC by RF mode, thus the contrail of the handheld devices will be displayed, and a LCD also can work.

The Handheld Device System Model
Figure 1 shows the handheld devices model in 3-D space, the XOY plane is the writing plane, namely the plane that info of the handheld devices mapped.The oxyz coordinates is attached to the handheld devices, namely the coordinates of the sensor installed.To get the contrail that is mapped on the writing plane, several physical variables are needed.These variables are acceleration of each axis of measurement coordinates (A x , A y , A z ), and the pitch angle (  , the angle between axis oz and XOY plane), the roll angle ( , the angle between axis ox and XOY plane), and the yaw angle ( , the angle between axis oy and XOY plane).Yaw angle can be ignored because of its little influence on result.

The Algorithm Introduction
The algorithm contains three parts: the measurement coordinates confirmation, the matrix of attitude angles confirmation and the solution to the handheld devices of which the acceleration mapped on the writing plane.The simplest instance is that the object is regarded as a point to be measured, so that the attitude changes caused by rotation can be ignored.So we only need to measure the movement characteristics on the 3 axes.Thus, the movements of this object can be expressed simply by kinematics equations.The velocity and displacement information can be gotten through computing the acceleration by following equations.
' n ' on behalf of any axis among X, Y, Z of the absolute coordinates, 0 v , 0 s on behalf of original velocity and displacement respectively, 0 t is start time of measurement, e t is stop time of measurement.So we only need to measure the acceleration of 3 axes, the start time and stop time to get the velocity and displacement characteristics on the 3 axes.The handheld devices cannot be seen as a point, because of its shape, shown as in Figure 1.Firstly, the handheld device's coordinates need to be confirmed.Suppose x g , y g , z g on behalf of the weights of gravitational acceleration on 3 axes of handheld device's coordinates.Because the changes of yaw angle have a little influence on the accelerometer when the handheld device moves horizontally or vertically, the system can be simplified as yaw angle equal to zero.The pitch angle  and roll angle  between handheld device's coordinates and writing plane's coordinates can be gotten in following equations.In this system writing plane's coordinates superposes with geographical coordinates.
The relationship of acceleration mapped on writing plane from handheld device's coordinates expressed by equations: (3) There into the Eq.3 on behalf of the dynamic angle changes which sample by micro-gyros during the writing action [6].
Original attitude angle determines the beginning situation of writing plane, the angles between writing plane and geographical coordinates are pitch 0  , roll 0  , and yaw 0  .Because the yaw angle varies little during the handheld device's movement, the yaw angle regards as a constant, namely 0 '   , the above equations can be simplified as: Through (4), the three weights of gravitational acceleration mapped on writing plane can be gotten by the same way.As shown in (5), * A on behalf of the linear acceleration of each axis of writing plane' coordinates, * a on behalf of the actual output acceleration of each axis of handheld device's coordinates, * g on behalf of the mapping gravitational acceleration value of writing plane' coordinates [7].
The basic equations to compute the velocity and displacement are shown in the following equations [8]: ' d ' on behalf of any direction among X, Y, and Z.
After sampling the acceleration signal becomes discrete signal, so the accumulative total will instead of the integral.Suppose the weights of acceleration on mapping plane (writing plane) are shown as follow: , following equations can be gotten.

The Error Analysis
In an ideal process of writing directly to mind is the measured acceleration in all axes whether zero at the beginning and end of exercise.But because of inherent acceleration sensor error and pen gesture of placing will lead to all directions on the different components of the acceleration due to gravity.Because of the sensor itself error and AD conversion error, even in the handheld device to maintain stationary, signal acquisition is not entirely the same, so the time points should not have direct access 0 0 t  and e T t  .For determine the starting point and termination points of each contrail.
Here the first analysis method carried out using differential treatment.For the static sensor error is relatively small and homogeneous data, according to whether the difference exceeds a certain threshold to determine whether exercise has happened.But the problems of the difference method are individual points fluctuations may result in greater volatility, however the exercise is not happen.In addition in a sport the course may also appear repeatedly volatility, so this difference should not describe the problem very well.Standard deviation analysis method can be used on this phenomenon, in the writing process can be seen in a single point because of the existence of measurement error and the entire writing process of non-continuous and high acceleration characteristics, should not only depend on a single point to distinguish the beginning and end of a sign.Therefore it need to consider the local statistical characteristics to the process of writing .suchas through calculated standard deviation of multiple points as a criterion exercise.The equation of standard deviation is expressed: Calculating the standard deviation of each point except to capitalize on the current point, but also necessary to use the previous 1 N  points.Writing at the track which also need to reduce the signal noise ratio, where the use of smoothing methods.If the true signal is smooth, smooth deal will only reduce the signal noise, it will not distort the true picture signal.
Point smoothing algorithm's basic equation: j S on behalf of the j point value of the Smooth signal, j Y on behalf of the j point value of original signal.

Through selection of different factors
i f can get smoothing of different forms and noise level.Here we used the triangular approach to deal with smooth, triangular smooth manner can avoid the disturbance to the peak signal, which is a weighted smoothing method. Here (11) Triangle smoothing can be seen as two k point rec- tangular smooth superposition, so the triangular smooth approximation to reduce the level of random noise is k .After smoothing process and standard deviation calculated, the finally signal can be used to determine the contrail starting point and termination point.The use of triangular smoothing method reduces the data noise, after smoothing the bias reduces, but does not change shape.

Micro-Gyro Rate Test Model
In this system gyro is used for real-time detect the change of initial state attitude angle, it is very important for elimination gravity acceleration components, so the gyro calibration also is very important.In the following  is the gyro rate test model [9].Take ADXRS401 microgyro, for example: V-Output voltage of micro-gyro, unit is V; K0-Drift value of micro-gyro, unit is V; K1-Scale factor of micro-gyro, unit is V/  /s; ω-Angular velocity input of micro-gyro, unit is  /s。

Micro-Gyro Calibration Test
① Put the micro-gyro in the test equipment and fixes the sensor on the turntable, the equipment we used is DTOP300E type uniaxial turntable.② Give micro-gyro power supply of 5 V. ③ Through the turntable computer given ±10  /s, ±20  /s, ±30  /s, ±40  /s, ±50  /s, ±60  /s, ±70  /s angular velocity input.④ After the turntable rotated at least four round by one angular velocity we began to sample and sampled continuously for one minute, then recorded one group data, finally we can get 15 group data, shown in the following Table 1.

Micro-Accelerometer Calibration Test
The micro-accelerometer is used to test the attitude angles when the pen hasn't yet write, in other word it's used to test the static attitude angles.Due to the acceleration sensor adopted for integrated triaxial acceleration sensor, so the orthogonal error will not affect the precision, then, the most error sources are zero error and sensitivity error and the error caused by the A/D conversion errors.We select ±g and 0g as the special points to calibration the sensor's zero output and sensitivity [10].The Table 2 shows calibration results of each axis of x, y, z.The ADC is 16bit and reference voltage is 4.096V.

SYSTEM TEST RESULT ANALYZE
In the system test process we tested the round contrail and analyzed the dynamic characters of this contrail which is representative.The dynamic curves are shown in following figures.Axis z of accelerometer is perpendicular to the mapping plane due to the sensor installation, so the axis z has no effect on the contrail recurrence.To recur the writing contrail the acceleration of axis x and axis y of accelerometer are needed both.As shown in   4, the acceleration is positive between the sample points 7 to 14.According to the Eq.1 we can know that the speed is increased at these points, as Figure 5 show, the speed curve is rising from point 7 to 14. However because of the error，this paragraph curve is not ideal one, Thus, the use of Ⅲ C error handling can be used for their amendments in order to     obtain the corresponding curves of Figure 5. Similarly according to the Eqs.1,8 and 11 we can obtain displacement curve from the velocity curve.After error correction a smooth curve of Figure 6 is obtained, Last using the two displacement curves represents x, y-axis of the plane coordinate system respectively.Therefore, in accordance with their corresponding points the contrail curve can be drawn on the plane coordinate system, as shown in

CONCLUSIONS
In this paper a kind of handwriting detecting system based on MEMS inertia sensors is introduced.The system samples the pen's acceleration and attitude angles changes and then computes the movement contrail of pen, finally the recurrence of handwriting is finished.The test result validates correctness of the theory.The system is different with usual 2-D electronic pen system, its greatest strength is freely writing in 3-D space and this is the first case of the inertial navigation theory is  The next tasks will content sensors data fusion and the accumulate errors analysis of the double integral.Then the more accurate contrail can be gotten.In additional, a better algorithm of weights of gravitational acceleration removal is needed to look for, so that the more pure dynamic acceleration can be gotten.

Figure 2
is the view of five untreated Error.Figure 3 is the view of five treated Error.The curve of Figure 3 is more smoothness than this Figure 2.

Figure 2 .
Figure 2. View of five untreated error.

Figure 3 .
Figure 3.View of five treated error.

Figure 2
are curves of acceleration, velocity and displacement of the five contrail without error treatment.As shown in Figure 3 are curves of acceleration, velocity and displacement of the five contrail through error treatment.As shown in Figures 4,5 and 6 are curves of acceleration, velocity and displacement of the five contrail through error treatment.Analysis of Figures 4,5

and 6 .
According to Figure

Figure 7 .
Other contrail identified pictures are shown in Figure 8 and Figure 9: