Uncategorized

Heart Rate Variability tracking with Sleep As Android

Working hard? Sporting actively? Being dragged into destructive habits? Not getting enough rest? Get a new level of insight into your bodily processes and the quality of your sleep. We proudly announce a new feature in Sleep as Android, monitoring heart rate variability via a wide range of wearable devices. Read on to learn more.

What is Heart Rate Variability?

It is no surprise that heart rate keeps changing all the time. It may rise to 180 bpm during intense exercise and fall as low as 40 bpm during deep sleep. 

A less known fact is that heart rate keeps fluctuating on a short time scale. Even if one is lying still, relaxed, the oxygen need of the body is stable, and there is no apparent reason for such variations.

The following picture demonstrates such fluctuation during 5 minutes, recorded on my own heart. The line represents gaps between individual heartbeats (so-called R-R intervals) in milliseconds. The average heart rate was 55 bpm, but the values were jumping between 45 and 65 on a short time scale – quite a wide range.

This phenomenon, called heart rate variability, or HRV, was discovered decades ago and has been intensely studied ever since. The current need for oxygen is not the only factor that controls the function of the heart. Today, we know of dozens of other factors, such as blood pressure, breath frequency, digestion, stress level, or medication, that contribute to the control of heartbeat. 

Even if the body is seemingly still, relaxed, and doing nothing, all these factors keep fluctuating, and the heart responds accordingly by random fluctuations of its beat. A healthy heart is not a metronome, and a certain level of variability is a normal function. Medical research has shown that too low variability may indicate various diseases, chronic stress, sleep deprivation, and much more.

There are countless resources on the Internet where you can learn more about this phenomenon and its health implications. Start with a popular introductory article, dive into an extensive scientific treatise, or simply try your luck with Google.

New: HRV tracking in Sleep As Android

Our app, Sleep as Android, integrates with a range of wearable devices that record individual R-R intervals. With these devices, you can now monitor HRV during your sleep and get a new level of insight into your physiological processes and the miraculous power of sleep. Here is how it works.

1. Get a supported device

  • Polar H7, H10, OH1, or Verity Sense. Recommended, tested.
  • A pulse oximeter from Happy Electronics. Recommended, tested.
  • Any device that implements the BLE Heart Rate Profile. It’s an open standard supported by various fitness trackers or health monitors. If you happen to have such a device at home, you can try to connect it with our app, and hopefully, it will work.

2. Connect it to the app, according to the documentation

3. Sleep with the device

Track your sleep, wearing the device. New information, showing your HRV analyses, appears in the sleep details chart, as well as long term statistics charts, as described in the following sections.

Short-term HRV chart

Apart from the heart rate (red line), the sleep record detail chart is now showing a violet line, depicting HRV development throughout the night. Each point on the violet line represents HRV (SDNN, in particular) for a 5-minute interval. 

The screenshot displays a typical night of mine. The first thing to notice is that the HRV curve closely corresponds to the amount of physical activity. It gets much higher in the light sleep phase, partly due to the simple fact of the body turning and tossing more intensely, partly due to internal processes related to the REM phase.

The parts that we should focus on instead are the lower values during the deep sleep phases when the body is completely still. The values then represent the natural variability of a free-running heart. These valleys are typically lower when one goes to bed very tired (a tough day at work, heavy exercise), and they get higher during the night as the body and the mind get refreshed. In the picture above, it grew gradually from 17 at the beginning of the night to more than 40 in the valleys at the end.

The actual values vary heavily among different people. We cannot generally pinpoint a “good” or “bad” number. However, they make sense in a longer-term individual context. You will surely notice these developments, having followed your HRV measurements for some time.

A Drunken Marathoner’s Chart

Compare the previous screenshot with this one.

Solely for the sake of education and enlightenment of myself and the readers, I underwent a dangerous experiment of drinking more than just a couple of beers.

The effects are obvious. The heart is boosted by the alcohol, it beats much faster than normal, and the variability gets close to zero. The values get better throughout the night, but they never return to my normal resting values.

Even though the drinker may seem to be sleeping happily, the actual nature of the underlying physiological processes is very different from normal healthy sleep.

I also get very similar readings after an unusually heavy exercise, such as running a marathon. The body is completely exhausted by the unaccustomed performance, and even a whole night of good sleep is not enough to fully recover.

Some professional coaches are using this kind of HRV analysis to monitor the training progress of athletes and to adjust their training load.

Resting HRV Before Awake

From the short-term HRV charts demonstrated above, we extract a single number that should correspond to the overall quality of your rest. We take one of the lower readings at the end of the night (technically, the 10th percentile from the last two hours) and call it HRV Before Awake. Analogously, we compute the same statistic for the first 2 hours (HRV after onset). Sleep record detail displays the two values at the bottom:

When you go to bed after a hard day and have a night of good quality sleep, the “After” value tends to be way higher than the “Before”. However, if you are not that tired in the evening, the value may remain roughly the same.

There are new items on the Charts/Trend screen. “HRV before awake” shows, well, the long term development of the HRV before awake.

“(+) HRV before awake” combines both values (after onset, before awake) in a single chart. Each night is represented by a bar, showing the two data points. If HRV increased during the night, the bar is violet, otherwise red.

This is a proprietary method that we invented to accommodate the fact that we measure the heart activity only during sleep and we need to find the representative values in a bunch of noise.

There is another approach, used by some health/fitness apps: The measurement is taken every morning just after wake-up, recording the heart for several minutes, before getting off the bed and starting usual daily activities.

Most people find this procedure too demanding. Some simply do not have the extra few minutes in the morning, others fall asleep again during the measurement.

If you are among those who are willing to adopt this regular routine, you may want to try an app specialized in this task, StressLocator by Happy Electronics. It may provide more detailed insights, as the measurements are taken under controlled conditions and permit different methods of analysis.

Total HRV for a night

Another statistic shown in the app is SDANN, which is a single number that nicely summarizes the total amount of heart rate variability throughout the entire night, including all the local minima and maxima.

Again, the values tend to vary heavily across the population, and it is difficult to pinpoint concrete “good” or “bad” readings. Some papers suggested normative values based on large-scale clinical studies. However, it makes more sense to watch the statistic in the individual context, and a decreasing trend may indicate an unfavorable condition like chronic stress and lack of proper sleep.

SDANN for a particular night is displayed in the sleep record detail,

and the long term trend can be monitored in Charts/Trend/HRV.

Try it out

All these features will be available in the next release of Sleep As Android. We are rolling them out in beta as of now, and a stable release will follow, hopefully in a few weeks.

 

31 thoughts on “Heart Rate Variability tracking with Sleep As Android

  1. Great news! I hoped the last two years, that you will once offer hrv…

    What your readers should know about OH1: it tracks also the movements during sleep.

    So I ordered an OH1 yesterday.

  2. I was able to track hrv with my Mio Fuse, which was pleasantly surprising. My Mio Slice only reported HR, which is disappointing. What do we need to look for to determine if a wearable hrm supports hrv?

  3. Hello Michael,

    In the first place, the device needs to support so called Heart Rate Profile (https://learn.adafruit.com/circuitpython-ble-heart-rate-monitor-gizmo/heart-rate-service), which is an open protocol for transferring heart rate measurements over Bluetooth. Both Mio Fuse and Mio Slice seem to support it as you would not have seen HR otherwise.

    There is an optional item in this protocol, called RR Intervals, which are time intervals between every consecutive pair of heartbeats. We need this data to calculate HRV. Apparently, some devices do not provide this data.

    It may be difficult to find this information in advance. Technical specifications provided by the vendors often do not go into this level of detail. One can try to contact their technical support, or search Internet fora.

    Best Regards

    Jan

  4. Hello Joe,

    Yes, we are planning to integrate HRV on Garmin too.
    Although I can not promise any concrete schedule at this moment.

    Best Regards

    Jan

  5. Hi – the final graph of my sleep session is not displaying HRV data despite being paired with my polar h10 and showing the collected heart rate data. Any idea how to correct this? Thanks. Tom.

  6. Hello Tom,

    Please, send us a bug report from the app: the top-left-corner menu -> Report a bug.

    It attaches diagnostic information that helps us to tell what is going on.

    Thank you

    Jan

  7. In the line:
    > When you go to bed after a hard day and have a night of good quality sleep, the former tends to be way higher than the latter. However, if you are not that tired in the evening, the value may remain roughly the same.

    Is “the former tends to be way higher than the latter” a typo? Shouldn’t it be the latter tends to be way higher than the former (e.g. end of sleep number is higher than sleep onset number)?

  8. Thank you Tort, you are right, the wording is unfortunate. It is ambiguous. The former/latter refers to the fact that “HRV before awake” is mentioned before “HRV after onset” in the previous paragraph. I will fix it.

  9. This was working on my Garmin Vivoactive 4 starting on 3/11/21 (woke up to find the new line in my chart and the extra data at the bottom.). Worked every night for 6 nights and then stopped and has not come back. Was this a trial release that has since been removed in an update?

    Coincidentally, I now have to force stop the new watch app every morning. Stop Tracking never ends the session or app.

  10. Hello Barry, I am sorry for your troubles with the app. HRV functionality is still there. I can not tell what went wrong based on your comment. Please send us a bug report from the app – menu -> Report a bug. It will attach detailed diagnostic information that will allow us to analyze the issue. Thank you, Jan

  11. Samsung seems to provide RR intervals via their API. We have done some experiments, but encountered some technical difficulties. Hopefully we will provide the integration one day, but I can not promise anything at this point.

  12. Jan thank you for the clarification. I actually got an OH1 and returned it because it doesn’t, like you said, through the standard profile and got a rhythm 24 instead. Rhythm 24 actually needs to be set to hrv mode after every power on, so I’ll go back to Polar again now that I know it works with SAA.

    Couple of questions:
    In sleep info I see the hrv chart but not the hrv before wake numbers like in the screenshot. Has this been removed?

    In the trend graph for hrv gain, what do the + and – graphs signify exactly? The legend is confusing.

  13. Hello Mark,

    Great, I hope it will work to your satisfaction.

    As for your questions:

    There have been some major changes in the user interface, and specifically to the charts and statistics UI. And it is not finished yet, I believe there will be some more changes in the next few weeks. I am not sure how it will look like in the end, we will update the screenshots and the description once it is finalized. You are right, in the latest version right now, there is no Before -> After summery at the bottom. There is a HRV “bubble” at the top of the chart, which displays total HRV for the night (SDANN), and HRV gain, which is After minus Before.

    In the HRV Gain trend, each bar represents one night. One end of the bar is “HRV Before”, the other is “HRV After”. The bar is green if After > Before, red if After < Before. It's a bit like a candle chart of a stock price.

  14. OK that makes sense. Another reason why I was confused is the dates don’t line up correctly. When looking at the week view, everything is shifted ~1.5 days to the left on my phone.

    Could you add HRV to sleep score customization? I also measure HRV after wake, and so far SDANN/HRV tracks perfectly with it, which is why I’d like to see it next to all the other sleep info.

  15. Shifted charts: I have not seen this before, it does not happen on our dev phones. Please, can you send a screenshot with a short description to urbandroid.info@gmail.com? Thanks

    HRV in sleep score customization: thank you for the feedback, I will discus it with my colleagues.

  16. Hi
    Thanks for a very nice sleep app.
    I am looking into HRV data in particular since this app is the only one I have seen that uses Polar OH1.
    I am curious on how the short and long term HRV is derived. In the last post it saiys total HRV is SDANN. Does that mean that short term is SDNN? Is there a natural logarithm involved as well?
    Any chance to get access to all short term HRV data points or just have a readout of them in the graph?

    Thanks

    Henrik

  17. Hello Henrik,

    Yes, the short-term HRV is SDNN for 5 minute intervals, the long-term is SDANN for the entire night.

    You can export your sleep records into CSV file and extract the SDNN data from there.
    Export: Main menu -> Backup -> Export Data
    The file will be stored to your phone to /sleep-data/sleep-export.csv
    The format is partly described here: https://docs.sleep.urbandroid.org/devs/csv.html
    You need to extract all fields that look like “SDNN-1617751903386-78.963036”. The first number is timestamp in millis, the second is the SDNN value.

    Best Regards

    Jan

  18. Hi again,
    Export is so cool, thanks 🙂
    Is it SNANN or SDNN that is exported?

    Unfortunately I see only these fields at the end (that is no SDNN field)?:

    DHA-1627731395996-2.3541111E-36
    LUX-1627731400881-134.0
    LUX-1627731520928-237.0
    LUX-1627731659256-198.0
    DEVICE-1627731668170
    TRACKING_STOPPED_BY_USER-1627731668171

    Regards

    Henrik

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.