Automatically sync & import Garmin TCX data
Over the last few weeks, I’ve been gradually increasing the supported devices for TRAQS.me. As of today, I’ve successfully integrated FitBit, Withings, GPS data (GPX files), MyZeo, and now Garmin Heartrate monitors (TCX files).
Devices like FitBit make syncing and importing data relatively fast. As soon as the device syncs with the ANT-based station, data is uploaded to the FitBit site and this can be easily extracted. However, for Garmin devices like the FR60 heart-rate monitor, extracting data from the Garmin Training Center product is a manual process. You have to manually launch the app, go to Export, and save your data as a .TCX file.
You can pick and choose each activity to export (tedious), or you can save the entire data (a larger file ~ 15MB of data now) which takes some time to save and process. This is clearly less than ideal. In an effort to have my data INSTANTLY imported and available, I spent some time researching ways to accomplish this. The hacker in me was thrilled when I discovered a linux-based open source project called GarminTools. From the project page:
“This software provides Linux users with the ability to communicate with the Garmin Forerunner 305 via the USB interface. While this is the only Garmin unit that I own, I did implement all of the documented Garmin protocols as of Rev C (May 19, 2006) over the USB physical link. This means that if you have a Garmin with a USB connection to a PC, you ought to be able to use this software to communicate with it.
If you’re looking for a complete solution to all of your Linux Garmin GPS needs, this is not it. I own a Garmin Forerunner 305 and wrote this code specifically so I could download and save data from that particular GPS unit to my Linux machine. I tried gpsbabel, but found that it did not have command line options specific to the Forerunner run and lap data – all I could do was get the tracklog. That’s how all of this got started. I also wanted a few other things, like the ability to convert a track log into a Google maps encoded polyline, and (eventually) the ability to generate PNG images of heart rate and elevation data.”
I’m going to eventually dig deeper into this project, but since my time is more constrained this weekend I opted for a more pragmatic (ok cheap) hack. I discovered that the Garmin Training Center app stores individual TCX files each time you sync under a folder (on Windows 7) like:
I figured a simple approach would be to sync this folder with my server, find any files newer than the last imported Activity/Heartrate data, and process. A simple windows share could have sufficed, but I figured it might be easier just to sync with Dropbox and make the data available from any of my computers. So, here’s the quick n’ dirty recipe:
1) If you don’t already have an account, signup for Dropbox and install clients on your computer running Garmin Training Center, and where you ultimately want to send your .tcx files.
2) After your Dropbox folder is setup and you’ve done a simple test to verify sync works, you’ll want to share this folder. Now, I’m sure there’s an easy way to share folders OUTSIDE of the Dropbox folder, however 1 minute of Googling with no luck made me look for another option. On Windows-based machines you can actually do the equivalent of a Unix symlink using the Junction program from sysinternals. Here’s how to set it up:
- Download and install Junction from the URL (you can copy the junction.exe file to c:\windows\system32)
- Go to the command prompt (cmd), cd to your Dropbox directory, and run:
- c:\windows\system32\junction GarminHistory C:\Users\username\AppData\Roaming\GARMIN\Devices\1110044\History
- Do a directory listing and verify the new GarminHistory folder exists under Dropbox and syncs properly
3) Go to your destination server where Dropbox is installed and presto, you have all of your workout/activity/heartrate data available in .TCX format!