MagicSox: An E-Textile IoT System to Quantify Gait Abnormalities MagicSox: An E-Textile IoT System to Quantify Gait Abnormalities

The global society is increasingly facing the challenges that reduce mobility, quality of life, and independence. Gait disorders are often both a result of, and predictor of further issues, tied to the 15 million stroke patients annually world-wide. These individuals face a number of gait abnormalities including drop foot that is a pathological condition, limiting patients’ ability to lift the foot from the ground during the swing phase of walking. In this research work, we introduce a novel smart textile system, MagicSox that is woven with multiple sensors distributed over the surface of the foot. The overarching goal of MagicSox is to quantify the gait abnormalities in remote settings such as patients’ homes so that clinicians and physical therapists can assess their patients on daily basis. The paper provides a detailed architecture of MagicSox that leverages the computing and communication capabilities of a modern Internet of Things (IoT) processor, the Intel Curie. We have developed an Android smart phone app that uses Bluetooth low energy (BLE) and automates the multi-sensor data collection from MagicSox. In terms of signal processing of wearable sensor data, we adopted multiplication of backward diﬀerences (MOBD) to analyze the multi-modal time series data to distinguish drop foot events from normal walking (cid:73)


Introduction
The global medical community is now attentive of Gait since the society witnesses the increasing population with decreased mobility due to medical conditions such as stroke, Parkinson's, arthritis, and other age-related conditions [1,2,3].The cyclic motion of gait biomechanics involves the entire body, providing an insight into a patient's functional capabilities.A corpus of studies provide evidence that fluctuations in gait from one step to the other could reflect disruptions in intrinsic motor or postural control from age-or disease-related decline in the central and peripheral nervous systems [4,5].For example, the gait abnormality known as drop foot is described as an inability to lift the foot from the ground during the swing phase of the walking [6].Drop foot could be a symptom of underlying disease or an effect of neurological conditions.With strokes affecting 15 million people globally each year and drop foot being a potential side-effect, it is a rising concern [7].
In this paper, we examine the use of smart textiles to measure the gait movements and differentiate between a healthy movement and a drop foot movement.
People who have suffered from stroke pose as a great target group because of the shear amount in society and their need for a cheaper and more efficient method of getting back on their feet.We have developed a smart textile called "MagicSox" to collect data on various attributes of motion on an individual's lower extremities, designed to monitor patients with neurological diseases during their time of rehabilitation.MagicSox is embedded with a number of sensors in various key locomotive points on the foot and ankle, strategically placed to measure movement, angle change, and forces exerted upon each step.
This research article provides an overall architecture of MagicSox (see Figure 1).The overarching goal of MagicSox is to automate the remote assessment of stroke patients, especially for gait rehabilitation.In addition to the on-board module consisting of multiple sensors and an Intel Curie microcontroller (with Bluetooth Low Energy(BLE)), MagicSox is embedded with algorithms such as multiplication of backward differences (MOBD) to accurately differentiate between a standard walking step and a drop-foot step.We have pursued a usability study on 12 healthy participants who simulate drop foot gait during the data collection trial.The contribution of the paper is as following: • Design and development of a smart textile system for remote drop foot The rest of the paper is organized as follows.In Section II, background and related works in gait abnormalities, drop foot and rehabilitation, and wearable biosensors for rehabilitation is discussed.In Section III, the design of MagicSox and the experiment setup are explained.In Section IV, we explain the methods we have used, in Section V we review and discuss our results, and in Section VI we conclude the paper.

Gait Abnormalities
Walking abnormalities, also referred to as gait abnormalities, are any abnormal or uncontrollable walking pattern.Factors causing gait abnormalities may include genetics, injuries or diseases afflicting the leg nerves, muscles or bones.
The most common reasons that will lead to a gait abnormality include arthritis leg injuries, bone fractures, infections that damage tissues in the legs, shin splints (an injury common to athletes that causes pain in the shins), nervous system disorders such as cerebral palsy or stroke [8].Therefore diagnosis of gait abnormality from observation can provide useful information regarding different neurological or musculoskeletal conditions.
In our research work, we focus on "drop foot" (also known as foot drop) that is not a disease but a type of gait abnormality that indicates someone's inability to lift the front part of the foot [9].This happens due to the weakness in the related muscles of lower limb.Drop foot is characterized by steppage gait [10].
In this phase, the foot hangs down with the toes touching the ground.This causes the toes to scrape the ground while walking.Therefore, patients with drop foot usually lift their knees higher than usual or swing their leg in order to avoid dragging the toes on the ground.
Recently novel tools and technologies have been developed to improve the rehabilitation of patients with stroke [11], but they have not significantly impacted clinical practice.For this reason, some have suggested that home-based programs may be the answer [12].
Using wearable sensors and obtaining objective measures of gait and balance, will provide unique information of how and why the functional performance of gait and balance are impaired.Therefore, therapists can focus on the specific physiological reasons for difficulty in walking or balancing during specific tasks [13].

Wearable Technologies in Gait Rehabilitation
Smart wearable systems have great potential to be the future of healthcare tracking and can be used in a home based program.For example, Wang et al. [14] proposes a smart garment designed to monitor posture to support prevention and treatment of spinal pain during the neurological rehabilitation of upper extremities.The garment combines various inertial measurement units that is controlled by an Arduino processor.The user will be notified that their posture is inadequate via internal vibration units along with alarms and visual instruction that is transmitted though Bluetooth to a smart phone.S. Ryan Edgar et al. [15] and his research team developed a wearable shoebased rehabilitation monitoring device, designed specifically for stroke patients.
The shoe is designed with an insole that has five pressure sensors integrated, in the heal part lies an insole connector that allows the microcontroller to read the shoes data.The actual shoe board is vertically placed along the backing of their shoe.The information is relayed to a phone from a Bluetooth module.As well, the microcontroller contains a 3 − axis accelerometer to monitor directional motion.The smart phone application depicts the pressure exerted in each location on the soul of the foot as well as each axis reading from the accelerometer.
In another report by Mazzoldi et al. [16] wearable devices which are able to read and record the posture and movements of a subject wearing the system is discussed.The sensory function of the garments is achieved by fabric strain sensors, based on threads coated with polypyrrole or carbonloaded rubbers.The presence of conductive elements gives these materials piezoresistive properties, enabling the detection of local strain on the fabric.
In this research, we introduce MagicSox, a smart textile wearable device which can be used to quantify different aspects of gait abnormalities.Utilizing different types of sensors, will provide unique information regarding the orientation and angular velocity to understand the swing of the foot, pressure on the heel to better understand the heel strike and the angular displacement for movement of the ankle for dorsiflexion.In addition to aiding the stroke rehabilitation process, MagicSox is also a healthcare tool for everyday life.It can be used to provide insights for athletes or to aid in posture.

MagicSox
MagicSox is a smart textile system with Internet-of-Things (IoT) functionalities to sense, compute and communicate the gait abnormalities such as drop foot.Our design utilizes four different types of sensors, measuring force, resistance, orientation, and angular velocity.With a total of five sensors, two of which built in to our microcontroller, they provide the data that allow us to differentiate normal walking from gait abnormalities.
• Arduino 101 board with the Intel Curie processor module

• Gyroscope and Accelerometer integrated in the Intel Curie
• Pressure Sensor on the heel • 2 Flex Sensors, one along the heel and the other one on the anterior side of the ankle • Smart Phone to collect the data via Bluetooth in the application

Inertia Measurement Units
The Arduino 101 has an on-board 6-axis accelerometer/gyroscope.The microcontroller measures orientation with its accelerometer and angular velocity with its gyroscope.In unison, they form an inertial monitoring unit (IMU) that allow us to read the kinematics behind the foot.Once data collection begins on the Arduino, the gyroscope raw values are converted into an angular velocity for each of the three axes (g x , g y , g z ).Similarly, the accelerometer measures the acceleration for each axis (a x , a y , a z ), returning a raw value in need of conversion.The gyroscope is useful because of its ability to measure rotational movement around the axes.The accelerometer does not have this function if the movement remains continuous.These sensors can show how much a person takes their foot up in order to complete the gait cycle.Also, they can show if the person swings their foot while walking which is a normal symptom in the drop foot phenomena.As an example, Figure 2 shows the data from the gyroscope, and the zoomed-in picture to observe the difference between normal walk and drop foot walk, respectively.As shown in Figure 2, accelerometer and gyroscope are located on top of the foot.

Pressure Sensor
The Arduino IMU reads kinematic data for our sock.Additionally we use a pressure sensor to detect when the individual wearing the sock has a definitive heel strike vs. a standard step.Heel striking is of critical concern to athletes and is well documented in athletic literature [17,18,19].However, we hypothesize that heel striking could be an important feature to consider in drop foot analysis.We used the FlexiForce A201 [Tekscan, 9.7mm in diameter] that is a piezoresisitive sensor, made of a semiconductor material.The pressure sensor acts as a pressure sensing resistor in an electrical circuit.Beneath the sensors film and adhesives lies a silver strip and pressure sensitive ink.The active sensing area is only where the silver is in contact with the ink.When force is applied to the sensor, the resistance decreases.When the force is removed, the resistance is very high.The FlexiForce sensor is thin enough to allow non-intrusive measurement, fitting for our smart textile design.In our experiment, the sensor is located on the heel portion of the sock as shown in Figure 1.

Flex Sensor
The flex sensor is aimed at measuring angular displacement at the ankle joint.Flex sensors are analog resistors that act as variable analog voltage dividers.Under the flexible substrate of the sensor lies carbon resistive elements.
As the substrate is bent, the sensor creates resistance output that is similar to 165 the radius of the bend.In our design, we use the Spectra Symbol flex sensor that has a thickness of 6.35mm, with 84.86% of the part length designated as active length.While lying flat, it has a resistance of 7K to 13K ohms.Its bent resistance is minimally two times greater than the flat resistance at a 180 degrees pitch bend.The sensor takes use of an impedance buffer and voltage divider, contributing to a reduced error.
We have used two flex sensors, one located on the heel along with the pressure sensor, and the other one is located in the anterior side of the foot on the ankle.These locations have been chosen in order to estimate that how normally the person can complete a gait cycle.In the area of stroke rehabilitation, these sensors will provide information regarding the ankle dorsiflexion.Since one of the exercises in the stroke rehabilitation is ankle dorsiflexion, these sensors can show the strength and duration of this exercise.They also can provide the difference between the normal gait and the drop foot gait, because the ankle flexion is reduced in the drop foot gait compared to the normal gait.Figure 3 shows the data from flex sensor located on the heel and the zoomed in picture of it.Each of the peaks is a step and the difference between normal and drop foot walk is clearly visible in both amplitude and duration.The location of the flex sensor in determined on the foot on top of the figure.

Intel Curie Microcontroller with BLE
All the sensors are connected to the microprocessor board Arduino 101, which collects the data from the pressure and flex sensors, utilizing its built-in accelerometer and gyroscope as well.All the data from the Arduino board is sent to MagicSox application on the smart phone.MagicSox application was designed to run on any Bluetooth Smart or Bluetooth Smart Ready enabled device running Android 4.4 or higher.This Android device utilizes the BLE technology available on both the Arduino 101 and the device itself to receive updates every 100 milliseconds from MagicSox.This update comes in the form of a byte array which contains all the essential information from MagicSox, including raw sensor data from the two Flex Sensors, the Pressure Sensor, the Accelerometer and the Gyroscope.The Android device then parses this data and saves all of it into a Comma Separated Values (CSV) file which can be used for further processing later.Figure 4 shows how MagicSox application works on the smart phone.

E-Textile Design Configurations
The first batch of socks attached the microcontroller directly to the sock, stitching at the grounding screw-holes.Due to the Printed Circuit Board (PCB) layout of the Arduino 101, the attachments were not equidistant and there was a slight overhang of the board from the attachment locations which was inconsistent across among the four points.This lopsided method was sufficient for early experimentation, but did not provide an ideal long-term solution.
The second batch of socks produced for the experiment were modified slightly to take advantage of insight gained in the initial round.None of the electronic or sensor layout was changed among the versions, merely the attachment methods.Sensor sleeves were constructed using a stretchy mesh netting material.The textile pattern was tailored to the various sensors dimensions, using a 0.25 of an inch seam allowance.The pattern was based on a modified standard large 220 men's sock.Due to the difficulty in sewing such pliable fabric, we pinned the cut mesh sleeve onto tear away paper in order to prevent gathering or from moving around as it was sewed onto the sleeve.Each sensor was placed into the sleeve and hand stitched on top to enclose and lock the sensor into the sleeve.During attachment to the sock, the side seam was reopened to enable flat sewing, with chock contours guides determined first on a model.Slits were cut in the material and the sensors were channeled through them at each location, including the dorsum of the foot, heel and ankle.Pressure and flex sensors were attached using a 2mm stitch length.The pressure sensor was placed on the heal.Flex sensors were placed on top of the foot at the arch.We then hand stitched Velcro to a 3D printed PCB mount using Velcro and stitched a Velcro strap to the sock in order to attach the PCB to the sock itself.After sewing all the sensors and Velcro to the sock, the raw cut edges of the sock were reattached with a double stitch using the least amount of seam allowance possible with the fabric inside out. Figure 5 shows the design iterations and improvements of the MagicSox.

Experimental Setup
The main goal of this paper is to distinguish between the normal gait and the drop foot which, as mentioned earlier, is a gait abnormality caused by stroke that happens because of the damage to the fibular nerve, sciatic nerve and muscles in the anterior side of the lower leg.
In order to collect the data, we recruited 12 healthy subjects to walk in two different situations, one is the normal gait and the other one is to simulate the drop foot walking.The first 4 participants were asked to do the experiment with the first batch of socks and the remaining 8 participants performed the experiment with the newer version of the socks in order to compare the different versions of the sock and observe how design developments can change the results.
Both groups preformed the same two walking tests.Each participant was asked to walk for 5 minutes in their normal gait and afterwards, they were asked to simulate the drop foot walking for 5 minutes.Therefore, we have an overall of 10 minutes of data from each participant which is separated equally into normal gait and drop foot walking.
The data has been recorded from the accelerometer, gyroscope, pressure sensor and two flex sensors.As mentioned previously, the flex sensors and the pressure sensors are variable resistances.Static state for relativity is required to measure this physical state.We accomplish this static state by introducing a standard resistor.To measure the relative change in state between the standard resistor and flex or pressure sensors, we designed a voltage divider that allows us to extrapolate the desired information using Ohm's Law.One last challenge on this setup is maximizing the voltage range to increase the signal to noise ratio.We chose to use a standard 10kΩ resistor, which provides a potential voltage swing of approximately 1v.Therefore, the data that is recorded from the pressure sensor and two flex sensors are the voltage across these sensors.
Since the accelerometer and gyroscope each have 3 different dimensions, we have an overall of 9 attributes in the data.The data is recorded continuously via Bluetooth to a smart phone by the sampling frequency of 10Hz for each data channel.

Support Vector Machine (SVM)
After collecting the data, in order to distinguish between the normal gait and drop foot walking, we used a Support Vector Machine (SVM).The SVM uses a nonlinear mapping to transform the original training data into a higher dimension.It searches for the linear optimal separating hyperplane in this new dimension (that is, a "decision boundary" separating the tuples of one class from another).With an appropriate nonlinear mapping to a sufficiently high dimension, data from two classes can always be separated by a hyperplane [20].
SVMs are supervised learning models.
The general concept of the SVM is that the system trains itself based on a training dataset which can be a part of the original dataset that is labeled into two different categories.Then, after the system is trained, it will be tested on the other part of the original dataset to predict the labels of the data, and by comparing the predicted labels and the original labels, we can find the accuracy of the system.In this study, we used several learning algorithms to be implemented in the SVMs.It is possible to classify the datasets which are not linearly separable by applying the Lagrangian optimization theory to a linear support using the Kernel.While the nonlinear support vector machines retain the efficiency of finding linear decision surfaces, they allow us to apply them to not linearly separable datasets.It is also possible to change the margins of the classifiers and change the complexity and accuracy of the systems.In general, large margins make the system less complex, but on the other hand, will let the system generate more errors, resulting to lower accuracy.This can be achieved by changing a variable called Cost constant in the classifier models.
Figure 6 shows a concept of the SVM and its supporting hyperplanes that divide two different classes and introduces the margin.When we make the margin large, we allow some data points between the decision surface and the supporting hyperplanes, which at the end will result in false classification and reduce the accuracy.Different types of SVM classifiers are applied on the data in order to compare their performance.We have used 4 different types of Kernel functions all of them with 3 different Cost constants of 1, 10 and 100.Table 1 shows different learning algorithms that have been used in this study with their complexity index which 300 we will refer to them later in the results section.

Index
Kernel Name Kernel Function Degree Cost Constant Regarding the evaluation of the methods, we used 2 different evaluation methods of 10-Fold Cross-Validation and Hold-Out method with the portion of 2/3 and 1/3 for training and evaluating respectively.
In this paper, we provided the raw data recorded from all the sensors to the classifier and compared the performance with the case where we used the Multiplication of Backward Differences (MOBD) algorithm for the data recorded from the pressure sensor which is a useful tool to determine the heel strike.
Determining the heel strike is useful here because in the drop foot walking, the heel strike happens less or with a lower pressure compared to the normal gait.

Multiplication of Backward Differences (MOBD)
The MOBD algorithm was developed in the efforts to create a better method for detection of the large spikes in heart wave signal [21,22].Using the MOBD algorithm for heel strike detection seemed applicable due to the fact that the spike in heart wave and the impact transient of heel strike share that similar sharp waveform.
The algorithm computes a backward derivative which in discrete time, a derivative is well approximated by a difference.Those differences are then multiplied together, which in turn provides a robust peak detector.
Assuming p[n] be the pressure sensor data in time sample n, the first-order backward difference at time n , x[n], is: Therefore, the N − th order MOBD nonlinear transform is as follow: Also, y[n] is forced to be zero if the backward differences are not in agreement with respect to sign.
where the sgn(x) is the signum function.
At a given time, a sample from the pressure sensor is stored in the microcontroller.At the next sample time, another sample from the sensor is stored.
Those two samples are then subtracted and stored in its own variable.This is then repeated two more times so that 3 differences have been collected.The algorithm then checks for 3 consecutive positive or negative differences.When climbing up a steep waveform, a peak, the algorithm will result in consecutive differences in comparison to a waveform that has a more rounded shape to it.If 3 consecutive differences are found, they are multiplied together and that value is compared to a predefined threshold value.If the calculate value is greater than the threshold value, the algorithm recognizes the detection of a heel strike.
The impact values of a heel strike are much larger than that of a non-heel strike impact due to the distributions of forces along the foot for each strike.A threshold value was determined that allowed for the heel strike impact transient to be detected while avoiding possible false peaks that could stem from various types of noise.Figure 7 shows the data from the pressure sensor along with the MOBD results.The MOBD algorithm output would be 1 if it detects a heel strike and 0 if there is no heel strike.As it can be seen from Figure 7, we have heel strike for normal walking, but no heel strike for drop foot walking.showing the heel strike (bottom panel).

Evaluation
Recalling from the explanation of the support vector machine, it needs to divide the original dataset into two parts; one for training itself and one for testing and providing the accuracy, which is called evaluation.On the evaluation aspect of the classification, we used two different methods of training and testing the system which are Hold-Out and k-Fold Cross-Validation.The Hold-Out method simply takes one portion of the dataset for the training and holds the other portion for testing the accuracy.The ratio of these portions can be defined by the user and we defined the portions to be 2/3 and 1/3 for training and testing, respectively.In k-Fold Cross-Validation, the system divides the dataset into k different folds which the length of each fold is the same as the others and no folds have overlap with each other.The concept is that the system uses each of these folds for testing while getting trained from the other folds, and at the end, provides the accuracy of the system which is the average of all the accuracies on different folds.In this paper we used the Hold-Out method with the portions to be 2/3 and 1/3, and k-Fold Cross-Validation with the number of folds k equal to 10.

Results and Discussion
In this section, we report the results of the classification of the normal walking and the drop foot walking and compare the performance of the classifier for the two cases mentioned earlier.

Classifying the raw dataset
In this case, we labeled the data to 0 and 1 for the normal and drop foot walk respectively and without any processing, sent the raw data to the classifier.Table 2 shows the performance of different SVM and evaluation methods applied on the raw data.

Classifying the feature extracted dataset
In this case, we first applied the MOBD algorithm as explained in the previous section in order to apply different types of SVM classifiers.The new dataset contains all the previous information, except the pressure sensor data which is replaced by the results of MOBD algorithm.
After applying the MOBD algorithm and labeling the data to 0 and 1 for the normal walking and drop foot walking respectively, we applied the dataset to the classifier in order to observe the performance.Table 3 shows the accuracy of different SVM and evaluation methods applied on the feature extracted dataset.
As it can be seen from Tables 2 and 3, the performance of the system improves as we use more complex Kernel functions such as the Radial kernel or  (False Positive).
400  Although our focus in this research was on the quantification of drop foot, MagicSox can also be used for athletes to alert them whenever they have heel strike which can cause serious injuries or pain.It also can be used as an activity tracker to show how many steps a person has taken during the day, or how much distance they have walked.As an immediate next step, we will pursue a pilot study on stroke patients who will wear MagicSox and help us evaluate the system under a clinical setting.

monitoring•
Selection and location of multiple motion sensors including flex sensor, pressure sensor, accelerometer and gyroscope • Integration of the multiple sensors onto a textile material for quantifying foot locomotion • Establishment of a signal processing algorithm (MOBD) to detect drop foot event • Design of an Android app for patient-friendly data collection in remote settings • Machine learning experimental analysis to measure the performance and usability of MagicSox

Figure 1 :
Figure 1: An overall system architecture of MagicSox.

Figure 2 :
Figure 2: Gyroscope data for Normal and Drop Foot walking.5 minutes data in top 3 panels and 20 seconds zoomed in data in bottom 3 panels. 160

Figure 3 :
Figure 3: The data from the flex sensor located on the heel.5 minutes data in top panels and zoomed in 20 seconds data in bottom panels.The visual observation of the flex sensor data provides an understanding of how drop foot differs from normal walking.In each walking cycle, the ankle dorsiflexion in drop foot is weak.

Figure 4 :
Figure 4: An operational flow chart of the Android smart phone app.

Figure 5 :
Figure 5: Design iterations of the MagicSox.The sensors and the microcontroller were stitched directly to the sock in the Design 1, but sensor sleeves were used in the Design 2. Also, the microcontroller is attached to the socks via velcro and a 3D printed shield.

Figure 6 :
Figure 6: A concept of SVM and the terms of decision surface, supporting hyperplane and margins.

Figure 7 :
Figure 7: The raw data from the pressure sensor (top panel) and the MOBD algorithm results

Figure 8 :
Figure 8: Performance of the best model with Radial Kernel and Cost constant of 100 with both evaluation methods applied to Case 1. Raw dataset and Case 2. Feature extracted dataset, for all of the participants.

Figure 9 :
Figure 9: Actual labels and predicted labels of a 600 samples data and the zoomed in picture of 50 samples.White color shows label 0 for normal walking, blue color shows label 1 for drop foot walking and the red color shows the error while the actual label is 0 but the classifier predicts as 1.

Table 1 :
Different methods of classification used in this study.

Table 3 :
The performance of different methods on the features extracted data from each of the participants.

Table 4 :
The actual and predicted labels applied on the whole length dataset.We have 838 False Positives and 146 False Negatives.In this research article we introduced a novel wearable health monitoring system, MagicSox, that fuses the capabilities of smart textiles with Internetof-things to detect and communicate gait abnormalities such as drop foot.We provided a detailed technological architecture of MagicSox that can be divided