A few weeks ago, I picked up a cheap bluetooth heart-rate monitor as a way of inspiring me to do more exercise.

My reasoning was that if I could demonstrate to myself that my resting heart rate was improving and I could map how my heart responded to various forms of exercise, then I would do more exercise to compete with myself.

This has been mildly successful, however, most of the applications that it works with require you to set the type of workout you’re doing and change the action you’re taking everytime you start a new workout.

I also wanted to start tracking my heart rate during my working day to see how my body reacted to varying levels of stress as I worked commuted and generally went about my daily life, however I really struggled to find an app that would do this, so I thought I’d see what I could do myself.

I work in IT and I’m a complete data geek, so I already had a good idea of the kinds of statistics services out there that I might be able to put to good use.  The one that immediately sprang to mind was StatsD as it has loads of support across multiple languages and feeds into the Graphite graphing engine allowing for rapid correlation of data across multiple sources.

I already had a graphite solution running in the form of Dataloop’s monitoring platform for a side project that I run, so I figured that sending the data there would probably be a good place to start.

Looking around, I found the ble library for python (my programming language of choice) and, after making a few changes, I had a library that worked well on both Arch Linux and Ubuntu Linux.

I got to work on writing the code that would take my heart-rate and throw it up to the monitoring provider and then I wore my monitor, started the code on my laptop and waited for the results to come in.  I wasn’t disappointed:

selection_007

As you can see, it works pretty well.

My next steps will be to try and integrate it into a Raspberry Pi Zero along with some Electrodermal Activity sensors to monitor my stress levels whilst I work.

The really great thing is that because this is also my monitoring platform, I can send out alerts when my stress levels reach a given threshold, or even correlate stress levels with a major incident on the website!