Design of an Artificial Neural Network Algorithm for a Low-Cost Insole Sensor to Estimate the Ground Reaction Force (GRF) and Calibrate the Center of Pressure (CoP)

As an alternative to high-cost shoe insole pressure sensors that measure the insole pressure distribution and calculate the center of pressure (CoP), researchers developed a foot sensor with FSR sensors on the bottom of the insole. However, the calculations for the center of pressure and ground reaction force (GRF) were not sufficiently accurate because of the fundamental limitations, fixed coordinates and narrow sensing areas, which cannot cover the whole insole. To address these issues, in this paper, we describe an algorithm of virtual forces and corresponding coordinates with an artificial neural network (ANN) for low-cost flexible insole pressure measurement sensors. The proposed algorithm estimates the magnitude of the GRF and the location of the foot plantar CoP. To compose the algorithm, we divided the insole area into six areas and created six virtual forces and the corresponding coordinates. We used the ANN algorithm with the input of magnitudes of FSR sensors, 1st and 2nd derivatives of them to estimate the virtual forces and coordinates. Eight healthy males were selected for data acquisition. They performed an experiment composed of the following motions: standing with weight shifting, walking with 1 km/h and 2 km/h, squatting and getting up from a sitting position to a standing position. The ANN for estimating virtual forces and corresponding coordinates was fitted according to those data, converted to c script, and downloaded to a microcontroller for validation experiments in real time. The results showed an average RMSE the whole experiment of 31.154 N for GRF estimation and 8.07 mm for CoP calibration. The correlation coefficients of the algorithm were 0.94 for GRF, 0.92 and 0.76 for the X and Y coordinate respectively.


Introduction
Human postural control is used for maintaining a subject's balance against the external force of gravity during locomotion [1,2]. By analyzing the sensory information and calculating the biomechanics for the coordinates of limb segments, we can determine the velocity of the center of mass of the segments or the joint torque that can be used for control. These methods are also used in rehabilitation exoskeletons and muscular power strengthening exoskeletons. We should know the state of the wearer for calculating the magnitude and direction of the assistive force for the wearers' needs.
Foot plantar center of pressure (CoP) and ground reaction force (GRF) provide the most important information for postural control. Perry et al. showed that gravity, which is the only external force during human locomotion, creates the GRF on the insole, which is the end effector of the lower limbs, to stand, so its utilization is limited and it may not operate well in dynamic tasks. The researchers estimated the location of the CoP directly from the values of FSR sensors (not through the whole pressure value of the insole) to get the errors from that. Thus, it is not a fundamental solution.
We aimed to develop a low-cost flexible insole pressure measurement sensor that estimates the magnitude of the GRF and calibrates the location of the CoP during static and dynamic motions. We used a WMA, but we created the virtual forces and their coordinates for passing the bounds of limited sensing areas. Then an artificial neural network (ANN) system was used to estimate the magnitude and coordinates of the virtual forces. An ANN algorithm has the inputs of the values of the FSR sensors. For fitting the algorithms, the F-Scan system was used for several tasks. After predicting those values, we summed the virtual forces to estimate the magnitude of the GRF and used the WMA to calibrate the CoP. Validation was also done with the F-Scan system during several tasks.
The remainder of this paper is structured as follows: In Section 2 the hardware and our proposed algorithm design for estimating the virtual forces and moving coordinates are presented. And the settings for ANN are also shown in Section 2. In Section 3 experiments for data acquisition are presented. The experimental results are shown in Section 4 and they are discussed in Section 5. Lastly, conclusion is given in Section 6.

Hardware Design
The locations of the FSR sensors are the most important elements for composing the algorithms. Every algorithm needs the values of the FSR sensors as input values, so they should be located appropriately. We set the location of the FSR sensors according to the anatomical shape of a foot, and they are the protruding areas. These areas make contact with the ground earlier than the others and get more pressure than the others, so FSR sensors should be located at these areas for sensing the pressure most of time, and we can utilize these values to estimate the pressure of other areas. We used six FSR sensors, and their locations were at two phalanges, two of metatarsal bones, the calcaneus, and the arch of the foots as shown in Figure 1. The sensor at the arch of the foot(E) was used for another reason. Because pressure at this area is intermittently formed, estimation of it is very difficult without measurements, and because of its shape, this is the last area to get pressure during the locomotion. Therefore, this area for input value was helpful for algorithm fitting. FSR sensors were attached to a polypropylene insole of size US8, and the signals were transmitted to the microcontroller (STM32F407VG-discl1, STMicroelectronics, Geneva, Switzerland) through the circuit, which is recommended by the manufacturer [20].
FSR-A401 (TEKSCAN Inc., South Boston, MA, United States) with a sensing area of 2026.93 mm 2 was used, and we calibrated them using the system in Hall et al. [21]. After the FSR sensors are used, the electric resistances of the FSR sensors change. Therefore, we fitted the 4th-order polynomial function with the FSR voltage value and, its moving integral, offset to compensate for that and also for reducing the hysteresis effect. To reduce the noise from the sensors, we used an RC analogue high-pass filter with 335.06 Hz cutoff frequency, and on the computer, we also used a digital low-pass filter with 20 Hz cutoff frequency for the noise. Gray circles with wires show the FSR sensors. White bolded numbers indicate the anatomically divided areas. Blue squares mean the areas of the virtual forces that contain the FSR sensors in them.

Virtual Force Algorithm (VFA) Design
The insole was divided into six areas to estimate the whole insole pressure. The areas were composed around the FSR sensors, and the FSR sensors were the center of the areas as in Figure 1. Every area had a force converted from the pressure of the area and its moving coordinate, which is shown in Table 1. These values can be predicted from algorithms for which inputs are the values of the FSR sensors. We used an ANN algorithm for the virtual force algorithm (VFA).
The ANN system is a statistical learning algorithm designed from the idea of the nerve network of humans. It is a model that estimates the output values from a node that is composed of numerous synapses and multiplied by fitted weight constants. A human cannot calculate the magnitude of the GRF and the location of the CoP for every moment, but he can maintain the balance of the body and perform locomotion by feeling it with a nerve network that is fitted with numerous frames that accumulated since birth. We can use this point for our algorithms.
We trained 18 ANN algorithms with 18 input values of magnitudes, 1st and 2nd derivatives of magnitudes of six FSR sensors for the magnitudes of virtual forces and coordinates of their locations like in Figure 2. We used those values to reduce drastic errors during experiments. They maintain the slope of the estimated values with velocities and accelerations so there can be no abrupt dominant change.
A neural network fitting toolbox in MATLAB (The MathWorks, Inc., Natick, MA, United States) was used for algorithm fitting. Tangent-sigmoid transfer function, which is an activation function for connecting the layers was used for hidden layer and output layer and a Levenberg-Marquardt backpropagation algorithm was used for training the weighted constants of the algorithm. Collected dataset were divided into three parts: 70% for training, 15% for validation, and 15% for testing.
The magnitudes of the GRF were calculated by summing the virtual forces as in Equation (1), and the location of the foot plantar CoP was calculated by a WMA with virtual forces and their locations as in Equation (2).

Virtual Force Algorithm (VFA) Design
The insole was divided into six areas to estimate the whole insole pressure. The areas were composed around the FSR sensors, and the FSR sensors were the center of the areas as in Figure 1. Every area had a force converted from the pressure of the area and its moving coordinate, which is shown in Table 1. These values can be predicted from algorithms for which inputs are the values of the FSR sensors. We used an ANN algorithm for the virtual force algorithm (VFA).
The ANN system is a statistical learning algorithm designed from the idea of the nerve network of humans. It is a model that estimates the output values from a node that is composed of numerous synapses and multiplied by fitted weight constants. A human cannot calculate the magnitude of the GRF and the location of the CoP for every moment, but he can maintain the balance of the body and perform locomotion by feeling it with a nerve network that is fitted with numerous frames that accumulated since birth. We can use this point for our algorithms.
We trained 18 ANN algorithms with 18 input values of magnitudes, 1st and 2nd derivatives of magnitudes of six FSR sensors for the magnitudes of virtual forces and coordinates of their locations like in Figure 2. We used those values to reduce drastic errors during experiments. They maintain the slope of the estimated values with velocities and accelerations so there can be no abrupt dominant change.
A neural network fitting toolbox in MATLAB (The MathWorks, Inc., Natick, MA, USA) was used for algorithm fitting. Tangent-sigmoid transfer function, which is an activation function for connecting the layers was used for hidden layer and output layer and a Levenberg-Marquardt backpropagation algorithm was used for training the weighted constants of the algorithm. Collected dataset were divided into three parts: 70% for training, 15% for validation, and 15% for testing.
The magnitudes of the GRF were calculated by summing the virtual forces as in Equation (1), and the location of the foot plantar CoP was calculated by a WMA with virtual forces and their locations as in Equation (2). (2) .

Figure 2.
Flow chart of the ANN algorithm for estimating the GRF and calibrating the CoP of the insole.2.3. Artificial Neural Network Setting.

Artificial Neural Network Setting
Before doing the experiments for many subjects, we should decide the number of layers of an ANN. So, we did the scan experiment which is performed standing on two feet and moving the center of mass counter-clockwise and back and forth for one subject. Data for fitting the algorithms were acquired by the F-Scan system. Chen et al. confirmed that the F-Scan system was accurate for measuring GRF and CoP [22]. We used the F-Scan system for reference data. Every experiment was done with the subjects wearing an F-scan insole sensor and low-cost flexible insole pressure measurement sensor as in Hu et al. like Figure 3 [19]. The data acquisition rate was set to 50 Hz (20 ms). After data acquisition, we composed the matrices for algorithm fitting. One frame of 20 ms was converted to one data matrix. The matrix is composed of 19 columns with the six magnitudes of the FSR sensors, six 1st and 2nd derivatives of them for input values, and pressure values and coordinates of the divided. We fitted the ANN algorithm with different number of layers of hidden neurons for finding the optimum number.
We knew that time durations for all numbers of layers for estimating virtual forces are less than one second and we did not consider the variable for that reason. As to the mean of error and correlation coefficient, 10 layers had the best performance among all numbers of layers as shown in Figure 4. Therefore, we decided the number of layers would be 10 for estimating the virtual forces.

Artificial Neural Network Setting
Before doing the experiments for many subjects, we should decide the number of layers of an ANN. So, we did the scan experiment which is performed standing on two feet and moving the center of mass counter-clockwise and back and forth for one subject. Data for fitting the algorithms were acquired by the F-Scan system. Chen et al. confirmed that the F-Scan system was accurate for measuring GRF and CoP [22]. We used the F-Scan system for reference data. Every experiment was done with the subjects wearing an F-scan insole sensor and low-cost flexible insole pressure measurement sensor as in Hu et al. like Figure 3 [19]. The data acquisition rate was set to 50 Hz (20 ms). After data acquisition, we composed the matrices for algorithm fitting. One frame of 20 ms was converted to one data matrix. The matrix is composed of 19 columns with the six magnitudes of the FSR sensors, six 1st and 2nd derivatives of them for input values, and pressure values and coordinates of the divided. We fitted the ANN algorithm with different number of layers of hidden neurons for finding the optimum number.  And for the coordinates, we did same process. Time durations were all less than five hundred seconds, so we also did not consider it and got the number of 200 layers as same reason for the virtual force.
We also determined the data amount for algorithm fitting by experiment. Figure 5 shows the result of the algorithm fitting with different numbers of data frames. After 10,000 frames, the rate of error decreasing slowed down. So, we collected 15,000 frames for algorithm fitting and the proportions of each experiment are the same in the data set.  We knew that time durations for all numbers of layers for estimating virtual forces are less than one second and we did not consider the variable for that reason. As to the mean of error and correlation coefficient, 10 layers had the best performance among all numbers of layers as shown in Figure 4. Therefore, we decided the number of layers would be 10 for estimating the virtual forces.  And for the coordinates, we did same process. Time durations were all less than five hundred seconds, so we also did not consider it and got the number of 200 layers as same reason for the virtual force.
We also determined the data amount for algorithm fitting by experiment. Figure 5 shows the result of the algorithm fitting with different numbers of data frames. After 10,000 frames, the rate of error decreasing slowed down. So, we collected 15,000 frames for algorithm fitting and the proportions of each experiment are the same in the data set.  And for the coordinates, we did same process. Time durations were all less than five hundred seconds, so we also did not consider it and got the number of 200 layers as same reason for the virtual force.
We also determined the data amount for algorithm fitting by experiment. Figure 5 shows the result of the algorithm fitting with different numbers of data frames. After 10,000 frames, the rate of error decreasing slowed down. So, we collected 15,000 frames for algorithm fitting and the proportions of each experiment are the same in the data set.
seconds, so we also did not consider it and got the number of 200 layers as same reason for the virtual force.
We also determined the data amount for algorithm fitting by experiment. Figure 5 shows the result of the algorithm fitting with different numbers of data frames. After 10,000 frames, the rate of error decreasing slowed down. So, we collected 15,000 frames for algorithm fitting and the proportions of each experiment are the same in the data set.

Experimental Settings
Experiments were done with eight adult males who had a foot size of US8. Their body state indexes are shown in Table 1. Every subject performed five tasks for data acquisition: (1) The scan experiment is performed standing on two feet and moving the center of mass counter-clockwise and back and forth.  After fitting the algorithms with acquired data, all algorithms are converted into MATLAB function block of simulink so we can use the algorithm in real time with the values of FSR sensors transmitted from microcontroller (STM32F407VG-disc1, STMicroelectronics, Geneva, Switzerland) board by serial communication (20 ms). We did the whole experimental process again with the algorithm for validation.

Figures 6a and 7a
show examples of the CoP trajectory plots during the scan experiment, gait experiment of subject 3 by the WMA, the VFA and the reference data of the F-Scan system. We can see that the trajectory of the VFA is much closer to the F-Scan than the WMA. Figures 6b and 7b show the estimation of the magnitude of the GRF during the experiments, and we can see that the estimations are close to the reference data. Figure 6a and 7c show examples of the CoP trajectory plots during the scan experiment, gait experiment of subject 3 by the WMA, the VFA and the reference data of the F-Scan system. We can see that the trajectory of the VFA is much closer to the F-Scan than the WMA. Figure 6b and 7d show the estimation of the magnitude of the GRF during the experiments, and we can see that the estimations are close to the reference data.     Figure 8 shows the RMSE of the VFA and the WMA by the reference data of all the subjects during each experiment. The green bars of the WMA have higher values than the yellow bars of the VFA, so it is clear that the error decreased with the proposed algorithm.

Discussion
In this study, we proposed and validated an algorithm (VFA) for estimating GRF and calibrating CoP of an insole with several experiments. Using eight healthy males our validation experiments confirmed that the VFA can estimate the magnitude of the GRF of an insole during static and dynamic situations with a 29.34 N mean RMSE value and the location of the CoP with an 8.29 mm mean RMSE

Discussion
In this study, we proposed and validated an algorithm (VFA) for estimating GRF and calibrating CoP of an insole with several experiments. Using eight healthy males our validation experiments confirmed that the VFA can estimate the magnitude of the GRF of an insole during static and dynamic situations with a 29.34 N mean RMSE value and the location of the CoP with an 8.29 mm mean RMSE value. The results also confirmed that the VFA have high correlation coefficients like 0.94 for GRF, 0.94 for the X coordinate, and 0.76 for the Y coordinate. The correlation coefficient of 0.76 can be regarded as a low value but that is because of the low span of the Y coordinate, and it is not low compared with relevant studies. Hu et al. proposed a nonlinear model for estimation of the foot plantar CoP trajectories, and their research had the best success with estimating CoP so far [16]. They achieved an average RMSE value of 2.48 mm for the medial-lateral direction, which equals the Y coordinate of this study, and 10.18 mm for the anterior-posterior direction, which equals the X coordinate of this study. The exact distance error was 10.48 mm, which is higher than the 8.29 mm of this study. The experiments done in that study were composed of static experiments like quiet standing, sitting down, and standing up. Those static experiments had input signals of almost all the sensors with monotonous changes of magnitudes of the sensor signals. Those conditions are advantageous for algorithm performance. Moreover, the VFA described in this paper had an average RMSE of 8.28 mm, which is lower even with fewer sensors (six FSR sensors) than the study of Hu et al. (12 FSR sensors). For dynamic situations like walking, we achieved 9.45 mm for the average RMSE value during 1 km/h and 2 km/h gait experiments. Thus, VFA performed the best for estimating the CoP during all situations so far.
Studying the GRF, Park et al. found the NRMSE of estimating the GRF during walking, running, and jumping [13], with values of 14.68 for walking, 10.9 for running and 14.72 for jumping. During the walking, the maximum magnitude of GRF was 800 N. Then RMSE was calculated as 120 N, which was much higher than the error of this study (34.01 N). They had the biggest error during the experiment in 20 to 70% of the gait cycle, while in this study we can see that there is no loss of force during the gait cycle in 0.4 to 0.88 s in Figure 7b. These results confirm that for estimating the GRF, VFA is the best algorithm reported.
We concluded that the reason why our proposed algorithm (VFA) has a higher performance than any other algorithms is in virtual forces and moving coordinates. In Figure 6a, the gray circles with bolded black edges indicate the locations of the FSR sensors. With the limitation of the WMA model that has fixed coordinates with weighted constants, the CoP cannot get out of the region of the FSR sensor area, which has the FSR sensors as apexes. We can see that CoPs of WMA are located at the edge which is drawn by connecting the FSR sensors. However, with virtual coordinates, the CoP can move out of the FSR sensor area, as in Figure 6a, with green circles. However, with virtual forces and moving coordinates, CoP can get out of the FSR sensor area, as we can explain through Figure 9.  [13], with values of 14.68 for walking, 10.9 for running and 14.72 for jumping. During the walking, the maximum magnitude of GRF was 800 N. Then RMSE was calculated as 120 N, which was much higher than the error of this study (34.01 N). They had the biggest error during the experiment in 20% to 70% of the gait cycle, while in this study we can see that there is no loss of force during the gait cycle in 0.4 s to 0.88 s in Figure 7d. These results confirm that for estimating the GRF, VFA is the best algorithm reported.
We concluded that the reason why our proposed algorithm (VFA) has a higher performance than any other algorithms is in virtual forces and moving coordinates. In Figure 6a, the gray circles with bolded black edges indicate the locations of the FSR sensors. With the limitation of the WMA model that has fixed coordinates with weighted constants, the CoP cannot get out of the region of the FSR sensor area, which has the FSR sensors as apexes. We can see that CoPs of WMA are located at the edge which is drawn by connecting the FSR sensors. However, with virtual coordinates, the CoP can move out of the FSR sensor area, as in Figure 6a, with green circles. However, with virtual forces and moving coordinates, CoP can get out of the FSR sensor area, as we can explain through Figure 9.  Table 3. Numerical values of frame in Figure 9. In Figure 9, we can see three points of CoP by VFA (Algorithm), WMA (No Algorithm) and reference data (F-Scan) of a certain frame during a scan experiment. Of course, the point of the VFA is closer to the F-Scan point than that of WMA. This is because the virtual force of D area which is getting bigger by VFA, drags the orange point of WMA backward. In Table 3, the proportional rate of ADC values of FSR sensors in the A, B, D area is 1:2.4:2.8. However, the proportional rate of the estimated virtual forces of areas is 1:4.45:12.24. The proportion of the force of D area is much bigger than before, so its effect is also higher. The estimated moving X coordinates of C and D areas are also dragged slightly backward compared to before. In the WMA for the calculation of CoP, like ∑

Numerical
, so when F i gets bigger, the effect of x i is higher. So, bigger values of virtual forces resulted from the VFA let the coordinates which is slightly dragged backward have more power to drag the CoP to the actual location. Table 3. Numerical values of frame in Figure 9.

Numerical Value
Divided Area of Insole The principle of estimating the virtual forces from other FSR sensors can be explained by linear multiple regression which is regarded as an ANN with one neuron. We fitted the linear multiple regression which has six FSR sensor values for inputs and estimated force of B area for output, as in Equation (3): F ER = a 0 + a 1 F T + a 2 F R + a 3 F L + a 4 F H + a 5 F C + a 6 F LT We can get the constants for Equation (3) as in Table 4. We know that the constants of A, B, C areas are positive values and those of D, E, F are negative. A positive value means that if the FSR sensor of that constant gets a higher value, it gives the output, which is the estimated force, a positive effect to get higher force. A negative value means the opposite. For example, the constant a 4 of heel FSR sensor has a negative value, so if the heel FSR sensor gets a higher value, the estimated force of B area gets a lower value. The reason is clear: when the heel gets a higher value, that means the CoP is located in the back side of the foot and FSR sensors on the front side cannot help getting a lower value for pressure. This explains why the protruding areas can be chosen for the locations of the FSR sensors for input values of algorithms. To sum up, the VFA lets the virtual forces get higher values of pressure than those measured by FSR sensors and also gives the virtual forces more reasonable coordinates than the fixed coordinates of the FSR sensors. So, the CoP that is calculated by a WMA with those virtual forces and moving coordinates can be closer to the actual value. Thus, we can overcome the fundamental limitations of the FSR sensor and use a low-cost sensor like the whole insole measurement pressure sensing system. The VFA is very practical for the low-cost sensor field. We can use it for the wearable sensor market for weight measurement and daily step analysis with connections to smartphones or computers. Furthermore, in research, as we explained in the introduction, it can be used for rehabilitation engineering, medical engineering, biomechanics and so on. However, in this study, we set a restriction on the size of the foot, but we think it likely that there is an average foot shape for every person and we can make algorithms with the VFA that operate for every foot size. Our future work will be to normalize the algorithms of the virtual forces and coordinates for every size of foot and person to compose only one algorithm for all human beings.