Marco's Blog

All content personal opinions or work.
en eo

Linux and the Polar F6 Heart Rate Monitor

2008-07-21 5 min read Howto marco

Well, if this is not a telling example of how things are progressing in the world of open source… I recently bought a heart rate monitor, since I realized there was something wrong with the calories burnt displayed on exercise equipment. Never one to leave out a geeky detail, I ran to the closest sports equipment store (in my case Sports Basement) and checked out the latest gear.

My geek heart was pounding for the latest and greatest, of course: the Garmin Forerunner 405 was beckoning, a GPS-enabled masterwork that seemed just made for my nerdy self. It had everything you’d want from an exercise watch, and I had already used the Forerunner 201 to great satisfaction in my cycling days.

After a little deliberation, I decided that I really just needed a heart rate monitor, not a full exercise computer. I wasn’t going to use GPS any time soon, and even if I wanted to, I would have probably used the GPS in my cell phone, the BlackBerry 8830. There is software for that one (BBTracker) that records GPS data, and that’s all you need for real.

I got the F6 home and downloaded everything you can download, including the Polar WebLink software. I played with it a bit and found the method used to download data ingenious: the watch chirps the exercises stored to the computer microphone, and the software then parses the chirps a la modem.

Well, aside from that, everything else didn’t seem to fit me. The software (surprise, surprise) runs only on Windows. I made it install on Wine, but I get GPFs left and right, and it seems quite unusable in general. I could have spent more time making it work, of course, especially seeing how some guy posted a video capture of him/her running the software under Wine on YouTube, but then there was the fact that you had to use the Polar web site to use that data that made me think twice.

So, off I go, trolling through Google search results for “Linux Polar F6.” And instead of finding a bunch of useless results, I found software that works and actually helps.

The first find was a piece of software written years ago by a Swiss guy for a different HRM that uses the same protocol. I tried the software, called rs200_decode, and it didn’t work. I tried a little mor, since it didn’t segfault in evil ways and seemed to genuinely try, and found that I just had to move the watch really close to the mic. Then the software would read the data just fine, giving me a nice progress update that followed the data stream accurately from 0% to 100%.

The data it outputs in human readable format is wrong, which just means that the F6 and the RS200 are not compatible. Enters a different guy, from Switzerland as well, who figured out how to parse the data from the F6. So you tell the rs200_decode tool to dump binary data, and the f6-split-tool reads the data and dumps it into a different format.

Of course, since life is not easy, the data output format for this tool is binary, too. The software for which it is meant is a different beast entirely, a Java application made available as a WebStart package, called PolarViewer.

With all three components together, you can actually read the data from your watch and display it successfully, as well as use the PolarViewer software to graph and analyze. How could I be happier?

Well, I confess I found PolarViewer a little non-intuitive in the sequence at the heart of this. I don’t know whether it’s just because the software was written with a different sport and HRM in mind (cycling on an S7xx), but the sequence of steps necessary to make things work is annoying, so I add it here in some detail. And since you can probably use the whole sequence, I’ll just make it all one go.

Preparation

  1. Download rs200_decode binary from the link above and place it somewhere on your PATH

  2. Download f6-split-tool sources;

    1. untar, and
    2. make in the extracted directory;
    3. place f6-split-tool somewhere on your PATH
  3. Install or run PolarViewer from the link above

  4. Create a new sport type in PolarViewer for your workouts (call it whatever you like, and create as many sport types as you want)

Download Data

  1. Start rs200_decode with the command line:
    			rs200_decode -m -b -o dump.bin   	
    
  2. Put the F6 in download mode
    1. from watch mode, push Ok (the button on the right in the middle)
    2. in Exercise mode, push Up (the button on the right up) until you see File
    3. push Ok, then Up – you should see Send
    4. put the watch close to the microphone
    5. push Ok
  3. The watch should chirp and the software should display a progress indicator that moves from 0% to 100%; when the watch stops chirping, it should reach 100%

Transform Data

  1. The rs200_decode tool created a file called dump.bin
  2. Call f6-split-tool with dump.bin as argument:
    f6-split-tool dump.bin
  3. This should create a series of files in the current directory (maximum 12) named exercise_xx.frd

In PolarViewer

  1. Add event by clicking on the + symbol
  2. Select the sport type in the main tab
  3. In the Optional tab, select one of the exercise_xx.frd files from the browse button
  4. Select “Import HRM”
  5. Save
  6. Repeat steps 1. to 5. until you imported all the data

For the real geek: the steps above can all be automated, and the imported exercises are stored in the .polarviewer directory (under home). By slightly modifying the f6-split-tool, you can make it spit out the necessary XML that can be added to the .polarviewer/exercises.xml file, and you are good to go! You can write a little script that does all the work from start to finish.

And now we just have to figure out why the original PolarViewer creator chose Java…