HXM-T: display heart rate from Zephyr’s HXM

Zephyr HXM is heart rate monitor that transmits data over Bluetooth and is ordinarily used with fitness applications running on smartphones.

Here’s idea, during indoor cycling workouts, it would be cool to see my heart rate on big PC screen instead of the phone’s small one. Since data is transmitted over Bluetooth, and the protocol is not that difficult to decode, I was able to get something running in few evenings.

The interesting part here was the bizarre mix of technology: BT data is read by Python script, the UI is GTK window with WebKit view inside. The WebKit widget displays SVG graphic, which is animated by Javascript embedded in it…

Code’s on bitbucket. Right now, it’s just a hack, no proper error handling, missing several useful features like logging HR to file, or showing battery level in separate gauge.

===========================================
HXM-T: display heart rate from Zephyr's HXM
===========================================

HXM-T reads heart rate from Zephyr's HXM over Bluetooth
and either prints it to console or displays it in a
SVG graphic that looks like car's speedometer.

Tested on Ubuntu 9.10 and Ubuntu 10.10

Requirements:

 * Zephyr HXM BT heart rate monitor
 * PC with Bluetooth
 * Python along with some libraries:
   * python-bluez
   * python-gtk2
   * python-webkit
   
To print HR to console, put on the chest strap and run:   

    python hxm.py
    
To display HR in GTK/WebKit/SVG, run:

    python ui.py
   
HXM BT message decoding logic adapted from HXM Tracker by Jari Multisilta,

http://www.my-maemo.com/software/applications.php?name=HXM_Tracker&faq=38&fldAuto=1293

About these ads

8 Responses to “HXM-T: display heart rate from Zephyr’s HXM”


  1. 1 Juris Zeltiņš (@ViltusVilks) January 24, 2012 at 6:06 pm

    Kur ņēmi HXM atkodēšanu!? Ir apraksts vai ne-py valodā? :)

  2. 3 freeman March 25, 2012 at 10:10 pm

    Nice project, thanks for the code!

  3. 4 Avi June 20, 2012 at 1:26 am

    Thank you so much for the code. Is there a way you can include R-R interval measurement in this code. Thanks!

  4. 5 Avi June 20, 2012 at 3:39 pm

    The code also works on Windows 7. You will have to install pybluez (bluetooth) and pygtk. I tested it on python 2.6 32 bit version on windows 7 and the corresponding pybluez. It gave problems on 64 bit version of python. If pygtk is giving problem then you can just comment out the gtk import statement (import gtk) in the script and the code( which displays the HR value on console) still works.

  5. 6 thebirdieflies July 15, 2012 at 11:13 am

    Hi. I wanted to adapt the dial display code, but I’m new to coding and I’ve never dealt with Javascript or SVG. What I essentially want is to feed a value of my own, and have the needle point to that in the dial. Can you tell me how to do that?

    This is what I’ve understood so far:
    I can change the initial position of the needle in the SVG file code.
    ‘hr’ in hxm.py & ui.py refer to the heart beat rate. I’ve commented out the hxm part, and tried to put in my own values of hr. That doesn’t do anything. The dial shows the needle at the initial position as set by me, then falls down to 0.

    Please help!

  6. 7 Pete February 11, 2013 at 5:13 pm

    I’m getting the following error when I run python ui.py
    Any ideas? Thx pete

    pete@ubuntu-hp-laptop:~/Desktop/hxm-t$ python ui.py
    Traceback (most recent call last):
    File “ui.py”, line 7, in
    import hxm
    ImportError: No module named hxm

  7. 8 Gps Locator November 21, 2013 at 12:24 am

    Good response in return of this difficulty with real
    arguments and explaining everything on the topic of that.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.

%d bloggers like this: