Edge AI on STM32

Edge AI on STM32: ECG Signal Quality Classification

Edge AI on STM32: ECG Signal Quality Classification

We built a smart ECG quality-control system that runs entirely on an STM32L452REI microcontroller. Using a compact INT8 convolutional neural network, the device instantly decides whether an ECG segment is useful or too noisy to keep. Valuable signals are preserved, while poor-quality data is filtered out at the source. Full AI inference takes only 108 milliseconds on a low-power STM32L-series device, with no cloud, external processor, or internet connection required. The result is a fast, private, and efficient edge-AI solution for wearable and portable ECG monitoring.

Category:
AI / ML
Industry:
Wearables / Embedded AI
Client:
Internal R&D / Product Development
Year:
2025

What Is Edge AI?

Edge AI means running classification and analysis directly on embedded hardware instead of in the cloud. For ECG wearables, assessing signal quality locally lets the device reject bad measurements before they are stored or transmitted. This lowers latency, reduces data transfer, and avoids sending raw, sensitive biosignals to external services. This project demonstrates that approach on a resource-constrained STM32 microcontroller.

The Challenge

Wearable ECG data is frequently degraded by movement, contact problems, and muscle noise. Many compact devices record or transmit the signal without evaluating its quality locally, so poor-quality windows reach downstream analysis unchecked. This can reduce trust in the results and increase manual review effort. Cloud processing is not always practical either, due to latency, connectivity, power, privacy, and regulatory constraints.

Our Solution

We trained a lightweight neural network on a public ECG dataset (Kaggle, ~10,000 samples), augmented to simulate lead detachment, motion artifacts, and EMG interference. The model was quantized to INT8 and deployed via TensorFlow Lite Micro on the STM32L452REI, a compact, energy-efficient MCU. The implementation distinguishes two separate timings: each inference takes 108 ms to run, while classification is scheduled every 1 second as the evaluation cadence configured in this prototype. The device operates fully offline, with no internet or cloud connection required.

Live on-device inference output
Live on-device inference output

Implementation Overview

Sampling rate
500 SPS
Dataset
~10,000 ECG samples (90/10 split)
Model
Lightweight INT8 neural network
Deployment
TensorFlow Lite Micro on STM32
Inference time
108 ms per classification
Evaluation cadence
Every 1 second
Target MCU
STM32L452REI

Key Results

99.6% Validation precision
96.9% Live prototype accuracy
108 ms Inference time per window

Key Features

  • On-device ECG quality classification: Signal-quality assessment runs entirely on the STM32L452REI, with no cloud or network involved in the decision.
  • INT8 quantized model: A lightweight neural network deployed via TensorFlow Lite Micro, sized to fit a resource-constrained microcontroller.
  • Defined timing model: Each inference completes in 108 ms, with classification scheduled every 1 second in this prototype.
  • Local, privacy-friendly processing: Suitable for privacy-sensitive and connectivity-limited use cases where raw biosignals should not leave the device.
  • Wearable-oriented architecture: A practical fit for low-power wearable prototypes built around MCU-class hardware.

What You Gain

Reject poor-quality windows early

Discard unusable ECG segments before storing or transmitting data.

Less cloud dependency

Reduce cloud reliance and raw-data transfer.

Privacy by design

Preserve privacy by processing sensitive biosignals locally.

More reliable measurements

Improve reliability of wearable measurements in motion-heavy conditions.

AI on MCU-class hardware

Add AI classification to MCU-based products without moving to Linux-class hardware.

Reusable blueprint

Use the prototype as a blueprint for other biosignal or industrial sensor applications.

Technologies

  • STM32L452REI
  • TensorFlow
  • TensorFlow Lite Micro
  • INT8 Quantization
  • C
  • Python
  • ECG / Biosignals

Results

This project demonstrates that ECG signal-quality classification can run directly on a low-power STM32 microcontroller without cloud dependency. By combining dataset augmentation, INT8 quantization, and TensorFlow Lite Micro deployment, the prototype provides a practical blueprint for adding local AI decisions to wearable and sensor products where privacy, latency, and connectivity matter. The results reported here are prototype / R&D figures, not a clinically validated medical product.

Work With Us

Ready to Build Something Exceptional?

From Edge AI inference to production firmware, we turn complex embedded challenges into real, deployable solutions. Let's talk.