Rest of You Week 2: Heart Rate, meet Noise.
SparkFun Polar Heart Rate Monitor Interface

SparkFun Polar Heart Rate Monitor Interface

For Rest of You this week, Dan asked us to collect data from two sensors and send the data to a file. He suggested that one sensor  be facing inward (e.g. galvanic skin response, heart rate, body temperature) and one be facing outward to detect environmental changes (e.g. light, noise, air temperature). I decided to monitor my heart rate while sleeping and combine that with sensing noise in the room. Often, around three in the morning or later, very loud voices float up from the street and through our open window. I rarely wake up, but my fiancé does. I wanted to see if I notice the noise on some level.

I borrowed a Polar Heart Rate Monitor and Heart Rate Monitor Interface (HRMI) from Dan. The monitor and interface couldn’t be easier to use– the HRMI is set up to detect the heart rate monitor right out of the box,  and SparkFun has great documentation on their HRMI, as well as sample software, so I walked through the steps to get set up fairly quickly. I combined the basics of Dan Julio’s hrmi_simple Processing sketch (included in the hrmi_demos.zip file) with the sample createWriter sketch on the Processing site to send my heart rate values to a text file. Once I had the heart rate side of things working, I used Dan Shiffman’s Sound Threshold with Sonia sketch from Learning Processing to figure out how to detect sound levels. I combined the sound sensing code with my heart rate code, and eventually wound up with this sketch.

I set up my laptop and the HRMI next to my bed, put on the heart rate sensor, and went to bed. There were a few times during the night that signal dropped out, so I lost my heart rate reading, but I was able to get some pretty good results. Here’s a snapshot of what the output file looks like:

HRMI Plus Sound Readings

HRMI Plus Sound Readings

The lowest rate I observed for my heart while I was awake was about 64, but while I was sleeping, it dropped down into the low fifties. As you can see in the snapshot above, however, when the noise level increased to .2 instead of the .1 where it seemed to hover most of the night, my heart rate increased back up to the low sixties. There’s no way to know, though, whether I was reacting to noise, or if the noise and increase in heart rate were due to my own shifting around in my sleep.

Here’s a snapshot of another parallel spike in values:

HRMI Plus Sound-- parallel spike in values

HRMI Plus Sound-- parallel spike in values

This spike in values occurred right before I woke up and stopped the program, around 4:30 in the morning, so I wonder if in this case it was a noise that raised my heart rate and woke me.

There are a few improvements I’d like to make to this sketch. First, I’d like to add a time stamp to the output. Secondly, I’d like to graph the values together. I’d also like to find a way to secure the heart rate sensor a little bit better so that it doesn’t shift in my sleep and risk sending false readings.

One Response Subscribe to comments


  1. Sound vs. heart rate while sleeping « Rest Of You

    [...] A few snapshots of excerpts from my data output file are included in a version of this blog post at http://carolineabrown.com/2009/09/rest-of-you-week-2-heart-rate-meet-noise/. [...]

    Sep 28, 2009 @ 2:44 pm

Reply