Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional ANT+ Bike Power output. #36

Merged
merged 3 commits into from
Jan 31, 2021
Merged

Add optional ANT+ Bike Power output. #36

merged 3 commits into from
Jan 31, 2021

Conversation

ptx2
Copy link
Owner

@ptx2 ptx2 commented Jan 31, 2021

No description provided.

@ptx2
Copy link
Owner Author

ptx2 commented Jan 31, 2021

Tested on macOS Catalina and Debian Buster (Raspberry Pi) with a Wahoo Elemnt Bolt as the receiver and an Anself ANT+ GarminStick2 (USB 0fcf:1008).

To test this on Linux, the gymnasticon user needs permission to open the ANT+ USB device (the below actually allows any user to open it):

cat <<EOF |sudo tee /etc/udev/rules.d/51-garmin-usb.rules
# Garmin ANT+ - USB1
ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1004", MODE="0666"
# Garmin ANT+ - USB2
ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1008", MODE="0666"
# hLine USB2 ANT2
ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1009", MODE="0666"
EOF
sudo udevadm control --reload-rules
sudo udevadm trigger

To pair, wake the bike (on Flywheel turn the crank; on Peloton enter a class or Just Ride), then add the sensor to your watch/bikecomputer as usual.

@chriselsen
Copy link
Contributor

chriselsen commented Jan 31, 2021

Can confirm that this works with Garmin Fenix 5+ and Samsung Tab S6 as receiver. Thanks for the quick turnaround!

Here is what I did to get it working in case someone else wants to try:

  • Start with Gymnasticon Raspberry Pi SD image
  • Install "git": sudo apt-get install git
  • Clone "ant-server" branch: git clone --single-branch --branch ant-server https://github.com/ptx2/gymnasticon.git
  • Enter folder: cd gymnasticon
  • Build and link new version: npm link && npm run-script build
  • Restart the gymnasticon service: sudo service gymnasticon restart
    (I'm using a modified gymnasticon service, which runs as bot right now).

@ptx2 ptx2 merged commit d72804f into master Jan 31, 2021
@ptx2 ptx2 deleted the ant-server branch January 31, 2021 23:17
@chriselsen
Copy link
Contributor

Looks like the content of /etc/udev/rules.d/51-garmin-usb.rules needs to be changed to e.g.:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0fcf", ATTRS{idProduct}=="1008", RUN+="/sbin/modprobe usbserial vendor=0x0fcf product=0x1008", MODE="0666", OWNER="pi", GROUP="root"

@GMac22
Copy link

GMac22 commented Feb 2, 2021

Ant+ Worked here with Peloton > Pi4(gymnasticon v1.2) > Garmin Forerunner 935. Able to receive power and cadence now. Thanks so much.

ANT permissions used from the post above #36 (comment)

@ptx2
Copy link
Owner Author

ptx2 commented Feb 3, 2021

@chriselsen Interesting! The 1.2.0 SD card image released today (based on Raspbian Buster) includes the 51-garmin-usb.rules from above and seems to work ok here. Do you have any more details? e.g. error msgs, logs, steps to reproduce, OS (if you're not using the SD card), hotplugging, any other USB devices plugged in, etc.?

@chriselsen
Copy link
Contributor

Let me build a new 1.2.0 SD image and try again. Maybe I didn't wait long enough for the interface to come up. Also there is a collision with the Peleton bike expected on ttyUSB0 and the ANT+ stick being on the same device. I wonder if this causes an issue.

@ptx2
Copy link
Owner Author

ptx2 commented Feb 3, 2021

Gotcha. I think it's the RUN+="/sbin/modprobe usbserial vendor=0x0fcf product=0x1008" causing the /dev/ttyUSB* device node to be created for the ANT+ stick?

With the rules file on the SD card (same as one up top here), it shouldn't create a /dev/ttyUSB* node for the ANT+ stick but Gymnasticon should still find and open the ANT+ stick directly by its vendor/product ID using libusb. (This was actually intended to avoid it stealing the default Peloton device path.)

At least, that's what it does for my ANT+ stick :-)

@chriselsen
Copy link
Contributor

Ahh, that makes sense. I was looking for the /dev/ttyUSB* to exist. But you're right, with your rules content it doesn't do that, yet gymnasticon can still transmit over it. All working as expected with your rules content now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants