Skip to content

Bike trainer software with ANT+ power and heartrate sensor logging.

License

Notifications You must be signed in to change notification settings

russery/pm-trainer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PM Trainer

PM Trainer Main Dialog

This is a simple indoor bicycle training application, similar to a very stripped-down version of TrainerRoad or Zwift with the following features:

  • Creates target-power workout profiles for the user to follow
  • Displays and logs ANT+ heartrate and power data
  • Uploads your workout to Strava

Installation Guide

Installation is still a bit janky due to a number of dependencies. For now, this should work, but YMMV

  1. Download the repo (either as a zip or via git clone)
  2. Run pip install msgpack - this shouldn't be required, but for some reason python setuptools chokes on it.
  3. Install libusb. Note that on MacOS Catalina, I've found that only the Homebrew version works (the ones on pip and Macports do not work). If you have Homebrew installed, run brew install libusb.
  4. From the root of the downloaded files, run python setup.py install. This should install all the other dependencies needed.

Quickstart:

  1. Configure Strava API access as described below (if you want automatic uploads)
  2. Plug in your ANT+ dongle and wake up your heartrate and power sensors
  3. Launch PM trainer: python src/pmtrainer/pm_trainer.py
    • Your ANT+ dongle and sensors should automatically be detected.
  4. Select a workout:
    • Click the gear icon (settings)
    • Under the "Workout" section click "Select"
    • Click on the profile of the workout you want, then click "Select"
    • Click "Save" on the settings dialog
  5. Ride your heart out!
  6. When the workout is over, close PM Trainer, and you'll be prompted if you want to save your workout to Strava (if you've configured Strava API access).
    • If you don't want to link your Strava account there will be a *.tcx file in the log directory configured in the Settings dialog. You can manually upload this file to Strava.

Strava API Access

Each user is expected to set up their own Strava API client, so there are a few annoying steps required to use the Strava integration feature:

  1. Follow instructions on Strava API Getting Started to configure an app. Briefly:
    • Go to Strava API Settings in your Strava account, and fill out the required fields.
    • Get the Client ID and the Client Secret from the page after you've registered your API.
  2. Enter these items in the PM Trainer settings dialog:
    • Launch PM Trainer, click the Settings button (gear icon)
    • Click the "Strava Connect" button in this dialog
    • There will then be a popup window prompting you to enter these values. Enter them in the required fields, and then click "Save"
  3. That's all folks! At this point, PM Trainer will open a browser window requesting you to authenticate the app with Strava (standard Oauth2 workflow).

Connecting Sensors

If you have an ANT+ dongle connected when PM Trainer is launched, it will automatically select the first heartrate monitor and power meter that it sees. Note that this could cause issues if you have more than one of these active (e.g., if there are two people wearing heartrate monitors in range, it's uncertain which one will be picked up by PM Trainer). This will be fixed someday by Issue #10.

Compatible Sensors and Dongles

PM Trainer hasn't been tested with many different dongles or sensors, but here are ones it is known to work with:

Dongles:

Sensors:

Currently cadence sensors and erg-mode trainers are not supported, although it would be fairly easy to add support for them if needed.

Creating Workouts

Creating a new workout is as simple as creating a YAML file in the workouts folder. The format of this file is:

name: <workout name goes here>
description: <brief description of the workout>
duration_s: <duration in seconds>
blocks:
  - duration: <duration as fraction of total workout>
    start: <desired power at the beginning of the block as a fraction of FTP>
    end: <desired power at the beginning of the block as a fraction of FTP>
  - ... more blocks...

Each "block" element defines a segment of the workout with either constant power, or a power ramp. If the start and end values are the same, desired power will be constant. Conversely, if these values are different, desired power will either increase or decrease across the segment. There are a few sample workouts in the workouts folder. Note that the sum of the duration values across all blocks must be 1.0, or the workout will be rejected.

Once you've created the workout in this folder, launch PM Trainer and the workout will now show up in the workout selection dialog under Settings:

About

Bike trainer software with ANT+ power and heartrate sensor logging.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages