Seedlabs
Source research

Gait Trajectory Prediction on an Embedded Microcontroller Using Deep Learning

Mohamed Karakish, Moustafa Ahmed Fouz, Ahmed ELsawaf · 2022 · 30 citationsRead the paper

Achieving a normal gait trajectory for an amputee's active prosthesis is challenging due to its kinematic complexity. Accordingly, lower limb gait trajectory kinematics and gait phase segmentation are essential parameters in controlling an active prosthesis. Recently, the most practiced algorithm in gait trajectory generation is the neural network. Deploying such a complex Artificial Neural Network (ANN) algorithm on an embedded system requires performing the calculations on an external computational device; however, this approach lacks mobility and reliability. In this paper, more simple and reliable ANNs are investigated to be deployed on a single low-cost Microcontroller (MC) and hence provide system mobility. Two neural network configurations were studied: Multi-Layered Perceptron (MLP) and Convolutional Neural Network (CNN); the models were trained on shank and foot IMU data. The data were collected from four subjects and tested on a fifth to predict the trajectory of 200 ms ahead. The prediction was made for two cases: with and without providing the current phase of the gait. Then, the models were deployed on a low-cost microcontroller (ESP32). It was found that with fewer data (excluding the current gait phase), CNN achieved a better correlation coefficient of 0.973 when compared to 0.945 for MLP; when including the current phase, both network configurations achieved better correlation coefficients of nearly 0.98. However, when comparing the execution time required for the prediction on the intended MC, MLP was much faster than CNN, with an execution time of 2.4 ms and 142 ms, respectively. In summary, it was found that when training data are scarce, CNN is more efficient within the acceptable execution time, while MLP achieves relative accuracy with low execution time with enough data.

What the full text shows

Working prototype
  • CNN achieved higher correlation coefficient than MLP when gait phase information was excluded. — 0.973 vs 0.945 (Without current gait phase; tested on 5th subject)
  • Both MLP and CNN achieved similar high correlation coefficients when gait phase information was included. — ~0.98 (With current gait phase; tested on 5th subject)
  • MLP had significantly lower execution time on the microcontroller compared to CNN. — 2.4 ms vs 142 ms (Deployed on ESP32 microcontroller)
  • CNN achieved lower RMSE than MLP without gait phase information. — 0.245 vs 0.298 deg/s (Foot trajectory 200 ms ahead)
  • MLP and CNN achieved lower RMSE than LSTM-based models from previous research. — 0.217 to 0.298 deg/s vs +0.202 to +0.27 deg/s difference (Inter-subject implementation 200 ms ahead)
Setup
Dataset from 5 subjects (4 for training, 1 for testing) using MPU9250 IMUs; deployed on ESP32 (dual-core 240 MHz, 512 KB RAM, 4 MB Flash).
How
MLP and CNN models were trained using TensorFlow on IMU data (shank and foot) and optimized via Grid Search. The models were converted using tinymlgen/TensorFlow Lite and deployed on an ESP32 microcontroller to predict angular velocity 10 time frames (200 ms) ahead.
Limitations
Small sample size (5 subjects) due to gyroscope data corruption. · Phase shift during swing phase, particularly in CNN. · Initial jump in predictions, especially in CNN.

Summarized by Gemma 4 from the open-access full text · 15 Nov 2026. Read it