Skip to content

Basic working example of how to read heart rate and R-R interval data over Bluetooth Low Energy using Noble

Notifications You must be signed in to change notification settings

watsonix/node-ble-hr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Receive heart rate and RRI via BLE HR using Node

This simple example uses Noble-mac (or with simple documented modification Noble) to listen to heart rate and beat-to-beat interval (aka RRI or IBI) data transimitted from any device which speaks the Bluetooth Heart Rate Service protocol. A list of such devices currently includes:

  • Polar H10
  • Polar H7
  • Wahoo TICKR(X)
  • Zephyr HxM (BT4.0 version only)
  • 4iiii Viiiiva

and several others (see Notes below)

Overview

index.js is pretty short and thoroughly commented. The code is very basic: it just finds the first bluetooth peripheral transmitting the bluetooth heart rate service and listens for and parses out the measurement data.

How to use this

  • Install node
  • Clone this repo
  • In the root directory, run npm install to install noble
  • Put on device and run node index.js
  • After a few seconds, you should see RRI data printed to the terminal

Notes

I searched for a good Python-based solution (in late 2018) and found nothing suitable. This was the best option available and plays nice with Python via the subprocess module and pipe of stdout. (see here for some example code).

Based on node-h7-hr, which pulls HR only and uses the original noble, now dysfunctional on macOS. Took some time to figure out how the bytes were laid out for RRI, but I've documented it.

After upgrading macOS and Node versions, I had trouble getting things to work anymore. However in the end there was a relatively simple solution, using the noble-mac package instead of noble, which is more stable on macOS between versions. Those without macOS can make the simple documented changes in index.js and package.json to use noble instead.

If you have trouble with Node versions, unfortunately, this can be a wormwhole. However, I can recommend the node-reinstall package for both re-installing and installing first time. Also: run commands without sudo.

I have tested with the H7 and the Tickr. This should function with other Bluetooth heart rate sensors that broadcast the Heart Rate (180d) service. This does not include Fitbit or Apple products, which are more locked-down on the data side unfortunately.

Example lists of devices this should be compatible with (mostly HR straps) can be found at EliteHRV and Sweetwater

Resources

About

Basic working example of how to read heart rate and R-R interval data over Bluetooth Low Energy using Noble

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%