













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Class: Senior Design Project Lab; Subject: Electrical and Computer Engr; University: University of Illinois - Urbana-Champaign; Term: Spring 2007;
Typology: Study Guides, Projects, Research
1 / 21
This page cannot be seen from the preview
Don't miss anything!














Electrocardiogram Pulse Detection for Home Use By Brooks Lindsey Youn Seok Heo ECE 445, SENIOR DESIGN PROJECT Spring 2007 TA: Hyesun Park May 1, 2007 Project 21.
In this project I designed and constructed a prototype for an electrocardiogram (EKG) device capable of storing and displaying measured data on a personal computer. The user of this device attaches two disposable electrodes at each wrist and can then view and save an EKG waveform and a measurement of heart rate in beats per minute. A message is also displayed indicating when a heart beat may have been missed. The device transmits data to the computer via USB, recording a new set of measurements whenever the user clicks the appropriate command on the user interface. A microcontroller and USB-UART integrated circuit (IC) are used to convert the analog signal produced in the user’s heart to digital information in the computer While the prototype functions correctly and provides usable data, further improvement could be made by providing battery power, detecting EKG wave features with greater reliability and eliminating the change in DC offset induced by user movements. ii
APPENDIX A – BLOCK DIAGRAMS................................................................Appendix, page 1 APPENDIX B – SCHEMATICS..........................................................................Appendix, page 3 APPENDIX C– TEST DATA...............................................................................Appendix, page 7 APPENDIX D – PICTURES...............................................................................Appendix, page 12 iv
I have developed an electrocardiogram (EKG) monitoring device that operates in tandem with the user’s personal computer. In this design, data is acquired using two wrist electrodes and is passed through analog filters and amplifiers before using a microcontroller and integrated circuit on an Arduino USB board to generate numerical data suitable for analysis with detection software. All data is passed through a USB port of the computer, while the software is implemented using Matlab. Maintaining safety of the user while connected to the device is of paramount importance, specifically in limiting the current traversing the users’ body.
The purpose of this project is to use the natural electrical signal provided by the heart and sound engineering in such areas as impedance matching of dielectric mediums, analog signal processing, hardware-software interfacing, and software analysis tools to develop a usable and highly accurate at- home product. As heart disease is the leading cause of death in this country, cardiac illness affects hundreds of thousands of people each year. Many heart conditions can be diagnosed by a trained medical professional after looking at a simple EKG readout, a waveform showing the variation in time of the electrical activity of the heart. Frequent monitoring of EKG on a personal computer using the device allows for familiarization with one’s EKG waveform, and any changes can be readily recognized. Users believing they see an abnormality in their EKG data can then seek medical attention earlier than they would otherwise be able to. The device also gives an indication if a missing beat is recognized.
Specifications for each block of the project are located in section 1.3, as seen in Diagram A.1 of Appendix A (All diagrams, tables and figures can be found in the appendices). An important specification for the overall project is the ability to capture and display a long enough data so that multiple cardiac cycles (multiple periods of the user’s EKG waveform) can be displayed with a single data capture. Typically, the heart rate to be detected falls in the range from 60 to 130 beats per minute. Using Equation 1.1, this means the period of the EKG signal is from 0.46 seconds (corresponding to 130 beats/min) to 1 second (corresponding to 60 beats/min). T [s] = (heart rate [beats/min] / 60 [sec/min])-1^ (1.1) A sample of 2 seconds would be needed to show two full cardiac cycles for a person with a heart rate of 60 beats per minute, although four cycles could be displayed for a heart rate of 130 beats per minute, though with some loss in wave details. In practice however, heart rates as low as 60 bpm were not seen among tested individuals, potentially due to the fact that users were alert and somewhat nervous when being tested. In addition, the sampling rate must be substantially high so that waveform details are clearly visible, since reading an EKG depends on recognizing the features of this waveform. The width of the narrowest feature in the EKG waveform, the QRS wave, is approximately 120 ms [1], so if the sampling rate is at least 16.67 Hz, then two samples will be taken on a QRS wave.
The analog to digital converter produces sets of numeric values by sampling the filtered electrocardiogram voltage signal at a specified sampling rate. As previously discussed (1.2), sampling rate must be high enough to capture the desired EKG features. As seen in Diagram A.1, analog to digital conversion can be performed by the microcontroller. 1.3.6 Microcontroller In addition to performing analog to digital conversion, the microcontroller must output data in a format capable of being converted to USB for reading into a computer. The microcontroller’s data output format is UART (Universal Asynchronous Receive/Transmit). 1.3.7 Personal Computer Interface The interfacing technology needs to transform the digitized signal so that data can be read into a personal computer via USB, the device can be recognized in Windows, and data can be manipulated and analyzed in a Windows-based software application. This requires either creation of drivers for the device or use of pre-existing drivers to allow our device to interface with Windows. In addition to voltage signal data, accurate time data must also be passed to software to allow computation of statistics. 1.3.8 Data-Analyzing Software The software application receives time and EKG data from the interface and allows the user to easily interact with the device. It computes, displays, and stores relevant statistics such as heart rate and missing beat information. An accurate, readable waveform with time scale also needs to be displayed and storable at the user’s request.
2.1 Power Supply Circuit Although an early design for a circuit to power the signal conditioning unit was created, it was never implemented due to time constraints. Interfacing components received power from the PC through the USB cable, while the signal conditioning unit was powered using +/- 9.0 V from the Agilent E3631A triple output DC power supply. 9.0 V was chosen after higher voltages caused chips to overheat after a few minutes of operation, and so that 9 V batteries could conceivably be used to power the device. 2.2 Signal Conditioning Unit Design The design of the signal conditioning circuit proceeded in stages until the final design was reached (Figure B.1). Initially, only an Analog Devices AD622 instrumentation amplifier was used to check signal intensity and noise levels without any filters. Because the largest noise contribution was at 60 Hz and the wide range for EKG measurement is 0.5 Hz to 50 Hz [5], initially first order RC filters were built with a high pass filter (fc = 0.5 Hz) and a low pass filter (fc = 50 Hz) in series on each input. When these failed to cut noise significantly, I began researching higher order filters. A standard second order filter design (visible in Figure B.1) was eventually selected [6] for a low pass filter with approximately the same cutoff as the first order filter. High pass filters were also created (Diagram A.4) after referring to a bioengineering project from a previous semester [7] in an attempt to eliminate DC components. The functioning of these filters was checked by performing circuit analysis on the designs referenced. While the measured response was good with these filters, the range of the pass band was eventually narrowed to yield a better SNR in the optimal heart rate frequency range. I believe the resulting range is still acceptable based on measured data (see section 3.2 for design details). A single AD 622 instrumentation amplifier was used to amplify the difference between the filtered signals measured at each wrist. The gain on this amplifier was set using a gain resistor RG according to the formula provided by the manufacturer [8].
Interfacing design encompasses everything between the output of the AD622 and the software receiving data (Diagram A.2). The initial design was to use a PIC 16F877A microcontroller to perform analog to digital conversion and to output using the PIC’s UART transmitter. From here, a UART-USB bridge IC (FT232) would be used to convert data to USB suitable for interfacing with a computer’s USB port. Device drives would then need to be written so that Windows would recognize the device and allow it to communicate with the software application. After spending several weeks simultaneously working on all parts of the interfacing (PIC programming, PIC to USB-UART chip communication, and device driver) without approaching functioning status on any of them, the decision was made to implement interfacing with the help of an Arduino USB board. This board essentially integrates a microcontroller (ATMEGA168) and the USB-UART chip (FT232) and has a connector for a USB cable so that all sampling as well as data transfer between these
nets. In addition, nets were labeled so that they could be connected to each other without drawing nets between them. To design the board, a board file was used to look at all the components. Maximum board size for the free version of Eagle is restricted and is denoted by a white rectangular border. Parts were then placed within this border and arranged so that they are located spatially close to their connecting parts. After the board design, the fact that drill sizes are slightly larger than the datasheet specification was accounted for. This is because Advanced Circuits places plates on the inside of the holes, thus reducing the size of hole. Also, components cannot rub against each other when the board is being soldered together. For the advanced circuits for the parts shop, .cam files were used. After receiving the PCB board, the maker of the board indicated that each connection needed to be checked because large boards seem to be a problem for the mill. An ohmmeter was used to perform this checking. Components were soldered onto the board and points were created for ground and the positive and negative supply voltages. Testing revealed the ground and negative supply voltages to be connected to each other so that when the power supply was connected, the negative voltage changed to zero volts. Thus the project was not able to be implemented successfully using the PCB.
Descriptions of all final block implementations as shown in Diagram A.1 are discussed in detail here.
As discussed in section 1.3.1, silver-silver chloride electrodes were chosen for their ability to close match tissue impedances. In addition, the wrist-to-wrist two electrode measurement scheme was chosen for its ease of use. Any user can quickly and easily access his or her wrists and attach disposable adhesive electrodes without extensive experience with electrode placement.
A standard second order filter design (can be seen in Figure B.1) was eventually selected [6] for a low pass filter with a cutoff of 53.05 Hz using 30 kΩ resistors and 0.1 μF capacitors. Standard LM741 op amps were used for each filter. fc = 1 / (2π(R 1 R 2 C 1 C 2 )½) (2.1a) (2.1) R 1 = R 2 = 30 [kΩ], C 1 = C 2 = 0.1 [μF] (2.1b) fc = 1 / (2π (30 103 [Ω]) (0.1 10 -6^ [F])) = 53.05 [Hz] (2.1c) High pass filters were also created (Diagram A.4) after referring to a previous bioengineering project [7] in an attempt to eliminate DC components. Calculations are similar to Equation 2.1 but with 3.3 MΩ resistors, producing a cutoff frequency of 0.48 Hz: fc = 1 / (2π (3.3 106 [Ω]) (0.1 10 -6^ [F])) = 0.48 Hz (2.2) While the measured response was good with these filters, the range of the pass band was eventually narrowed to yield a better SNR in the optimal heart rate frequency range. As shown in Diagrams A. and A.4, the R values from Equation 2.1a were changed so that R 1 = R 2 = 56 kΩ for the low pass filter and R 1 = R 2 = 1.5 MΩ for the high pass filter, yielding: fcLOW = 1 / (2π (56 103 [Ω])) (0.1 10 -6^ [F])) = 28.4 Hz (2.3a) fcHIGH = 1 / (2π (1.5 106 [Ω])) (0.1 10 -6^ [F])) = 1.06 Hz(2.3a) This range still includes relevant EKG frequency range, as 1.06 [Hz] 60 [sec/min], and no healthy user was measured this low. A single AD622 instrumentation amplifier was used to amplify the difference between the filtered signals measured at each wrist. The gain on this amplifier was set using a gain resistor RG according to the following formula [8]: Gain = (50.5 kΩ /RG) + 1 (2.4a) RG = 47.5 Ω (2.4b) Gain = (50.5 103 [Ω]/ 47.5 [Ω]) + 1 = 1064.2 (2.4c)
moments in time (whenever the user clicked), I had to find a way to detect the two time measurements from the microcontroller’s internal clock that I knew were embedded in each snapshot of data. Since the clock begins counting forward from zero immediately upon power on and since time values are in milliseconds, for all times beyond one second after power on, the time data will be greater than the maximum value of any data point (1023). So I simply scan the vector of input data in Matlab, picking out the values greater than 1023 and using the elapsed time to automatically create a set of time values equal in length to the number of data points between the time values. Matlab can then plot the EKG data, which is normalized so the highest value equals one, as function of time. Normalization of the EKG data allows for similar-looking EKG waveforms across different users and at different measurements, since the DC offset is ignored. This lends a uniformity of appearance to all waveforms produced by the device and enables quick interpretation of the waveform for use as a qualitative diagnostic tool. Normalization also proves important in detecting the presence or absence of pulses, the most important function of the software. It makes sense to detect the QRS wave of the EKG since it is the most prominent feature at the highest voltage and occurs once per cycle of the heart. The QRS wave is indicative of the strong wave of charge, or depolarization, that radiates through the heart during ventricular contraction. In ideal cases, or for a “standard” EKG waveform, the QRS wave is relatively easy to detect in software. An initial QRS wave is found by searching for the maximum of the data set, or the value equal to unity after normalization. Next a threshold is used to detect the other peaks in the data indicating QRS waves. For an unmoving user, setting the threshold at 99% of the maximum proved to be effective. Measuring the time between detected peaks allowed for computation of heart rate. The software was also set up to indicate a missed beat whenever 1.5 times the computed peak-to-peak interval passed without detecting another peak. The problem with this implementation was that some users were observed to have another EKG feature, the T wave equal to or greater than the QRS wave in magnitude (Figure C.6a). Using the standard detection scheme described above, this resulted in the recording of many false positives and the computation of an erroneously high heart rate. The solution to this difficulty would be to implement detection that also checked the width (time duration) of detected pulses rather than just the magnitude, as T waves for all users were observed to be appreciably wider than QRS waves. However, this would increase the lag in time between when the user clicks “update” on the user interface and the data is actually displayed on the computer monitor. The user interface (Figure B.4) was designed to be as simple as possible, consisting of three buttons to capture new data, save the current waveform image to disk, and clear data and axes to display the EKG waveform. As mentioned previously, heart rate data and whether or not a missing beat was indicated is automatically saved to a text file that is appended and displayed on each update. Image saves and statistics saves are both configured to include time stamps so that the user can easily sort through saved EKG data for later reference. Save locations on the user’s hard drive are configured automatically to keep data together and easy to locate. The software creates a new text file for statistics and a new directory to store waveforms if needed. 3.5 Power Supply Circuit Design Included in Appendix B (Figure B.3) is the design for a proposed power supply circuit using 9V batteries, although it was never implemented or tested. Battery powering would make our device more
marketable, particularly if it could be made to run for a long time without changing batteries or using less expensive batteries than 9V.
4. DESIGN VERIFICATION In general terms, the ultimate test of the device is if it safely and accurately records and displays readable EKG data from any user in a timely fashion. Testing procedures described in the design review were implemented as closely as possible as the project developed. These tests are detailed as follows: 4.1 Testing Because this product proposes directly connecting a user with no medical or electrical knowledge to a live circuit, safety is the most important consideration in testing. For this reason, two 220 kΩ current- limiting resistors are placed in series with the user and the device. It is important to note that internal body impedance and thus current to the user varies from person to person, as: Iuser = Vcardiac / Zbody (4.1) It should also be noted that the electrical signal produced in the heart will vary slightly between people. Current through the user (Iuser) was measured by taking the voltage across a 220 kΩ current-limiting resistor and dividing by 220 kΩ. This works because the system can be modeled as a single loop circuit, with only one voltage source, the heart and a single current passing through the impedance of half of the body to reach the wrist, then one 220 kΩ current-limiting resistor, then the device, then the other 220 kΩ resistor, then the impedance of the remaining half of the body. The maximum current to the user measured in testing was 0.454 μA, which is approximately 22 times below the safety limit on current to users of medical devices prescribed by the American Heart Association [10], 10 μA. Modular testing is described in the following sections. 4.1.1 Signal Conditioning Unit Tests The primary quantitative test for measuring the effectiveness of the signal conditioning unit’s filter and amplify setup is the measurement of signal to noise ration (SNR). This measurement was performed using an oscilloscope to first measure the peak-to-peak voltage of an EKG signal at the output of the signal conditioning unit, where peak-to-peak for EKG is defined to be from the minimum of a QRS wave to the maximum of the same QRS wave. Let this voltage be called Vsignal. Noise is measured using the oscilloscope to measure the width or distribution of the signal at what should ideally be a sharp peak of a QRS wave. Let this measured voltage be called Vnoise. SNR in decibels (dB) is given by the following formula. SNR = 20 log 10 (Vsignal / Vnoise) (4.1)
Because the power supply circuit was never implemented, testing for efficient use of battery power could not be completed as described in the design review document. All other testing indicated in this document was able to be performed, with the accuracy testing of the pulse detection circuit being replaced by the accuracy testing of the pulse detection software. For a true medical device to be used in a clinical setting, accuracy greater than the 90% we obtained would be desired, but this value is likely acceptable for a low-cost early screening device, which is the intended use of our device. The good SNR of the conditioning circuit contributed to this acceptable accuracy and to the high readability of the waveform on the computer screen. An important plus was the measured safety of the device, which shows no risk to users regardless of body impedance. The major area where our testing showed a need for improvement was in the device’s inability to deal with EKG waveforms having two peaks per cycle of similar magnitude (elevated T wave case). A more complex pulse detection algorithm is needed in order to do this, although this will slow data acquisition time even further.
This product did not have a target buyer beyond the simple goal of providing a health service to the general public, especially to those considered at risk or having a history of heart conditions. With the present implementation of the product, a major factor inflating production costs is the use of the Arduino USB board and its drivers rather than the cheaper microcontroller, USB-UART chip and self-written drivers proposed initially. Overall, part costs were high than I expected. It may be possible for manufacturers to find cheaper prices for components in the signal conditioning unit and for cables used.
Cost tables are included here rather than in the appendices. Tables 5.3 and 5.4 compare interfacing costs with and without the use of the Arduino USB board. Table 5.1 – Signal Acquisition Costs: Prices indicate bulk costs for electrodes and cables. Cost per device and for 10,000 units at these production prices are given. Signal Acquisition Costs Part Cost Number/Unit Cost/Unit Cost/10, Alligator to banana cable
Electrodes, 50 $9.50 1 pack of 50 $ 9.50 $ 95, Total Cost $18.35 $183, Table 5.2 – Signal Conditioning Unit Costs: Prices indicate bulk costs for large-scale production. Cost per device and for 10,000 units at these production prices are given. Printed circuit board (PCB) costs are rough estimates and assume high production. Signal Conditioning Unit Costs Part Cost Number/Unit Cost/Unit Cost/10, LM741 J $4.80 4 $19.20 $192, AD622 AN $2.25 1 $ 2.25 $ 22, Resistors $0.89 14 $12.46 $124, Capacitors, 0.1 μF $1.40 8 $11.20 $112, PCB fabrication estimate
Total Cost $46.11 $461, Interfacing Costs, with Arduino Board Part Cost Number/Unit Cost/Unit Cost/10, Arduino USB board
USB printer-style cable
Throughout the development of the project, several noticeable opportunities for improvement presented themselves. These areas will be discussed here before final conclusions on the project are drawn. 6.1 Improvements in Cost As discussed in section 5, cost seems like it may be prohibitive in the development and marketing of this project. Obviously using a microcontroller rather than the integrated board would help this. If a design could be developed to correctly integrate the signal detection unit, microcontroller, and USB-UART chip, it would be conceivable to design a printed circuit board for all of these components, which should reduce costs even further. It is possible that cheaper microcontrollers or a less expensive packaging of some of the chips used could also improve this situation. For example, the LM741CH and LM741H are nearly half the cost of the LM741J used in the prototype. The cost analysis in section 5 underlines the importance of finding low-cost suppliers of parts not only for ICs, but especially for device accessories like USB cables, alligator cables and electrodes. The product could be sold without any of these, but this would be misleading to the customer and would not really be ethical. There could also be some ethics concerns involved if using cheaper components means they do not function well or for a very long duration. This would be especially unethical since this is a medical screening device. 6.2 Technical Improvements One existing difficulty in using the device is that the user must be still immediately prior to and during recording of data. While data is not noticeably corrupted by moving or clicking the mouse, any movement of the limbs or torso results in a DC offset change that can disrupt QRS wave detection or shift the signal completely out of range of the A/D converter. A significant way to improve the operation of the device is to eliminate motion artifacts (Figure C.6b) by placing motion sensors at the location where each input cable attaches to an electrode. This is commonly done in commercially available EKG monitors, especially those for clinical use. However, the cost of an already expensive product would further increase. It should also be noted that product software could not rely upon Matlab since this is an engineering software package and not something most users would have, but the design and algorithms would be similar. One technique for dealing with the varying DC offset between users was implemented by a group in a previous semester [11] in which the first captured waveform was used as a reference to establish the baseline of the EKG for that particular user. On subsequent captures, this baseline would be subtracted. This is something of an alternative to my idea of pulling up the baseline to a small positive value for all users. While their method likely preserves dynamic range better than mine, it depends heavily on the correct detection of that first waveform and that it is free of motion or other artifacts. Because their method of computing heart rate depends on detecting waves at a set voltage above the baseline, I would think they would also have problems with users having abnormally high T waves, perhaps even more because they use a fixed voltage threshold rather than one that is normalized and thus changes for each user. 6.3 Final Project Conclusions
While not everything in the original design of the project was able to be implemented in the way that it was designed, project revision enabled the main features of the project to still be realized, although perhaps at a higher cost to the customer. In the end, I was pleased with the functionality of the project and the quality of the waveforms that could viewed on the screen. I was also pleased with how well the device was functioning “out of the box.” Although still very much a prototype requiring several connections to be made to set up the device before each use, once the project was set up it functioned remarkably well right away on different users (as long as the user remained still). I was also pleased with the accuracy of the heart rate computation, as this is encouraging for creating software capable of recognizing more advanced shapes or arrhythmias. A product such as this could be very useful because it could allow people to receive medical diagnosis and treatment in areas where there are few trained medical personnel, such as in developing nations. Finally, the experience of creating this project from one end to the other—although trying at times—was helpful to see a practical useful for different concepts and for learning which areas are best implemented in hardware or software, considering both technical and cost considerations.