All Projects → ptx2 → Gymnasticon

ptx2 / Gymnasticon

Licence: mit
Make obsolete and/or proprietary exercise bikes work with popular cycling training apps like Zwift, TrainerRoad, Rouvy and more.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gymnasticon

Reverse Engineering Bluetooth Protocols
Intercepting Bluetooth device communication and simulating packet responses of an iPhone from a Raspberry Pi 3
Stars: ✭ 105 (-32.26%)
Mutual labels:  raspberry-pi, bluetooth, reverse-engineering
Openhaystack
Build your own 'AirTags' 🏷 today! Framework for tracking personal Bluetooth devices via Apple's massive Find My network.
Stars: ✭ 794 (+412.26%)
Mutual labels:  bluetooth, reverse-engineering
Galaxybudsclient
Unofficial Galaxy Buds Client for Windows
Stars: ✭ 733 (+372.9%)
Mutual labels:  bluetooth, reverse-engineering
Bthidhub
Bluetooth HID hub
Stars: ✭ 65 (-58.06%)
Mutual labels:  raspberry-pi, bluetooth
Super Simple Raspberry Pi Audio Receiver Install
Super Easy installation to make your Raspberry Pi an Audio Receiver
Stars: ✭ 448 (+189.03%)
Mutual labels:  raspberry-pi, bluetooth
Rpi Audio Receiver
Raspberry Pi Audio Receiver with Bluetooth A2DP, AirPlay, UPnP and Spotify Connect
Stars: ✭ 650 (+319.35%)
Mutual labels:  raspberry-pi, bluetooth
Qdomyos Zwift
Zwift bridge for smart treadmills and bike/cyclette
Stars: ✭ 63 (-59.35%)
Mutual labels:  raspberry-pi, bluetooth
Multi Room Audio Centralized Audio For Home
🎵 This Github Repository provides details on setting up a centralized audio system for your home using nothing but Raspberry Pi's and Old Speakers.
Stars: ✭ 189 (+21.94%)
Mutual labels:  raspberry-pi, bluetooth
Arduino Robust Serial
A simple and robust serial communication protocol. It was designed for Arduino but can be used for other purposes (e.g. bluetooth, sockets). Implementation in C Arduino, C++, Python and Rust.
Stars: ✭ 83 (-46.45%)
Mutual labels:  raspberry-pi, bluetooth
Pirogue
PiRogue is a small device meant to ease network interception and analysis.
Stars: ✭ 90 (-41.94%)
Mutual labels:  raspberry-pi, reverse-engineering
Balena Sound
Build a single or multi-room streamer for an existing audio device using a Raspberry Pi! Supports Bluetooth, Airplay and Spotify Connect
Stars: ✭ 1,306 (+742.58%)
Mutual labels:  raspberry-pi, bluetooth
Blynk Library
Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc.
Stars: ✭ 3,305 (+2032.26%)
Mutual labels:  raspberry-pi, bluetooth
SmartSpin2k
Transform your spin bike into a Smart Trainer!
Stars: ✭ 88 (-43.23%)
Mutual labels:  bluetooth, fitness
Joycontrol
Emulate Nintendo Switch Controllers over Bluetooth
Stars: ✭ 667 (+330.32%)
Mutual labels:  raspberry-pi, bluetooth
Platypush
A versatile and extensible platform for home and life automation with hundreds of supported integrations
Stars: ✭ 192 (+23.87%)
Mutual labels:  raspberry-pi, bluetooth
Phony
Easy to use bluetooth hands free telephony, with python
Stars: ✭ 57 (-63.23%)
Mutual labels:  raspberry-pi, bluetooth
Johnny Five
JavaScript Robotics and IoT programming framework, developed at Bocoup.
Stars: ✭ 12,498 (+7963.23%)
Mutual labels:  raspberry-pi, bluetooth
Ha Bt Proximity
Distributed Bluetooth Room Presence Sensor for Home Assistant
Stars: ✭ 77 (-50.32%)
Mutual labels:  raspberry-pi, bluetooth
Magicblue
💡 Unofficial Python API to control Magic Blue bulbs over Bluetooth
Stars: ✭ 92 (-40.65%)
Mutual labels:  raspberry-pi, bluetooth
Sonyheadphonesclient
A {Windows, macOS, Linux} client recreating the functionality of the Sony Headphones app
Stars: ✭ 123 (-20.65%)
Mutual labels:  bluetooth, reverse-engineering

Gymnasticon

Gymnasticon enables obsolete and/or proprietary exercise bikes to work with Zwift and other training apps. Support for new bikes can be added easily. The diagram below shows an example of how it works with the Flywheel Home Bike.

Bikes tested

  • Flywheel
  • Peloton Bike (requires an additional cable)
  • Schwinn IC4/IC8 aka Bowflex C6
  • Keiser M Series Bikes (M3i, M3i-TBT, M3iX)
  • LifeFitness IC5 (probably works)

Apps and devices tested

Any software, bike computer or watch that supports standard Bluetooth LE and ANT+ power meter and cadence sensors should work, including:

  • Zwift
  • TrainerRoad
  • Rouvy
  • RGT
  • FulGaz
  • mPaceline
  • Peloton iOS/Android (BLE CSC cadence only)
  • Garmin Fenix (requires ANT+ stick)
  • Garmin Edge
  • Wahoo Elemnt Bolt (requires ANT+ stick)

Platforms tested

Raspberry Pi Zero W is recommended for best user experience. Any recent Linux or macOS system should be able to run Gymnasticon.

  • Raspbian Buster on Raspberry Pi Zero W
  • Raspbian Buster on Raspberry Pi 4
  • Raspbian Buster on Raspberry Pi 3B+
  • macOS 10.14+
  • Debian Buster on x86-64

Note: If using a Bluetooth LE bike (e.g. Flywheel) a Bluetooth LE 4.1+ adapter with multi-role capability is required. All Raspberry Pi devices listed above have this capability but not every BT 4.1+ adapter is guaranteed to have it. Alternatively, two BT 4.0+ adapters can also work: one for the client (to connect to the bike) and one for the server (to receive connections from Zwift or another app).

Quick Start: Install Gymnasticon SD card image

This is the easiest way to get up and running on a Raspberry Pi.

Prerequisites:

  1. A Raspberry Pi Zero W or Raspberry Pi 4
  2. A compatible micro-SD card (4 GB+)
  3. Access to a computer with an SD card slot
  4. A program to write SD card images like Raspberry Pi Imager or dd(1)

Steps:

  1. Download the latest Gymnasticon SD card image
  2. Write the image to the SD card using Raspberry Pi Imager or dd
  3. Optionally add a config file to the SD card (not necessary for Flywheel or Peloton, see below)
  4. Insert the SD card in the Raspberry Pi, power it up and wait 2-3 minutes
  5. Start pedaling and Gymnasticon should appear in the Zwift device list

Config file:

If using a bike other than Flywheel or Peloton - create and adapt a gymnasticon.json file within the main folder of the SD card. It should end up in the same folder as bootcode.bin, cmdline.txt, config.txt, etc.

The following example configures Gymnasticon to look for a Schwinn IC4 bike and to reduce its power measurement values by 8%:

{
  "bike": "ic4",
  "power-scale": 0.92
}

The following example configures Gymnasticon to look for a Keiser M series bike:

{
  "bike": "keiser"
}

See below for additional configuration options.

Gymnasticon SD card read-only mode

During first boot Gymnasticon enables the Overlay Filesystem for the root filesystem ("/") and mounts "/boot" as read-only. This reduces the risk of fatal filesystem corruption as result of e.g. power failures, but also extends the lifetime of the SD card by minimizing wear.

A clean shutdown of Gymnasticon is therefore not necessary. Just keep your Raspberry Pi plugged in and running.

It is still possible to setup networking and remote access so you can check logs, or participate in development work. But this mode is neither necessary, nor recommended for typical users.

Note: This modified Pi OS image will behave equivalent to stock Pi OS images with regards to the wpa_supplicant.conf and ssh files only during first boot. This means that the Wifi and SSH settings become part of the underlay filesystem and persist across subsequent reboots. Placing a wpa_supplicant.conf or ssh file onto the boot partition after the first boot will result in settings NOT being persisted across reboots. Also note that in this case the wpa_supplicant.conf and ssh files are removed and not available during another reboot.

You can change the root filesystem between read-only and read-write mode, but also show the current mode using the command overctl.

Troubleshooting

Flywheel bike

Peloton bike (with passive wiring)

  • Note that stats are only broadcast during a class or Just Ride session

Manual install

Try the Quick Start first. Otherwise read on for how to install Gymnasticon and its dependencies manually.

Dependencies:

  • Node.JS 12.16.1+

    • armv6l binaries (Raspberry Pi)
    • x64 binaries
  • On Linux (including Raspberry Pi)

    • sudo apt-get install libudev-dev (required by node-bluetooth-hci-socket)

Note: Your user must have permission to access the Bluetooth adapter and advertise services.

Install:

npm install -g gymnasticon
gymnasticon

To run as an unprivileged user:

# this gives cap_net_raw+eip to all node programs not just gymnasticon
sudo setcap cap_net_raw+eip $(eval readlink -f $(which node))

To run at boot time, restart on exit and to avoid giving cap_net_raw+eip to the node binary it is recommended to run under systemd. See the deploy/gymnasticon.service from this repository for an example systemd unit file.

sudo cp gymnasticon.service /etc/systemd/system
sudo systemctl enable gymnasticon
sudo systemctl start gymnasticon

To view the output of Gymnasticon running under systemd:

journalctl -u gymnasticon -f

CLI options

Note: The CLI options below can also be used in the config file. --bike ic4 on the command-line is the same as {"bike":"ic4"} in the config file.

$ gymnasticon --help
   __o
 _ \<_
(_)/(_)

Gymnasticon
v1.4.0

usage: gymnasticon [OPTIONS]

Options:
  --config                <filename> load options from json file        [string]
  --bike                  <type>
               [string] [choices: "flywheel", "peloton", "ic4", "keiser", "bot",
                                           "autodetect"] [default: "autodetect"]
  --bike-connect-timeout  <seconds>                        [number] [default: 0]
  --bike-receive-timeout  <seconds>                        [number] [default: 4]
  --bike-adapter          <name> for bike connection           [default: "hci0"]
  --flywheel-address      <macaddr>
  --flywheel-name         <name>
  --peloton-path          <path> usb serial device path
                                              [string] [default: "/dev/ttyUSB0"]
  --bot-power             <watts> initial bot power                     [number]
  --bot-cadence           <rpm> initial bot cadence                     [number]
  --bot-host              <host> for power/cadence control over udp     [string]
  --bot-port              <port> for power/cadence control over udp     [number]
  --server-adapter        <name> for app connection            [default: "hci0"]
  --server-name           <name> used for Bluetooth advertisement
                                                        [default: "Gymnasticon"]
  --server-ping-interval  <seconds> ping app when user not pedaling
                                                           [number] [default: 1]
  --ant-device-id         <id> ANT+ device id for bike power broadcast
                                                       [number] [default: 11234]
  --power-scale           <value> scale watts by this multiplier
                                                           [number] [default: 1]
  --power-offset          <value> add this value to watts  [number] [default: 0]
  --version               Show version number                          [boolean]
  -h, --help              Show help                                    [boolean]

Contributing

git clone https://github.com/ptx2/gymnasticon.git
cd gymnasticon
npm run build
npm link
gymnasticon --help

HOWTO: Add support for a bike

It should be trivial to add support for other proprietary bikes, so long as there is a means of getting realtime-ish cadence/power data from them.

  1. Implement a bikeclient in src/bikes
  2. Add cli options to src/app/cli-options
  3. Add function to instantiate the bikeclient with the cli options to src/bikes/index.js

License

MIT

More info

Read the development notes here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].