Protocentral easyECG MicroPython Library
MicroPython library for the Protocentral easyECG Breakout: single-lead (Lead I) ECG over I²C / Qwiic. It handles the sampling, filtering and heart-rate detection. The same driver also runs on a Raspberry Pi.
Don't have one? Buy it here
Wiring, electrode placement and troubleshooting are in the easyECG Getting Started guide.
Links
| Product page | https://protocentral.com/product/easyecg-single-lead-ecg-breakout-qwiic/ |
| Getting Started guide | https://protocentral.com/product/easyecg-single-lead-ecg-breakout-qwiic/docs/getting-started/ |
| Arduino library | https://github.com/Protocentral/protocentral_easyecg_arduino |
| Hardware design files | https://github.com/Protocentral/protocentral_easyecg_hardware |
Features
- Paced sampling with missed-sample counting: 250 SPS in, 125 or 250 Hz out
- 50/60 Hz notch and 40 Hz low-pass in software; no high-pass by default, to keep the ST segment
- Heart rate from a simplified Pan-Tompkins R-peak detector
- Saturation, mains-pickup and a provisional lead-off flag
- Readings in µV at the electrodes
- A port of the Arduino library 1.0.0: the same API in snake_case, and a Python version of every Arduino example
Not a medical device. For research and education only. The breakout has no patient isolation: when electrodes are on a person, power the host from a battery or connect through an easyISO isolated Qwiic adapter. On a mains-powered host you get a flat line, and
is_saturated()reports it.
Installation
MicroPython (Raspberry Pi Pico, ESP32, …):
mpremote mip install github:Protocentral/protocentral-micropython-easyecg
This also installs the TLA20xx driver. With Thonny, copy protocentral_easyecg.py and protocentral_tla20xx.py to the board instead.
Raspberry Pi, with I²C enabled (sudo raspi-config nonint do_i2c 0):
python3 -m venv ~/easyecg && source ~/easyecg/bin/activate
pip install protocentral-easyecg
Quick Start
from machine import Pin, I2C
from protocentral_easyecg import EasyECG
i2c = I2C(0, scl=Pin(5), sda=Pin(4), freq=400000) # Pico: GP5, GP4. Change for your board
ecg = EasyECG(i2c) # default address 0x49
if not ecg.begin():
raise OSError("easyECG not found")
while True:
if ecg.update(): # True at the output rate, 125 Hz
print(ecg.ecg_microvolts(), ecg.heart_rate())
On a Raspberry Pi, replace the I²C lines with from protocentral_tla20xx_linux import I2C and EasyECG(I2C(bus=1)).
Call update() as often as you can; it samples only when the clock is due, and never blocks. If missed_samples() grows, your loop is too slow.
API Reference
| Method | Description |
|---|---|
EasyECG(i2c, address=0x49) / begin() |
Construct / configure the ADC. begin() returns False if the board doesn't answer |
update() |
Non-blocking. True when a new output sample is ready |
ecg_microvolts() / ecg_filtered() |
Filtered output, in µV at the electrodes / in counts |
ecg_unfiltered_microvolts() / ecg_unfiltered() |
Plain ADC average |
heart_rate() / beat_detected() / last_rr_millis() |
bpm, 0 until established / true once per beat / last R-R interval |
is_saturated() / is_lead_off() / mains_microvolts() |
Signal-quality flags; lead-off is a provisional heuristic |
set_sampling(adc, out) / missed_samples() |
Sample clock (default 250, 125) / samples the loop couldn't take on time |
set_notch(hz) / set_low_pass(hz) / set_high_pass(hz) |
Filters: 50 Hz, 40 Hz, off by default. 0 disables |
calibrate_baseline(ms) / set_baseline(n) |
Measure and subtract the resting offset |
The full API, including the low-level ADC passthroughs, is documented in protocentral_easyecg.py.
Examples
| # | Example | Description |
|---|---|---|
| 01 | easyecg_simpletest.py / easyecg_raspberrypi.py |
Filtered ECG in counts and µV (MicroPython / Raspberry Pi) |
| 02 | easyecg_plotter.py |
Filtered and unfiltered traces for Thonny's plotter |
| 03 | easyecg_heartrate.py |
Heart rate on every beat, with saturation and lead-off messages |
| 04 | easyecg_openview.py |
Stream to OpenView 3.4+ (easyECG Breakout). Save it to the board as main.py, then close Thonny or mpremote before connecting OpenView |
| 05 | easyecg_diagnostics.py |
I²C, ADC, noise, mains and sample-rate checks. Run this first if something is wrong |
The examples default to QT Py ESP32-C3 pins: change the I2C(...) line for your board.
License
- Software: MIT, see LICENSE.md
- Hardware: CERN-OHL-P v2, in the hardware repo
Copyright (c) 2026 Protocentral Electronics.
Support
Open an issue on GitHub or email support@protocentral.com.
Metadata
Release files for protocentral-easyecg 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| protocentral_easyecg-0.2.0.tar.gz | 20.4 kB | With provenance | Details for protocentral_easyecg-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| protocentral_easyecg-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for protocentral_easyecg-0.2.0-py3-none-any.whl |
Total release size: 32.0 kB
Release files / protocentral_easyecg-0.2.0.tar.gz
| Download URL | protocentral_easyecg-0.2.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
273646ac101f57de88647720389aa6e45318e6476e9baac62c6f920d3d8538d4
|
|
BLAKE2b-256 checksum How to use checksums |
3653867c4f9bd12726c410e6805e30a7affe1961eb3676a594d322e44a9aa337
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / protocentral_easyecg-0.2.0-py3-none-any.whl
| Download URL | protocentral_easyecg-0.2.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
775b70482c574c2839f3136cca6d29f5be365318d79cfec21b2c774a080a9f4e
|
|
BLAKE2b-256 checksum How to use checksums |
4cd5320aed2a0ddc056d453e14a6843c999f8ad708471d691658be4cd3e1ab75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logSecurity for protocentral-easyecg 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for protocentral_easyecg-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.