Using python and the great matplotlib library, I have made a little app that measures the hart rate and computes various heart rate variability parameters (such as rMSSD, pNN50, LF, HF). On the hardware side, the pulse sensor connected to an Arduino Uno microcontroller is used. Parts of the code are based on other open source libraries. I am also planning to release the code as open source.
Here is a screenshot of the app:
A few things still need to be worked out. For instance, the heart beat detection (which is made by the Arduino) is not perfect. A few percent of beats are misclassified – depending on the positioning of the pulse sensor.
Update: I have now uploaded the source code. You can find it on GitHub.
Heart Rate Variability (HRV) describes the variation in the time interval between heartbeats and it is often calculated based on RR intervals (i.e. the interval between two successive R-peaks in the ECG wave). HRV is relevant for clinical monitoring of patients, in psychophysiology, as well as in sports.
There are several approaches to measure HRV “at home”, such as:
Apps that connect to heart rate monitors (capable of RR-interval measurement) and calculate HRV from the data.
Record an ECG, analyze the graph to find the positions of the R peaks and compute the HRV descriptors from there.
In the next months, I want to compare these methods. I have already played around with the first method (using the Android apps “Stress Check” and “Heartservice“), but I am quite concerned about the precision of this approach. For the second method an adequate heart rate monitor is needed, which are available from Viiiva, Garmin, Wahoo TICKR, and Polar. It seems like chest straps are needed for precise measurements. Connection to the mobile phone via ANT+ or Bluetooth LE is possible. While Bluetooth LE seems easier, I have set up ANT+ on my Nexus 5 relatively quickly using the “ANT+ enabler” and some of the official ANT+ apps. As I still need to buy a heart rate monitor capable of measuring RR intervals, I have not yet tested any of the apps.
For the third method (recording an ECG), I am planning to use an Arduino microcontroller and the Olimex EKG-EMG shield. An interesting alternative is the E-Health platform by cooking hacks that will work with Arduino, Raspberry Pi and Intel Galileo boards, and can be connected to various other medical sensors.
Update: I found the Pulse Sensor, a lightsuccessful kickstarter project allowing you to measure the heart rate using a light sensor (it basically records a photoplethysmogram). The clip is connected to a microcontroller (such as an Arduino) and can be easily attached to your finger or ear lobe. That makes it one of the easiest methods to get HRV data.
Once the measurements are set up for robust everyday use, I want to study how certain HRV descriptors correlate with workout intensity, recovery, food intake, and so on.
Stay tuned for more.