PBR

2023 · A home training application for cycling that connects to trainer, power meter and heart rate devices.

Technologies: web, TypeScript, React, HTML

During winters, I used to ride a home trainer. When the bike is attached to them, these trainers will measure the power put into the pedals. Their resistance can also be controlled to simulate steeper slopes. Based on that a bike ride or an exercise can be performed.

There are plenty of applications (1, 2, 3) but almost all of them require $10-20 per month. That is fair, as they have plenty of features (including social networking), but these are features that I don’t need.

Driven by the curiosity if I can gather the data from the trainer, I decided to make my own application: PBR (Pedal, Breath, Repeat) (yeah, maybe too much programmer thinking about REPL).

andreipana.net/pbr

Key features:
  • It’s free.
  • It runs directly in the browser, nothing to install locally.
  • Records activities in gpx format that can be uploaded to Strava or any other training tracking application.

The app can connect to a smart home trainer, a power meter and a heart rate sensor and record the values from these devices. The user can choose a predefined workout (exercise) that basically says: ride 5 minutes at 200 W, then ride 4 minutes at 100 W, then repeat. In the end, all the data recorded are saved to a gpx file that can be stored or uploaded to a training tracking application, like Strava.

And here are a few photos of the application in use:

And the activity imported to Strava:

And I can watch podcasts and conferences while training, who needs to see a 3D rendered virtual avatar on a bike that drains the tablet battery faster than ever:

Making of

Initially I started with C# as a Windows desktop application, but it turned out that working with Bluetooth in C# on Windows is more complicated than it should be and also somehow unreliable.

Studying the subject further, I found out that in 2023 web browsers (at least the Chromium-based ones, Chrome and Edge) support a very decent Bluetooth API.

So it became the right choice for the project, gaining the ability of running it without installing anything and also working on pretty much every device and operating system. Now I can use it from my Android tablet or phone or using the laptop.