Aqueveque, Sobarzo, Saavedra, Maldonado, and Gómez: Android Platform for Realtime Gait Tracking Using Inertial Measurement Units

Android Platform for Realtime Gait Tracking Using Inertial Measurement Units


One of the most important movements performed by the humans is gait. Biomechanical Gait analysis is usually by optical capture systems. However, such systems are expensive and sensitive to light and obstacles. In order to reduce those costs a system based on Inertial Measurements Units (IMU) is proposed. IMU are a good option to make movement analisys indoor with a low post-processing data, allowing to connect those systems to an Android platform. The design is based on two elements: a) The IMU sensors and the b) Android device. The IMU sensor is simple, small (35 x 35 mm), portable and autonomous (7.8 hrs). A resolution of 0.01° in their measurements is obtained, and sends data via Bluetooth link. The Android application works for Android 4.2 or higher, and it is compatible with Bluetooth devices 2.0 or higher. Three IMU sensors send data to a Tablet wirelessly, in order to evaluate the angles evolution for each joint of the leg (hip, knee and ankle). This information is used to calculate gait index and evaluate the gait quality online during the physical therapist is working with the patient.

Human locomotion have a series of alternating rhythmic movements of the low limbs and trunk which defines a forward movement of the body and therefore the center of gravity. Any alteration in that exercise can lead to discomfort and even injury in different levels of the body.1 Normally, biomechanical gait analysis is done using optical motion capture systems with high-speed cameras and infrared markers.2 Such systems are sensitive to light, obstacles and are expensive. However, some new systems for the optical motion analysis have been implemented3 using commercial cameras4 in order to reduce the costs associated with the system described above, but these systems are limited to indoor environments (laboratories or rooms) and need a high postprocessing time and resources. Inertial Measurement Units (IMU) have been developed to measure navigation angles without the known problems of accelerometers and gyroscopes. Comercial versions of IMU are a good option for movement analysis with a mechanical model of the body. In the field of medicine, these systems have been able to enter in the field of clinical assessment of movement, either complementing or replacing other widely used, for example video based capture analysis, simple visual observation and measurement of diagnostic methods postural stability using posturography.5 For that reason, a system based on inertial sensors (accelerometers, gyroscopes and magnetometers) is proposed for gait analysis using navigation angles. Three sensors send the data wirelessly to a tablet (android device) and angles evolution of each step can be evaluated. This information permits calculate gait index and evaluate the gait quality on line while the physical therapist is working with the patient. We propose a tool to help physical therapists to evaluate in real time the performance of the gait of people with drop foot and compare with the gait when a drop foot stimulator is used.7,8.

Matherials and Methods


In humans, gait involves a method in which, as bipedal species, use their lower limbs for make coordinated and cyclical movements to move. The gait period begins when the foot loose the contact with the floor and ends with the next contact with the floor of the same foot.1 Thus, from the above definition it is possible to analyze the movement exerted in two phases: the support phase and the swing phase (see Fig. 1). The support phase can be subdivided into four stages:1

  • Contact with the heel is the initial contact were the gait analysis begins and occurs when the heel contact with the floor, keeping the hip flexed and the fully extended articulation of the knee, while the ankle keeps angle between the leg and the instep.1

  • The response to the load occurs in the moment when the heel touches the ground (plantar flexion) and lowering part of the foot begins to make full contact with the ground.9

  • The stage of medium support is given at the time when the opposite foot is in the air, so everything that the body supports is concentrated on the foot being analyzed. The knee joint reaches its peak bending at this stage, to result in the dorsiflexion of the ankle joint from plantar flexion.1

  • The heel lift is when the heel starts its descent to the floor, where the dorsiflexion of the ankle joint reaches its maximum at the moment when the heel is peeled completely off the ground, starting the foot swing phase.1

Foot swing phase consist in the movement forward of the foot, and is divided into two stages:

  • Takeoff of foot is time when the entire foot loses the contact with floor and is the point where the ankle plantar flexion is maximum. To proceed with pendulous movement of the leg forward.1

  • The medium swing is the stage where the ankle passes from plantar flexion to dorsiflexion (to complete the movement of dorsiflexion) reaching this stage the closest approximation of the toes to the floor, to end contact heel on the floor and restart the gait cycle.1

System design

A. Inertial Measurement Unit (IMU)

The design of the device should be simple, small, portable and autonomous. As a general outline, the diagram is shown in Fig. 2. The system has its own battery charger for the power supply, a central processing for receiving and sending data, corresponding to the microcontroller, the sensor and the transmission system via Bluetooth. Sending format angles measured by the device is quaternary, which implies a transmission of 5 bytes per shipment, 1 per quaternary angle and 1 for an identifier indicating the start of a measurement.

B. Android Application

As every Android app, the developed application has the following technical requirements:

  • Android 4.2 “Jelly Bean” or higher.

  • Bluetooth device 2.0 or higher.

Starting the application, the device will ask for permission to activate the Bluetooth device, in case the device is not activated. If it is already activated it will generate a list containing the previously Bluetooth paired devices with the smartphone or tablet so the user can connect the android app with the sensors to receive data from the sensors and perform the tracking. The application has two main parts described below:

  1. Sensor’s connection: Connection with Bluetooth devices in Android systems is a system blocking procedure, for this reason the connection is made in a different thread that manages the user interface (UI thread). In case that the connection fails, a screen message will inform the user in order to retry the connection, but if the connection is successful, the application asks the user in which part of the body the sensor is located: thigh, ankle or foot.

  2. Data reception: Once all sensors needed to measure are connected, the user accesses to the data reception fragment. In this fragment sockets are received from the previous fragment where the connection was established. In the data reception fragment both threads and connected sockets are created. Each thread is in charge only of one connected socket, get its input stream and keeps reading it and recreating 5 bytes packets to pass them to a specific function. This function receives the raw data packet, writes the data in the output file and gets the three navigation angles from the raw data. Additionally this angles are added to the charts, then through the communication between the secondary threads and the UI thread the charts are updated every 10 samples. All this process is detailed in Figure 3, where the process is showed in a scheme for one single socket. If the user selects to work without charts, this scheme is enormously simplified deleting the blocks of conversion to navigation angles and the addition of data to the charts. Once the measure with the app is finished, a CSV file is saved on the Android device in the following format:


    The indexes represent the order of connection (index_c) and the segment of the leg where the sensor was located (index_s). The fourth value corresponds to the sample number followed by the time when this sample was read. The last four values are the quaternary angles received from the sensor. Additionally Figure 4 shows three screenshots of the application.


For gait analysis, the measurement protocol is to locate the three sensors in the positions shown in Figure 5, connect them with the application and then wait for the stabilization of measurements, i.e. the graphic lines remain for calibration and after this the march consisting of three to five steps, after which terminates the test. In Figure 6 the angles described by the three joints of the leg during measurement of the walk are observed. Data that is subsequently processed in Matlab for analysis. According to the arrangement of the sensor and in this case, the Yaw curve represents the lateral movement of each segment of the leg, the Roll curve rotational movements and the Pitch curve the movements to front and back, the latter being the most variable during a march in a straight line (see Fig. 7). To make a little deeper in the analysis of the obtained data, a step is selected in the march of the subject, as shown in Figure 8, where it is possible to identify two major stages of walking, and some sub-phases.9 In addition, Figure 8 can dislodge some interesting data to analyze the amplitudes achieved in some movements that are part of the walk, such as:

  • Hip flexion: 29.8766 °

  • Knee flexion: 49.2409 °

  • Dorsi-flexion of the foot: 8.6835 °

  • Plantar flexion: 24.2326 °

By reference,10 the above results are within the normal amplitude range of movements of the joints measurements. From figures 6 and 8, we can measure some interesting Gait Cycle Index (GCI),6 shown in the Table 1.


A system for measuring and evaluating the gait based in inertial sensors was implemented. The system is simple, inexpensive, convenient, easy to use and flexible. The system consists in inertial measurement devices and an Android application for the acquisition and display of data in real time. The use of this application for data collection and realtime evaluation of gait, is beneficial for professionals being a cheap way to evaluate and monitor objectively patients. The system also involves a great help to patients suffering dropped foot, because represents a good option for an objetive evaluation of the gait. Due to the portable feature of the system, it becomes easy to move it by a treating physician or physical therapist. The system is small (35 x 35 mm), has a calculated 7.8 hours of autonomy, a resolution of 0.01°in their measurements and proves to be an effective alternative for evaluation and analysis of movement at low cost and close to the user. It is proposed as a future work to increase the processing performed by the developed application,11 to provide more clear and direct information for the professional that is using the system to evaluate gait performance by indexes, to eliminate the postprocessing of acquired data in another platform, and implement an automated web platform that receives the file with the data saved by the application and submit a full report analyzed the patient’s condition to record it. In this way, the compatibility of the system is secured in different operative systems.


This work was supported by the National Fund for Scientific and Technological Development, FONDECYT, Chile, through FONDECYT N° 1140469 and FONDEQUIP EQM150114.



MW Whittle. Gait analysis: An introduction. Butterworth Heinemann, Oxford - Great Britain, 4th edition, 2007.


F.R.I.N. Marconi Electronic Systems Ltd A. D. King, B.Sc. Inertial navigation – forty years of evolution. GEC REVIEW, 13, 1998.


AV Dowling, O Barzilay, Y Lomborzo, A. Wolf An adaptive home-use robotic rehabilitation system for the upper body. IEEE Journal of Translational Engineering in Health and Medicine, Vol. 2, 2014.


O Sprdlik. Detection and Estimation of Human Movement Using Inertial Sensors: Applications in Neurology. Ph.d thesis, Control Engineering department, Electrical engineering faculty. Czech Technical University, Prague, 2012.


H Zhou. Hu Housheng. Human motion tracking for rehabilitation—a survey. Biomedical Signal Processing and Control, 3, January 2008.


A Cretual, K Bervet, L. Ballaz Gillette gait index in adults. Gait & Posture, Vol. 32, Issue 3, Jul. 2010; pp. 307-310.


PN Taylor, IA Wilkinson, MS Khan, DEM Slade-Sharman. The Correction of Dropped Foot Due to Multiple Sclerosis Using the STIMuSTEP Implanted Dropped Foot Stimulator. International Journal of Mulple Sclerosis Care, 2015; DOI: 10.7224/1537-2073.2015-038


KW Cheng, T Kai-Yu, AB Rad. Development of a circuit for functional electrical stimulation. IEEE Transactions on neural systems and rehabilitation engineering 2004;12.


J Perry, J. Burnfield Gait analysis: Normal and Pathological function. SLACK Incorporated, Thorofare, U.S.A, 2th edition, 2010.


A Faller, M. Schunke The Human Body: An Introduction to Structure and Function. Thieme, Stuttgart - New York, 4th edition, 2004.


J Won, J Saniie. Smart mobile system for body sensor networks. Electro/Information Technology 2013.

Fig 1.

Phases of gait.

Fig 2.

General hardware scheme of IMU sensor.

Fig 3.

Scheme of data reception and charts update.

Fig 4.

Screenshots of the application, (a) Connection fragment showing devices, (b) connection fragment showing segments, (c) Reception data.

Fig 5.

Location of sensors for measurements, A: Hip sensor, B: Knee sensor, C: Ankle sensor.

Fig 6.

Graphics obtained from gait test subject.

Fig 7.

A representation of the sensors measures with its reference axis in sagital plane, where α is the pitch angle of the hip, β is the pitch angle of the knee and λ is the pitch angle of the ankle. A, B and C are the locations described in Figure 5.

Fig 8.

One step of gait test subject. Where A: Rest, just before the subject begins to walk, B: swing phase when the foot is in the air, C: Support phase when the foot returns to the floor, D: Medium support, E : takeoff of the foot, F: medium swing, G: heel lift.

Fig 9.

Phases identified in test. A: Rest, just before subject begins to walk, B: swing phase: foot is in air, C: Support phase: foot returns to floor, D: Medium support, E: takeoff of foot, F: medium swing, G: heel lift.

Table 1.

Gait cycle index (GCI) from figures 6 and 8.

Index Value
Time of toe off (% gait cycle) 51.54
Cadence (step/s) 1.60
Minimum hip flexion (°) 1.61
Range of hip flexion (°) 29.88
Peak abduction in swing phase (°) 3.27
Range hip rotation in support phase (°) 18.13
Knee flexion at initial contact (°) 22.60
Time of peak flexion (% gait cycle) 53.60
Range of knee flexion (°) 49.24
Peak dorsiflexion in support phase (°) 8.68
Peak dorsiflexion in swing phase (°) 3.15

[i] Values calculated from measures acquire with the system proposed, and shown in the figures 6 and 8. The GCI in the table were calculated considering a total cycle time of gait of 1.94 seconds.Indexes of the pelvis as pelvic tilt and pelvic rotation could not be calculated because a sensor was not placed in the pelvis zone.

Abstract views:


Article Metrics

Metrics Loading ...

Metrics powered by PLOS ALM

Copyright (c) 2016 Pablo Aqueveque, Sergio Sobarzo, Francisco Saavedra, Claudio Maldonado, Britam Gómez

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.
© PAGEPress 2008-2018     -     PAGEPress is a registered trademark property of PAGEPress srl, Italy.     -     VAT: IT02125780185