Real-Time ECG Analysis and Two-Level Alarms for a Wearable Heart Monitor

The Challenge

Heart disease is the leading cause of death worldwide. Many dangerous rhythm problems, such as atrial fibrillation, are hard to catch because they only happen from time to time. A patient might have a few minutes of irregular rhythm once a month. A standard ECG in a clinic, or even a 24-hour Holter test, can miss it completely.

Cormedio set out to fix this with a small ECG device that patients can wear for weeks in daily life. Most wearables on the market only measure heart rate and show it on a phone. Cormedio wanted to offer something they did not: a real ECG signal, analysed in real time, with alarms that react when something goes wrong.

By late 2018 the team had a working sensor. At its first live demo at the University of Szeged's Department of Paediatrics, clinicians confirmed that the signal was clean. P and T waves were clearly visible, which is what a cardiologist needs to judge the rhythm. They also liked that the device needs only a few electrodes, which matters a lot with small children.

The next step was the hard part. Cormedio had to show that the system could do more than stream a signal. It had to understand the signal and act on it. Before going to investors and partners, the company needed a working prototype that could:
  • Receive the ECG stream from the wearable sensor over Bluetooth and display it live
  • Detect individual heartbeats and calculate heart rate variability (HRV) on the fly
  • Recognise two levels of rhythm problems and respond to each one differently
  • Send an SMS and start a phone call on its own when it detects a serious event, including the patient's location
  • Be proven on both a live person and a professional ECG simulator

This was a hardware-in-the-loop project with a fixed demo date. It combined an off-the-shelf ECG chip with its own quirks, a GSM modem that had not been chosen yet, and analysis rules defined by a paediatric cardiologist. Cormedio also wanted its own engineer involved throughout the project, so the knowledge would stay in-house once we handed it over.

Live ECG trace from a wearable sensor displayed on a tablet
Cormedio's earlier prototype streaming a live ECG to a tablet at the University of Szeged, November 2018

The Solution

We put together a small, focused team: a senior LabVIEW engineer who specialises in measurement and signal processing, and a project manager who handled scope, the client relationship and delivery. The requirements were agreed in a short, formal requirements document. In the kick-off session the client handed over the sensor hardware and the ECG simulator, and the cardiologist's analysis rules were translated into concrete detection criteria.

Architecture. The application is built in LabVIEW as a set of parallel loops that communicate through queues. Acquisition, visualisation, analysis and alarm handling each run independently. A slow SMS send or a file write can never freeze the live ECG trace or cause beats to be missed. Shared state such as messages and recording buffers is managed centrally, and all errors are logged to disk for troubleshooting.

Signal processing. The raw signal from the chest sensor is band-pass and low-pass filtered. We kept the filtering light so that the underlying waveform stays usable for clinical analysis. Beats are then extracted with configurable QRS width and minimum R-R interval thresholds. For every beat the system tracks heart rate, amplitude, QRS duration, PR and QT intervals, and ST and isoelectric levels, along with rolling means and standard deviations. A live Poincaré plot shows heart rate variability.

Two-level alarms. We implemented the client's detection algorithms and set them up around two alarm levels:
  • Type A (record for review): When the system detects a predefined rhythm anomaly, it saves the minute before the event and several minutes after it to a timestamped measurement file. The recording length is configurable. Clinicians can open the recordings from the app, zoom in and review them later.
  • Type B (act now): When the system detects a serious anomaly, it sends an SMS through a USB GSM modem to a preset phone number and then starts a call. The message includes GPS coordinates that can be opened directly in Google Maps.

Built to be demonstrated. Everything a presenter needs is on one screen: the live trace, the beat counter, HRV statistics, an alert history, recording and sending indicators, and switches to turn SMS alerts on or off for each recipient. Hardware settings such as COM ports live in a simple configuration file, so the demo can be moved to a new laptop in minutes.

Validation. We tested the system in two ways. First with a live wearer, to prove signal quality and HRV measurement. Then with a professional multi-parameter ECG simulator, to trigger repeatable events on demand: runs of tachycardia to trigger Type A recordings, and bursts of premature ventricular contractions (PVCs) to trigger the full SMS and call chain.

Working with the client's team. Cormedio's own developer worked with our engineer directly throughout the project. We pushed source code and a status update every week. The project ended with a user manual and a demo runbook that took the presenter step by step through both the live-wearer scenario and the simulator scenario.

LabVIEW block diagram of the parallel visualisation, analysis and alarm-sending loops
The application architecture: parallel loops for visualisation, analysis and sending alarms, linked by queues
The LabVIEW front panel with the ECG graph, Poincaré plot, detection parameters, alert history and alarm settings
The LabVIEW front panel: live ECG trace, Poincaré plot, detection parameters, alert history and alarm settings
LabVIEW block diagram of ECG filtering and feature extraction
ECG feature extraction: filtering, beat detection and QRS timing
LabVIEW block diagram of the event recording buffer
Event recording logic: a rolling buffer that captures the signal before and after each alarm
LabVIEW block diagram computing HRV and ECG statistics
HRV and ECG statistics: rolling mean and standard deviation for heart rate, QRS, PR, QT and ST

The Result

We delivered the prototype, ready for demos, by the agreed end-of-November deadline. The accompanying documentation followed in the same week. The finished system covered every scenario Cormedio had defined for its demonstrations:
  • A live ECG from a person wearing the sensor, displayed in real time
  • A Type A alarm triggered with the simulator, with the measurement saved automatically
  • A Type B alarm triggered with the simulator, with an SMS sent and a call started
  • Heart rate variability measured live, with HRV factors calculated

Cormedio came back for a follow-up round of improvements after the first delivery. The final part of the project was signed off in February 2020.

For a young MedTech company, this was a key milestone. Cormedio had started with a sensor that could stream a clean signal. It ended with a working system that detects rhythm problems as they happen and calls for help when needed. That is the capability the company planned to bring to its miniaturised, patentable final device. The prototype gave Cormedio something concrete to show cardiologists, investors and potential industry partners.

Project tech stack

LabVIEW logo

LabVIEW

Signal processing waveform icon

NI toolkits

Bluetooth logo

Bluetooth

Radio tower icon for the GSM modem

GSM/GPRS modem

Heart pulse icon for the ECG simulator

ECG simulator

Long-term wins

A working proof of concept for real-time ECG analysis with two-level alarms, delivered on a fixed demo deadline
A modular, multi-loop architecture that keeps live display, analysis and alerting independent of each other
Repeatable demo scenarios validated on both a live wearer and a professional ECG simulator
Knowledge transferred to the client's in-house engineer, with weekly code handovers, a user manual and a demo runbook
A strong technical foundation for Cormedio's investor, clinical and partner conversations