Running on clouds
Combining IoT and footwear to find out more about my running.
Ever since I started using the Nike Running app about two years ago I was fascinated by the way I could go back and look at my runs and see my pace, distance, location and elevation. (Here are some of them.) But as neat as that is I wondered if it would be possible to get more granular data to see every movement I did over the course of a run. About six months of deep-diving into Arduino, quaternions and javascript libraries later I present to you:
So how does it work?
The hardware:
An ESP32 (ESP32 is a series of low-cost, low-power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth.) In this case I chose a SparkFun Thing Plus — ESP32 WROOM for the ease of its Qwiic Connect System that made assembling the flex and imu sensors super easy.
An IMU Sensor that allows us to read the shoes position and translate it into quaternions that can be later used to translate the motion of our threejs model on the web. The BNO080 on the SparkFun VR IMU Breakout — BNO080 (Qwiic) works incredibly well for this purpose and also offers library addons to read steps and much more.
A flex sensor to measure the bending of the sole on impact with the ground. I went with the SparkFun Qwiic Flex Glove Controller since it offered a Qwiic connector.
The basic idea:
Our ESP32 translates our sensor data into a json string that we will send via a websocket connection over Wifi. On our PC we open a hosted webpage that connects to the ESP32 via websocket, receives the sensor data in form of quaternions for movement and strings for flex, steps and accuracy and displays this data.
The Github repository:
You can find all the necessary files for this project here: https://github.com/sinnfeinn/nkshoe
The Arduino code:
To program our ESP32 we will use Arduino IDE. To set this up simply download Arduino IDE here and follow these instructions to add the board definitions for the Adafruit feather board.
After adding the board definitions we need to add several libraries to the Arduino IDE in order to work with websockets, our sensors and so on.
Install all of these:
- Websockets (https://github.com/Links2004/arduinoWebSockets)
- ArduinoJson (https://arduinojson.org/?utm_source=meta&utm_medium=library.properties)
- SparkFun ADS1015 Arduino Library (https://github.com/sparkfun/SparkFun_ADS1015_Arduino_Library)
- SparkFun BNO080 Arduino Library (https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library)
- NTPClient (