125:315 BME MEASUREMENTS AND ANALYSIS LABORATORY FALL 2004 LABORATORY #3: BIOMEDICAL SIGNAL PROCESSING & ECG I. Objectives 1. Design a data acquisition system with LabView and BIOPAC. 2. Understand the effects of low, high, and band-pass filters on ECG filters. 3. Develop an algorithm for computing heart rate and implement the algorithm in LabView. II. Introduction The main function of the heart is to pump blood through two circuits: 1. Pulmonary circuit: through the lungs to oxygenate the blood and remove carbon dioxide; and 2. Systemic circuit: to deliver oxygen and nutrients to tissues. Because the heart moves blood through two separate circuits, it is sometimes described as a dual pump. II.1. The Electrical and Mechanical Sequence of Heartbeat The heart has four chambers - two atria and two ventricles. The walls of these chambers are made mainly of special heart muscle. The chambers have to contract (squeeze) in the correct order for the heart to pump blood correctly with each heartbeat. The sequence of each heartbeat is as follows: The sinoatrial node (SA node) in the right atrium is like a tiny in-built 'timer'. It fires off an electrical impulse at regular intervals. (About 60-80 per minute when you are resting and faster when you exercise. This controls your heart rate.) Each impulse spreads across both atria which causes them to contract. This pumps blood through one way valves into the ventricles. The electrical impulse gets to the atrioventricular node (AV node) at the lower right atrium. This acts like a 'junction box' and the impulse is delayed slightly. Most of the tissue between the atria and ventricles does not conduct the impulse. However, a thin band of conducting fibres called the atrioventricular bundle (AV bundle) acts like 'wires' and carries the impulse from the AV node to the ventricles. The AV bundle splits into two - a right and left branch. These then split into many tiny fibres (the Purkinje system) which carry the electrical impulse throughout the ventricles. The ventricles contract and pump blood through one way valves into large arteries. o The arteries going from the right ventricle take blood to the lungs. o The arteries going from the left ventricle take blood to the rest of the body. The heart then rests for a short time (diastole). Blood coming back to the heart from the large veins fill the atria during diastole. o The veins coming into the left atria are from the lungs (full of oxygen). o The veins coming into the right atria are from the rest of the body (depleted of oxygen). The sequence then starts again for the next heartbeat. The closing of the valves in the heart make the 'lubdub' sounds that a doctor can hear with a stethoscope. II.2. The Electrocardiogram (ECG) An electrocardiogram, also called an ECG or EKG, is a graphic record of the heart's electrical activity. It is a noninvasive test that is used to reflect underlying heart conditions by measuring the electrical activity of the heart. Many heart conditions can be learned by looking for characteristic patterns on the ECG. An ECG is obtained by positioning electrical sensing devices/leads on the body in standardized locations. The four extremities and the chest wall have become standard sites for applying the electrodes. Standardizing electrocardiograms makes it possible to compare them as taken from person to person and from time to time from the same person. A normal characteristics ECG is represented in figure 1. It has a typical upward and downward deflection that reflects the alternate contraction of the atria and the ventricles. Figure 1: Normal ECG Waveform (http://www.temple.edu/biomed/qrs.html) III. Purpose The purpose of this laboratory experiment is to understand the collection, processing and acquisition of ECG signals using two different data acquisition systems as well to compute heart rate from ECG by using R-R wave time intervals and using FFT analysis. IV. Materials and Methods IV.1. Apparatus Hardware PC running Windows BIOPAC Data Acquisition Unit (MP30) LabView Data Acquisition Unit 1 BIOPAC electrode lead set (SS2L) BIOPAC disposable vinyl electrodes (EL503) BIOPAC Electrode gel (GEL1) and abrasive pad (ELPAD) Software LabView Software BIOPAC PRO Student Lab Software IV.2. Setup BIOPAC 1. 2. 3. 4. 5. 6. 7. Plug an Electrode Lead Set into CH 1 on the Biopac MP30 unit. Turn the MP30 data acquisition unit on. Turn the computer on. Go to MP30 > Setup Channels Go to Channel1 (CHl) , then click on ‘Presets’, Select ECG (0.5 – 35 Hz) Click ON the boxes under Acquire Data, Plot on Screen, and Enable View Display. From the bars menu, go to MP30 >Data Acquisition > Set the acquisition length to 3 minutes. LabView Don’t start the LabView Setup before finishing your measurements with BIOPAC, once you are ready: 1. Launch the LabView software on the host computer. 2. Connect the BIOPAC Electrode lead set to the channel on the rightmost of LabView Unit. IV.3. Subject — Electrode Connections 1. Remove all substantial metal jewelry from the Subject and make sure that the subject is not touching any metal (metal pipes, chairs etc.). 2. Place three electrodes on the subject as the table indicates. Electrode Position Lead Color Centered on the anterior wrist (same side Right arm as the palm of the hand), about 0.5-1.0” White down from the palm Right leg Medial, just above the ankle, flat on skin (not over bone) Black Left leg Medial, just above the ankle, flat on skin (not over bone). Red 3. Attach the electrode leads by color as shown in the table. The pinch connectors work like small clothes pins, however they will attach to the electrode only on one side. You may have to rotate the pin to make sure the metal on the inside of the clip is connected, touching and clamped onto the electrode at the base of the nipple. Clip connector cables to subject’s clothing, or place so that there is no strain on the electrode clips or the cable wires at any point in the set up 4. Wait 5 minutes after the electrodes have been attached to the skin to begin recording (this gives the gel time to settle and maximize conductivity). IV.4. Measurements and Data Collection Data Acquisition by using BIOPAC 1. 2. 3. 4. Once the subject is ready, click start to begin the ECG recording. Record for at least 1-2 minutes. Make sure your data looks like the ECG waveform in Figure 1. Stop recording and save your data. Designing the Data Acquisition System with LabView 1. Launch LabView software. 2. Open a new LabView VI. 3. Acquire Signal: Select the DAQ assistant in the block diagram of your LabView VI. The DAQ Assistant is graphical interface for configuring measurement tasks and channels in LabView. The Daq assistant may be selected under “Input” from the drop down menu that appears by right clicking on the block diagram. http://zone.ni.com/devzone/conceptd.nsf/webmain/2F464ACECA02E54E86256D790073BC30 4. Set parameters to obtain an ECG signal: From Analog Input, select ‘Voltage’. From supported physical channels, click on Channel ‘ai0’. When the ‘Analog Input Voltage Task Window’ comes up: Adjust the ‘Input Range’ from -5V to +5 V. Set the ‘Terminal Configuration’ to ‘Differential’. Set the ‘Acquisition mode’ to ‘Continuous’. From the Clock Settings, select the ‘samples to read’ to 750, and the ‘sampling frequency’ to 500. 5. Amplify signal: This can be done by simply multiplying the signal output by a constant of ‘250’. To find a multiplier: right click on the block diagram, select FunctionsAll Functions, and go to Numeric, then select ‘Multiply’ To add a numeric constant: right click on the block diagram, select FunctionsAll Functions, and go to Numeric, then select ‘Numeric Constant’ http://zone.ni.com/devzone/conceptd.nsf/webmain/0214A86C42DA256D86256D2800040773?o pendocument 6. Create graph on front panel http://zone.ni.com/devzone/conceptd.nsf/webmain/1EFD9CB48881C4DD862569AB00802282? opendocument 7. First connect the output of amplified signal to the graph and rename it as “Input Data”, and then the same output will be connected to the Band-stop Filter. To add a band-stop filter, right click on the block diagram, go to ‘Functions’Analysis Filter, select band-stop filter. 8. Set the lower and higher cutoff frequencies to 45 Hz and 75 Hz respectively for the band-stop filter to remove 60 Hz noise from the input signal. Select: ‘Infinite Impulse Response’ (IIR) filter. Topology: Butterworth Order: 1 9. Right click on lower cut-off frequency and upper cut-off frequency to create a control. 10. Connect the output of band-stop filtered signal to: A Waveform you will create on front panel, then to: A Low Pass Filter To add a low pass filter, right click on the block diagram, go to ‘Functions’Analysis Filter, select low pass filter. 11. Set the cut-off frequency of the low pass filter to 40 Hz. Select: ‘Infinite Impulse Response’ (IIR) filter. Topology: Butterworth Order: 3 12. Right click on lower cut-off frequency to create a graphical indicator 13. Connect the output of low pass filtered signal to: A Waveform you will create on front panel, then to: A High Pass Filter To add a high pass filter, right click on the block diagram, go to ‘Functions’Analysis Filter, select high pass filter. 14. Set the cut-off frequency of the High Pass to 0.5 Hz. Select: ‘Infinite Impulse Response’ (IIR) filter. Topology: Butterworth Order: 3 15. Right click on higher cut-off frequency to create a graphical indicator 16. Connect the output of high pass filtered signal to: A Waveform you will create on front panel, then to: FFT graphical user interface (GUI) To add a FFT GUI, right click on the block diagram, go to ‘Functions’Analysis Spectral (FFT) 17. When the FFT window comes up, set the parameters as follows: Spectral Measurement: Magnitude (RMS) Window: Hamming Result: Linear 18. Connect the output of FFT GUI, to a waveform graph. 19. Right click on the waveform graph, select ‘Properties’, to set up as: Click on ‘scales’, select X-axis, adjust the minimum to: 0 and the maximum to : 50 Select Y-axis, click on ‘Log’ Adjust the minimum to: 0.001 and the maximum to : 1 20. Recreate graph to plot continuously: While loop: To create a while loop go to FunctionsExec Ctrl While Loop Include all within the while loop. 21. Click ‘Run’ button to start recording. IV.5. Data Analysis and Interpretation BIOPAC 1. From your ECG recordings, calculate heart rate for 10 cycles (R-R interval); Set up the measurement box to BPM: Beats per minute. 2. Calculate the mean, maximum, minimum, standard deviation for those 10 heart beats. 3. From the menu bar go to Transform FFT set up as: Linear Hamming Window Pad with last points Remove mean, remove trend LabView 1. 2. 3. 4. Calculate heart rate from the time interval between two R waves. Compare this value with the heart rate you calculated using Biopac. Is your heart rate within the normal heart rate range? Is there peak in your FFT graph that corresponds to your heart rate calculated from (1)? V. Lab Report Guidelines V.1. Report Format Introduction: Motivate lab in your own words (personal assessment of topic importance); Give justification for methods used in the laboratory experiment. Methods: Description of data collection and measurements. Describe experimental protocol and care taken to perform the laboratory experiment. Results: Data (Objective summary of results). Focus on the organization of the data. Analysis: Meaning of the results, how data processing such as filters and data analysis such as FFT can help to better interpret your results. What conclusions can or cannot be made and why? Include results from IV.5: Data Analysis and Interpretation. Summary & Conclusions: Include only overall trends or findings from Analysis Section. There need be no more than 3 or 4 main points. Base your discussion on the questions in V.2, below. References: (quote all sources used, including web sources, no plagiarism) V.2. Analysis Guide Questions 1. Why do you need to use an FFT analysis? Give examples where FFT analysis would be significant. Explain the results you obtained from your FFT analysis. Compare the results you obtained with BIOPAC and LabView. 2. How did we decide on the filters to be used in data processing, explain the effects of filters and gain you used on your raw ECG data? 3. Explain the difference between the signal acquired by BIOPAC and LabView systems. Why do you think there is a difference? 4. Does the heart rate remain the same? Discuss the reasons behind the heart rate variability. 5. What is the clinical significance of ECG?