DEV Community

Cover image for Build a Training Coach Device with M5Stack StopWatch and Bedrock AgentCore 💪

Build a Training Coach Device with M5Stack StopWatch and Bedrock AgentCore 💪

Introduction

This post is the English version of my entry for Day 5 of the AWS Community Builders Advent Calendar 2026 (Japanese).
https://qiita.com/advent-calendar/2026/aws-community-builders

A little while ago, I built an avatar app for the M5Stack StopWatch (just "StopWatch" from here on) that lets you talk to Claude Code (article in Japanese).
https://zenn.dev/yokomachi/articles/202611_m5-stopwatch-avatar

This time I used the same StopWatch to build a training coach app that supports my daily workouts.
The agent that plans the training menu is hosted on Amazon Bedrock AgentCore, and the app itself runs on the StopWatch.
It counts reps for each exercise, builds the menu with the agent through voice input (STT), and reads the count aloud with speech synthesis (TTS) so you can keep track without looking at the screen. I tried to make the most of the StopWatch hardware.

So, here's the demo (no sound).
The agent suggested training the upper body and core, but for the demo I had it build a menu of push-ups, squats, and the exercise bike.

The repository is public, so feel free to use it.
https://github.com/n-yokomachi/m5-healthwatch

Features

Deciding today's menu by voice

When you start the app, the agent on AWS looks at the previous menus stored in DynamoDB and suggests which body part to train today.
Hold the yellow button and answer by voice, and the agent picks up what you said and builds the menu.
You can make requests like "Add the exercise bike" or "Double the squats".

Counting on the screen and by voice

Press the StopWatch's physical button to start, and it counts through the menu in order.
For timed exercises like the exercise bike, it shows the elapsed time and announces interval changes by voice, saying "make it a bit harder" or "ease off".

Architecture

Overall architecture

The StopWatch connects directly over Wi-Fi to the Amazon Bedrock AgentCore Runtime endpoint.
The agent transcribes the user's voice input with Transcribe and then passes it to the LLM.
The agent's reply is turned into speech with Polly and sent back to the StopWatch.

Component Purpose
Amazon Bedrock AgentCore Runtime Agent runtime
Strands Agents (Python) Agent framework
Amazon Nova 2 Lite LLM
Amazon Transcribe Speech to text
Amazon Polly Text to speech
Amazon DynamoDB Training menu history
Amazon Cognito Authentication
AgentCore Observability Agent tracing
M5Stack StopWatch (ESP32-S3, Arduino) Device

Conversation flow with the agent

The audio sent from the StopWatch reaches the LLM as shown in the sequence diagram below.

Tips

Calling AgentCore Runtime directly from the StopWatch

AgentCore Runtime can authenticate with a Cognito JWT.
The StopWatch just gets a token from the Cognito API, puts it in the Authorization header, and calls the Runtime. So there's no need to create SigV4 signatures on the StopWatch, and no need to put IAM access keys on it either.

Running locally during training

If you use Polly in real time to read the count aloud during training, network latency makes the voice drift away from the screen.
So the numbers and fixed phrases like "start" and "make it a bit harder" are synthesized with Polly in advance and embedded in the firmware.

Gradually raising the intensity from training history

The training menu history is stored in DynamoDB.
When you ask for it, the agent refers to your previous menus and numbers and suggests a slightly harder workout, which gives it a bit of a personal-trainer feel.

Wrapping up

So that was the training coach device I built with the M5Stack StopWatch and Bedrock AgentCore.
Honestly, it's still pretty rough and the experience has plenty of room to improve, but on the flip side, I think it could actually be useful day to day if I built it properly.
The M5Stack StopWatch restarts and launches apps fairly quickly, which makes trial and error and testing on the real device easy during development.
M5 StackChan is fun too, but as a first M5 product, I'd highly recommend the StopWatch as well.

Top comments (0)