Local processing of Garmin smartwatch data

Tags: fitness, opendata

Do you trust Garmin with your health and fitness data? The GPS and fitness firm suffered a major ramsomware attack in 2020 calling into question their security practices and infrastructure. This blog post posted on Hacker News1 highlights some of the problems with relying on proprietry cloud services to process smartwatch data:

“…if we convince ourselves that technology is magic, we risk becoming hostages to it… The point of open source is not to ritualistically compile our stuff from source. It’s the awareness that technology is not magic: that there is a trail of breadcrumbs any of us could follow to liberate our digital lives in case of a potential hostage situation. Should we so desire, open source empowers us to create and run our own essential tools and services.”

The author of the blog post downloaded data from his Garmin device and processed the GPS tracks using python and open source libraries.

My preliminary attempts are detailed below…

On OpenBSD plugging the watch via its dedicated cable into a USB port causes the device to show up as a mass storage device.

Back to the blog post, the next step set out is to use:

“…an open-source utility called gpsbabel (thank you gpsbabel! I donated!) that can unpack Garmin’s semi-(?)proprietary “.FIT” file format into the interoperable “.GPX” format. From there, I was able to cobble together bits and pieces of XML parsing code and merge it with OpenStreetMaps via the Folium API to create custom maps of my data.”

doas mount /dev/sd2i /home/chris/USB/

Then use a file manager to browse files. It would appear that the tracks of activities are saved under

/home/chris/USB/GARMIN/ACTIVITY/

The filenames are weird but the modification dates appear to show when the activity was undertaken.

GPSbabel is in the OpenBSD ports tree :-)

I needed to install qt5 to provide the necessary core libraries which pulls in LOTS of dependencies.

Manual approach here, just for speed and track example in plot.py:

gpsbabel -t -i garmin_fit -x track,speed -f A7393808.FIT  -o gpx -F
2020-07-23speed.gpx python plot.py -f 2020-07-23speed.gpx

Copy the generated html file to the Downloads folder so it can be accessed in Firefox.

By rooting around in the OpenBSD ports tree it seems much of this can be done in GPXsee, which is in ports. However, it is necessary to convert the Garmin FIT files to gpx first because GPXsee can’t read Garmin FIT files directly.

gpsbabel [options] -i INTYPE -f INFILE [filter] -o OUTTYPE -F OUTFILE

This extracts speed and track info so it can then be opened in GPXsee

gpsbabel -t -i garmin_fit -f A7393808.FIT -o gpx -F 2020-07-23.gpx

This extracts HR data as well:

gpsbabel -t -i garmin_fit -f A7393808.FIT -o gpx,garminextensions -F
2020-07-18.gpx

I converted the files and named them based on the modification date and appended a brief description of the route for reference purposes. All a bit of a faff but it is good to know I can migrate away from the Garmin cloud services if I feel the need.


  1. https://www.bunniestudios.com/blog/?p=5863↩︎