CSE 466 Lab 9-- Final Project:
Improving the Electrocardiograph
Introduction
In this lab you'll use the basic recorder you built in Lab 8. Don't proceed until that lab is finished and working correctly..
Objectives
In this lab, you will add performance improvements and new features:
- Digital filtering to improve the waveform display and reduce unwanted noise
- A QRS detector to accurately measure R-R periods in the heart waveform, and display in BPM (Beats per Minute)
- Measurements and tests for additional heart characteristics and their display
- Improvements to the user interface
Suggested Reading and Resources
Material on detection algorithms
To Do:
NOTE: Read through the entire lab so you know what is coming, and you can plan accordingly.
Understand that you should do as much as you and your partner can, but the final work you demo and hand in should be working and polished. This is an open-ended project; nobody is expected to implement all of what is suggested here.
...in other words, ...surprise me...!!!
I. Add some digital filtering to clean up your signal
Copy your code from Lab 8 to a new sketch called HeartMonitor.ino. Add some digital filtering to your code to smooth and clean your signal. See the lecture notes on Digital Filtering for notes on filter characteristics and bandwidths.
Note: This processing should be added before the data is written to the display or to the file on the SD card.
A lowpass Butterworth 4-pole IIR filter, an FIR lowpass filter or a moving-average filter are possible choices. Experiment with filter orders, lengths and frequencies to find the optimum compromise between useful information and noise elimination.
A good tool is the Interactive Filter Design Tool- IIR and FIR with C code shown above.
II. Add a Heart Rate display to your Display and File
Implement a QRS detection algorithm of your choice, derive the Heart Rate and and display it, in Beat-per-Minute (BPM). In your code comments, include a brief explanation of how your algorithm works. See the references above, particularly the paper Real Time ECG Feature Extraction, and the lecture slides on QRS detection. Accurate detection of the R-peak of the QRS complex is crucial to the success of additional detection algorithms.
Notes:
- You should construct a separate data flow of your displayed heart data, with additional processing, to allow for filtering and other processing.
- You may need to do a short moving average of the R-R interval you measure, of 2 or 4 beats.
- Adding markers at the bottom of your display to indicate where you detect the QRS R-peak may be helpful in debugging.
- Test your results on as many fellow students as possible; robust algorithms are valued. Take time to be a test subject for others.
III. Add some additional Analysis Routines
Implement as many detectors as you can to identify several types of heart Arrhythmia:
- Bradycardia
- Tachycardia
- Premature Ventricular Contraction (PVC)
- Premature Atrial Contraction (PAC)
For information about these see the lecture notes and the paper Real Time ECG Feature Extraction.
You should display your results on screen, and write your results to the file on the SD card.
An display example which you can modify is shown in Figure 13 of the above paper:
Tailor your display to fit the information you detect.
IV. Add User Interface Features
- A second button will allow you to scroll your display data left and right after capture.
- Add the ability to recall a previous file from the SD card and display it.
Deliverables
- Write a short theory-of-operation document describing your QRS detector and any Arrhythmia detectors you implemented.
- Demonstrate your working Heart Monitor and the data on the SD card to the class during the Final Projects demo as below. Your sketch should have both partner's names in comments at the beginning. Turn in your HeartMonitor.ino, your theory-of-operation document, and a sample file from the SD card. All deliverables should be uploaded to your Catalyst Dropbox before the Final Project Demo time.
Final Projects demo and turn-in: Thursday, December 11, 2014, 830-1020, in CSE003