Skip to content

fuzzylabs/wearable-my-foot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wearable My Foot

Powered by Fuzzy Labs. Formerly known as 'AI-for-your-feet'.

Wearable My Foot (WMF) is an Open Source wearables project built on Arduino.

The primary aim is to try and replicate a 'running power' metric similar to that produced by state of the art commercial products such as Stryd. We're using the gyroscope and accelerometer built into the Arduino along with some clever maths in order to produce an estimation of running power.

Future ideas include attaching a pressure sensitive insole to the device and tracking things such as gait and posture.

The project covers:

  • Building the physical hardware.
  • Writing and deploying the firmware to the hardware.
  • Gathering gyroscope and accelerometer data from the hardware.
  • The algorithm(s) used to transform that data into useful metrics (running power, step counter, ground time, etc.)
  • An Android app that pairs with the hardware and displays the metrics in realtime.

Hardware

Wearable My Foot Hardware

The hardware is based on an Arduino Nano IOT microcontroller.

n.b. the current generation of hardware is a prototype. Future iterations will have a better form-factor by using smaller components. Example product links are included for purchasing the components.

Microcontroller code

The firmware code for the Arduino is built using PlatformIO.

Optional Virtualenv setup

Feel free to skip if you're installing / have installed PlatformIO using a different method. To initialise the environment using Python 3 and pip:

python -m venv env
env/bin/activate
pip install -r requirements.txt

To activate the environment, source env/bin/activate.

Building and deploying to the device

To Just build

platformio run

Build and upload

platformio run -t upload

Attach a serial monitor

platformio run -t monitor

Run the tests - this builds a new image and uploads it so that tests are run on the device

platformio test

Android app

The Android app allows the device to connect via Bluetooth and upload data. It's written in Kotlin.

Wearable My Foot Android App

Building and deploying via Android Studio

  1. Enable the development mode on your Android device, and connect the device with a USB cable
  2. Clone or download the repository code
  3. Open the project in Android Studio (File > Open)
  4. Run the app (Shift+F10 or Run > Run 'app'), this might display a prompt on the Android device to confirm that you trust the computer (if it is not on the trusted list yet)

Screen sharing Android device on linx

TODO (scrcpy)

Usage

  1. Have the Arduino powered on
  2. Open the app. The app will request access to location data, which is required for Bluetooth scanning.
  3. Tap 'Scan' to scan for BLE devices, if the compatible device is found, its MAC address will be displayed on the screen.
  4. Tap 'Connect' to connect to the Arduino. After successful connection, the orange LED will light up on the Arduino, and current readings will be displayed on the screen.
  5. Tap 'Disconnect' to disconnect and end the session.
  6. Tap 'Save' to save the results of the session into a CSV file (saved at Android/data/ai.fuzzylabs.wearablemyfoot/files/ on the Android device

Jupyter notebooks

The notebooks directory contains notebooks with code used in the experiments

  • powermetre.ipynb -- the notebook for estimating the power of a walk in a straight path. Requires three CSV files
    • Measurements of acceleration when the device is at rest for calibration (provided at data/still.csv
    • Measurements of acceleration during a walk with the Arduino mounted on a chest (can be recorded with the provided app, and the sample data is provided at data/chest3.csv
    • Measurements of acceleration during a walk taken with the Android device for comparison (provided at data/chest-android.csv

Versioning the notebooks

See here for a nice description of the problems associated with versioning Jupyter notebooks and some suggested solutions.

We're using nbstripout to remove the outputs and state data from the committed versions of our notebooks.

nbstripout --install
nbstripout --install --attributes .gitattributes
nbstripout --install --global
nbstripout --status

Results

Cadence

Mean average cadence (in steps per minute) recorded with different methods:

Test case Stryd Garmin (WMF) Peak Detection (WMF) FFT (WMF) Autocorrelation
1km mixed run 82.56 82.48 71.50 170.17 154.48

Data

The data directory contains some example data generated by the device.

Power measurements

Several sample CSV files containing IMU measurements (acceleration and angular velocity)

  • still.csv -- several minutes of the devices sitting still on a table; used to assess the accuracy and the bias of the IMU
  • leg.csv -- a short walk with the device strapped to a side of a leg
  • chest3.csv -- a short walk (4.5 metres) with the device attached to a chest
  • chest-android.csv -- a short walk (4.5 metres) recorded with an Android phone (at the same time as chest3.csv)

Data dashboard (Dash)

The dash directory contains a dashboard generated by the Dash framework. Dash is Python-based, and uses the Flask web framework; Dash is similar to R-Shiny.

Running locally

pip install -r requirements.txt
python app.py

Modification

  • For a guide to Plot.ly graphs etc, see here.

Other wearable feet things

Commercial Pressure Sensing Insoles

Open Source / DIY Pressure Sensing Insoles

TODO

Commercial Foot Pods

Open Source / DIY Foot Pods

TODO

Running Power