Skip to main content
Created By: Samuel Alexander Public Project Link: https://studio.edgeimpulse.com/public/366723/live
Wearable gait monitoring prototype components beside the Nordic Thingy:53

01-cover

Introduction

Subtle changes in gait can be early indicators of various medical conditions, including neurodegenerative diseases like Parkinson’s, multiple sclerosis, balance disorders, and even other injuries with far-reaching health consequences. Early detection often relies on subtle changes in how a person walks, such as reduced speed, shuffling steps, or unsteadiness. Unfortunately, current assessments primarily rely on periodic, in-clinic observations by healthcare professionals, potentially missing subtle yet significant changes occurring between visits. Moreover, subjective self-assessments of gait are often unreliable. This lack of continuous, objective monitoring hinders timely diagnoses, limits the effectiveness of treatment plans, and makes it difficult to track the progression of gait-related conditions. A proactive, data-driven solution is needed to ensure individuals and their healthcare providers have the information necessary for informed decision-making.
Human gait cycle diagram labeling stance and swing phases

02-gait

Image Credit: Can Tunca, “Human Gait Cycle”, 2017, via mdpi.com

Project Overview

This project aims to develop a wearable device for early gait disorder detection. We’ll begin by collecting data representing normal gait patterns during walking, running, and standing. Next, we’ll extract relevant features using Edge Impulse tools, focusing on characteristics like leg swing acceleration, stride length, and foot placement (supination/pronation). Employing Edge Impulse’s K-means anomaly detection block and feature importance analysis, the device will learn to distinguish healthy gait patterns (based on the individual’s established baseline) from potential anomalies. Initially, inference results will be displayed on a smartphone app. This proof-of-concept can be expanded into a wearable device that alerts users of gait abnormalities and trends, recommending healthcare consultations when appropriate. Ultimately, our goal is to provide a proactive tool for early disorder identification, enabling timely intervention and improved outcomes.
Nordic Thingy:53 mounted in a shoe clip for gait data collection

03-project

Why the Nordic Thingy:53? Platform Continuity.

The Nordic Thingy:53 leverages the nRF5340 Arm Cortex-M33 SoC, providing the computational resources necessary for on-device AI inference. It also includes a built-in accelerometer to capture detailed gait data and Bluetooth 5.4 for wireless communication. Importantly, the same nRF5340 chip powers the nRF5340 Development Kit, providing a consistent hardware platform throughout the project’s development cycle. This means we can easily prototype on the Thingy:53, refine algorithms and sensor selections on the Development Kit, and ultimately transition to a custom wearable design for mass production – all using the same core chip. This approach ensures a smooth and efficient development process.
Nordic Thingy:53 development board used for wearable inference

04-thingy

Hardware Requirements

  • Nordic Thingy:53
  • 3D printer

Software Requirements

  • Edge Impulse CLI
  • nRF Programmer App (iPhone/Android)
  • nRF Connect Desktop

Dataset Collection

The Thingy:53 was used for collecting a dataset for training the AI model to establish a baseline of normal, healthy gait patterns. This dataset includes three types of movement: standing, walking, and running. To capture realistic data, the user wore the device while performing these activities. The dataset’s variety helps the model accurately classify different gait patterns and detect potential abnormalities in various situations.
Animated gait data collection with the Thingy:53 attached to a shoe

05-dataset-collection

A 3D printed shoe clip-on case modification is made for attaching the Thingy:53 to a shoe. You can download the .stl files here: https://www.thingiverse.com/thing:6558382
CAD model of the 3D printed shoe clip for the Thingy:53

06-cad


Printed shoe clip modification before attaching it to footwear

07-mod


Thingy:53 mounted on a shoe for accelerometer collection

08-shoe

This project assumes basic familiarity with connecting the Thingy:53 to Edge Impulse via the nRF Connect app. If needed, refer to this guide for assistance.
nRF Connect app connected to the Thingy:53 for Edge Impulse

09-nrfconnect

Collect data for each label (standing, walking, running) using the nRF Connect app. Choose:
  • Sensor: Accelerometer
  • Sample Length (ms): 20000
  • Frequency (Hz): 20
For each label, we collected 13 repetitions of 20000 ms which equals to 260 seconds for each label. This seems to be plenty enough for our testing, however more data may be necessary if the gait patterns are performed with a larger variety of terrains.
Mobile data collection settings for standing, walking, and running labels

10-collect-data

Split the 20000 ms sample into 4 sections of 5000 ms windows.
Sample split tool dividing a long accelerometer recording into windows

11-split-sample


Data acquisition page with the completed gait dataset

12-complete-dataset

Perform a train/test split if needed, or try to aim for approximately an 80/20 ratio.
Dashboard controls splitting gait samples into training and test sets

13-train-test-split

Impulse Design

After thorough testing, including using the EON Tuner, the optimal settings for our time series data were determined. We employ both a classifier and K-means anomaly detection to enable both gait pattern classification and anomaly scoring.
Impulse design with spectral features, classifier, and anomaly detection blocks

14-create-impulse

Spectral Features

Spectral analysis transforms raw accelerometer data from the time domain into the frequency domain. This reveals hidden patterns in gait data, such as stride frequency, step regularity, and harmonic components of movement patterns. These extracted spectral features can provide a richer representation of gait characteristics for the neural network, often leading to improved classification accuracy and a clearer understanding of potential gait abnormalities.
Spectral features page for transformed accelerometer gait data

15-spectral-features

Classifier

As mentioned, these parameter settings are already using optimized values from the EON Tuner.
Tuned classifier settings generated from EON Tuner results

16-tuned-classifier


Classifier testing results after tuning the gait model

17-tuned-testing

These are our results before using the EON Tuner (default parameter values and settings).
Initial classifier results before EON Tuner optimization

18-initial-results

The EON Tuner is a valuable tool for finding the best parameter settings and model architecture to maximize accuracy. While it can also optimize for performance or memory usage, our project has sufficient resources in these areas. Therefore, we prioritize accuracy as the primary optimization goal.
EON Tuner configuration prioritizing accuracy for the gait model

19-eon-tuner-settings


EON Tuner results comparing candidate gait model configurations

20-eon-tuner

Anomaly Detection (K-means)

K-means clustering is chosen for gait anomaly detection due to its computational efficiency and ability to robustly identify distinct clusters. While Gaussian Mixture Models (GMMs) can model more complex data distributions, in our testing K-means excels in identifying distinct clusters like normal walking, running, and standing. We chose L1 Root Mean Square (RMS) for anomaly detection with accelerometer data (accX, accY, accZ) due to its sensitivity to outliers and interpretability. L1 RMS emphasizes large deviations, which helps identify significant gait abnormalities and provides insights into the specific directions of those anomalies. It’s also more robust to noisy accelerometer data compared to L2 RMS.
K-means anomaly detection settings for accelerometer features

21-anomaly-detection-settings


Anomaly explorer plotting vertical and forward gait feature clusters

22-anomaly-vertical-forward


Anomaly explorer plotting forward and sideways gait feature clusters

23-anomaly-forward-sideways

Deployment

Now the AI model is ready to be deployed to the Edge. Nordic Thingy:53 is selected for our deployment option. For this project we chose unoptimized (float32) to preserve accuracy since our hardware has enough performance and memory headroom.
Deployment page selecting the Nordic Thingy:53 target

24-deployment

After building our model, we’ll get the new firmware. Follow this guide to flash the firmware.
nRF Connect programmer screen writing the gait firmware to the Thingy:53

25-write-firmware-nrfconnect

Conclusion

This project successfully demonstrates the potential for wearable AI solutions in early detection of gait disorders. By harnessing the Thingy:53’s capabilities and Edge Impulse’s streamlined workflow, we developed a device capable of identifying gait anomalies. This tool offers proactive health monitoring, with the potential to alert users to subtle changes that may foreshadow underlying medical conditions. Future work could expand the dataset for greater robustness, explore additional sensor modalities, and conduct clinical trials to thoroughly validate the system for diagnostic use. See this project in action: