A smart phone based gait monitor system

Gait analysis is the study of human locomotion and is able to provide useful information in various areas such as health care, therapy, sports training, and characteristic recognition. This paper presents a smartphone based system to collect and calculate gait parameters. These parameters consisted of step length, velocity, cadence, motion intensity, and walking regularity are calculated from the sensor data collected by the inertial sensor of a smart-phone. A prototype of gait parameter collection and visualization system was developed on a laptop and cell phone. The proposed system collects accelerometer data from a smart-phone and calculates the gait parameters related to walking activity. All the parameters are displayed on a customized Matlab graphic user interface on the laptop. The fall detection function is also integrated into the system. Once the user fall down, an alarm message will be sent to preset contact. The experiments are carried out on 4 subjects to test the stability and accuracy of the system. The system shows high accuracy and reliability on counting steps (error < 5.47%) and walking duration (error < 4.55%). Based on the gait monitor system, an anomaly data detection method is presented. Four independent gait parameters include cadence, and tri-axel motion intensity parameters are chosen from previous results during normal activity. If the latest data deviates from the normal activity model too far, the data will be set as an abnormal event.


INTRODUCTION
Gait analysis studies human locomotion in terms of gait parameters, like walking cadence, velocity and step length, augmented by measuring body movements, body mechanics, and the activity of the muscles.Gait analysis is used to assess, plan, and treats individuals with diseases that affect their ability to walk.It is also commonly used in sports biomechanics to improve athletes run in more efficiently way or to identify posture or movement related problems for injured people.Walking activities are described as gait event in the studies.The gait event or cycle begins when one heel hits the ground and ends when another heel hitting the same ground.The events consist of the stance phase (the heel-totoe contact sequence of the foot) and the Swing phase (the foot suspending and proceeding in the air).Some commonly used gait parameters are defined based on the detection of gait event.The velocity is the relation between the walking distance and duration.Step length is the tip-to-tip or heel-to-heel distance between two subsequent feet.Cadence is the number of steps the person walking per second.A search on the web for scientific articles that include "gait" in the title returned more than 3,400 publications between 2012 and 2013 [16].All these researches are acquired quantitative measurements that characterized gait in order to apply them to various fields.Therefore, various sensors have been developed to measure data related to walking activities.These user carried sensors can be divided into three categories: imaging, floor, and body-worn sensors.
The statistical data shows that 40% of the reviewed articles published in late 2012 and 2013 are related to non-wearable systems, and 37.5% of them are proposed inertial sensorbased systems.The remaining 22.5% are from other wearable systems.An increasing number of researches indicated the fact that the body-wear based portable sensors systems are the most promising method for gait analysis [16].
Our work is focused on designing a smart-phone based gait monitor system which is easier to spread than other independent gait monitor systems.Most smart-phone has an inertial measurement unit built inside.An inertial measurement unit worked by detecting current rate of acceleration using multi-axes accelerometer and rotational attributes like pitch, roll and yaw using multi-axis gyroscope.Some also include magnetometer mostly to assist calibration against orientation drift.For the purpose of gait analysis, these data are converted into commonly used gait parameters such as velocity, step length, and cadence.
Falling detection is an important application for inertial sensor.Falling can happen in anytime and anywhere, and may cause serious consequence especially for the older population.It is estimated that more than one third of the adults aged over 65 years fell each year [2], [17], and therefore makes it the leading cause of nonfatal injury for the age group.Recent researches on injuries in general public have shown that the fall is an increasing cause of injury, especially fractures, in elderly individuals [11].
Among older people, 55 percent of fall injuries occurred inside the home.An additional 23 percent occurred outside but near their home [19], [3].Traditionally, placing seniors in nursing homes or care centers reduces the risk of fall.However, with wireless networks and low-power mote technology, we can now approach the problem from a different perspective [3], [4], [9].With highly reliable fall detection system, person suffered from fall especially the aged population can be found immediately, and a real time alarm system can be build based on the architectures.
In addition to fall, similar accidents happening during daily life include slip and trip.Slip has been a research topic for a long time.Some researches focus on the relation between fall or trip accidents and build features like stairs, ladders, windows and roofs.They find fall accounted for more than 80% slip, trip and fall (STF) related fatalities, and 61.4% of these accidents are related to fall on stairs [5].There are also some researches studied the STF accidents in work groups with reference to age.The group with age of 45 or higher has an increased rate of STF accidents in recent years [12].Aside from occupational accidents, STF is also the second-leading reason for intentional death.It cause more than 25,000 fatalities in 2009.Elderly individuals have the highest risk, more than 3.3 million nonfatal STFs happen on elderly individuals in 2012.

RELATED WORKS
The following researches provide statistic references for others.Herran et al. [16] reviewed gait analysis researches, including image processing, floor sensors, and sensors placed on the body.The statistic result shows a trend that the wearable sensor are becoming more and more popular in both research field and application field.Kunze et al. [13] compared the differences among the body sensors placements such as on the head, wrist, torso, and pocket.They implanted series of experiments and the result suggested that the waist could be the most reliable choice for measuring human activity.
In order to obtain accurate gait parameters, various algorithms for converting raw sensor data to gait parameters have been developed.Trojaniello et al. [20]reviewed five methods of estimating gait event and temporal parameter from the acceleration signals of single inertial measurement unit were compared through tests.Their result indicates that their sensitivity values varies from 81% to 100% across methods.Their positive predictive values are ranged from 94% to 100%.In the estimation of step and stride durations, all methods are acceptable while in estimating swing, stance and double support time some differences were found due to the error of final contact detection.It shows the position of the IMU on the lower trunk does not affect the accuracy too much except for one method.Depending on the statistical analysis result in the previous paper.M method has a good performance in the estimation of gait parameters.In the paper of M method [15], the author presents their estimating method which is relatively better than other two methods in previous researches.They take advantages from the continuous wavelet transform which can remove extraneous signal fluctuation but preserve the underlying frequency.When combining with differentiation analysis, it shows good performance in suppressing noise, correcting baseline drift, resolving overlapping peaks.Thus, it can detect the initial contact (IC) and final contact (FC) exactly which indicates the beginning and the ending of a gait event.They also present a method to determine if the contact came from the right foot or the left foot.Except accelerometer, inertial measurement unit (IMU) also provided with gyroscope, so they can use angular velocity signal within the gyroscope to distinguish each side of contacts.In their experiment, all ICs and FCs are detected by their method and the time error was approximately 2% and 3% in each side, respectively.
Accelerometer or inertial sensor based fall detection methods have been raised in recent years.Gupta et al. [10] performed falling detection using tri-axial accelerometer.They put the accelerometer on subjects' waist combining with pressure sensor in the insole.They applied threshold based algorithm for fall detection which was similar to the algorithms from others.They also present new algorithm based on frequency analysis which used wavelet transform.It has good performance for gait classification and fall detection.Chen et al. [7]presented a fall detection method using noninvasive wearable sensor in conjunction with wireless network.They used low-power and low-cost MEMS technology based accelerometer and built a wearable circuit board for that.Then it was put on the waist for measuring the acceleration of a subject.Once the norm of the acceleration exceeds a threshold, an impact was found.If there was no impact within next several seconds, the system started to look for orientation change.If there was no orientation change from the subject, which indicated the subject was injured or even unconscious, the alarm system would send warning message to the nurse.Selvabalab et al. [18] implemented the human fall detection system using two wireless network architectures, named cross bow wireless sensor node system and PIC18LF4620 wireless module.The fall detection mechanism was conceived with two sensors including three-axes accelerometer and Passive Infrared (PIR) sensor to monitor the activities for elderly people.The resultant voltage changed because of the human activities are the targeted interest and are detected through both sensors.The real time output is compared with stored templates and the computational analysis is done within microcontroller in real time.The system informs the caretaker through the wireless architecture once any abnormal data different from the stored templates detected.
More complex activity monitor systems can identify differ-ent activities or recognize stumble rather than general fall.Lee et al. [14] implemented wireless accelerometer sensor module and algorithms to recognize wearer's posture, activities and fall.In their algorithm, activity is determined by the AC component of accelerometer signal and the posture is determined by the DC component of accelerometer signal.Those activity and posture included standing, sitting, lying, walking, running and so on.The fall detection rate of the system is 93.2% on 30 subjects.The whole system is built and tested using wireless sensor network in experimental space.This system can be applied to elders for activity monitoring, fall detection, exercise measurement, and pattern analysis.Different from looking for a specific pattern, Chehade et al. introduced a normal distribution walking model based on one feature extracted from acceleration signal during walking [6].They tried seven different places for the tri-axes accelerometer on the human body.Finally they found the sensor on the chest had the best performance for separating stumble from normal activities.The stumble data is considered as an abnormal deviation from the normal activity model, so they trained their model through a long period of history data.The best threshold of this model was when the model reached the lowest false alarm rate.Some researchers developed a gait parameter analysis tool based on one accelerometer [23].Yang's group designed a software program for extracting gait parameters from accelerometer signal and displaying these parameter through a graphic user interface.Their work provided a convenient tool for themselves and others.For general purpose, more complicated body sensor networks (BSNs) contain inertial, ECG, humidity, and light sensors, have been studied intensively in recent years.In the perspective of system design methodology, Fortino et al. summarized the common tasks and requirements for BSNs applications in their paper [8].This paper presented an open-source programming framework, signal processing in node environment (SPINE), which could fulfill these requirements.Therefore, an efficient management of body sensor networks could be achieved under this architecture.In this project, several parameters like cadence, velocity, motion intensity are collected.

SYSTEM 3.1 Gait parameter calculation
The system collects data from the sensors in the smartphone which is clipped on the waist.The mobile device recorded acceleration data in a sampling frequency of 50Hz.Then the data is transmitted to the laptop in the Matlab where the raw sensor data is converted into gait parameters.All results and a Flash playing the walking or running cadence of the user are shown in a customized Matlab GUI. Figure 2 and 3 show the system diagram and the system flowchart.
Step counting algorithm is the core of the whole program.This self-adaptive peak-detection algorithm has following advantages comparing with other algorithms.First, it is insensitive to the peak amplitude changing.The amplitude of the peak usually changes and the main reasons can be the location changing in response to our body or motion intensity.The changes of the smart-phone placement may severely affect the peak value because it changed the orientation of the smart-phone and the distribution of the gravity in three coordinates.That is the reason that caused the in- Second, since the window sizes change with fundamental frequency all the time, no matter how fast or slow the user walks or runs, it can be guaranteed that the window will not cover two true peaks in anytime while it can exclude the false peak that is closed to the true peak.Thus, this algorithm is superior comparing to other peak detection algorithms using sliding window for fixed size or using filter of fixed cut off frequency.

Cadence = steps/walkingduration
(1) V elocity = walkingdistance/walkingduration RM S = (Ai − Am) 2 /N (4) The starting and ending times for each walking activity are detected automatically through the real-time step counting algorithm so that the walking duration can be acquired in this way.Based on these information, variety of gait parameters can be calculated through these formulas above.Some of them might require walking distance information input by users.Root mean square (RMS) that related to the exercise intensity is defined by the formula 4. Ai represents i th acceleration sample in the sequence, this sequence contains all samples of a complete walking activity.Am represents the average value of this sequence and N represents the length of this sequence.The RMS1-3 indicate the three axis of the acceleration signal individually.Regularity is defined by Step 2: Performing FFT analysis on these 150 samples, acquiring the fundamental frequency of this sequence.
Step 3: Based on the fundamental frequency, making a new window with the size equal to one cycle of the fundamental component of the signal.
Step 4: If this window size is out of the range between 12 and 50, it is limited to the margin of this range.Which means we suppose that the gait event frequency cannot be higher than 4.16/sec or lower than 1/sec.Part b: Window locating (In this part the system finds a peak then moves the window to the peak) Step 5: Applying the new window on the signal sequence, finding the negative peak within the window.
Step 6: Putting the window around the negative peak, so the peak is located in the center of the window.Part c: Peak verification (In the last the system makes sure that the peak found in last part does correspond to one step) Step 7: Determining whether the negative peak is the lowest value within the window.If not, go back to step 1.
Otherwise, go to next step.
Step 8: If it is different from the last peak value M and this negative peak value is also lower than -2.5*g (gravitation), the number of steps increases by one and the value of M is replaced by this peak value.Otherwise, go back to step 1.
Step 9: Calculating gait parameters based on formulas (1)˜(5).formula 5.In the formula 5, A f f represents the amplitude of the fundamental frequency and A f i represents the amplitude of the i th frequency in the spectrum.The better the subject keeps in a fixed walking cadence, the higher regularity and amplitude of the fundamental frequency.All these parameters are shown in the Figure 4.

Fall detection
Fall detection and alarming functions are integrated into the system.According to the observation from related experiment [7] falling has distinct feature.The average peak of acceleration changes during siting and walking only reaches 2.5*G and 1.9*G, respectively, while falling are from 6.9*G to 12.7*G.In another experiment [10], the minimal peak value of acceleration changed during falling down is 8.4*G while the maxima values during walking, sitting and shuffle walk are 5.3*G,4.0*Gand 4.9*G.These results ensured a robust methodology for threshold based fall detection.In our system, we defined the acceleration changing through the following formula.
In this formula, Ac is the indicator of amplitude changing, aimax and aimin is the maximum and minimum values for the latest input acceleration signal sequence with length of 100 in i th direction.
People suffered from fall do not always need help, in most cases they can help themselves.Thus, a double check is implemented after a falling has been found.If there is no distinct acceleration changing after fall for a time period longer than 20 seconds, which means that the person cannot move himself/herself, the system will send an alarm message to another person.We use the formula below to determine if there is any movement on the subject.
ai(n) represented the n th acceleration data in i th direction.If A d is larger than 2, the system will take the subject as being able to help himself/herself.

Abnormal activity detection
An abnormal activity detection algorithm is presented in this work.A normal activity model is built based on several independent real-time gait parameters acquired from previous work (cadence, RMS1-3).When people suffered from accidents like fall, slip or trip, their motion intensity and walking cadence are changing rapidly.Therefore, these parameters are capable of reflecting effectively whether some accidents are happened on the user.First of all, the system collects past 2 minutes data and separates these data into 24 short segments (L,1)˜(L,24).Each segment L has a length for 5 seconds without overlapping.Second, these gait parameters are calculated for each segment.Four sequences of different parameters, (C,1)˜(C,24), (R1,1)˜(R1,24), (R2,1)˜(R2,24) and (R3,1)˜(R3,24) are extracted from (L,1)˜(L,24).These sequences correspond to cadence, RMS1-3.Third, the mean µ and standard deviation σ are calculated in each parameter sequence (C, R1, R2, R3).A normal distribution model is built as Eq.( 8).
Fourth, a dynamic threshold τ is set based on the normal distribution model, the initial value of the threshold is plus/minus 3σ away from the mean value.Once any of these gait parameters of latest segment is out of the thresholds, an alarm message is shown on the GUI and the user can determine if the reported anomaly is true or false.The threshold in each model is modified based on the false positive and negative.If a sequence of normal walking is reported as an accident, the threshold will be modified by 0.5σ to reduce the sensitivity of alarm system.Vice versa, if an accident is missing, the sensitivity will increase by the same amount.Different from other specific pattern recognition model, the proposed model is built based on a normal walking or running activity.Four different features from the previous gait parameter calculation system are selected to build the normal activity model.This anomaly detection algorithm can find distinct abnormal gait parameters that come from an occasional accident.

EXPERIMENT 4.1 Experiment setup
Gait parameters acquired from our system are tested through the following experiments on 4 people.The experiment tools include experiment and control groups.Experiment group includes a smart-phone (Google Nexus6) with clip on a phone case, and a laptop.Control group contains a video recording device and a tape measure.The experiment environment is on an outdoor field with 40 meters straight line drown on the ground.

Description
During the experiment, each subject went through the calibrated line three times by slow speed walking, fast speed walking, and jogging.The whole process was recorded by video recording device.Following the experiment results, steps, cadence, average velocity, average step length were compared with the real data derived from the video record.
Other results like RMS1-3 and regularity were listed individually.In the fall detection test, each subject was asked to fall down on the mattress 3 times in each direction (forward, backward, and sideward), and the number of correct detection times were recorded.

Results
Subject

DISCUSSION
The experiment results show acceptable accuracy for calculating steps, duration, cadence, average step length, and velocity.The average error for steps and duration are 5.4692% and 4.5465%, respectively.The main error comes from the jogging test of subject 3. Unlike other subjects, subject 3 did not wear leather belt on the trouser, and the smart-phone could not be placed securely on the user.It caused irregular movement of the smart-phone while jogging.The results indicate that most people have better ability to keep their gait cadence in walking than running.In addition, the comparison of the results from all subjects shows that keeping cadence during running is a challenge task.So the regularity can be used to determine how well people can control their body movement in a regular pattern.The motion intensity indicator RMS shows that in most cases people have more intense movement in vertical direction during walking and running.The limitation of the system is that the gait parameter calculation method requires manually input the walking distance.Currently, many popular commercialized sports bands from Fitbit, Jawbone, and Nike have the function of step counting while none of them has achieve the accurate calculation of walking distance.The related studies have been done in some areas like the inertial sensor based navigation system.This limitation hopefully could be addressed based on these researches.Comparing with these commercialized products, our system is more suitable for people with some abnormal walking posture.In our early research [22][21], these commercialized products were tested on old people, and found perform huge errors on cane or walker users.However, our smart-phone based system does not affected by the abnormal posture from user's arm.
The accuracy of fall detection is closely related to how people fall.Falling sideward has the heaviest impact while the impact of falling forward and backward has mitigated by arm or hip.The threshold based fall detection method could be failed in case of affecting by people's subconscious protection actions.After falling, if the subject stand up within 20 seconds, the alarm will not be triggered.The experiment has one limitation which frequently appears in similar experiments.In order to verify such kind of system, the test should be carried out on people in realistic situations.Since the falling is a rarely happened event, it is hard to collect enough data from realistic situation.Therefore, all falling events are simulated in the laboratory environment.A deliberate falling is slower and slighter than an accidental falling.Moreover, all subjects are falling on a mattress instead of the ground, and it mitigates the impact in some degree and reduces the amplitude of the signal peak during falling.The falling in the realistic situation could be more intense and the amplitude of acceleration signal will be higher as well.
The accuracy of the system has been verified by the experiments, and these gait parameters can be used to describe human activity.The normal distribution model of walking can be used to detect accidents caused by either internal or external factors.The observation and experience indicates that people tend to keep a fixed pace during normal activity.Therefore, the acceleration signal has a repeated pattern and gait parameters should be in a limited range within a short period of time.Any parameter far from this range can be caused by accidents.However, the limitation of this method is it cannot distinguish what accident it is.It requires different sensor in different places like pressure sensor in the insole or inertial sensor on the ankle to recognize some specific patterns.

CONCLUSION
This paper presents a convenient tool for collecting data from smart-phons, plotting real-time acceleration data and playing corresponding flash of the user's cadence in GUI, and calculating 9 different key parameters closely related to walking activity.The integrated accident detection function also protects people from injury.The smart-phone platform can be extended to other mobile devices with accelerometer and data transmission functions, and the sampling frequency can also be adjusted from 20 to 250Hz.Currently, the algorithm is designed for putting smart-phone on the waist, the future work will include improving the feasibility of the mobile device on different positions of human body.Moreover, the system performs well in different walking speeds without information from the source of the acceleration peak, and the other activities like jumping or sitting can also be taken as a step.Thus, activity classification function can be added to the system.