HealthyPi 6

A robust, high-performance, scalable open-source platform for biosignal acquisition

Available for pre-order

View Purchasing Options
Dec 29, 2025

Project update 3 of 9

On-Device Edge ML - Real-Time Beat Classification

by Ashwin Whitchurch

Hello HealthyPi 6 backers!

We’re excited to share a major milestone: real-time on-device machine learning is now running on HealthyPi 6! Beat-by-beat ECG arrhythmia classification runs directly on the device—no cloud required.

What’s New: Edge AI for Cardiac Research

HealthyPi 6 now runs TensorFlow Lite Micro on the dedicated Cortex-M4 processor, analyzing every heartbeat in real-time to detect PACs, PVCs, fusion beats, or unknown morphologies.

Beat-by-Beat Classification

  1. QRS Detection: Pan-Tompkins algorithm detects R-peaks at 500 Hz
  2. Beat Extraction: 1.5-second window centered on R-peak
  3. Neural Network Inference: CVxTz classifier processes the beat (~233 ms)
  4. Result: 5-class AAMI output (Normal, SVEB, VEB, Fusion, Unknown)

This means HealthyPi 6 can catch arrhythmias as they happen—not after reviewing hours of data. What is shown in the AI screen is live, real-time analysis, beat-by-beat.

The AI screen displays three cards: the Main Beat Waveform showing the live ECG trace with classification label, confidence %, and RR interval; Ectopic History with 5 thumbnail waveforms of recent abnormal beats color-coded by type; and Statistics tracking total beats, normal %, VEB count, SVEB count, and average inference time.

The AI/ML Architecture

Dual-Core Design

CoreFunctionDetails
Cortex-M7 (400 MHz)Peripheral MasterSensors, display, USB, WiFi
Cortex-M4 (200 MHz)Algorithm ProcessorQRS detection, HRV, TFLite inference
ML Architecture Diagram

The M7 acquires sensor data, batches 16 samples, and sends them to M4 via OpenAMP IPC (shared SRAM2). The M4 runs QRS detection, beat extraction, and TFLite inference, then returns heart rate and classification results back to M7 for display and streaming. This parallel architecture ensures real-time operation without data drops.

Memory Layout

SDRAM1 (32 MB):
├── Display Buffers (4 MB)
├── TFLite Arena (1 MB)
├── Model Cache (512 KB)
└── Classification Buffers (67 KB)

Model stored in 128 MB QSPI flash, cached to SDRAM at boot for fast inference.

The Neural Network Model

We’ve used the CVxTz MIT-BIH Beat Classifier as a reference implementation—a multi-layer 1D CNN trained on the gold-standard MIT-BIH Arrhythmia Database:

SpecificationValue
Architecture4 conv blocks (8 Conv1D layers) + 2 Dense layers
Conv BlocksBlock 1: 2×Conv1D(16,5) → Block 2: 2×Conv1D(32,3) → Block 3: 2×Conv1D(32,3) → Block 4: 2×Conv1D(256,3)
Dense LayersDense(64) → Dense(64) → Dense(5, softmax)
Parameters~254,900
QuantizationINT8
Size291 KB
Input187 samples @ 125 Hz
Output5-class AAMI: Normal (green), SVEB/Supraventricular Ectopic (amber), VEB/Ventricular Ectopic (red), Fusion (amber), Unknown (gray)
Inference time~233 ms/beat

Performance Optimization

Our initial QSPI XIP approach yielded 4.5 second inference—far too slow for real-time use. By caching the model to SDRAM at boot, we achieved a 17x speedup from ~4,500 ms down to ~233 ms per beat. This is powered by TFLite Micro with Zephyr RTOS native support and CMSIS-NN optimized kernels. At typical heart rates of 60-100 BPM (600-1000 ms between beats), 233 ms provides comfortable headroom for real-time operation.

Bring Your Own Model

Conversion tools available after source release. Edge Impulse also supported—covered in a future update.

Easy Model Loading: No Reflashing Required

Requirements: Model size ~500 KB max (INT8 quantization essential), tensor arena up to 4 MB, inference <500 ms ideal.

Data Collection

HealthyPi 6 isn’t just for inference—it’s also a powerful data collection platform for training your own models. With 3-lead ECG (ADS1294R), PPG (AFE4400), and temperature sensors, plus 32 MB SDRAM and 128 MB QSPI flash, you have the hardware to capture rich multi-modal datasets. Stream real-time data via USB (OpenView protocol), record to SD card, or forward directly to Edge Impulse for cloud-based model training. All sensors share synchronized timestamps for multi-modal datasets.

What’s Next

The beat classification model is just the beginning. HealthyPi 6’s flexible ML framework opens up exciting possibilities:

We’ll be adding more models and use cases in future updates—and with the open model loading system, you can develop and deploy your own.

The firmware is fully open source. GitHub repository releases after funding completes.

Thank You!

We’re thrilled to bring edge AI to HealthyPi 6, empowering researchers with real-time cardiac insights. Stay tuned for more updates as we continue to enhance the platform!


Sign up to receive future updates for HealthyPi 6.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects