GOAL Lab 5 Bld Pressure Measurement System (Feb 3/4) Demnstrate a system that measures mean arterial pressure (MAP). OBJECTIVES ) Build the electrnics t measure the air pressure frm a pressure cuff. 2) Develp the Arduin data acquisitin cde. 3) Develp the MATLAB interface that prcesses data and displays mean arterial pressure (MAP). GENERAL GUIDELINES ) Each student must build his/her wn circuit. 2) Students are allwed (even encuraged) t help each ther. Of curse, Buma will be arund t prvide assistance as well. REQUIRED PARTS AND MATERIALS Lab kit, benchtp pwer supply, test prbe kit Scpe, Arduin + USB cable Pressure cuff + shrt length f /8 inner diameter rubber hse + female Luer-t-Barb hse cnnectr + 3 diameter PVC tube Fig. : Pressure cuff (left) and MPX2050GP sensr (right). MPX2050GP piezresistive pressure sensr (ne) AD620 instrumentatin amplifier (tw) Resistrs: 270 hm resistr (red/purple/brwn) (ne).0 khm resistr (brwn/black/red) (tw) 2.7 khm resistr (red/purple/red) (ne) 3.3 khm resistr (range/range/red) (ne) 5.6 khm resistr (green/blue/red) (ne).0 Mhm resistr (brwn/black/green) (ne) uf capacitr (blue) (ne)
PART 0: INTRODUCTION The bld pressure measurement system will use a pressure cuff, the MPX2050GP sensr, tw AD620 instrumentatin amplifiers, the Arduin fr data acquisitin, and MATLAB fr data prcessing. Here s hw it wrks: ) The pressure cuff: a. Inflate until bld flw is cut-ff frm the arm. b. Then, the cuff pressure slwly decreases ver rughly 40 secnds. 2) The sensr mnitrs the cuff pressure. a. The first AD620 amplifier increases the sensr signal. b. A high-pass filter and secnd AD620 amplifier islates and increases the scillatin signal. 3) The tw amplifier utputs are recrded by the Arduin and sent t a cmputer. 4) The cmputer prcesses the data (using MATLAB). a. The first prgram imprts data frm the Arduin. b. The secnd prgram analyzes the tw vltage wavefrms t determine the MAP. Fig. 2: Simplified blck diagram f the bld pressure measurement system. 2
PART : PRESSURE SENSOR AND ELECTRONICS The first part f the circuit is shwn belw. The pin diagrams fr the sensr and AD620 are shwn in Fig. 4. + 0V + 0V 3 7 Pressure Sensr 270 hm 8 AD620 (GAIN = 84) 4 5 OUTPUT 6 + 0V GND 2 5.6 khm -0V.0 khm GND Fig. 3: First part f the signal cnditining electrnics. (a) (b) (c) Fig. 4: (a) External appearance f the MPX2050GP pressure sensr. Pin is FARTHEST away frm the nzzle. (b) Simplified blck diagram f the internal electrnics f the sensr. (c) Pin diagram f the AD620. Step a: Install the MPX2050GP pressure sensr. Use NEAT and COLOR-CODED wiring! Red = +0V Black = GND Blue = -0V Yellw = ther Feel free t cnsult Buma s bard as an example. The pin diagram fr the sensr is shwn in Fig. 4(a). The sensr leads are bent t allw the sensr t be placed flat against the breadbard. 3
Step b: Install the instrumentatin amplifier. The pin diagram fr the amplifier is shwn in Fig. 4(c). The gain resistr R G is 270 hm, which shuld prduce a differential gain A d = 84. The AD620 is pwered by +/- 0V (use red and blue wire fr pwer cnnectins). Remember t cnnect Pin5 t the 5.6 khm and khm resistrs. Step c: Set up the pressure cuff. Lightly wrap the pressure cuff arund the 3-inch diameter PVC tube. D nt wrap the cuff t tightly (slight wiggle rm is fine). This is nly fr initial testing f yur system. Press the gray valve buttn near the bulb t squeeze ut all the air frm the cuff. Attach the pressure cuff t the sensr chip. Attach the shrt rubber hse t the sensr s input barb. Attach the female-luer-t-barb cnnectr t the ther end f the rubber hse. NOTE: The cnnectr may already be attached t the shrt rubber hse. Attach the pressure cuff t the female-luer-t-barb cnnectr. Fig. 5: Hse cnnectins between pressure cuff and sensr. Step d: Hk up the benchtp pwer supply fr +/- 0V. Yu shuld (and better) knw hw t d this by nw. Step e: Cnfigure the scpe. Attach a scpe prbe t the amplifier utput (Pin 6 f AD620 chip) and use CH f the scpe. Turn n the scpe. If necessary, press the Frce buttn t enable lcal (e.g. Frnt Panel) cntrl. Press Default Setup t reset the scpe Make sure bth the scpe and the prbe are set t X CH vertical adjustments: Adjust the vertical scale (large knb) t V/div. Adjust the vertical ffset (small knb) t make 0V in the lwer half f the screen (see Fig. 6). 4
CH hrizntal adjustments: Adjust the hrizntal scale (large knb) t 2 sec/div Adjust the hrizntal ffset (small knb) t mve the Vertical range T marker near the Offset Cursr A = 4.5V left edge f the screen (see Fig. 6). Press the CURSORS buttn: Select Mde >> Manual Select Type >> Amplitude Adjust Cursr A t be at +4.5V (see Fig. 6). This cursr makes it MUCH easier t knw when t stp inflating the cuff! T Hrizntal Offset Fig. 6: The vertical and hrizntal ffsets n yur scpe shuld lk smething like this. Step f: Test the electrnics. Wait fr the scpe trace t start appearing at the left edge f the screen. While lking at the scpe, inflate the cuff until the vltage just crsses the 4.5V cursr line, then stp and let the cuff slwly deflate. Sme cmments: Squeeze the bulb at rughly twice per secnd. Make nte f the number f squeezes necessary (rughly eight) t crss 4.5V (see Fig. 7a). After yu stp inflating, yu shuld hear a faint hissing sund as the pressure slwly drps. The pressure shuld drp t abut 2V by the end f the secnd trace (see Fig. 7b). Befre repeating the test, press the gray valve near the bulb t release all the air. If the cuff deflates much t fast r slw, let Buma knw (he can make adjustments). Amplitude (vlts) Amplitude (vlts) (a) (b) (End f Part) Fig. 7: (a) The cuff inflatin and initial deflatin shuld lk smething like this. (b) The next scpe trace shws the remaining prtin f the slw cuff deflatin. The trace shuld reach rughly 2 vlts by the end f the trace. 5
PART 2: HIGH-PASS FILTER AND SECOND AMPLIFIER We need t measure the pressure scillatins in rder t btain the MAP. Hwever, these scillatins are pretty tiny (e.g. 0 mv)! Therefre, we will use a high-pass filter and anther amplifier t increase the scillatin signal. Frm Pin 6 f previus AD620 chip.0 uf.0 Mhm GND 3.3 khm 3 8 2 + 0V 7 AD620 (GAIN = 6) 4 5 OUTPUT 6 + 0V 2.7 khm GND -0V.0 khm GND Fig. 8: Schematic f secnd part f signal cnditining electrnics. Step 2a: Install the high-pass filter and secnd AD620 amplifier. Use NEAT and COLOR-CODED wiring! The uf capacitr is the BLUE ne. Step 2b: Test the electrnics. Cnnect a SECOND scpe prbe t the utput (Pin 6) f the secnd AD620 amplifier. Make sure the secnd prbe and CH2 f the scpe are set t X. CH2 vertical setting: Vertical scale = V/div Vertical ffset = rughly the same as CH. Perfrm anther cuff inflatin test and view BOTH scpe channels during the entire prcess. During cuff inflatin, CH2 shuld shw large amplitude spikes (see Fig. 9). During cuff deflatin, CH2 shuld be relatively flat (near V r s). Squeezing the cuff shuld prduce sme vltage peaks and dips. Dem yur wrking circuit t Buma. Amplitude (vlts) Cuff inflatin CH CH2 Oscillatins due t tapping the cuff Fig. 9: Example f CH and CH2 wavefrms n the scpe. 6
Step 2c: Cnnect the Arduin t yur circuit with THREE wires. Arduin A0 pin = YELLOW wire t the utput f the first AD620 chip. Arduin A pin = YELLOW wire t the utput f the secnd AD620 chip. Arduin GND pin = BLACK wire t the breadbard grund. Step 2d: Keep the scpe prbes cnnected t yur circuit. Watching the scpe wavefrm will help yu prperly inflate the cuff n yur arm (later in lab). OK, nw yu re dne with the hardware! Mving n t prgramming (End f Part 2) PART 3: ARDUINO Fr this lab, we want t recrd 50 secnds f data frm TWO analg input pins. We ll chse a sampling interval f dt = 50 ms and N = 000 samples. Step 3a: Starting with last week s Arduin cde, mdify it t d the fllwing: () Time between readings is T = 50 millisecnds. (2) Number f samples per trace is N = 000. (3) We want t recrd and send TWO vltages. Therefre, we need t duble the number f variables (e.g. ADCvalue0, ADCvalue, Vmeas0, Vmeas). Inside yur lp, send each vltage ne after anther (3 decimal places) by using Serial.println twice (nce fr Vmeas0 and again fr Vmeas). Step 3b: Uplad yur cde and bserve the Arduin utput using the Serial Mnitr n the cmputer. Make sure the bttm right f the windw is set t 57600 baud. Yu shuld ntice the letter a n the first line. Type in the letter y in the cmmand line and press the Send buttn. Yu shuld see a rapid burst f vltage values when yu send y. This will last abut 50 secnds, s it takes a while t finish. The Arduin s yellw Tx LED shuld be blinking rapidly during the data burst. Remember t save yur prgram! (End f Part 3) 7
PART 4: MATLAB (2 prgrams) This week, we will have twice the fun and write TWO MATLAB prgrams! ) The first prgram will acquire data frm the Arduin. This prgram is run ONCE during an experiment t btain raw vltage data. 2) The secnd prgram analyzes the tw wavefrms t btain the mean arterial pressure (MAP). This prgram can be re-run multiple times t tweak varius parameters (e.g. Vref) in the signal prcessing. This tw-step apprach avids the need t re-d the entire cuff inflatin/deflatin experiment multiple times yur arm will thank yu fr this. Step 4.: Starting with yur MATLAB cde frm last week, make the fllwing changes: The number f samples per trace is N = 000. The input buffer size f serobj shuld be twice as large (6*N), since we nw have TWO wavefrms and therefre twice the data t receive. The sampling interval is dt = 0.050 secnds. Create TWO vltage data vectrs (such as Vmeas0 and Vmeas). Since we are perfrming a SINGLE data acquisitin, we can make a plt AFTER data has been acquired. Remve the lines f cde invlving h=figure, plt, drawnw, q=0, and set(h, ButtnDwnFcn ). Remve the while (q = = 0) lp (but keep the cde inside the lp). Since we are acquiring TWO wavefrms, we must wait until 4*N bytes are received (rather than 7*N bytes). During the fr m=:n lp, yu must use fscanf TWICE (nce fr Vmeas and nce fr Vmeas2). OK, nw we can finally plt bth Vmeas0 and Vmeas n the same figure! Use the subplt cmmand t make TWO plts n the same figure. Fr example: figure; subplt(2,,); plt(t, Vmeas0); subplt(2,,2); plt(t, Vmeas); 8
Remve the drawnw cmmand (since we are nt lping the data acquisitin and display). Step 4.2: Perfrm a trial data acquisitin: First, wait fr the scpe t start a new sweep. Then start yur MATLAB cde -- yu shuld see the Arduin start t blink rapidly, which means it is happily sending data t the cmputer! Start inflating the pressure cuff while watching the scpe. Stp inflating when the CH vltage crsses 4.5V. Then stp and leave everything alne fr abut a minute. If yu want, yu can squeeze the cuff a few times during the deflatin perid (see Fig. 0a). Hpefully yu will see a figure appear with bth wavefrms (see Fig. 0a). Dem yur cde t Buma. 5 Vmeas0 Amplitude (vlts) 4 3 2 0 0 5 0 5 20 25 30 35 40 45 50 5 Vmeas Amplitude (vlts) 4 3 2 0 0 5 0 5 20 25 30 35 40 45 50 Time (sec) (a) (b) Fig. 0: (a) Yur Arduin and MATLAB data acquisitin prgrams wrk if yu get a plt like this. The spikes during deflatin are due t Buma tapping n the cuff. (b) Yu shuld get plts like this when yu use yur wn arm! Step 4.3: Make a vltage measurement with the pressure cuff n yur arm. Snugly wrap the cuff arund yur upper arm, then run yur MATLAB data acquisitin cde. Inflate the cuff until the scpe shws a CH vltage f abut 4.5V. A CH vltage f 4.5V crrespnds t a cuff pressure f abut 60 mmhg. Inflatin shuld be dne in less than 0 secnds, s squeeze the bulb pretty fast! Remain VERY STILL AND RELAXED until the cde is dne. Yu shuld get smething like Fig. 0b. Nw that yu have yur data, remve the cuff frm yur arm. 9
Step 4.4: Create a new MATLAB prgram (Editr >> New >> Script) t btain the MAP. The basic signal prcessing steps t btain the mean arterial pressure (MAP) are the fllwing: () Cnvert Vmeas0 t cuff pressure Pcuff. (2) Select nly the deflating part f Pcuff and Vmeas. (3) Apply a high-pass filter t Vmeas in rder t remve slw fluctuatins. (4) Find the lcatin f the peak scillatin in the filtered Vmeas signal. (5) The MAP is the value f Pcuff crrespnding t this lcatin! First, we need t cnvert Vmeas0 t cuff pressure Pcuff: Define the values fr sensr sensitivity S (V/mmHg) and amplifier gain Ad. Define the reference vltage Vref as.5 fr nw (tweak this later). Cnvert t Vmeas0 t pressure Pcuff using yur frmula frm PreLab5. Make a new figure shwing a plt f Pcuff versus time. Run yur new prgram (NOT the first MATLAB prgram). Yu shuld get a plt that lks similar t Fig.. Adjust the value f Vref and re-run the cde until the initial cuff pressure is ZERO. Secnd, we need t select the desired prtin f each wavefrm. We want t ignre the cuff inflatin and fcus n the cuff deflatin. Therefre, we will thrw away the first 200 samples (first 0 secnds). D smething like: Pcuff_b = Pcuff(200:end); Vmeas_b = Vmeas(200:end); Third, we need t imprve the appearance f the Vmeas_b wavefrm by sending it thrugh a 4 th rder Butterwrth digital high-pass filter. Use the [b, a] = butter(rder, Wn, ftype) cmmand (see MATLAB help dcumentatin) t design a digital high-pass filter with the fllwing parameters: Filter rder is 4. The digital frequency is defined by Wn = fc/(0.5*fs). Fig. : Yur plt f cuff pressure vs time shuld lk smething like this after the prper value f Vref has been determined. 0
We want the crner frequency t be fc = 0.5 Hz. Remember that the sampling frequency fs is related t the sampling interval dt. Filter type is high. Nw that we ve designed ur filter, apply it t the Vmeas_b signal by using the filtfilt cmmand. D smething like: Vmeas_filt = filtfilt(b, a, Vmeas_b); Furth, we need t find the array index f the maximum scillatin: Use the max cmmand t find the INDEX f the maximum scillatin. Cnsult the MATLAB help dcumentatin fr the max cmmand. Fifth, determine the MAP! Nw that yu have the index, select the value f Pcuff_b at this same index. Make a new figure shwing plts f Pcuff_b and Vmeas_filt. Fr pltting purpses, yu need t define a new time vectr. D smething like: t_b = t(200:end); If yu want the MAP value t appear in yur plt, d smething like: title(sprintf( MAP = %3.f mmhg, MAP)); Step 4.5: Run yur secnd MATLAB cde (NOT the first data acquisitin cde). Tw plts shuld appear (cuff pressure, deflating prtin f wavefrms). Hpefully yu get a MAP between 80 and 00 mmhg! Save this figure fr yur lab reprt and shw t Buma. Buma will tabulate the MAP values and declare the class winner (lwest MAP). Fig. 2: Yur MAP prcessing cde shuld prduce a plt shwing the deflating prtins f each wavefrm. Buma's MAP value desn't lk that great seems like he needs t d sme cardi exercise! (End f Lab5)