Projects / OpenHRStrap

Wearables · 2025

OpenHRStrap

A DIY chest-strap heart-rate monitor with an ESP32-S3, an AD8232 ECG front end and Pan–Tompkins R-peak detection; Strava picks it up as a BLE heart-rate sensor.

Work in progress: real-time R-peak detection while running, and a V2 PCB.

MCU
Seeed XIAO ESP32-S3
ECG front end
AD8232 module
Algorithm
Pan–Tompkins
Output
BLE, recognised by Strava
Power
1S Li-ion, 5 V boost
Case
3D-printed PLA and TPU
Analysis
Python
The strap module, labelled ESP32 Pulse Tracker, held up to the camera

Hardware

V1 is built from common modules. A Seeed XIAO ESP32-S3 handles processing and BLE, and an AD8232 module is the analogue front end. The AD8232 needs a third, reference electrode, so an extra button was sewn onto the back of a commercial chest strap, and wires are soldered directly to the strap's steel buttons. The case is printed in PLA and TPU, and a small reused 1S Li-ion cell with a boost converter to 5 V supplies power.

Design sketch of the strap module
Design sketch of the strap module

Pan–Tompkins detection

R peaks are detected with the Pan–Tompkins algorithm, implemented in Python to follow the filter chain of the original 1985 paper: band-pass (a low-pass followed by a high-pass), derivative, squaring and moving-window integration. Peaks are found on both the band-passed signal (FILT) and the integrated signal (INT). An INT peak above threshold TH1 counts as a beat only if a FILT peak above its own TH1 lies within a short window of it; the running signal and noise peak estimates (SPK, NPK) and the thresholds TH1 and TH2 = TH1/2 are then updated. If no beat is found within 166 % of the average RR interval, the algorithm searches back from the last beat using TH2.

Tested on ECG recorded with this hardware, with the first 10 s used to initialise the running parameters, it missed one R peak in the whole recording.

Detection over the whole recorded data set
Detection over the whole recorded data set

Running test

The strap was worn on a 5 km run together with a smartwatch with a wrist PPG sensor as the reference. Both activities were exported from Strava and aligned by timestamp in Python. The traces matched at the start, but the gap grew as heart rate rose; the strap mostly read lower than the watch and only sometimes matched again when heart rate came down. Without logging of the raw signal, the cause could not be determined.

Strap and smartwatch heart rate from Strava, aligned by timestamp
Strap and smartwatch heart rate from Strava, aligned by timestamp

Next: V2

V2 is in progress: a custom PCB with a new analogue front-end IC and data logging, so real-world runs can be examined and the algorithm and hardware tuned.