Watch Motion

Session recording

It's Christmas time! Just went on a two week break from my current freelance contract and started working on Watch Motion again. Bad news is that I catched a cold last week and have been sick since, so I haven't been able to go out and record any real world data.

The approach from the previous post with counting number of reps based on the peaks in sensor data looks promising. I would like to dive deeper into how this works when mixing noisy between-exercise data with the clean exercise data. To do this we need to capture longer sessions and have a ground truth for when an exercise starts and ends.

I did some updates to the app and added a session recording mode. Instead of just recording one exercise at a time, the app now records sensor data continuously. I can mark the start of an exercise by pressing a button, it will then count down from 3, mark the start and set the end to a few seconds later.

The sensor data is stored directly to a csv-file on the watch. That means that we now have two types of data, a csv-file containing the raw sensor data and an array of exercise slots looking like this:

[
  {
    "exercise": "battlerope",
    "start": 3219,
    "end": 4219
  },
  {
    "exercise": "chins",
    "start": 8429,
    "end": 9429
  }
  ...
]

The architecture for uploading files looks like this:

After finishing recording a session the following happens:

  • The app makes a POST request to a lambda function exposed through API Gateway
  • The lambda function creates a unique id for the session and stores it together with the metadata in a DynamoDB table
  • It also requests a presigned upload URL from S3 that is sent back as the response to the watch app
  • The watch app uploads the CSV-file to S3 using the presigned URL
  • S3 triggers an event when the upload is complete which triggers another lambda function
  • That lambda function reads the CSV-file and updates the DynamoDB entry with a condensed version of the log data scaled down to 1024 entries.

Below is the data captured, first some sample data I collected at home while sick, but you can click fetch latest to get the most recent recording:

Acceleration

Gyroscope

Magnetometer

Pretty happy with the progress so far, next step is to collect a couple of workout sessions and see if we can get a good model for counting reps and ideally also classifying the type of exercise.