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  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