BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 02.05.08 Signal Processing Breadboard Lab Summary: Lab 1: Square Wave Oscillator Lab 6: QRS Detection: Band Pass Filter video 3 Lab 2: Instrumentation Amplifier video 1 Lab 7: QRS Detection: Absolute Value Circuit video 4 Lab 3: High Pass Active Filter Lab 8: QRS Detection: Low Pass Filter and Overall System Test Video 5-log Lab 4: Active Gain Block and Low Pass Filter Lab 5: Notch Filter for 50/60 Hz Rejection video 2 The Signal Processing Labs use the BIOPAC SS39L Signal Processing Breadboard, the SS39L Interface Cable, SS60L Interface Cable, and the BSLTCI-22 Breadboard Electrode Interface. Page 1 of 63 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Signal Processing Background The human body can be studied by viewing the potential difference (Voltage) between strategically placed surface electrodes. Because surface electrodes are an easy, non-invasive way to obtain information about the body, they represent a good starting point for examining the types of electronic circuits used in Biomedical Engineering. In order to view and record the potential difference between surface electrodes, electronic circuits are used. Electrode leads, which are essentially wires, connect the electrodes to the circuit. Most signals from physiological activity have small amplitudes and must be amplified and processed before they can be viewed in a meaningful way. The good news is that the characteristics of biopotential amplifiers are much the same as any other amplifier. We will review the basics of amplifiers, with special emphasis on the biopotentials. 1. Gain. Physiological signals have amplitudes that range from several microvolts to a few millivolts. To drive display and recording equipment, most biopotential amplifiers have gains of 500 or greater. It is useful to use the decibel form of gain, which is obtained from linear form by the formula: Gain(dB) = 20 log10 (LinearGain) 2. Common-mode rejection (CMR). The human body makes a reasonably good antenna, and will create electric potentials from electromagnetic radiation present in the atmosphere. A serious problem is 50/60 Hz radiation - present almost anywhere there is electric power. The problem become acute when the biopotentials we wish to monitor have useful energy in the 50/60 Hz range. CMR is the property of canceling any signals that are in common to both inputs, while amplifying differential signals (a potential difference between the inputs). Both AC and DC CMR are important for physiological signals. CMR is usually specified for a common-mode voltage change at a certain frequency. The common-mode rejection ratio (CMRR) is first obtained: CM CMRR = AD (VVOUT ) where AD is the differential gain of the amplifier VCM is the common-mode voltage present at both inputs of the amplifier VOUT is the output voltage result when the common-mode inputs are applied The logarithmic conversion of CMRR, common-mode rejection is defined as: CMR(dB) = 20 log10 (CMRR) 3. Frequency response. The bandwidth of a physiological amplifier should accurately amplify all the frequencies of importance in the signal, while rejecting those signals outside the bandwidth of interest. The bandwidth is defined as the difference between the low frequency cutoff and high frequency cutoff. The cutoff is defined at the point where the gain is 0.707 of the midpoint gain of 2 the response, and is alternatively called the half power point ( 0.707 = 0.5) , or –3dB point, since − 3.01(dB) = 20 log10 (0.707) . 4. Input impedance. A fundamental rule of measurement is to not allow the measuring device influence the signal under observation. An amplifier should exhibit high input impedance so as to not measurably attenuate physiological signals being measured. In the case of the ECG, the ECG electrode itself has low impedance, but skin impedance can range from 100 ohms to 1M ohm. Amplifier input currents cause potentials across the skin impedance that are amplified by the gain of the amplifier, causing large DC offsets in the amplifier output. 5. Noise and drift. Unwanted signals that contaminate physiological measurements, noise produced within amplifier circuitry is generally defined as those signals with components above 0.1Hz, while drift refers to the changes in baseline below 0.1Hz. Noise can be measured in microvolts peak to Page 2 of 63 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 peak ( μV p− p ) or microvolts root mean square ( μVRMS ). Sources of drift include offset voltage drift (varying input impedance), and gain drift, usually affected most by temperature. 6. Electrode polarization. Electrodes made of metal, and used with a electrolyte, such as the standard ECG Silver/Silver chloride electrode, form small potentials resulting from ion electron exchange between the electrode and the electrolyte (as in a battery). The challenge for the amplifier designer is to amplify the weak physiological signals in the presence of these polarized dc signals. Page 3 of 63 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 ECG Background The generation of electrical activity in the heart is characterized by mechanical events. During the period of diastole, the heart rests between beats, and assumes its maximum size while filling with blood that has been oxygenated by the lungs and venous blood from the body. Mechanical activity in the heart is called systole and is initiated by contraction of muscles surrounding the atria by electrical stimulation. The stimulations of the sinoatrial node (SA node), a bundle of nerves located in the right atrium, start the heartbeat and set the frequency of cardiac rhythm. This rhythm can be modified by nerve fibers external to the heart that function to control the hearts response to increases or decreases in the body’s demand for blood. Contractions of muscles comprising the atria are stimulated by impulses generated by the SA node. Impulses from the SA node are conducted along nerve fibers in the atrium to depolarize the atriovetricular node (AV node). AV node stimulation causes contraction of the muscles comprising the ventricles via the bundle of His and the Purkinje conducting system. The depolarization and repolarization of the SA node is followed by the depolarization and repolarization of the AV node – this is the electrical control system that initiates the muscle contractions necessary to maintain the heart’s pumping action. This nerve system generates the external action potentials known as electriocardiogram (ECG), which can be recorded by electrodes at the surface of the body. ECG waveform and heart function (from Biophysical Measurements, P. Strong, Tektronix Inc.) It is important to understand the basic functions of the heart as shown by the ECG waveform. The QRS spike is associated with the rapid depolarization of ventricular muscle immediately preceding its contraction. The P wave is the result of atrial depolarization and the T wave is caused by ventricular muscle repolarization. Monitoring this electrical generator, enclosed in a torso, is the function of electrocardiography. By attaching electrodes to certain places on the body, the small electrical potentials on the surface are sensed. The potentials can then be amplified, conditioned and displayed to give a representation of the heart’s electrical activity. Assuming we will be using the basic frontal plane cardiac vector – a standard placement of electrodes – we can construct a simple ECG monitor to record the potentials. Circuit requirements: The ECG QRS spike can range from 400 uV to 2.5 mV peak, and will require a voltage gain of 100 to 1000. ECG bandwidth has been standardized to make interpretation of the results uniform. Two filters with 3dB cutoffs are used – a high pass filter at 0.05Hz and a low pass filter at 100Hz. A 60Hz (or 50Hz) notch filter is used to attenuate nominal mains interference. Although the waveform of the ECG is considered as a low frequency AC signal, there can be significant DC offsets between the electrodes on the body (0 to ±20mV DC). With a voltage gain at +1000, a DC offset of 20mV will cause an amplifier to try to produce a signal at 20.0V, higher than typical power supplies permit. We must prevent DC offsets from swamping the AC signal of interest, and we do this with a high pass filter. Signals present on the electrodes higher than 100Hz contribute noise to the ECG that must be reduced to present an accurate view of the ECG. Potentials generated from muscle activity are undesirable in the ECG and are partially reduced with the low pass filter (it is required that a person being monitored for ECG remain relaxed and motionless.) There are numerous other potentials that are inadvertently amplified when using electrodes to monitor ECG. The mains power produces very high levels of EMI interference, which must be Page 4 of 63 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 carefully eliminated. The use of shielded electrodes, coupled into a differential amplifier, can reduce EMI mains interference dramatically. Other sources of EMI include radio stations, cell or portable phones, microwave sources, computers, and automotive ignition. We will not attempt to squelch all these sources of interference, although you may experience them in your circuits. Page 5 of 63 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Breadboard Setup The SS39L Breadboard is designed to rapidly prototype the ECG circuitry without the use of soldering equipment. Close examination of the SS39L Breadboard reveals that there are five individual boards mounted on the plastic base. The top bus strip has a row of two power bus rows. Next is a strip that contains a 5x64x2 connection array, designed to easily accept 0.3” Dual In Line (DIP) integrated circuits (IC). Beneath the 5x64x2 strip is another power bus strip identical to the top strip. The BIOPAC lessons do not use or refer to the bottom two boards. The power busses are not labeled on the SS39L, so for safety and reliability, add the following labels: • • • • Top Row: ‘-5’ Row above row A: ’G1’ Row below row J: ‘G2’ Next Row: ‘+5’ The power strips must be wired so that the top bus is connected to -5.0V (Green terminal), the bus above row A is GND (Black terminal), the bus below row J is also GND (Black terminal), and the last bus is connected to +5.0V (Red terminal). Needle nosed pliers are recommended for inserting wires into the breadboard. 1. Connect a Brown 1.0” jumper from the Black terminal (GND) to the bus above Row A (G1). Connect a Red 2.0” jumper from G1 to G2. 2. Connect a Yellow 4.0” jumper from the Red terminal (+5V) to the bus +5. 3. Connect a Brown 1.0” jumper from the Green terminal (-5V) to the bus -5. 4. Each bus is actually divided into two half busses. Bridge all the busses by adding four 0.3” Orange jumpers as shown below. Next, place all the integrated circuits and wire them to the power busses, adding the decoupling capacitors. 1. Place the LMC6484A with pin 1 in row F, column 55 2. Place an LM324 with pin 1 in row F, column 35 3. Place an LM324 with pin 1 in row F, column 24 4. Place an LM324 with pin 1 in row F, column 13 5. Connect four 0.01uF capacitors with one end in pin 4 of each IC, the other end to G2 bus. 6. Connect four 0.01uF capacitors with one end in pin 11 of each IC, the other end to G1 bus. 7. Check all capacitors for short circuits. 8. Place the BSLTCI-22 Breadboard Electrode Adapter with pin 1 in row A, column 48. Page 6 of 63 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Power Verification BME ECG Board Layout with Integrated Circuits The following steps will apply +5V and -5V isolated power to the breadboard from the MP35. The MP35 power is limited to about 100ma. If the MP35 power is overloaded by the breadboard circuitry due to improper wiring, the MP35 may not perform acquisitions properly. 1. If inserted, remove the DB9 end of the SS39L cable from the MP35, and turn off the MP35. 2. Plug in the SS39L Cable Black (GND) banana plug into the Black terminal jack. 3. Plug in the SS39L Cable Red (+5) banana plug into the Red terminal jack. 4. Plug in the SS39L Cable Green (-5) banana plug into the Green terminal jack. 5. Plug in the SS39L Cable GND Reference pin into the breadboard GND bus G1. 6. Plug in the SS39L Cable SIGNAL pin into the breadboard GND bus G1. 7. Plug in the SS39L Cable DB9 plug into CH1 of the MP35. 8. Plug in the SS60L Cable DB9 plug into CH2 of the MP35. 9. Plug in the SS60L Cable SIGNAL pin into the breadboard GND bus G1. 10. Plug in the SS60L Cable GND pin into the breadboard GND bus G1. 11. Turn on power to the MP35. Verify 5V(±5%) and -5V(±5%) power buses with a DVM. • If at any time during the experiments the measured power busses drop below their rated values, turn off the MP35 and find the cause of the circuit overload in your breadboard wiring. 12. Start BSL PRO. Make a sample reading of the MP35 (Start). Verify that the reading is ~0.00V DC. If there is a problem with power that causes the MP35 startup routine to fail, the Busy light on the MP35 front panel will flash an error code sequence, and will not allow a recording to occur. The Busy light normally comes on for 1 or 2 seconds, blinks once for USB renumeration, stays on for 10-20 seconds for self-calibration, then turns off. The Busy light then monitors USB data transfers. Page 7 of 63 BSL PRO Signal Processing Breadboard Labs © BIOPAC 2005 Figure 1 – BME LAB SCHEMATIC – 1 of 2 Page 8 of 63 www.biopac.com BSL PRO Signal Processing Breadboard Labs © BIOPAC 2005 Figure 1 – BME LAB Schematic – 2 of 2 Page 9 of 63 www.biopac.com BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Lab 1: Square Wave Oscillator Objectives: 1. Create a Square Wave Oscillator, which will be used to test the remaining circuits in the BME labs. 2. Approximate the magnitude of an ECG signal. Background: The step voltage has great value in analysis of amplifiers. The square wave generator built in this lab is used later to determine gain and AC-response of the remainder of the circuits in the BME Breadboard Labs. Square wave generators are available commercially, but self-test is an important part of most modern medical equipment, so it is included as the first project. A Square Wave Oscillator can be designed using the opamp as a Schmitt comparator, using a single quad opamp (Fig. 1.1). Fig. 1.1 Schematic for SS39L Breadboard Lab 1 Referring to the schematic, the Square Wave output voltage is Vo, and the voltage across the capacitor is Vc. The voltage across the comparator inputs Vi is the difference of (Vc – ßVo). Assuming an ideal comparator response, with the voltage Vi < 0, the capacitor charges exponentially toward Vo through the RC combination. The output stays at Vo until Vc=+ßVo, which causes the comparator output to reverse to – Vo. Vc charges exponentially toward –Vo. The output will continue this cycle, with the period T: T = 2 R3 C1 ln (1 + 2 R1 ) R2 The output will swing rail to rail. With the LMC6484 opamp (supplied with the SS39L), expect ~9.8 Vpp signal out, with some offset due to mismatch between positive and negative rail levels. This will also affect the square wave symmetry. The oscillator is followed by an amplifier which provides a divide by 19.6 (0.5 Vpp) which, in turn, is followed by another amplifier that divides by 200 (2.5 mVpp). The 2.5 mVpp square wave is a signal level very close to the expected ECG signal, and can be used to test the instrumentation amp gain, as well as the high and Low Pass filters. The 0.5 Vpp will be used for the common mode test of the instrumentation amp. Page 10 of 63 Lab 1 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Laboratory: Hardware Setup 1. Build the square wave oscillator and divisor functions per the Lab 1 Schematic (Fig. 1.1). 2. Connect the interface cables to the MP35 unit. a. SS39L into CH1 on the MP35 b. SS60L into CH2 on the MP35 3. Connect the interface cables to the breadboard to monitor the square wave outputs. a. MP35 CH1 signal input to 0.5 Vpp (IC1 pin 7). b. MP35 CH2 signal input to 2.5 mVpp (IC1 pin 8). c. Connect the negative leads to the ground bus. Software Setup Set the BSL PRO software for recording as follows: Use the SqWvGen.gtl template (File > Open > SqWvGen.gtl) to simplify setup. 1. MP35 > Set up Channels: a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. b. Click the “wrench” icon for CH1 and set parameters as follows: i) Filters 1, 2, 3: None; Gain: x50, Offset: 0; Input coupling: DC ii) Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV. Scaling is set at x5 to account for the probe’s ÷5 internal resistor scaling. Page 11 of 63 Lab 1 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 iii) | c. Click the “wrench” icon for CH2 and set parameters as follows: i) Filter 1,2,&3: None; Gain: x2000; Offset: 0; Input coupling: DC ii) Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV. Scaling is set at x5 to account for the probe’s ÷5 internal resistor scaling. d. Click OK as required to exit Set up Channels. 2. MP35 > Set up Acquisition a. Mode: Record, Save Once, PC Memory b. Sample Rate: 5000 c. Acquisition Length: 5 seconds (minimum) 3. Use two measurement rows. To set up, select (File > Preference > General). Show 2 measurement rows. Show 3 digits of precision. Page 12 of 63 Lab 1 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Recording 1. Press the “Start” button in the software window to begin recording. 2. After at least 5 seconds, press the “Stop” button. Analysis 1. a. b. c. 2. Set the following measurements for each channel: Freq (frequency) d) Stddev (standard deviation) Mean e) P-P (peak-to-peak) Delta T (time) Select a section of the high output level for each channel, avoiding any ringing at the transitions, and measure Mean. 3. Select a section of the low output level for each channel, avoiding any ringing at the transitions, and measure Mean. 4. Select one square wave cycle and measure Freq, Delta T, and Stddev, P-P for each channel. Standard deviation of a square wave is ½ the P-P value. Standard deviation is equal to RMS, but with the added bonus of DC removal. 5. Do you notice “noise” on the 2.5mVpp signal? Magnify a section of the signal to measure the frequency and amplitude. Page 13 of 63 Lab 1 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Data Report for Lab 1: 1. Report all findings of the Lab. Channel High Mean Low Mean Freq Delta T Stddev P-P CH1 CH2 2. Include recorded graphs of the results. To paste graphs into an open Word document, select Edit > Clipboard > Copy Graph in BSL PRO and then right-click in the Word document and select paste. 3. Review the findings. a. Is the square wave symmetrical (are the periods for both halves of the cycle equal)? Yes No b. What is the ratio of the noise to the 2.5mVpp signal? c. Report any discrepancies from actual results and expected results. Expected results: Frequency: 1.0 Hz ±20%; Output Voltage at voltage dividers: 0.5 Vpp and 2.5 mVpp ±10% d. Report suspected causes for any discrepancies. e. How was /could the problem(s) be fixed? 4. What is the correlation between the Delta T and Freq measurements? (answer as an equation) 5. Why is the Stddev measurement more precise than the P-P measurement? End Lab 1 Page 14 of 63 Lab 1 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Lab 2: Instrumentation Amplifier Fig. 2.1 Schematic for SS39L Breadboard Lab 2 Objectives 1. To build a simple instrumentation amp to act as a primary interface for medical transducers, such as electrodes or bridge resistance sensors. 2. To use the Square Wave 2.5 mVpp signal as a single ended input to test for Gain. Background: An instrumentation amplifier (InAmp) is a device that amplifies the difference between two input potentials, while rejecting any signals that are common to both inputs. The InAmp is usually assigned the delicate job of extracting small signals from sensors and transducers, in instruments such as ECG, EEG, blood pressure monitors and defibrillators. They are especially effective in removing both common mode DC and low frequency AC signals, essential for monitoring human body potentials. The most important property of InAmps is common-mode rejection (CMR), the property of canceling out any signals that are common to both inputs, while amplifying any signals that provide a potential difference to the inputs. Instrumentation amps have several features in common: A. Balanced, differential inputs each with high impedance and low bias currents B. Single ended output with respect to a reference terminal C. A closed loop gain block with gain setting resistor isolated from the signal terminals D. Low output impedance, normally several milliohms at low frequencies Why not use an opamp—don’t opamps have balanced differential inputs with high impedance, low output impedance, and a gain block? Because, in the typical inverting or non-inverting circuits, both the signal and the common mode voltage appear at the amplifier output. The opamp does exhibit CMR, but the signal is amplified by the opamp’s closed-loop gain, while the common mode voltage receives unity gain, reducing the opamps’s output swing. To summarize the problems of just using an opamp, inadequate DC CMR will produce undesirable offsets at the output. Inadequate AC CMR causes large, time-varying errors that change with frequency, making the errors difficult to remove in following electronic circuits. Another important property of InAmps is low noise voltage and current. Input noise is Referred To Input (RTI), so that a specification of 10nV/ Hz @1 k Hz will be multiplied by the differential gain at the output. If the InAmp is operated at high gain, then the InAmp input noise can become the largest noise source of the entire circuit. An InAmp must provide adequate bandwidth for an application. Unity bandwidths of up to 4 M Hz are typical of good InAmps. Most InAmps specify bandwidths at several gain settings, to show how the bandwidth decreases with increased gain. Page 15 of 63 Lab 2 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 AC CMR varies with frequency and gain. For most InAmps, the CMR increases with gain (up to a certain point) because most designs have a front end configuration that rejects common-mode signals while amplifying differential voltages. Since any imbalance in the differential input will show up as a commonmode error, AC CMR decreases with frequency. In this lab, an InAmp for an ECG application (Fig. 2.1) is built. When setting the gain, use what is known about the required measurement(s) to obtain the largest gain possible from the InAmp without exceeding its capabilities. It is important to design the best CMR from the front end, because the sensors are really only electrical conductors attached to the body (antennas). The electrodes will pick up every imaginable form of electromagnetic energy present, from the heart, muscles, nearby heterodyne radios, computers, AC mains, electric lights, radio stations, transmissions from friendly aliens, microwave ovens and waffle irons. Even the best attachment of electrodes to the body cannot fully account for skin resistance, which is surprisingly high and varies from electrode to electrode. Although input voltage offset will be multiplied by the gain of the circuit to contribute to DC offset at the output, the dominant output DC offset will be from DC potentials between the electrodes. In this lab, expect as much as 25 mV between the two signal electrodes. The LM324 data sheet (available at: http://cache.national.com/ds/LM/LM124.pdf) shows the output voltage swing from the LM324’s opamps is about 1.2V from the supply rails. The MP35 Channel input jacks will provide ±5V supplies, so that allows ±3.8 V swings. The ECG signal is not expected to exceed 2.5 mV, although the common-mode signals may be 100 times higher, or more. The front end of the InAmp must accurately reproduce the common-mode signals so that they can be cancelled out by the following difference amplifier. To calculate the maximum voltage swing that will not exceed the output swing limitation (3.8V in this lab): Max voltage swing = DC electrode offset + ECG signal + CM noise + Input Offset For this lab: Max voltage swing = 25 mV +2.5 mV + 1.0 mV + 3 mV = 31.5 mV Although a maximum gain of (3.8V/32.5 mV) = 117 is possible, a more conservative gain of 101 is recommended. The bandwidth of the ECG is very small (100 Hz), so bandwidth is not a major concern, even at very high gains. The input offset of 4.0 mV may contribute to DC offsets at the output. Laboratory: Hardware Setup for Gain Measurement 1. Build the square wave oscillator and divisor functions per the Lab 2 Schematic (Fig. 2.1). Matching the 4 resistors of the difference amp section can improve CMR. Carefully measure R10, R11, R12 and R13 with a high quality DVM, noting the values of each resistor. Make the ratio of R13/R12 as close as possible to R11/R10. Leave at least 8 vertical busses vacant on the end of the LM324 for test hookup, as well as placement of the Electrode breadboard adapter 2. Connect the interface cables to the MP35 unit. a. SS39L into CH1 on the MP35 b. SS60L into CH2 on the MP35 3. Connect the interface cables to the breadboard to monitor the square wave outputs. a. MP35 CH1 signal input to U2 pin 5, +INAMP. b. MP35 CH2 signal input to U2 pin 1, INA_OUT. c. Connect both the signal grounds/negative leads to the ground bus. Page 16 of 63 Lab 2 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 4. Connect the square wave generator (Lab 1) to the InAmp inputs to use the Square Wave 2.5 mVpp signal in a single ended configuration to test for Gain. a. Square Wave Generator 2.5 mVpp output (U1 pin 8) to +INAMP input (U2 pin 5). b. Connect -INAMP (U2 pin 10) to the ground bus G1. Software Setup for Gain Measurement Set the BSL PRO software for Gain Measurement recording as follows: Use the InAmpGain.gtl template (File > Open > InAmpGain.gtl) to simplify setup. 1. MP35 > Set up Channels: a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. b. Click the “wrench” icon for CH1 and set parameters as follows: i. Filters 1, 2, 3: None; Gain: x2000, Offset: 0; Input coupling: DC Page 17 of 63 Lab 2 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 ii. Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV c. Click the “wrench” icon for CH2 and set parameters as follows: i. Filter 1,2,&3: None; Gain: x50; Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV d. Click OK as required to exit Set up Channels. 2. MP35 > Set up Acquisition e. Mode: Record, Save Once, PC Memory f. Sample Rate: 5000 g. Acquisition Length: 5 seconds (minimum) 3. Use two measurement rows. To set up, select (File > Preference > General). Show 2 measurement rows. Show 3 digits of precision. Page 18 of 63 Lab 2 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Recording for Gain Measurement 1. Segment 1: Gain a. Press the “Start” button in the software window to begin recording. b. Wait for the recording to stop after 5 seconds, or press the “Stop” button. c. Set the measurement rows to read Stddev, P-P and Mean for each channel. 2. Using the I-beam selection tool, select one full cycle of the square wave. 3. Measure the Stddev for the input and output signal. a. Measure the CD offset of the output – the mean of exactly one cycle b. Verify the gain is 101 ±2%. c. Paste the recorded graph into an open Word document for your report. To paste graphs into an open Word document, select Edit > Clipboard > Copy Graph in BSL PRO and then right-click in the Word document and select paste. Use Edit > Clipboard > Copy Measurement to copy measurement data. d. Note the measurements notes results in a table: Stddev P-P Mean Channel 1 Channel 2 e. Note any anomalies. Do any square waves droop? Is there phase inversion between channels? Hardware Setup for CMRR Measurement 1. When we measured the gain, we injected a low level signal into the positive +InAmp input, while holding the –InAmp input at GND. We demonstrated that the InAmp is working properly when we recorded an output with the correct gain. To test CMRR, we will inject a high level signal into both inputs on the InAmp, then measure the output. Ideally, with infinite CMR, the output would remain at 0.0V DC. We need a high level input, because the InAmp is very good at suppressing signals that appear on both inputs, and we need to be able to see the output with reasonable accuracy. 2. Connect MP35 CH1 signal input to U2 pin 5, +INAMP. Connect the Ground wire to GND. 3. Connect MP35 CH2 signal input to U2 pin 1, INA_OUT. Connect CH2 Ground wirer to GND. 4. We will now change the input from the 2.5mVpp signal to the 0.5mVpp signal. This will require moving one end of a jumper that was inserted in the Hardware Setup for Gain measurement at the beginning of the experiment. Lift the end of the jumper from U1-pin 8 (2.5mVpp) and insert it into U1-pin 7 (0.5Vpp). The other end of the jumper should remain in U2-pin 5 (+IN_AMP). Page 19 of 63 Lab 2 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 5. Remove the jumper from U2-pin 10 to GND. Connect a jumper from U2-pin5 to U2-pin 10. This will insert the same 0.5Vpp signal into both InAmp inputs. Software Setup for CMRR Measurement Set the BSL PRO software for CMRR Measurement recording as follows: Open a New Window for recording. Use the InAmpCM.gtl template (File > Open > InAmpCM.gtl) to simplify setup. 1. Open the the InAmpCM.gtl template, or change the Channel Set Up Parameters as follows: a. Channel Labels: CH1 0.5V CM input, CH 2 InAmp CM out b. CH1 Gain = x50 Scaling: 10 mV Æ 50 mV, -10 mV Æ -50 mV Page 20 of 63 Lab 2 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 c. CH2 Gain = x200 (or x100 if DC offsets are too high) Scaling: 10 mV Æ 50 mV, -10 mV Æ -50 mV 2. MP35 > Set up Acquisition a. Mode: Record, Save Once, PC Memory b. Sample Rate: 5000 Acquisition Length: 5 seconds (minimum) 3. Use two measurement rows. To set up, select (File > Preference > General). Show 2 measurement rows. Show 3 digits of precision. Recording for CMRR Measurement 1. Record 5 seconds of data. Using the selection tool, select one cycle of the square wave. Use the measurement tool to read the Stddev for both channels. 2. Paste the recording into an open Word document (your lab writeup) 3. Record the Stddev for the CH1 CM input, and CH2 InAmp Output CM Page 21 of 63 Lab 2 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Analysis and Data Report for Lab 2: 1. Report all results of the Lab. Include recorded graphs of the results. To paste graphs into an open Word document, select Edit > Clipboard > Copy Graph in BSL PRO and then right-click in the Word document and select paste. 2. Gain measurements: a. how the recordings for the gain measurement. Verify the operation, and show the gain calculation. b. Note the square wave levels and their offset. c. Do any square waves droop? d. Note any phase inversion between channels. e. Calculate the Gain and compare to the expected gain of 101. 3. CMRR Measurements a. Show the recordings for the CMRR calculation including the measurement settings. Show the CMRR calculation, and the DC offset. b. CMRR calculation: Differential Gain=101 Common mode gain= Output StdDev/Input Common Mode StdDev CMRR=Differential gain/Common mode gain c. Calculate Common Mode Rejection CMR(dB) = 20 log CMRR d. Report any discrepancies from actual results and expected results. Expected results: CMR -40dB to -120dB e. Report suspected causes for any discrepancies. f. How was/could the problems(s) be fixed? End Lab 2 Page 22 of 63 Lab 2 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Lab 3: High Pass Filter Fig. 3.1 Schematic for SS39L Breadboard Lab 3 Objective: 1. To design, build and test a High Pass active filter to demonstrate the bio-medical application of filters in an ECG monitor. Background: Wilhelm Einthoven is credited with designing the first ECG using a magnetic string galvanometer. Since then, recording of ECG signals has been standardized to accurately interpret the results. The standard requires two filters: a High Pass filter with a -3dB cutoff at 0.05 Hz and a Low Pass filter -3dB filter cutoff at 100 Hz. The High Pass filter specified here is a standard second order Butterworth filter (Q=0.707)— preferred for its maximally flat response and reasonably good roll-off. Other filter topologies offer steeper roll-offs, but typically have ripple in the pass band and increasing non-linear phase. For ECG filters, avoiding excessive non-linear phase is important because non-linear phase will result in varying group delay within the ECG frequency band. This effect is problematic because varying delays at different frequencies will result in distortion of the ECG signal, thus confusing diagnosis of possible physiological problems. The main purpose of the High Pass filter in ECG monitoring applications is the removal of DC offsets from the ECG signal that are present after the initial amplification stage. DC removal is necessary to move the signal as close as possible to the middle of the power supply rails, so that the following circuitry can filter, and further amplify if necessary. That is why the High Pass filter precedes the Low Pass filter. The 0.05 Hz High Pass filter used here has the advantage of having a pass band that extends well below 1 Hz, and the final ECG waveform will display a minimum of filter induced sag. A disadvantage of this filter is its very long settling time, which can cause long waiting periods until signals can be properly displayed. Another problem is the large capacitors that are required. A 1 Hz High Pass filter might be implemented because of these practical issues of construction and observation. A 1 Hz filter is far more useful for monitoring the ECG under conditions of body motion to permit physiological monitoring during the course of exercise. Normally, during exercise, electrodes on the body shift position, thus causing artifacts at the low end of the ECG spectrum. A 1 Hz High Pass filter helps reduce this effect. The Sallen-Key configuration shown in the BME Laboratory ECG Amplifier schematic is a biquad implementation, meaning there are two poles in the circuit transfer function: When C6=C7=C, the form becomes: Vo s2 = 2 Vi s + sω 0 / Q + ω 0 2 2 where R14 = R R15 = (4Q ) R and CR = 1 2ω 0 Q Page 23 of 63 Lab 3 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Laboratory: Hardware Setup 1. Build the active High Pass filter per the Lab 3 Schematic (Fig. 3.1). C=10uF R14=226K R15=453K 2. To further develop the ECG amplifier, connect (as in Fig. 3.1): a. High pass input to instrumentation amp output b. Square wave generator 2.5 mV P-P output (U1 pin 8) to +INAMP (U2 pin 5) c. –INAMP (U2 pin 10) to GND 3. Connect the interface cables to the MP35 unit. a. SS39L into CH1 on the MP35 b. SS60L into CH2 on the MP35 4. Connect the interface cables to the breadboard to monitor the square wave outputs. a. MP35 CH1 signal input to INA_OUT (IC2 pin 1). b. MP35 CH2 signal input to HPF_OUT (IC2 pin 14). c. Connect the negative leads to the ground bus. Software Setup Set the BSL PRO software for recording as follows: Use the High Pass.gtl template (File > Open > High Pass.gtl) to simplify setup. 1. MP35 > Set up Channels: a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. Page 24 of 63 Lab 3 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 b. Click the “wrench” icon for CH1 and set parameters as follows: i. Filters 1, 2, 3: None; Gain: x50, Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV c. Click the “wrench” icon for CH2 and set parameters as follows: i. Filter 1,2,&3: None; Gain: x100; Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV d. Click OK as required to exit Set up Channels. 2. MP35 > Set up Acquisition a. Mode: Record, Save Once, PC Memory b. Sample Rate: 5000 c. Acquisition Length: 300 seconds Page 25 of 63 Lab 3 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 3. Use two measurement rows. To set up, select (File > Preference > General). Show 2 measurement rows. Show 3 digits of precision. Recording Press the “Start” button in the software window to begin recording. The High Pass output may drift, but should be centered at 0.00V within 30 seconds. Then press “Stop”. High Pass filter function with a complete cycle highlighted. Hardware Setup for Electrode Interface 1. To view actual ECG waveforms, we will now remove the 2.5mVpp test signal and connect the SS2L Electrode Assembly, using the BSLTCI-22 Breadboard Electrode Interface. 2. Remove jumper from 2.5mVpp (U1 pin 8) to +InAmp (U2 pin 5) 3. Remove jumper from –InAmp (U2 pin 10) to GND. 4. Connect TCI-22 pin 2 to +InAmp U2 pin 5. 5. Connect TCI-22 pin 4 to –InAmp U2 pin 10. 6. Connect TCI-22 pin 3 to GND bus. 7. Attach electrodes to a human subject for an ECG recording. It is a good idea to lightly abrade the skin (using an ELPAD), before electrode placement to decrease the impedance between the electrode and the skin surface. Establish a standard Lead II configuration with three EL503 disposable electrodes: Attach the GND (BLACK) electrode on the right leg, the POS (RED) electrode to the left leg and the NEG (WHITE) electrode to right forearm. Page 26 of 63 Lab 3 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 SS2L inserted into BSLTCI-22 Breadboard Electrode Interface, connected to input of InAmp. 8. Save the current graph (File, SaveAs, “MyHigh Pass.acq”). Record the ECG wave by clicking “Start” – since we are in Append mode, the data is attached to the end of the current graph window. You may have to wait a long period for the waveforms to settle. Try to keep muscles relaxed during acquisition (why?). Large offsets may cause the InAmp output to go offscale – to rescale, click on the right hand side Vertical Scale and enter larger scale factors. Large offsets can be caused by high skin resistance – prepare the skin under the electrode with a gentle abrasive pad to reduce skin resistance. 50/60 Hz noise can sometimes be reduced by keeping the bulk of the electrode leads as close to the body as possible. ECG High Pass filter function with electrodes input. Page 27 of 63 Lab 3 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Analysis 1. Determine the AC gain of the circuit. a. Use the Stddev function over one complete cycle for both input and output. b. Verify gain is 1 +- 1%. 2. Use the I-beam tool to measure the heart rate recorded using the electrodes. Is there “noise” on the recording? Using the magnifying tool, expand a portion of the noise wave. Use the I-beam tool to measure the frequency. 3. High Pass 3dB cut-off measurements. a. Measure the 3db cut-off frequency using the sag of the high pass output. - Select a complete cycle of the High Pass Output after the waveform has stabilized. - Set the “Freq” measurement - Select one cycle, and note the freq = f b. Select a High Pass filter output area that begins after a low-to-high transition, then sags until the high-to-low transition. - Select an area that does not include the transitions; a period that will be ~T/2, with T = the period of the cycle. - Set the Delta measurement - Measure the droop, Vdelta c. Obtain V max. - Select a complete low-to-high High Pass Output transition. - Set the “Delta” measurement. Page 28 of 63 Lab 3 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 4. Estimate high pass filter response. According to Jacob Millman (“Microelectronics, Digital and Analog Circuits and Systems,” McGraw Hill, 1979), the response of a single order high pass filter can be estimated using square wave testing using the formula: f hp = Vdelta 2 f V max π Note: Millman’s formula is an approximation commonly used to derive the highpass filter breakpoint from the measured “tilt” or “sag” in the filter’s square ware response. The Tilt (P) is equal to (Vdelta/Vmax) and P = Pi*ƒhp/ƒ where Pi=3.1415926..., ƒhp is Highpass filter breakpoint, and ƒ is the frequency of driving square wave. The BSL PRO calculates Vdelta in a manner that requires this value to be multiplied by an additional factor of 2 to reference it properly to the Vmax measurement for the ultimate determination of P. This lab implements a second order filter, which through simulation, results in the formula: f hp = Vdelta 1.414 f V max π Data Report for Lab 3: 1. Show recorded graphs of the input and output responses to the High Pass filter, after the output has stabilized. 2. Show the results of the Square wave recording. 3. Show the results of the ECG recording. 4. Show the calculations for gain, and the High Pass 3dB cut-off frequency. 5. What is the heartbeat frequency of the ECG? What is the frequency of the noise measured on the ECG wave? 6. 3dB cut-off measurements: freq = f Vdelta V max 7. Estimated high pass filter response: End Lab 3 Page 29 of 63 Lab 3 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Lab 4: Active Gain Block and Low Pass Filter Fig. 4.1 Schematic for SS39L Breadboard Lab 1 Objectives: 1. To construct a simple non-inverting amplifier to increase signal level for the laboratory ECG monitor. 2. To follow the amplifier by a Low Pass filter with 3dB cut-off at 100 Hz, to limit the response of the system to the frequencies of interest. Background: The non-inverting amplifier of 5x gain is shown in the BME Laboratory ECG Amplifier schematic as Positive Gain Block. The gain is defined as: R Vo = 1 + 16 Vi R17 The InAmp provides a gain of x101, and the High Pass filter removes any DC offsets, leaving a ~100-500 mV signal primarily centered around ground level. Amplify this signal to a ~500-2500 mV level with the gain block and then remove the DC offset with the High Pass filter. Otherwise, the DC Offset may cause the output of the gain block or the Low Pass filter to easily rail because both of these blocks are DC voltage sensitive. The main purpose of the Low Pass filter in ECG monitoring applications is to limit the bandwidth to the frequencies of interest in the ECG signal. The original ECG signal is on the order of ~1-5 mV. The SallenKey configuration of the unity gain Low Pass Filter (LPF) shown in the BME ECG Amplifier schematic (the LPF that follows the Gain Block) is a biquad implementation, meaning there are two poles in the circuit transfer function: With R18 = R19 = R ω0 Vo = 2 Vi s + sω 0 / Q + ω 0 2 2 2 where C10 = C , C11 = (4Q )C and CR = 1 2ω 0 Q Modeling the response of an RC circuit to a step response closely approximates the cutoff frequency. Page 30 of 63 Lab 4 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Where the voltage across the output capacitor is given as: −t v 0 = Vi (1 − e RC ) The time for v0 to reach a tenth of its final value is 0.1RC, and the time to reach nine tenths of its final value is 2.3RC. t r is the difference between these two times, so: t r = 2.2 RC = 2.2 0.35 = 2πf h fh fh = and 0.35 tr Laboratory: Hardware Setup 1. Build the active gain block and LPF per the Lab 4 Schematic (Fig. 4.1), with previous experiment’s HPF_OUT (U2 pin 14) connected to U3 pin 10, the gain block. Be sure that the 2.5mVpp signal (U1 pin 8) is connected to +InAmp (U2 pin 5). Connect –InAmp (U2 pin 10) GND. Remove the SS2L Electrode if it is connected to the BSLTCI-22 Breadboard Electrode Interface. Gain Block: R17=24.9K Low Pass Filter: C10=.047uF R16=100K C11=0.1uF R18=R19=23.7K 2. Connect the interface cables to the MP35 unit. a. SS39L into CH1 on the MP35 b. SS60L into CH2 on the MP35 3. Connect the interface cables to the breadboard to monitor the Gain block outputs. a. MP35 CH1 signal input to HPF_OUT (U3 pin 10). b. MP35 CH2 signal input to GAIN_OUT (U3 pin 8). c. Connect the negative leads to the ground bus. Page 31 of 63 Lab 4 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Software Setup Set the BSL PRO software for recording as follows: Use the GainBlkLP.gtl template (File > Open > GainBlkLP.gtl) to simplify setup. 1. MP35 > Set up Channels: a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. b. Click the “wrench” icon for CH1 and set parameters as follows: i. Filters 1, 2, 3: None; Gain: x200, Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV c. Click the “wrench” icon for CH2 and set parameters as follows: i. Filter 1,2,&3: None; Gain: x50; Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV d. Click OK as required to exit Set up Channels. Page 32 of 63 Lab 4 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 2. MP35 > Set up Acquisition a. Mode: Record, Append, PC Memory b. Sample Rate: 5000 c. Acquisition Length: 300 seconds 3. Use two measurement rows. To set up, select (File > Preference > General). Show 2 measurement rows. Show 3 digits of precision. Recording A. Gain Block Use the Square Wave (~2.5 mV) output, through the InAmp (x101), and the High Pass Filter (x1). 1. Press the “Start” button in the software window to begin recording. 2. After the output has stabilized around ground potential (at least 30 seconds) press the “Stop” button. B. Low Pass Filter Use the same square wave generator input, through the InAmp, High Pass filter and gain block. 1. Change the hardware connections to monitor the Low Pass Filter outputs. Move the CH2 probe from U3 pin 8 to U3 pin 14 2. Press the “Start” button in the software window to append recording. 3. After the output has stabilized around ground potential (at least 30 seconds) press the “Stop” button. Page 33 of 63 Lab 4 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Analysis 1. Set the following measurements for each channel: a. Freq (frequency) b. Mean c. Delta T (time) d) Stddev (standard deviation) e) P-P (peak-to-peak) 2. Measure the Stddev values of input and output channels in a window containing one full cycle, after the output is stable. Verify a DC gain of 5. 3. Measure the P-P signal. 4. To test the LPF cutoff frequency (100 Hz) a. select in the CH2 Low Pass Output, a low to high transition waveform. b. Magnify the time base, so that the single transition is visible across the screen. c. Use the P-P tool to find the total extent of the transition d. Measure Delta T on a window that starts at 10% of the P-P, and ends at 90% P-P. Data Report for Lab 4: 1. Show a graph of the input and output responses to the Gain Block, after the output has stabilized. 2. Show a graph of the input and output responses to the LPF. 3. Show a graph of an expanded low to high Low Pass filter output transition, with the 10%-90% areas highlighted. 4. Compare the calculated High Pass 3db cutoff frequency to the design value and explain any discrepancies between actual results and expected results. 5. Compare calculated gain to measured input and output (Stddev values) in a window containing at least one full cycle. The output of the Gain Block should be 5x the output of the High Pass Filter. 6. Determine the rise time t r ,defined as the time for the waveform to rise from 10% to 90% its final value. End Lab 4 Page 34 of 63 Lab 4 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Lab 5: Notch Filter for 50/60 Hz Rejection Fig. 5.1 Schematic for SS39L Breadboard Lab 5 Objective: 1. To construct a notch filter to remove 50 or 60 Hz noise from the ECG signal. • This lesson uses a Multiple Feedback Band-Reject Filter. Background: The second order Band-Reject filter is shown in the BME Laboratory ECG Amplifier schematic as Notch Filter. The notch filter utilizes a Band Pass filter, followed by a summing amplifier, which subtracts the Band Pass output from the input signal. The Band Pass filter equation is: s(2ω 0 Q ) Vo = 2 Vi s + s( w0 / Q) + ω 0 2 With C = C12 = C13 Q = 1 and Req = R20 R21 R20 + R21 Establish the total gain of the Band Pass section multiplied by the gain of the resistor input voltage divider as Atotal = Abp Avr = 1 The gain of the resistor divider is Avr = R21 R20 + R21 The equations for the Band Pass section are: Abp = −2Q 2 = −2 Req = R23 Q R23 = 2 f 0πC 4Q where Req is the resistance seen by the Band Pass filter section. Req = R23 4Q 2 So Avr = 1 and R21 = R20 = 2 Req 2 Page 35 of 63 Lab 5 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 To produce a band reject function, add the Band Pass filter output to the original signal through an inverting summing section. The component values for a 60 Hz,Q=1 notch filter are as follows: With C=C12=C13=0.22uF R23=24.3K R20=R21=12.1K For a 50 Hz, Q=1 notch filter, the same values of C can be used but new values for R23 and R21 must be calculated using the provided formulas. Laboratory: Hardware Setup 1. Build the Notch Filter per the Lab 5 Schematic (Fig. 5.1), with LPF_OUT connected to the junction of R20 and R21 2. Connect the interface cables to the MP35 unit. a. SS39L into CH1 on the MP35 b. SS60L into CH2 on the MP35 3. Connect the interface cables to the breadboard to monitor the square wave outputs. a. MP35 CH1 signal input to LPF_OUT (IC3 pin 14). b. MP35 CH2 signal input to ECG_OUT (IC3 pin 1). c. Connect the negative leads to the ground bus. Software Setup Set the BSL PRO software for recording as follows: Use the Notch.gtl template (File > Open > Notch.gtl) to simplify setup. 1. MP35 > Set up Channels: Page 36 of 63 Lab 5 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. b. Click the “wrench” icon for CH1 and set parameters as follows: i. Filters 1, 2, 3: None; Gain: x50, Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV| c. Click the “wrench” icon for CH2 and set parameters as follows: i. Filter 1,2,&3: None; Gain: x100; Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV d. Click OK as required to exit Set up Channels. Page 37 of 63 Lab 5 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 2. MP35 > Set up Acquisition a. Mode: Record, Save Once, PC Memory b. Sample Rate: 5000 c. Acquisition Length: 30 seconds (minimum) 3. Use two measurement rows. To set up, select (File > Preference > General). Show 2 measurement rows. Show 3 digits of precision. Recording Use the Square Wave (2.5 mVpp) output, through the Instrumentation Amp (x101), High Pass Filter, Gain Block, and Low Pass Filter. 1. After the circuit has been running with the square wave input for 30 seconds, press the “Start” button in the software window to begin recording. Page 38 of 63 Lab 5 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 2. Record about 5 seconds, press the “Stop” button. 3. Save the recording as “Notch1.acq” (File, Save As) for backup in case of difficulty in analysis. Notch Filter Analysis 1. Set the following measurements for each channel: a. Freq (frequency) d) Stddev (standard deviation) b. Mean e) P-P (peak-to-peak) c. Delta T (time) 2. Show notch filter using FFT. a. Select CH2 Band pass Filter by clicking on the 60 Hz Notch Filter label. b. Select Transform > Difference and apply the default difference of 1 to the entire waveform. c. Click the Vertical Autoscale icon to scale the result. d. Select one half cycle (as shown below) to simulate an impulse response for the FFT function. e. Select Transform > FFT (no window, other defaults ON). The FFT will popup in another Window. 3. Magnify the lower frequencies to better display the range around the 60 Hz notch. Scale the FFT waveforms. a. On the output FFT, click on the Vertical Scale, and in the Vertical Scale dialog box, enter (for example) Scale=20dbV and Midpoint=40dbV. On the output FFT click on the Horizontal Scale and in the Horizontal Scale Dialog box, enter Scale = 100 Hz and Start = 0 b. Using the I-beam toll, record the depth of the notch and the bandwidth. Page 39 of 63 Lab 5 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Hardware Setup for Electrode Interface 1. To view actual ECG waveforms, we will now remove the 2.5mVpp test signal and connect the SS2L Electrode Assembly, using the BSLTCI-22 Breadboard Electrode Interface. 2. Remove jumper from 2.5mVpp (U1 pin 8) to +InAmp (U2 pin 5) 3. Remove jumper from –InAmp (U2 pin 10) to GND. 4. Connect TCI-22 pin 2 to +InAmp U2 pin 5. 5. Connect TCI-22 pin 4 to –InAmp U2 pin 10. 6. Connect TCI-22 pin 3 to GND bus. SS2L inserted into BSLTCI-22 Breadboard Electrode Interface, connected to input of InAmp. Recording 2—ECG Test the ECG amplifier with actual ECG signals. 7. Attach electrodes to a human subject for an ECG recording. a. It is a good idea to lightly abrade the skin (using an ELPAD), before electrode placement to decrease the impedance between the electrode and the skin surface. b. Establish a standard Lead II configuration with three EL503 disposable electrodes: Attach the GND (BLACK) electrode on the right leg, the POS (RED) electrode to the left leg and the NEG (WHITE) electrode to right forearm. Page 40 of 63 Lab 5 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 8. Set the BSL PRO software for recording as follows: a. Use the ECG.gtl template (File > Open > ECG.gtl) to simplify setup. Or manually open a new window and set just like the Notch Filter above, except label CH2 “ECG OUT”. Press “Start” to begin recording. • If the ECG (50/60 Hz Notch) is inverted, exchange the POS and NEG electrode connectors on the electrodes. • If excess 50/60 Hz noise is present, adjust (firmly attach) the electrodes for better contact. 9. Insert an event marker (F9 Windows, Esc Mac) for each condition: a. Subject touches keyboard b. Subject rapidly clenches/unclenches fist. c. Subject move arm. 10. After at least 30 seconds, press the “Stop” button • It may take up to 30 seconds for the waveform to settle (the 0.05 Hz High Pass filter). Page 41 of 63 Lab 5 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Data Report for Lab 5: 1. Include recorded graphs of the results. • To paste graphs into an open Word document, select Edit > Clipboard > Copy Graph in BSL PRO and then right-click in the Word document and select paste. a. Show a graph of the input and output responses to the Notch Filter Block, after the output has stabilized. b. Show the FFT response of the Notch Filter, and the design and calculated values. c. Show a graph of the ECG measurements. Indicate ECG levels (note total gain of 505). d. Explain any discrepancies between actual results and expected results. 2. Record the depth of the notch and the bandwidth and compare to the design values. 3. Can you see the effects of the 100 Hz Low Pass filter in the FFT results? 4. What effect did the Subject touching the mouse or keyboard have on 50/60 Hz interference? 5. What effect did the Subject’s rapid fist clenching/unclenching have on the measurement? 6. What effect did the Subject’s arm movement have on the measurement? End Lab 5 Page 42 of 63 Lab 5 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Lab 6: Band pass Filter for QRS Detect Function Fig. 6.1 Schematic for SS39L Breadboard Lab 6 Objective: 1. To construct a Band Pass filter as a building block in a QRS wave detector. Background: ECG measurements often require synchronization with other medical/lab equipment. The heart rate is an extremely useful synchronization tool. The typical method of obtaining heart rate is to trigger off the QRS wave, because it is the most prominent part of the ECG waveform. The QRS wave has been studied extensively—analysis of the QRS wave in many subjects has shown a pattern of high energy in the 17 Hz band. To trigger off this energy band, amplify the energy found in the QRS band, and reject other frequencies. The second order Band Pass filter at 17 Hz is shown in the BME Laboratory ECG Amplifier schematic. The Band Pass filter equation is: s(2ω 0 Q ) Vo = 2 Vi s + s( w0 / Q) + ω 0 2 With C = C14 = C15 and Q = 5 Av = −2Q 2 = −2 R26 = R27 4Q 2 R27 = Q f 0πC So, with C=C14=C15=0.47uF R27=200K R26=2.00K ω 0 =106.4 f 0 = 16.9 Hz Page 43 of 63 Lab 6 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Laboratory: Hardware Setup 1. Build the Band pass Filter per the Lab 6 Schematic (Fig. 6.1), with R26 connected to LPF_OUT (U3 pin 14). 2. Connect the interface cables to the MP35 unit. a. SS39L into CH1 on the MP35 b. SS60L into CH2 on the MP35 3. Connect the interface cables to the breadboard to monitor the square wave outputs. a. MP35 CH1 signal input to LPF_OUT (U3 pin 14). b. MP35 CH2 signal input to BP_OUT (U4 pin 8). c. Connect the negative leads to the ground bus. Software Setup Set the BSL PRO software for recording as follows: Use the BandPass.gtl template (File > Open > BandPass.gtl) to simplify setup. 1. MP35 > Set up Channels: a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. b. Click the “wrench” icon for CH1 and set parameters as follows: i. Filters 1, 2, 3: None; Gain: x50, Offset: 0; Input coupling: DC Page 44 of 63 Lab 6 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 ii. Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV| c. Click the “wrench” icon for CH2 and set parameters as follows: i. Filter 1,2,&3: None; Gain: x100; Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV d. Click OK as required to exit Set up Channels. 2. MP35 > Set up Acquisition a. Mode: Record, Save Once, PC Memory b. Sample Rate: 5000 c. Acquisition Length: 5 seconds (minimum) Page 45 of 63 Lab 6 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Recording Use the Square Wave (2.5 mVpp) output, through the InAmp (x101), High Pass Filter, Gain Block, and Low Pass Filter. 1. After the circuit has been running with the square wave input for 30 seconds, press the “Start” button in the software window to begin recording. 2. Record for 5 seconds. Analysis 1. Set the following measurements for each channel: a. Freq (frequency) d) Stddev (standard deviation) b. Mean e) P-P (peak-to-peak) c. Delta T (time) 2. Generate an Output FFT. a. Select CH2 Band Pass Out. b. Select Transform > Difference and apply the default difference of 1 to the entire wave. c. Click the Vertical Autoscale icon to scale the result. d. Select one half cycle (as shown below) to simulate an impulse response for the FFT function). e. Select Transform > FFT (no window, other defaults ON). f. When sampled at 5K samples per second, the FFT will show about 2.5K Hz full scale. Magnify the lower frequencies to better display the range around the 17 Hz notch. Page 46 of 63 Lab 6 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 105.00 75.00 dbV Magnitude 90.00 60.00 45.00 0.00 50.00 100.00 Hz 150.00 3. Generate an input FFT to compare with the output FFT. a. Select CH1 Low Pass Out. b. Repeat steps 2b-2e to create a new FFT window. 4. Superimpose the input FFT on the output FFT. a. Select the input FFT, select Edit > Select All, and then Edit > Copy to copy the entire input FFT waveform to the clipboard. b. Select the output FFT, select Edit > Insert Waveform. c. Both FFTs will be displayed in the same window. 5. Scale the FFT waveforms. a. On the output FFT, click on the Vertical Scale, and in the Vertical Scale dialog box, enter (for example) Scale=15dbV and Midpoint=75dbV. Select BOTH All Channels options. b. On the output FFT click on the Horizontal Scale and in the Horizontal Scale Dialog box, enter Scale = 50 Hz and Start = 0 c. Select the scope mode to overlap the waves. 6. Record the magnitude and bandwidth of the bandpass and compare to the design values. Page 47 of 63 Lab 6 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Data Report for Lab 6: 1. Include recorded graphs of the results. • To paste graphs into an open Word document, select Edit > Clipboard > Copy Graph in BSL PRO and then right-click in the Word document and select paste. a. Show a graph of the input and output responses to the Band pass Filter Block, after the output has stabilized. b. Show the FFT response of the input and output waves. c. Discuss the design and calculated values, and explain any discrepancies between actual results and expected results. End Lab 6 Page 48 of 63 Lab 6 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Lab 7: Absolute Value Circuit for QRS Detector Fig. 7.1 Schematic for SS39L Breadboard Lab 7 Objective: 1. To construct an Absolute Value Circuit as a building block in a QRS wave detector. Background: In the Breadboard Lab 6, the ECG signal was processed with a Band Pass filter with a high Q of 5 and center frequency of 17 Hz to amplify the main energy band of the QRS wave. The purpose of the Absolute Value Circuit is to full wave rectify the resultant signal to produce an output that is never less than zero, to generate a TTL level output that can be used by external equipment. The input signal at R29 arrives at a summing node of an inverting operational amplifier. A less than zero signal forward biases D2 and develops an output signal across R30, with a gain of R30/R29. When the signal is positive, D2 does not conduct. A negative feedback path through D1 is provided, which reduces the negative output swing to –0.7V and prevents the amplifier from saturating. This is a half wave rectifier. The second summing amplifier converts the half wave rectifier to a full wave rectifier. The second amp sums the half wave rectified signal and the input to produce a full wave signals. For negative inputs, the first amp output is zero, generating no current through R31, and the output is Vo = − R32Vi R28 Positive inputs are summed through R31 and R28, so Vo = R32 ( Vi Vi − ). R31 R28 With R31 = ( R R28 ) and Vo = Vi( 32 ) R28 2 R28=R29=R30=R32=10.0K R31=4.99K Laboratory: Hardware Setup 1. Build the Absolute Value block Filter per the Lab 7 Schematic (Fig. 7.1), with BP_OUT (U4 pin 8) as the input to the block. 2. Connect the interface cables to the MP35 unit. a. SS39L into CH1 on the MP35 b. SS60L into CH2 on the MP35 Page 49 of 63 Lab 7 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 3. Connect the interface cables to the breadboard to monitor the square wave outputs. a. MP35 CH1 signal input to BP_OUT (U4 pin 8). b. MP35 CH2 signal input to ABS_OUT (U4 pin 1). c. Connect the negative leads to the ground bus. Software Setup Set the BSL PRO software for recording as follows: Use the ABS.gtl template (File > Open > ABS.gtl) to simplify setup. 1. MP35 > Set up Channels: a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. b. Click the “wrench” icon for CH1 and set parameters as follows: i. Filters 1, 2, 3: None; Gain: x10, Offset: 0; Input coupling: DC Page 50 of 63 Lab 7 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 ii. Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV| c. Click the “wrench” icon for CH2 and set parameters as follows: i. Filter 1,2,&3: None; Gain: x100; Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV d. Click OK as required to exit Set up Channels. 2. MP35 > Set up Acquisition a. Mode: Record, Save Once, PC Memory b. Sample Rate: 5000 c. Acquisition Length: 5 seconds (minimum) Page 51 of 63 Lab 7 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Recording Use the Square Wave (2.5 mV P-P) output, through the InAmp (x101), High Pass Filter, Gain Block, Low Pass Filter and the Band pass Filter. 1. After the circuit has been running with the square wave input for 30 seconds, press the “Start” button in the software window to begin recording. 2. After 5 seconds, press the “Stop” button. Analysis 1. Set the following measurements for each channel: a. Freq (frequency) d) Stddev (standard deviation) b. Mean e) P-P (peak-to-peak) c. Delta T (time) 2. Compare the input to the output to verify the operation of this circuit. 3. Verify that the output is never less than zero, and that negative inputs are indeed converted to positive values. Page 52 of 63 Lab 7 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Data Report for Lab 7: 1. Include recorded graphs of the results. • To paste graphs into an open Word document, select Edit > Clipboard > Copy Graph in BSL PRO and then right-click in the Word document and select paste. a. Show a graph of the input and output responses to the Absolute Value Block, after the output has stabilized. b. Show the graphs of the input and output waves. 2. Does Vo = Vi ? Discuss the design and calculated values, and explain any discrepancies between actual results and expected results. End Lab 7 Page 53 of 63 Lab 7 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Lab 8: QRS Detection: Low Pass & System Test Fig. 8.1 Schematic for SS39L Breadboard Lab 8 Objectives: 1. To construct a Low Pass filter to remove the high frequency component of the wave generated by the QRS Band Pass filter, to produce a usable waveform that will become a QRS detector. 2. To test the ECG amplifier and QRS wave detector. Background: The Sallen-Key configuration of the QRS Low Pass Filter (LPF) shown in the BME ECG Amplifier schematic (the LPF that follows the Absolute Value Block) is a biquad implementation, meaning there are two poles in the circuit transfer function: ω0 Vo = 2 Vi s + ω 0 s / Q + ω 0 2 2 with R33 = R34 = R C19 = 4Q 2 C18 and RC18 = 1 4πf 0 Q Low Pass Filter: C18=.047uF C19=0.1uF R18=R19=237K Modeling the response of an RC circuit to a step response closely approximates the cutoff frequency. Where the voltage across the output capacitor is given as: −t v 0 = Vi (1 − e RC ) The time for v0 to reach a tenth of its final value is 0.1RC, and the time to reach nine tenths of its final value is 2.3RC. t r is the difference between these two times, so: t r = 2.2 RC = 2.2 0.35 = 2πf h fh Page 54 of 63 fh = and 0.35 tr Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Laboratory: Hardware Setup 1. Build the QRS Low Pass Filter per the Lab 8 Schematic (Fig. 8.1), with ABS_OUT (U4 pin 1) connected to R33 the QRS LPF input. 2. Connect the interface cables to the MP35 unit. a. SS39L into CH1 on the MP35 b. SS60L into CH2 on the MP35 3. Connect the interface cables to the breadboard to monitor the square wave outputs. a. MP35 CH1 signal input to ABS_OUT (U4 pin 1). b. MP35 CH2 signal input to QRS_OUT (U4 pin 14). c. Connect the negative leads to the ground bus. Software Setup Set the BSL PRO software for recording as follows: Use the QRS.gtl template (File > Open > QRS.gtl) to simplify setup. 1. MP35 > Set up Channels: a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. b. Click the “wrench” icon for CH1 and set parameters as follows: i. Filters 1, 2, 3: None; Gain: x10, Offset: 0; Input coupling: DC Page 55 of 63 Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 ii. Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV c. Click the “wrench” icon for CH2 and set parameters as follows: i. Filter 1,2,&3: None; Gain: x10; Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV d. Click OK as required to exit Set up Channels. 2. MP35 > Set up Acquisition a. Mode: Record, Save Once, PC Memory b. Sample Rate: 5000 c. Acquisition Length: 5 seconds (minimum) Recording 1—LPF Use the Square Wave (2.5 mVpp) output, through the InAmp (x101), High Pass Filter, Gain Block, Low Pass Filter, Band pass Filter and the Absolute Value Block. 1. Press the “Start” button in the software window to begin recording. Page 56 of 63 Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 2. Record for 5 seconds. • The ABS out data shown below is clipped but could be corrected by reducing the Gain setting for the channel. QRS LPF data Analysis 1—LFP 1. Set the following measurements for each channel: a. Freq (frequency) d) Stddev (standard deviation) b. Mean e) P-P (peak-to-peak) c. Delta T (time) 2. Test the LPF cutoff frequency (10 Hz) a. Select a low to high transition in CH2 Low Pass Output. b. Magnify the time base, so that the single transition is visible across the screen. c. Use the P-P measurement to find the total voltage of the transition, then make a Delta T measurement on a window that starts at 10% of the peak-peak range, and ends at 90%. Page 57 of 63 Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 ECG System Test the ECG amplifier and QRS detector with actual ECG signals. Hardware Setup for ECG System Test 1. Move the MP35 CH 1 signal input to ECG_OUT (U3 pin1). 2. MP35 CH2 signal input remains connected to QRS_OUT (U4 pin 14). 3. To view actual ECG waveforms, we will now remove the 2.5mVpp test signal and connect the SS2L Electrode Assembly, using the BSLTCI-22 Breadboard Electrode Interface. 4. Remove jumper from 2.5mVpp (U1 pin 8) to +InAmp (U2 pin 5) 5. Remove jumper from –InAmp (U2 pin 10) to GND. 6. Connect TCI-22 pin 2 to +InAmp U2 pin 5. 7. Connect TCI-22 pin 4 to –InAmp U2 pin 10. 8. Connect TCI-22 pin 3 to GND bus. Page 58 of 63 Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 9. Plug in the SS2L Electrode Assembly to the TCI-22. Connect to electrodes as follows: a. It is a good idea to lightly abrade the skin (using an ELPAD), before electrode placement to decrease the impedance between the electrode and the skin surface. b. b. Establish a standard Lead II configuration with three EL503 disposable electrodes: Attach the GND (BLACK) electrode on the right leg, the POS (RED) electrode to the left leg and the NEG (WHITE) electrode to right forearm. Software Setup Set the BSL PRO software for recording as follows: Set the BSL PRO software for recording as follows: Use the ECGsys.gtl template (File > Open > ECGsys.gtl) to simplify setup. 1. MP35 > Set up Channels: Page 59 of 63 Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 a. Enable Acquire Data, Plot On Screen, and Enable Display Value for CH1 and CH2, and type a label for each channel. b. Click the “wrench” icon for CH1 and set parameters as follows: i. Filters 1, 2, 3: None; Gain: x100, Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ-50 mV c. Click the “wrench” icon for CH2 and set parameters as follows: i. Filter 1,2,&3: None; Gain: x10; Offset: 0; Input coupling: DC ii. Scaling 10 mV Æ 50 mV and -10 mV Æ -50 mV d. Click OK as required to exit Set up Channels. Page 60 of 63 Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 2. MP35 > Set up Acquisition a. Mode: Record, Save Once, PC Memory b. Sample Rate: 5000 Acquisition Length: 30 seconds (minimum) Recording 2—ECG System 1. Press the “Start” button in the software window to begin recording. • If the ECG is inverted, exchange the POS and NEG electrode connectors on the electrodes. • If excess 50/60 Hz noise is present, adjust (firmly attach) the electrodes for better contact. 2. Insert an event marker (F9 Windows, Esc Mac) for each condition: a. Subject touches keyboard. b. Subject rapidly clenches/unclenches fist. c. Subject move arm. 3. After at least 30 seconds, press the “Stop” button • It may take up to 30 seconds for the waveform to settle (the 0.05 Hz High Pass filter). Page 61 of 63 Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Analysis 2—ECG 1. Need to specify ECG measurements. Note that the report asks for the effect on the ECG as Subject changes condition. • See BSL Lesson 5-7 or the Error! Hyperlink reference not valid. application note online at www.biopac.com for more details on ECG wave analysis. Page 62 of 63 Lab 8 BSL PRO Signal Processing Breadboard Labs www.biopac.com © BIOPAC 2005 Data Report for Lab 8: 1. Include recorded graphs of the results. • To paste graphs into an open Word document, select Edit > Clipboard > Copy Graph in BSL PRO and then right-click in the Word document and select paste. a. Show a graph of the input and output responses to the LPF. b. Show a graph of an expanded low to high Low Pass filter output transition, with the 10%-90% areas highlighted. c. Show a graph of the final ECG output vs. QRS wave detection. 2. Calculate the High Pass 3db cutoff frequency and compare to the design value. Explain any discrepancies between actual results and expected results. 3. Describe how the QRS detector can be tricked. Note any problems with recording ECG waveforms. 4. Determine the rise time t r , defined as the time for the waveform to rise from 10% to 90% its final value. 5. What effect did the Subject touching the mouse or keyboard have on 50/60 Hz interference? 6. What effect did the Subject’s rapid fist clenching/unclenching have on the measurement? 7. What effect did the Subject’s arm movement have on the measurement? End Lab 8 Page 63 of 63 Lab 8