Skip to content
edabe edited this page Mar 28, 2016 · 2 revisions

Configuring python-ant for RPi

This wiki describes the steps I've followed in order to get my new RPi v3 to work with the python-ant project.

Getting Started

I have followed the post from @johannesbader to get started.

There are many forks of the python-ant project out there, and after some investigation it seems that the fork by SamyCookie is the most active.

However, @SamyCookie has implemented a number of modifications over the original implementation, making all samples fail to work.

On my fork I am currently working on studying @SamyCookie's code to modify all samples accordingly.

The Hardware

  • USB Ant+ stick is from Garmin (USB2)
  • Ant+ heart rate strap from Garmin (old model)

Identifying the USB stick

$ dmesg |tail
[  164.128572] usb 1-1.4: new full-speed USB device number 4 using dwc_otg
[  164.240963] usb 1-1.4: New USB device found, idVendor=0fcf, idProduct=1008
[  164.240974] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  164.240980] usb 1-1.4: Product: ANT USBStick2
[  164.240987] usb 1-1.4: Manufacturer: Dynastream Innovations
[  164.240993] usb 1-1.4: SerialNumber: 214

The idVendor and idProduct match the Movestick mini by Suunto:

  • idVendor: 0fcf
  • idProduct: 1008

Interestingly enough, when listing the devices through lsusb the stick is identified as Dynastream Innovations, Inc. Mini stick Suunto:

$ lsusb
Bus 001 Device 004: ID 0fcf:1008 Dynastream Innovations, Inc. Mini stick Suunto
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Manual driver installation

Following johannesbader's post, we need to create an udev rule for the stick:

  1. Unplug the stick

  2. Create the udev rule

    $ sudo vi /etc/udev/rules.d/garmin-ant2.rules

    And add the following content, all in one line:

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

    Where modprobe is the command executed every time the stick is detected; it will create the /dev/ttyUSB0 node.

  3. Insert the USB stick and check that the /dev/ttyUSB0 has been properly created

    $ ls /dev/ttyUSB0

The Software

This is where I started to get into some trouble as the samples provided were not working properly. My fork of python-ant should now be consistent with my hardware configuration, but there is only one way to find out:

Cloning the python-ant repository from Git

$ git clone [email protected]:edabe/python-ant.git
    Cloning into 'python-ant'...
    Warning: Permanently added the RSA host key for IP address '192.30.252.129' to the list of known hosts.
    Enter passphrase for key '/home/pi/.ssh/id_rsa': 
    remote: Counting objects: 467, done.
    remote: Compressing objects: 100% (17/17), done.
    remote: Total 467 (delta 6), reused 0 (delta 0), pack-reused 447
    Receiving objects: 100% (467/467), 88.86 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (225/225), done.
    Checking connectivity... done.

Install python-ant

  1. Install python-setuptools

    $ sudo apt-get install python-setuptools -y
  2. Make sure the dev branch is active

    $ cd python-ant
    $ git branch
        * dev
  3. Install python-ant

    $ sudo python setup.py install

    For the records, I have recorded the result of the command above: Result-of-python-install

References

The following resources have been very helpful to me - thank you all for making them available