**4. Analysis**

This section explains the mathematical calculations and analyses used for the sensor calibrations and insole characterization.

#### *4.1. Sensors' Calibration*

#### 4.1.1. FSR Sensor Calibration

The FSR sensors exhibits resistance change in correspondence to the applied force. Therefore, a voltage divider circuit was used to convert the resistance changes to voltage values to be acquired by microcontroller.

$$V\_{out} = V\_{CC} \times \frac{R}{R + FSR} = 5V \times \frac{11 \text{ k}\Omega}{11 \text{ k}\Omega + FSR} \tag{1}$$

As the applied force increases, the FSR resistance also decreases, showing an increased output voltage according to Equation (1). The acquired voltages were then converted to their equivalent FSR resistance values by substitution of Equation (1).

$$FSR = \frac{5V \times 11k\Omega}{V\_{out}} - 11k\Omega \tag{2}$$

#### 4.1.2. Piezo-Electric Sensor Calibration

The piezo-electric sensor generates high voltage values, as high as 20 V with weights less than 5 kg, which requires using a voltage divider circuit before data acquisition by microcontroller.

$$\mathbf{V}\_{\text{max input}} = \text{Voltage divider Gain} \times \mathbf{V}\_{\text{Piezo max}} \tag{3}$$

$$\text{D} \Rightarrow \text{Voltage divider Gain} = \frac{\text{V}\_{\text{max input}}}{\text{V}\_{\text{Piezo max}}} = \frac{\text{V}\_{\text{CC}}}{\text{V}\_{\text{Piezo max}}} = \frac{5V}{20V} = 0.25\tag{4}$$

Therefore, the voltage divider circuit were chosen as follows:

$$\mathrm{V\_{out}} = \frac{\mathrm{R1}}{\mathrm{R1} + \mathrm{R2}} \times \mathrm{V\_{Piezo}} = \frac{3 \,\mathrm{M}\Omega}{3 \,\mathrm{M}\Omega + 9 \,\mathrm{M}\Omega} \times \mathrm{V\_{Piezo}} = 0.25 \,\mathrm{V\_{Piezo}} \tag{5}$$

Substituting the maximum piezo voltage in Equation (5) gives:

$$\text{V}\_{\text{out max}} = 0.25\\\text{V}\_{\text{Piezo max}} = 0.25(20V) = 5V \tag{6}$$

This ensures that maximum microcontroller input voltage (5 V) was not exceeded. The acquired voltages were then converted to their equivalent Piezo sensor voltage outputs by subject substitution of Equation (5).

$$\text{V}\_{\text{Piezo}} = \frac{1}{0.25} \times \text{V}\_{\text{out}} = 4\text{V}\_{\text{out}} \tag{7}$$

There are di fferent equivalent electrical models for the piezo-electric sensors [28]. A simplified common model is a voltage source/generator with a capacitance, which was used in this study. Usually, the capacitance values are in Nano Farad range. The equivalent capacitance is typically measured using a parallel connection of a capacitance meter to the sensor. Connecting the piezo-electric sensor to the voltage divider circuit forms a first order high-pass filter. Therefore, high resistance values in mega ohms were used to ensure that most of the generated frequencies by the applied forces would pass. Assuming equivalent capacitance of piezo-electric sensor equal to 9 nF, the cut-o ff frequency can be written as:

$$f\_{\text{cut}-off} = \frac{1}{2\pi R\mathcal{C}} = \frac{1}{2\pi (3M + 9M)9n\mathcal{F}} = 1.47Hz\tag{8}$$

Apart from DC and very low frequency components, other signal components were expected to be applied to the MCU input. AD620AN instrumentational amplifiers were used to amplify the low amplitude load cell signals, before it was applied to the microcontroller. The load cells give an output of maximum 40 mV, which can be amplified to the full-scale range of the analog channel. Therefore, the gain of the amplifier and the amplifier gain resistor were chosen as follows:

$$G = \frac{V\_{cc}}{V\_{load\,\max}} = \frac{5\,\,V}{40mV} = 125\tag{9}$$

$$R\_G = \frac{49.9k}{G-1} = \frac{49.9k\Omega}{124} = 402\,\Omega\tag{10}$$

#### 4.1.3. MEMS Sensor Calibration

As mentioned previously, the MEMS generates positive or negative amplitude signals based on the applied force in x, y or z directions. This requires an o ffset circuit along with a voltage divider circuit to reduce the signal amplitude. It is assumed the piezo-vibration output can go up to 10 V with the maximum applied force.

$$\text{V}\_{\text{max input}} = \text{Voltage divider Gain} \times \text{V}\_{\text{Pikezo max}} \tag{11}$$

$$\text{Voltage divider Gain} = \frac{\text{V}\_{\text{max input}}}{\text{V}\_{\text{Piezo max}}} = \frac{\text{V}\_{\text{CC}}/2}{\text{V}\_{\text{Piezo max}}} = \frac{5V/2}{10V} = 0.25\tag{12}$$

Therefore, the voltage divider circuit were chosen as follows:

$$\mathrm{V\_{out}} = \frac{\mathrm{R1}}{\mathrm{R1} + \mathrm{R2}} \times \mathrm{V\_{Piezo}} = \frac{3 \,\mathrm{M}\Omega}{3 \,\mathrm{M}\Omega + 9 \,\mathrm{M}\Omega} \times \mathrm{V\_{Piezo}} = 0.25 \mathrm{V\_{Piezo}} \tag{13}$$

Substituting the maximum and minimum piezo voltage in Equation (13) gives:

$$\text{V}\_{\text{out max}/\text{min}} = 0.25\\\text{V}\_{\text{Piezo max}/\text{min}} = 0.25(\pm 10V) = \pm 2.5V \tag{14}$$

The next step is to add an o ffset of 1/2Vcc to ensure that the signal was within 0 V to Vcc range.

#### *4.2. Piezo-Electric Sensor Response*

The piezo-electric sensors can detect the applied forces e fficiently, by converting the mechanical movements into electrical signals. However, the movements need to be dynamic. The piezo-electric sensor generated electrical pulses that mimicked the applied mechanical movement. If the mechanical movement was a fast press and release of finger on the active area of the piezo-electric sensor, the pulse was shrunk to an impulse-liked shape.

On the other hand, if a gentle force was applied by a slow press and remove by the palm of a hand, the generated signal had irregular pulse shape with longer duration compared to the fast finger press. Even though the piezo-electric sensor's output can mimic dynamically changing force, it fails to

detect a static force. Therefore, when the applied force is a mixture of dynamic and static force such as smart insole application, the piezo-electric sensors cannot be used to acquire static pressure. However, the piezo-electric sensors can be used to detect heel strike or toe off with good accuracy. Figure 10 illustrates the individual sensor output for the different applied forces.

**Figure 10.** Piezo insole sensors output with Arduino serial plotter: (**A**) fast finger press and release, (**B**) slow palm press and release, (**C**) sensors output for two-step walking.

Figure 11 shows the output from a single piezo-electric sensor of an insole for few gait cycles. When a force was applied vertically on the sensor's active area (ceramic), it compressed, exerting an electrical impulse with a positive peak that mimicked the mechanical force applied. The electrical signal went back to zero. As the applied force was released, the signal continued to some negative values as the piezo ceramic bounced to the opposite direction of the applied force. Finally, the signal returned to zero. The microcontroller clipped the negative part of the signal. However, some part of the negative signal was still there, due to the offset added in the acquisition circuit as illustrated in Figure 11.

**Figure 11.** Mimicking piezoelectric sensor output during gait cycle.

#### **5. Results and Discussion**

This section illustrates and discuss the results obtained from calibration and characterization tests.

#### *5.1. Sensors' Calibration*

#### 5.1.1. FSR Sensor Calibration

Three calibration trials were undertaken for one FSR sensor from Interlink Electronics [22], following the calibration procedure explained previously; 500 g weights where placed one by one every 3–4 s until it reached 5000 g, followed by unloading process from 5000 g down to 0 g. In the loading experiment, output voltage from the voltage divider circuit showed increasing values reflecting the decrease in FSR resistance as shown in Figure 12A. When the applied weight was constant, the output voltage remained constant with small variations.

**Figure 12.** FSR calibration test (**A**) applied weight and FSR circuit output vs. time (**B**) applied weight vs. FSR resistance.

In addition, if the constant weight was kept for a longer time (a few minutes), the sensor voltage stabilized to a steady value. However, the aim of this study was to investigate the dynamic response of the FSR. Therefore, the average output voltage for the sample were calculated and plotted against the corresponding applied weights. Figure 12B shows the plotted data with the fitted waveform. The calibration showed slight difference between the loading and unloading curves, which was expected due to the hysteresis behavior of FSRs. However, the error was caused by the FSR hysteresis, which can be neglected, as the difference was not significantly high. This can be justified if the response from the smart insole using FSR sensors resembles typical vGRF reported in the literature.

Off-Loading tests best fit relations:

$$Weight\_{Trial1} = 5035.2 \ast Resistance^{-1.72}$$

$$Weight\_{Trial2} = 3436.5 \ast Resistance^{-1.895} \\ Weight\_{Trial3} = 8111.8 \ast Resistance^{-2.589}$$

It is evident that the first and third trial relationships were close to each other (Figure 13). Therefore, either of them can be chosen for the FSR insole. The second trial showed a steaper curve due to higher hystersis error.

For each of the three trials, loading and offȬloading relationships where obtained. Loading tests best fit relations:

> ܹ݄݁݅݃ݐ்ଵ ൌ Ͷʹ͵͵Ǥ͵ כ ܴ݁ݏ݅ݐݏܽ݊ܿ݁ିǤଵସ ܹ݄݁݅݃ݐ்ଶ ൌ ͵ͷǤͶ כ ܴ݁ݏ݅ݐݏܽ݊ܿ݁ିଵǤଶଶ ܹ݄݁݅݃ݐ்ଷ ൌ ͷͳͳǤͶ כ ܴ݁ݏ݅ݐݏܽ݊ܿ݁ିǤସ଼

**Figure 13.** FSR calibration test: best fit curves between applied weight and FSR resistance for three trials.

#### 5.1.2. Piezo-Electric Sensor Calibration

Two piezoelectric sensors were used in the calibration process. Three trials were conducted on the first sensors with four trials for the second sensor. The piezoelectric sensors showed a linear relationship with the applied weights (Figure 14).

**Figure 14.** Piezo-electric sensor calibration test: (**A**) applied weight vs. time and piezoelectric output voltage vs. time (**B**) applied weight vs. piezoelectric output voltage.

The second and fourth trials for the 2nd piezo sensor had different slopes compared to the remaining trials. This could be related to the calibration process itself, as the weights were applied by fast presses and releases on the active area of the sensor. Therefore, applying the force on the exact same areas is not guaranteed between successive readings. This issue can be overcome by using a machine to apply the weights. However, this would defeat the purpose of the study in providing a low-cost setup (Figure 15).

**Figure 15.** Piezoelectric sensor calibration test: seven trials shows relationship between the applied weight and piezoelectric output voltage.

Obtained lines of best fit:

```
WeightPiezo1Trial1 = 0.42867 ∗ PiezoVoltage − 0.19123
WeightPiezo1Trial2 = 0.41110 ∗ PiezoVoltage
                                             + 0.0081012
WeightPiezo1Trial3 = 0.39321 ∗ PiezoVoltage
                                              + 0.084656
 WeightPiezo2Trial1 = 0.34619 ∗ PiezoVoltage
                                               + 0.4105
 WeightPiezo2Trial2 = 0.27242 ∗ PiezoVoltage
                                               + 0.57351
 WeightPiezo2Trial3 = 0.35564 ∗ PiezoVoltage
                                               + 0.30325
 WeightPiezo2Trial4 = 0.31765 ∗ PiezoVoltage
                                               + 0.36416
```
#### 5.1.3. MEMS Sensor Calibration

Twenty di fferent calibration trials were conducted on a piezo-vibration sensor. However, high repeatability error persisted, making it di fficult to obtain a clear relation between sensor output voltage and the applied weight. The applied weight showed a direct proportional relation with output voltage for some successive readings and an inverse relation with some other successive readings. This is because of the MEMS sensitivity to the applied force in 3-D space (x, y or z directions). It generates 1-D output voltage with positive or negative amplitude depending on the applied force in certain direction. Therefore, if the applied force is a summation of forces in 2 or 3 axes, the output voltage might go to zero or attenuated with the addition of di fferent sign amplitudes.

A linear relation was not clearly obtained by the application of vertical forces, as the applied force might not be applied in one axis only (Figure 16).

**Figure 16.** MEMS sensor calibration test: (**A**) applied weight vs. time and MEMS sensor output voltage vs. time (**B**) applied weight vs. MEMS sensor output voltage.

The mathematical relations obtained in the calibration phase cannot be used to design a piezo-vibration sensor-based smart insole, since the applied force in gait can be in any of the x, y or z directions (Figure 17). Therefore, the piezo-vibration sensor was discarded from the sensor list for designing smart insole. However, it can be utilized in other biomedical applications where the force directions are limited to a certain axis or a fixed plane. Moreover, it can be used to detect initial timing of the applied force. The lines of best fit obtained were:

> *WeightTrial*1 = 1.4145 ∗ *PiezoVoltage* − 1.3447 *WeightTrial*2 = 1.5215 ∗ *PiezoVoltage* − 1.8581 *WeightTrial*3 = 0.80343 ∗ *PiezoVoltage* − 0.22721

**Figure 17.** MEMS sensor calibration test: 3 best trials shows relationship between the applied weight and MEMS sensor's output voltage.

#### *5.2. Insole Charecterization*

#### 5.2.1. FSR-Based Insole Characterization

The gait cycle of 12 subjects were recorded while walking on a 10 m walkway in self-selected walking manner. Each subject had 6 trials recorded, where the first and last few (1 to 3) cycles were discarded from each trial, and the remaining part of the gait cycles for both feet were considered for analysis. The gait cycle of one of the subjects is analyzed in the following lines, illustrating a simple analysis technique that can be replicated in different application by researchers working with wearable insoles.

In normal gait cycles both heel peak (first peak) and toe off (peak) must show close values, with both feet having symmetrical signals. Even though the right foot signal showed close peak values (Figure 18), the left foot signals showed a big variance between the heel-strike and toe-off peaks. This can be explained, by the sensitivity difference between the FSRs of the insole and their hysteresis effect. As explained earlier, this issue was mitigated by some research teams using a regression models that calibrates the FSR insole readings against a reference signal, recorded simultaneously in motion analysis labs [34,35]. This expensive approach can be neglected in some applications, where the quality of the acquired signal is sufficient to achieve the desired goal. For instance, smart detection application, where the machine-learning algorithm can differentiate between different groups of people even with low- or medium-quality recorded gait cycles (vGRF).

**Figure 18.** Gait cycles readings for left and right foot with FSR smart insole.

The full gait record was segmented into distinct gait cycles. Then it was resampled into to 512 sample. Segmentation is a common practice to facilitate the comparison between all the gait cycles. The segmented gait cycles are used in smart detection algorithms where segments of equal length are used to train specific machine learning algorithms to classify different groups of people based on their gait. In addition, statistical data of the segmented cycles such as mean, standard deviation, time to peaks, and percentage of stance phase in a full cycle/stride (stance phase plus swing phase) can be utilized as a gait analysis tool in sports and medical applications.

The segmentation was carried out by a customized MATLAB code that detects groups of consecutive non-zero samples. Then it segments those signals into individual stance phases, each starting with a heel-strike and ending with a toe <sup>o</sup>ff. Figure 18 shows the first 10-m trial of one of the participants, where four gait cycles were extracted after excluding the first and last two gait cycles. Left foot vGRF was segmented into four stance phases (Figure 19A).

**Figure 19.** (**A**) Segmented left-foot gait cycles, (**B**) segmented right-foot cycles.

The data were sampled with a sampling rate of 60 samples/second, where each segmen<sup>t</sup> (stance phase) takes around 0.7 s. Therefore, each segmen<sup>t</sup> consists of around 42 samples, which were then resampled into 512 samples. The mean values and standard deviations of each of the 512 samples with respect to the 4 segmented signals were calculated. Then the mean values along with the deviation from the means (means plus and minus the deviation) for the left foot was calculated and plotted (Figure 20). Similar steps were repeated with left foot vGRF (Figure 20). This provides an illustrative figure that can be used by in different sport and medical applications to asses walking behaviors or complications.

**Figure 20.** Means and standard deviations of gait cycles; blue curves represents the mean gait value of the left foot with dashed line representing the deviation from the mean, while orange curves represents the mean gait value of the right foot with dashed line representing the deviation from the mean value.

The vGRF of a subject mainly depends on his/her health condition and the footwear used. In this study, all participants were advised to wear comfortable walking shoes avoiding high-heel shoes, especially for female subjects. This ensured that all subjects went through similar condition while conducting the experiment. It was observed that the collected data did not show any significant statistical difference based on gender.

#### 5.2.2. Piezoelectric Sensor Based-Insole Characterization

Three subjects participated in the piezo-electric insole test in the same manner as the testing of FSR based insole. The piezoelectric insoles were expected to detect the gait cycle, with impulse signals in heel-area sensors during the heel strike phase and lower amplitude impulses from all the sensors during the mid-stance phase. Finally, impulse signals from the toe and metatarsal heads sensors were taken in the toe-o ff phase. However, the readings were not promising, showing single irregular shape pulses per sensor for each individual gait cycle. The addition of di fferent sensors output showed periodic impulses, one impulse per period (Figure 21). This indicates that the full stance period was detected as one event only. Meanwhile, the correct vGRF must show two distinct peaks between the mid-stance phase, summing up to three main phases: heel strike, mid stance and toe o ff. The rigid nature of the piezo sensor made it di fficult to detect di fferent gait phases. Therefore, it can be summarized that it is not suitable for the smart insole application which requires to produce reliable vGRF signal due to gait.

**Figure 21.** Gait cycles for left and right foot with piezoelectric smart insole (**a**) subject 1, (**b**) subject 2.

In this study, the authors have characterized three samples from each sensor category randomly; however, the smart insole was implemented using 16-sensors. Therefore, it was expected that there would be a small variation of the vGRF recorded from the smart insole in di fferent trials and in di fferent subjects. However, Figure 20 clearly depicts that the vGRF from an individual foot has a unique pattern and this finding matches with the vGRF recorded by the commercial smart insole and force plate. This reflects the fact that the smart insole designed using FSR is capable of acquiring vGRF reliably and the designed system is robust enough to adapt to the age, gender and body mass index (BMI) variation of the participants. However, carbon piezoresistive material (like Velostat), which authors have tested in preliminary experiments (not reported here in order to avoid unnecessary length of the manuscript), showed very high hysteresis and this type of material is not suitable for human dynamicity monitoring. On the other hand, piezoelectric sensors can monitor dynamic pressure variation however, they are very sensitive to small pressure change and incapable to reliably produce mean vGRF. Moreover, the vGRF changed over trials and over subjects significantly and, therefore, temporal feature of vGRF cannot be identified using piezoelectric sensor-based smart insole.

#### *5.3. Performance Evaluation of the FSR-Based System*

Comparing the mean and standard deviation of vGRF for a gait cycle of the same subject recorded using the two systems, commercial F-scan and the proposed FSR insoles, it can be seen that both showed good quality signals except slight di fferences in peak values (Figure 22). The FSR insole showed smaller vGRF during left-foot heel strike phase compared to the F-scan insole. This is an expected behavior as each sensor is somewhat unique due to the manufacturing process and we cannot calibrate individual sensors, which can lead to some variation. In addition, due to the presence of an insole, the sensitivity of some FSRs decreases more than the others in the shoe. To mitigate this problem, a highly uniform pressure should be applied across individual sensors. Each sensor should produce uniform output. When this is not the case for a specific sensor, the software should determine a unique scale factor to compensate for the output variation. Currently, there are a few companies such as T-scan, that provide a special piece of equipment (equilibration device) which applies a uniform pressure on the full insole using a thin flexible membrane to perform such calibration. Moreover, compared to the F-scan system, the FSR readings showed smaller di fferences between vGRF peaks and mid stance values. This was mainly due to the superior number of sensors for the F-scan system (960 sensing areas) compared to the proposed insole (16 FSRs). In addition, the F-scan sensing elements were uniformly distributed on the full foot area, while the FSR sensors were placed on the foot areas where most of the pressure is exerted with no sensors placed on the low-pressure areas (medial arch). Adding a few FSR sensors to the medial arch can improve the quality of the signal obtained, especially for subjects with flat foot, who exerts considerable amount of pressure on medial arch areas.

**Figure 22.** Comparison between the mean and standard deviation of vertical ground reaction forces (vGRF) from left (blue) and right (orange) foot using F-scan system ( **A**) and FSR-system (**B**).
