Thursday, December 1, 2011

Garmin Forerunner 405 and Ubuntu 11.10

Recently I purchased my first Garmin running watch from Amazon.  I decided to go with one from the Forerunner 405 family as I preferred the style, size and features compared to the others I came across.
    

At home I only have Ubuntu machines, but I still want access to all of my running data from the watch.  The older Garmin watches connected over USB to transfer data, but these newer ones use something called ANT+ to communicate with other wireless peripherals and to transfer data to computers.

The watch came with a USB dongle.  Unfortunately, Ubuntu 11.10's kernel doesn't have any drivers that automatically load when plugging it in.  After searching a little bit, I discovered that the usbserial module can be loaded using custom vendor and product ID's.

To do this, you can check lsusb to find the dongle.  Dynastream is the subsidiary of Garmin that owns the proprietary ANT+ technology.

# lsusb | grep Dynastream

Bus 001 Device 015: ID 0fcf:1008 Dynastream Innovations, Inc. 

Now that you have the vendor and product ID, you can manually load the usbserial module. 

# sudo modprobe usbserial vendor=0x0fcf product=0x1008

This will create a new /dev/ttyUSBx device on the system.  I only have one /dev/ttyUSB0, so t he rest of this assumes that's the same for you.  Next I found out that there is actually an app in the archive for fetching this data, it's just very poorly documented.  You can install it from the Ubuntu Software Center or manually install it:

# sudo apt-get install garmin-ant-downloader

Once installed, you have to wake up the watch, and get it in pairing mode.  For me this meant messing around with the bezzle until I could find the pairing menu and enable pairing.  Once pairing is on, it's just a matter of running the app manually once

# garmin-ant-downloader

The watch should say pairing worked properly.  Now go back to the training menu, and reset your run using the quit button so that the timer is back at zero.  This tells the watch that it's ready to send the data that it recorded before.  Put it in date/time mode.  It's OK if it falls asleep, ANT+ works either way.  Rerun the tool and it should place a tcx file for your run in the current working directory.

# garmin-ant-downloader

The tcx file that it spits out is complete, but in it's current form won't upload to http://connect.garmin.com.  Because of an empty name field.  This can be fixed with a simple sed command however.


So for me this is enough to at least get my runs recorded and data somewhere I can manage with Ubuntu 11.10 without too much pain.  On the TODO:
  1. Find a way to automatically load usbserial when this vid/pid shows up.  It doesn't seem to have any modaliases defined, so this might be troublesome and just require a udev rule.  Any suggestions here would be helpful.
  2. Figure out why the Name field isn't populated properly when downloading data

6 comments:

  1. Thanks a lot for writing this. I'm still stuck a little since I'm using fedora and the usbserial module is compiled in (USB_SERIAL=y) to the kernel, but if I have to I'll build a new kernel just to do this.

    ReplyDelete
  2. Thanks for spelling this out. Gant and Gant-master have some documentation but my results were sketchy. I am attempting this with a 310XT. I ran this process, paired, and transfered data but cant locate any output file.

    This thread has info for a udev rule:
    https://forums.garmin.com/showthread.php?t=14598

    ReplyDelete
  3. alon:
    Yeah that does make it a little painful, but you might be able to do it via kernel command line then.
    Instead of loading those options at modprobe time (or modoptions) try on the kernel command line like this:

    usbserial.vendor=0x0fcf usbserial.product=0x1008

    user:
    Did the watch actually say the process was successful at the end? Sometimes it seems like it transferred but it didn't and you have to run it a second time i've found.

    ReplyDelete
    Replies
    1. Mario, thanks for that (also had same issue since Fedora 16), for full on Fedora I updated my howto at http://www.jamesarbrown.com/?p=5

      Delete
  4. thanks for your guide. I'm having some problems though.

    "sudo modprobe usbserial vendor=0x0fcf product=0x1008" doesn't work for me. I'm guessing that's because "lsusb | grep Dynastream" gives me this result:

    "Bus 002 Device 003: ID 0fcf:1008 Dynastream Innovations, Inc."

    My ant is on bua2. What should I do to get it to work?

    ReplyDelete
    Replies
    1. Are you using ubuntu or something else? It's possible that your distro has usbserial built in.

      I actually stopped using garmin-ant-downloader in favor of
      https://github.com/braiden/python-ant-downloader
      which doesn't require the usb-serial module too.

      Delete