Skip to main content

🖤 BleakHeart

An asynchronous BLE Heart Monitor library that supports additional measurements available from Polar sensors through the Polar Measurement Data interface (currently, ECG and accelerometer data from the Polar H10, and PPG from the Polar Verity).

BleakHeart is written in Python using the asyncio framework; BLE communication is based on Bleak.

Installation

Install from PyPI using pip:

python3 -m pip install "bleakheart"

Features

  • Supports heart rate acquisition for devices supporting the standard BLE heart rate service, including RR intervals, instant heart rate, energy expenditure and (client-based) time stamps;
  • Reads Accelerometer and ECG signals from the Polar H10 chest strap;
  • Reads PPG data from the Polar Verity, including in SDK mode;
  • Offers partial support for other measurements available through the Polar Measurement Data interface, possibly from other devices;
  • Normalises Polar sensor timestamps to Epoch time;
  • Reads the battery charge state through the standard BLE battery service (also available on other types of BLE devices);
  • Compatible with Jupyter Notebooks (IPython version 7+, IPykernel version 5+).

Usage

BleakHeart supports a variety of software design choices. Specifically:

  • A data producer/consumer model can be easily implemented by asking BleakHeart to push sensor data onto asynchronous queues;
  • Alternatively, data can be sent to a callback. Simple tasks such as sensor logging can be accomplished with only a minimal understanding of asyncio;
  • All data are tagged with their measurement type; thus the same queue or callback can be used to handle different types of measurements if desired.

Please see the getting_started notebook in the examples directory, or see this video introduction.

The examples directory also contains detailed stand-alone examples for some of the possible workflows. Use the help function on BleakHeart objects for more information.

Limitations

BleakHeart has mainly been tested on a Polar H10 chest strap under Linux and on a Verity sensor under Windows. However, reports from Windows and MacOS users have been positive. Other Polar devices are only partly supported; measurements other than ECG and acceleration on the H10, and PPG on the Verity, are returned as raw bytearrays. Offline recording to the internal Polar H10 memory is not supported.

Credits and contributing

This software was originally developed and is maintained by Fabrizio Smeraldi. Many thanks to

for testing, suggestions and code. If you would like to contribute, please get in touch.

Academic use

If you use this software for academic research, please reference this repository and let me know. I will cite your paper! :)

Disclaimer and license

Polar is a trademark of Polar Electro Oy; Bleak is an open-source BLE library developed by Henrik Blidh. The author is not affiliated with either.

This software is provided subject to the terms of the Mozilla Public License version 2.0, in the hope that it will be useful; see the LICENSE file for details.

Resources

Metadata

Release files for bleakheart 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bleakheart 0.2.0
File Size Uploaded
bleakheart-0.2.0.tar.gz 21.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bleakheart 0.2.0
File Interpreter ABI Platform
bleakheart-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.9 kB

Release files / bleakheart-0.2.0.tar.gz

Download URL bleakheart-0.2.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fe417ed00562fbddb20047711ec0d4d9513c2d071aa0db0fbd202cbd528e2776
BLAKE2b-256 checksum
How to use checksums
c4eb84a630fc364a0612d6783e604b0bd308eb021cdc88050fef69cc2ca74ebb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / bleakheart-0.2.0-py3-none-any.whl

Download URL bleakheart-0.2.0-py3-none-any.whl
Size 19.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c755846a0471bfe955cd55e328f15a2898b183f91b24f4a3457f6cf3257a5894
BLAKE2b-256 checksum
How to use checksums
f5c79d4e8886f8c06cd743d39ee6f29d3dc802498be0a75c3602d1eddc3d78aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page