Inspiration
Ischemic and hemorrhagic strokes remain primary causes of long-term neurological disability worldwide. Clinical outcomes depend heavily on immediate intervention within the critical time. However, centralized hospital imaging tools like CT and MRI scans are expensive, time-consuming, and unavailable in ambulances or low-resource rural health centers. Furthermore, transmitting continuous, high-bandwidth bio-signals to cloud servers introduces latency, requires stable internet connectivity, and raises patient bio-data privacy concerns. To overcome these barriers, we developed a low-cost, offline, portable Edge AI framework for rapid point-of-care stroke screening using scalp Electroencephalography (EEG).
What it does
Our system is a wearable, zero-cloud stroke screening device that executes end-to-end EEG processing and machine learning inference directly on an embedded microcontroller in Python:
- Signal Acquisition: Captures scalp EEG biopotentials via a compact BioAmp EXG Pill analog front-end sampled at 250 Hz by a Raspberry Pi
- On-Chip Artifact Mitigation: Applies digital IIR bandpass filtering (0.5Hz- 30Hz) and static Independent Component Analysis (ICA) spatial unmixing directly on-device in Python to suppress ocular and cardiac noise.
- Feature Engineering: Computes spectral asymmetry features over 2-second sliding temporal epochs, isolating Delta-to-Alpha Ratio (DAR), Brain Symmetry Index (BSI), and Power Spectral Density (PSD) metrics.
- Local Machine Learning Inference:Executes a lightweight Support Vector Machine (SVM) classifier in Python on the RP2040 dual ARM Cortex-M0+ processor for real-time Stroke vs. Non-Stroke detection with sub-10 ms latency.
- Mobile Emergency Telemetry: Transmits low-overhead alert payloads via BLE/Serial to a companion app upon anomaly detection to guide non-clinical bystanders through immediate FAST symptom validation, auto-route to the nearest stroke center, and generate clinical bio-signal logs.
How we built it
- Hardware Assembly: Interfaced the BioAmp EXG Pill analog front-end directly with the Raspberry Pi Pico microcontroller (RP2040 dual ARM Cortex-M0+ @ 133 MHz).
- Embedded Python Pipeline: Developed a Python-native signal processing pipeline leveraging embedded math libraries to handle real-time IIR digital filtering, static ICA matrix operations, and spectral feature computations (DAR, BSI, PSD).
- Machine Learning Deployment: Trained an SVM classifier in Python using Scikit-learn on EEG asymmetry datasets, then deployed the trained model parameters into the MicroPython/CircuitPython environment on the Pico to execute predictions efficiently on the microcontroller.
- Companion Mobile Application: Created a mobile interface to parse low-overhead serial/Bluetooth telemetry, guide bystanders step-by-step through the emergency FAST protocol, and automate emergency routing.
Challenges we ran into
- Python Execution on Resource-Constrained Hardware: Running matrix operations for spatial unmixing (ICA) and feature extraction within the strict memory and fixed-point constraints of the RP2040 required light memory buffers and optimized floating-point computations.
- Real-Time Artifact Removal at the Edge: Filtering out high-amplitude eye blinks and cardiac signals without delaying real-time inference or relying on cloud processing.
- Asymmetry Metric Calibration: Tuning sliding epoch windows (2 seconds) to ensure reliable spectral feature extraction (DAR and BSI) without exhausting the microcontroller's RAM.
Accomplishments that we're proud of
- Sub-10ms Inference on RP2040:Achieving ultra-low-latency stroke classification running entirely in Python directly on the standard Raspberry Pi Pico.
- Zero Cloud Dependence:Complete data privacy and full functionality in low-resource or remote offline emergency settings.
- Clinical Pathophysiology Mapping; Successfully converting clinical indicators of cerebral hypoperfusion (hemispheric power asymmetry) into a portable, low-cost diagnostic tool.
What we learned
- Techniques for optimizing digital filtering, matrix unmixing, and feature engineering for resource-constrained ARM Cortex-M0+ processors.
- How to deploy and execute Scikit-learn machine learning parameters efficiently within MicroPython/CircuitPython environments.
- The critical role of inter-hemispheric asymmetry metrics (DAR, BSI) in non-invasive stroke screening.
What's next for Explainable Edge AI EEG Stroke Screening on Raspberry Pico
- Custom PCB Integration: Designing a single custom PCB board integrating the RP2040 chip, BioAmp front-end, and a LiPo power system for a compact, all-in-one wearable form factor.
- Expanded Multi-Class Classification: Expanding the ML framework to differentiate between Ischemic vs. Hemorrhagic stroke types and transient ischemic attacks (TIA).
- Clinical Validation Trials:Partnering with clinical researchers to validate on-device accuracy against multi-channel clinical EEG datasets in prehospital ambulance environments.
Built With
- bioamp-exg-pill
- biomedical-engineering
- bluetooth
- circuitpython
- edge-ai
- eeg
- micropython
- python
- raspberry-pi-pico
- rp2040
- scikit-learn
- scipy
- tinyml
Log in or sign up for Devpost to join the conversation.