Use your Keiser M3 bike with apps like Zwift without buying a converter from Keiser which never really worked for me. This project was built to use make use of a Raspberry pi with 2 bluetooth adapters. Other systems may work but your on your own to get it setup. Two bluetooth adapters are required to make this work. I use the built in one on a Raspberry Pi 3/4 or the Pi Zero W and an additional one plugged into the usb port. The steps to install are below.
Any one available from Amazon with linux support should work but I have tried these:
- https://www.amazon.com/gp/product/B0775YF36R/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
- https://www.amazon.com/IOGEAR-Bluetooth-Micro-Adapter-GBU521/dp/B007GFX0PY/ref=sr_1_1?dchild=1&keywords=iogear+bluetooth&qid=1599502460&s=electronics&sr=1-1
- Setup your Pi with Raspbian or Raspbian Lite. https://www.raspberrypi.org/downloads/
- Disable the default bluetooth service. Note that I actually move the file to a backup location to make sure it doesnt come back after a reboot.
sudo systemctl stop bluetooth
sudo systemctl disable bluetooth
sudo mv /usr/lib/bluetoothd bluetoothd.bak
- Install the development requirements
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
- Install NVVM to manager Node.js versions (Make sure to close and reopen your shell after this step)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
- Install the latest binary build of Node.js to support Pis (anything newer and your need to spend a lot time with building it)
nvm install 10.22.0
- Download this repo or clone it locally. I put it in a directory off the home folder for pi called /home/pi/code/keiser
- Go to that directory and run
npm install
- Make sure both bluetooth adapters are connected and issues the following two commands
sudo hciconfig hci0 up
sudo hciconfig hci1 up
- Verify that you see two devices when you run:
hcitool dev
- Start this project manually as root. You should see log messages that indicate its looking for an M3i.
sudo npm start
- Wake up your bike and do a few revolutions of the pedals. You should see log messages indicating that its connected to that bike
- Launch Zwift and connect to the Power meter whose name starts with KeiserM3-. Then connect to the Cadence sensor. Enjoy
Run the following command:
sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
This grants the node
binary cap_net_raw
privileges, so it can start/stop BLE advertising.
Note: The above command requires setcap
to be installed, it can be installed using the following:
- apt:
sudo apt-get install libcap2-bin
- yum:
su -c \'yum install libcap2-bin\'
You can setup the program to run at Pi boot time by doing the following steps:
- Edit the keiser.service file in the root of this project to change the path if you didnt take my suggestion.
- Copy the service definition into the correct location
sudo cp keiser.service /etc/systemd/system
- Enable the service
sudo systemctl enable keiser
- Start the service (Make sure you aren't still manually running the project using npm)
sudo systemctl start keiser
- Verify it started
systemctl status keiser
- Reboot the system and verify that the service started automatically using step 5
Several people have reported issues at system boot with both adapters being recognized. A known work around by @djwasser is described in issue: #2
I leveraged several other great projects to build this. They are: