A Python-based BLE heart rate monitor recorder using Bleak
Project description
hrm-recorder
hrm-recorder is a Python library for interacting with Bluetooth LE heart rate monitors. It lets you scan for devices, save configuration, connect to a chosen device, and record real-time heart rate data (and basic HRV-like data) in CSV files.
Features
- One-Time Config – A quick CLI command
hrm-recorder configto discover BLE heart rate devices and store their addresses locally. - Recorder Class – A Python class (
recorder) for starting a BLE connection in the background, retrieving data, and optionally logging to CSV. - Pause/Resume – Pause the data logging without disconnecting.
- Simple API – Use it in IPython, a standard Python script, or any environment that keeps the session alive.
Installation
Install from PyPI with:
pip install hrm-recorder
Or install from source:
git clone https://github.com/Cortexan/hrm_recorder.git
cd hrm-recorder
pip install .
Note:
hrm-recorderrequires Python 3.9+ and the bleak library for BLE functionality on Windows, macOS, and Linux.
Basic Usage
1) Run Config from the CLI
hrm-recorder config
- Scans for nearby BLE devices (10s each scan).
- Lets you pick the device to save in `.hrm_config.json`.
- If a config file already exists, it’ll ask if you want to keep or replace it.
2) Usage in a Python Script or REPL
Create and use a recorder instance:
from hrm_recorder import recorder
# Create a new recorder instance
hrm = recorder()
# Optionally re-run config if you want to change the saved device
hrm.config()
# Start the background BLE thread
hrm.start()
# Get a quick HR reading
print(hrm.get()) # e.g. "HR: 72, HRV: 32.00"
# Start recording data to a CSV file
hrm.record()
# ... some time later ...
hrm.stop()
# Eventually exit (stop the background thread)
hrm.exit()
Contributing
- Fork the repo
- Create a feature branch
- Commit your changes
- Open a Pull Request
We’re happy to see improvements for advanced HRV, multi-device support, etc.
License
This project is licensed under the MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hrm_recorder-1.0.0.tar.gz.
File metadata
- Download URL: hrm_recorder-1.0.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c9e9e38dcff3dd4ac3a2b15a04d1021aeba8cfcdd6972452aad69e671051d81
|
|
| MD5 |
e20c1637b3653f562e72583596a4fb1b
|
|
| BLAKE2b-256 |
8dc709c5465f67d67db3b0629a5aed1b0fbc78e681a1d1984877759fc7491337
|
File details
Details for the file hrm_recorder-1.0.0-py3-none-any.whl.
File metadata
- Download URL: hrm_recorder-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7741e333d3bb09bbea54060ab6fa8d035cca8e2c0c078c1fdf1d7c889a76167
|
|
| MD5 |
7472e88888cd412dcfae20205e3a7189
|
|
| BLAKE2b-256 |
26844a7c14697be7a49f5e0d07733d21d8abaddc2bddac74483be82c06f3a642
|