Web-enabled Polar Heart Rate Monitor




Introduction: Web-enabled Polar Heart Rate Monitor

Use a Polar heart rate sensor, a cheap hardware board connected via USB and a little bit of software to put your heart rate on the Web. The live data is served right from your computer and made accessible via the Yaler relay (disclosure: I'm a founder of Yaler). Once you turn off the local service, the data is no longer public - own your data!

That said, the purpose of this project is of course to share your heart rate. My heart rate URL for example ishttp://tamberg-polar.try.yaler.io/ (Note: you'll get a "504 Gateway Timeout" error or an empty page if my heart is not online.)

What you need:

- T31 coded Polar transmitter (http://www.polar.fi/en/products/accessories/T31_coded_transmitter )
- Polar HRMI board from SparkFun (http://www.sparkfun.com/products/8661 )
- Mini USB cable (e.g. http://www.sparkfun.com/products/598 )
- Windows computer (.NET, not sure Mono works) connected to the Internet

So let's get started...

(Note: This project has been waiting in my Instructables drafts folder since March 2011. The setup was extended using a BlueSmirf Bluetooth module to increase range during the legendary 24 hour Pachube IoT Hackathon in April 2011, but I fear I'll never manage to document that part. So, here's the basic desktop version at least.)

Step 1: Putting on the Sensor

To test the Polar heart rate sensor, you got to put it on. Moisten the contact area (see image) and strap the sensor around your chest.

Step 2: Connecting and Testing the Polar Board

Once you got the sensor around your chest, it's time to test the sensor and the transceiver board. Connect the board to your computer via USB and wait.

If you are close enough to the transceiver (about 80cm max.) a greenish LED on the sensor board starts blinking. That means, your board and sensor both work.

If the LED does not blink, try moistening the sensor contact area and pressing the sensor tightly to your chest for a short moment.

For details on the transciever board and how to talk to it from Windows, see http://danjuliodesigns.com/sparkfun/hrmi_assets/hrmi.pdf

Step 3: Building and Running the PolarService

Now, let's build PolarService.exe:

- Download https://bitbucket.org/tamberg/pachubehack/get/tip.zip
- Unpack the downloaded ZIP and go to \PachubeHack\2011\PolarService
- Download https://bitbucket.org/yaler/yalercontrib/downloads/Yaler.Net.

- Unpack it and move Yaler.Net.dll into the \PolarService folder.
- Then run Build.bat by double clicking it.

As you can see in the source code, PolarService.exe connects to the transceiver board using a serial port and asks for 32 measurements by sending "G32\r", then reads the response values and reformats them to be part of an HTML page that uses the Google Charts API.

In order to become accessible from the Web, PolarService.exe uses the Yaler relay infrastructure. Visit https://yaler.net/ to get a free relay domain. (Or, to host your own relay instance for non-commercial use, see https://bitbucket.org/yaler/yaler)

You also need to know on which COM port the Polar hardware is connected to your computer. On Windows, type WINDOWS-R to open the command prompt, then type devmgmt.msc and press RETURN. Check Ports (COM & LPT) to find the right COM port.

- Right-click PolarService.bat to edit.
- Enter your relay domain, any name and the right COM port.
- Save all changes by closing the text editor.
- Then run PolarService.bat by double clicking it.

The PolarService Web UI is now accessible at a public URL. Check the program output to see your personal heart rate URL. Reload the page to refresh the heart rate graph. (To enable HTML auto refresh, uncomment it in the source code, re-build the exe and restart the service.)

You'll notice the strangely labelled X-axis. Not sure anymore why it's left to right. It was probably quite late when I wrote this code. Anyway, the scale is seconds and the most recent heart rate measurement is at 0.

That's it. Thanks for reading!

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge
    • Edible Art Challenge

      Edible Art Challenge



    4 years ago

    Hi Thomas, thanks for the post. Do you know if there is a way to do this with the newer Polar bluetooth straps? Or another way to post the live heart rate data online through the strap and a mobile device?


    Reply 2 years ago

    I know it's been quite a while since you've asked, but now we made a device that can do exactly this :) You might want to check it: https://igg.me/at/uecg


    Reply 4 years ago

    Hi, if the sensor speaks Bluetooth Low Energy there's a chance it implements the Heart Rate Profile. You can talk to it using any BLE library or right from your browser with Web Bluetooth (newest Chrome only), see e.g. https://github.com/WebBluetoothCG/demos/tree/gh-pages/heart-rate-sensor


    6 years ago on Introduction

    Hey Tamberg, thanks for the cool instruction!

    I have all of the required hard ware except a windows computer. Is there a way to do that on OsX?

    Thanks, Samuel


    Reply 6 years ago on Introduction

    Hi Samuel, you can probably use a terminal and the screen command to talk to the sensor breakout. And the .NET Code might run in Mono (no guarantees, though). Kind regards, Thomas