TECHNICAL BLOG
Deep Dives for Engineers
Detailed technical articles covering the real problems we solve in embedded systems, AI, and robotics engineering.
Detailed technical articles covering the real problems we solve in embedded systems, AI, and robotics engineering.
How to design embedded wearable systems for continuous health monitoring — signal acquisition, noise filtering, and on-device ML for heart rate, SpO2, and anomaly detection.
Continuous, passive health monitoring at hospital-grade accuracy was, until recently, possible only in clinical settings with bulky equipment. The convergence of miniaturised sensors (PPG, ECG, IMU, temperature), low-power microcontrollers (ARM Cortex-M series, RISC-V), and efficient on-device ML has changed this. Devices worn on the wrist or patch-mounted on the chest can now monitor heart rate, oxygen saturation, respiratory rate, and early arrhythmia indicators continuously — with processing happening on-device to preserve privacy and battery life.
A reference embedded health monitoring platform typically integrates:
Raw PPG and ECG signals are contaminated by motion artefacts, powerline interference (50/60 Hz), and baseline wander. Filtering in the embedded domain:
import numpy as np
from scipy import signal
def bandpass_ppg(raw_signal: np.ndarray, fs: float = 100.0) -> np.ndarray:
'''Bandpass filter for PPG: 0.5-4 Hz (30-240 BPM)'''
sos = signal.butter(4, [0.5, 4.0], btype="band", fs=fs, output="sos")
return signal.sosfiltfilt(sos, raw_signal)
def notch_ecg(raw_signal: np.ndarray, fs: float = 250.0) -> np.ndarray:
'''Notch filter to remove 50 Hz powerline interference'''
b, a = signal.iirnotch(50.0, 30.0, fs=fs)
return signal.filtfilt(b, a, raw_signal)
On embedded targets, implement these as fixed-point IIR filters using ARM CMSIS-DSP functions (arm_biquad_cascade_df2T_f32) for efficient execution on Cortex-M4/M7 without floating-point overhead.
Heart rate from PPG is derived via peak detection on the filtered AC component. SpO2 is calculated from the ratio of AC/DC amplitudes at red (660 nm) and infrared (940 nm) wavelengths:
def compute_spo2(red_ac, red_dc, ir_ac, ir_dc):
R = (red_ac / red_dc) / (ir_ac / ir_dc)
# Empirical calibration curve (from manufacturer datasheet)
spo2 = -45.060 * R * R + 30.354 * R + 94.845
return np.clip(spo2, 70, 100)
A 1D convolutional neural network trained on the MIT-BIH Arrhythmia Database can classify ECG beats into Normal, Supraventricular, Ventricular, Fusion, and Unknown categories with >96% accuracy. Quantise to INT8 with TensorFlow Lite for deployment on a Cortex-M33:
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model("ecg_classifier")
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_data_gen
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.inference_input_type = tf.int8
converter.inference_output_type = tf.int8
tflite_model = converter.convert()
The resulting model is typically 80-120 KB, fits in Cortex-M33 flash, and runs an inference in under 2 ms.
Health data processed on-device eliminates many privacy concerns — raw biometric signals never leave the device. For products marketed as medical devices, regulatory classification (FDA 510(k) in the US, CE Class IIa in the EU) applies when making clinical claims. Design your system to clearly separate wellness features (no regulatory path) from diagnostic claims (regulated) and document this distinction from the architecture stage.
Wearable health monitoring with on-device ML is now technically feasible on commodity embedded hardware. The combination of miniaturised sensors, efficient signal processing, and quantised neural networks enables clinical-quality metrics at consumer device power budgets. The engineering challenge has shifted from "is it possible?" to "is the signal quality reliable enough and the model calibrated well enough to be trusted?" — which requires careful sensor selection, rigorous validation, and honest performance characterisation.
Continue reading — handpicked articles you might enjoy