Next, download, compile and install the latest ‘BlueZ’ on your Raspberry Pi. BlueZ is the Bluetooth stack for Linux, and it works with Raspbian. Plug your bluetooth dongle into your Pi and the following commands will install BlueZ:

Use control-c to stop the scan. We are just interested in the line with ‘Polar H7’ in the description. In the example above, our peripheral ID is 00:D2:D0:94:C2:C0.

The programming language Go and the gatt library from Paypal can connect and retrieve data from the heart rate monitor. Before running a gatt program, make sure that the BLE device is down (off):

$ sudo hciconfig hci0 down
$ sudo service bluetooth stop

The gatt library defines callbacks for different stages of the peripheral connection process. It has a callback for when your bluetooth dongle changes state (like when it gets powered on). You can also set callbacks when a peripheral is discovered, connected and disconnected. So when we power up the bluetooth device, we start scanning for the peripheral ID of the Polar H7. When found, connect and when we have finished, clean up and disconnect.

References

* You can use any heart rate monitor that supports the Bluetooth Heart Rate GATT Profile.

Hi! Subconsciously you already know this, but let's make it obvious. Hopefully this article was helpful. You might also find yourself following a link to Amazon, Lego or eBay to learn more about parts or equipment. If you end up placing an order, I make a couple of dollarydoos. We aren't talking a rapper lifestyle of supercars and yachts, but it does help pay for the stuff you see here. So a massive shoutout to everyone that enables this place. Thanks!