TinyML ECG Atrial Fibrillation Detection
ISEF Category: Embedded Systems
Ready to Turn This Idea Into a Real Project?
This guide was put together with the help of AI research tools to give you a solid starting point. But a competitive science fair project lives in the details: refining your research question, fine-tuning your variables, analyzing your data, and presenting your findings like a seasoned scientist.
For next steps tailored to your interests, skill level, and timeline, work one-on-one with a MehtA+ mentor. Learn more about MehtA+ Science & Engineering Research Mentorship →
Subcategory: Signal Processing · Difficulty: Advanced · Setup: School Lab · Time: Full Year
The Hook
A tiny chip can spot a heart rhythm problem before a person feels anything wrong. That sounds like magic, but it comes from signal processing and smart model design. You can test whether a microcontroller can read raw ECG and flag atrial fibrillation in real time.
What Is It?
This project asks you to build a small machine learning model that reads ECG, which is the electrical signal from the heart, and decides whether the rhythm looks normal or like atrial fibrillation. Atrial fibrillation, or AFib, means the upper chambers of the heart beat in a messy pattern. The ECG trace often looks irregular, like a drumbeat with no steady rhythm.
Think of it like listening to music with a beat detector. A human can hear the pattern, but your model has to do the same job from raw data. TinyML means machine learning made small enough to run on a microcontroller, which is a tiny computer with limited memory and power. Quantization-aware training means you train the model so it still works after its numbers get compressed for a small device.
The hard part is not just making a model that works on a laptop. You need one that stays accurate after shrinking it to fit on a Cortex-M0 class device. That makes this a real engineering problem, not just a coding exercise.
Why This Is a Good Topic
This is a strong science fair topic because you can test clear inputs and outputs, compare model versions, and measure tradeoffs between size, speed, and accuracy. It connects to a real health problem, since AFib screening can help catch stroke risk earlier. You can learn signal processing, model evaluation, embedded deployment, and error analysis without needing a wet lab.
Research Questions
- How does quantization-aware training affect AFib detection accuracy on a microcontroller-sized model?
- What is the effect of model size on inference speed and memory use for real-time ECG classification?
- Does a model trained on raw ECG perform better than one trained on hand-engineered ECG features?
- To what extent does adding noise or signal drift change AFib detection accuracy?
- Which input window length gives the best balance of accuracy and latency for Cortex-M0 deployment?
- What is the effect of class balancing on false positives for AFib detection?
Basic Materials
- AD8232 ECG module or similar low-cost ECG sensor board.
- Compatible electrodes and lead wires.
- Microcontroller board with Cortex-M0 class performance or similar limited-memory board.
- USB cable and laptop.
- Breadboard and jumper wires.
- Stopwatch or timer.
- Data files from the MIT-BIH Arrhythmia Database.
- Spreadsheet software for tracking accuracy, memory use, and inference time.
- Digital scale or ruler is not needed for this project.
- Notebook for logging model versions and test results.
Advanced Materials
- Electrocardiography front-end hardware with analog output.
- Cortex-M0 development board with memory profiling support.
- Oscilloscope or logic analyzer for timing inference latency.
- Signal generator or ECG simulator for safe test signals.
- Current meter or power monitor for battery draw tests.
- Access to a Python environment for training and evaluation.
- Access to a labeled ECG dataset such as MIT-BIH Arrhythmia Database.
- Precision resistors and prototyping parts for signal conditioning experiments.
- Optional ECG simulator hardware for controlled validation.
- Secure data storage for model checkpoints and experiment logs.
Software & Tools
- Python: Trains and evaluates your ECG models and handles dataset prep.
- TensorFlow Lite for Microcontrollers: Converts and runs small models on embedded hardware.
- MIT OpenCourseWare: Offers free background on signals, systems, and embedded basics.
- ImageJ: Not needed here, so skip it and focus on signal tools instead.
- MATLAB Online: If your school provides access, it can help with signal inspection and filtering.
Experiment Steps
- Define the exact AFib detection task, including whether you will classify short ECG windows or full recordings.
- Choose one baseline model, then plan a second version that uses quantization-aware training so you can compare them fairly.
- Decide how you will measure success, including accuracy, sensitivity, specificity, model size, and inference time.
- Prepare a clean data split that prevents the same patient from appearing in both training and testing sets.
- Plan how you will test on both the public dataset and your microcontroller, so you can compare laptop performance with embedded performance.
- Build controls that check whether noise, class imbalance, or window length changes the model’s behavior.
Common Pitfalls
- Training and testing on ECG segments from the same patient, which inflates accuracy without showing real generalization.
- Shrinking the model after training without accounting for quantization loss, which can break AFib detection on-device.
- Using a data split that mixes nearby time windows from the same recording, which leaks pattern information into the test set.
- Reporting only overall accuracy, which hides false negatives that matter for medical screening.
- Testing inference time on a laptop and assuming the result matches Cortex-M0 performance, which it does not.
What Makes This Competitive
A competitive project goes past basic classification and measures the engineering tradeoffs in a careful way. You can compare raw ECG, engineered features, and different quantization methods, then show how each choice affects memory, speed, and error patterns. Strong work also uses patient-level splits, confusion matrices, and tests on real embedded hardware, not just offline code. If you can explain why one design survives compression better than another, your project starts to look like research.
Project Variations
- Train the same AFib detector on a different arrhythmia dataset and compare how well it transfers.
- Replace raw ECG with feature-based inputs, then test whether handcrafted features help tiny models more than end-to-end learning.
- Measure how noise filtering before inference changes false alarm rates on low-quality ECG signals.
Learn More
- MIT OpenCourseWare Signals and Systems: Search MIT OpenCourseWare for free lecture notes on signal processing concepts that support ECG analysis.
- NIH PubMed: Search for review articles on atrial fibrillation detection, ECG classification, and wearable monitoring.
- PhysioNet: Explore public ECG datasets and challenge papers, including MIT-BIH resources and benchmark methods.
- TensorFlow Lite for Microcontrollers: Read the official guides for deploying small models on embedded devices.
- NASA Open Science resources: Search for free material on time series analysis and sensor data methods that transfer well to ECG work.
