Throughout my time as a student at NC State University, I have been involved with undergraduate research. Last semester I was part of a project to collect various biometric sensor data. Our goal was to use this data to measure stress and learn how certain tasks affect participants. My task was to gather metrics from a heart rate monitor.
When dealing with biometric data, the first challenge is often gaining access to the data. Sensors use a variety of file formats and connection methods. Getting the right data isn’t always straightforward.
For our project, we used the Zephyr HxM heart rate monitor. It is a simple device that reports heart rate via bluetooth to a mobile app. The wearer straps the band around their chest, and the device begins reporting their heart rate. We chose this device because it provides accurate data and is fairly inexpensive.
Getting The Right Data
The Zephyr app reports heart rate in beats per second and can log this data to a CSV file. This makes it trivial to gather heart rate at a given time. Most metrics used for heart rate and stress analysis do not use beats/second. Instead, they use the RR interval or RRi. This refers to the time, in milliseconds, between heart beats. The RR interval comes from EKG graphs. It is the time between the R peaks on the graph.
Using the official Zephyr app it was not possible to access RRi data. After reading more about the device, I learned that the Zephyr does detect the time of each heartbeat. It keeps a counter, in milliseconds, of each heart beat. The most recent 15 timestamps are sent with each bluetooth packet. To get access to this data, I would need an app that could interact with the bluetooth stack directly.
At this point, I wanted to see if anyone had done the hard work for me. I looked around Github for other projects interacted with the Zephyr. For those who don’t know, Github is a website that hosts open source software.
I found a project from years ago that did exactly what I needed, an android app called ZephyrLogger. It logged the exact data from the Zephyr to a text file. Unfortunately, the project was no longer maintained. It would no longer work with modern Android devices.
I had some experience with Android apps in the past, so I decided to rework the ZephyrLogger into something we could use. I created a new UI and updated the data format. From the app’s output we could calculate the RRi and related metrics.
The project is still ongoing. There are several potential studies that could end up using heart rate data from the Zephyr. I have released the code for the app, so anyone can use it or adapt it for themselves. It is available on Github here: github.com/ianmcxa/ZephyrLogger
Originally getting heart rate data seemed like a straightforward task. It turned out to be a bit more complex. I ended up getting into several topics. These included bluetooth networking, heart rate variability and several android APIs.