GOAL Lab 6 Spirmeter System (Feb 20/21) Demnstrate a spirmeter system incrprating a (1) Lilly-type flw tube (2) piezresistive differential pressure sensr (3) instrumentatin amplifier and lw-pass filter (4) analg-t-digital cnverter (5) MATLAB prcessing and display. OBJECTIVES 1) Build and test the electrnics t measure the differential pressure frm the Lilly-type flw tube. 2) Develp the Arduin and MATLAB interface t display flw-time and vlume-time curves btained with a Lilly-type spirmeter. GENERAL GUIDELINES 1) 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 Scpe and prbe kit Cmputer with Arduin IDE and MATLAB Spirmeter flw head + MPX2010DP sensr + wiring Bacterial filter and muthpiece 10V benchtp pwer supply and banana cables AD620 instrumentatin amplifier (ne) TL081 p amp (ne) 30 hm resistr (range/black/black) (ne) 1 khm resistr (brwn/black/red) (ne) 3.0 khm resistr (range/black/red) (ne) 100 khm (brwn/black/yellw (ne) 0.1 uf capacitr (tan clred) (ne) 1
PART 0: INTRODUCTION The spirmeter measurement system will use a Lilly-type flw head, the MPX2010DP sensr, an instrumentatin amplifier and lw-pass filter, the Arduin fr data acquisitin, and MATLAB fr data prcessing. Here s hw it wrks: 1) The flw head: Air flw causes a slight pressure difference P between the tw sides f the mesh screen. 2) The sensr cnvers P int a differential vltage V. 3) The sensr utput V is then: Amplified by the AD620 instrumentatin amplifier. Smthed (lw-pass filter) by the TL081 p amp. 4) The lw-pass filter utput is recrded by the Arduin and sent t a cmputer. 5) The cmputer prcesses the data (using MATLAB). An upper plt shws exhaled flw vs time. The lwer plt shws exhaled vlume vs time. Fig. 1: Simplified blck diagram f the spirmeter measurement system. 2
PART 1: INSTRUMENTATION AMPLIFIER AND LOW-PASS FILTER The purpse f this sectin is t make a hme-built spirmeter. The MPX2010DP differential pressure sensr has already been attached t the flw head (Buma is s kind.). A fur-wire cable is the interface between the sensr and yur breadbard. The setup may nt lk very pretty, but it des give reasnable results after prper calibratin! Fig. 2: Electrnics fr flw head pressure sensr, instrumentatin amplifier, and lw pass filter. Fig. 3: (a) External appearance f the MPX2010DP pressure sensr (b) Pin diagram f the AD620 instrumentatin amplifier (c) Pin diagram f the TL081 p amp. Step 1a: Build the circuit in Fig. 2. Use NEAT and COLOR-CODED wiring! Red = +10V Black = GND Yellw = ther Feel free t cnsult Buma s bard as an example. The pin diagram fr the AD620 and TL081 are shwn in Fig. 3. 3
Due t limited supplies, yu may have t share the flw head + cable assembly. Please be GENTLE with the flw head and cable assembly. The wiring is given by: BLACK = GND WHITE = Pin 3 (+ signal input) f AD620 RED = +10V GREEN = Pin 2 (- signal input) f AD620 METAL = GND Step 1b: Measure the utput f the AD620. Attach a scpe prbe t the utput (Pin 6) f the AD620. Turn n the scpe. If necessary, press the Frce buttn t enable lcal (e.g. Frnt Panel) cntrl. Press the Default Setup buttn t reset the scpe. Make sure bth the scpe and prbe are set t 1X. Vertical settings: Scale = 0.5V/div Offset = -1.5V (this makes zer vlts near the bttm f the screen). Hrizntal settings: Scale = 500 ms/div Offset = +2 sec (trace shuld start near the left edge f the screen). Push the TRIG MENU buttn, g t SOURCE and select AC Line. Press the Run/Stp buttn s that it appears RED. Step 1c: Perfrm a frced expiratry maneuver (FEM) with the spirmeter. Cmments abut the flw head: Fr hygienic reasns, it is a gd idea t use a separate muthpiece fr each persn wh exhales int the spirmeter. Yu will need t attach a nse clip fr the FEM. Try t keep the spirmeter head statinary during the FEM (e.g. dn t tilt it up and dwn). Acquisitin prcedure: Press the Single buttn n the scpe and quickly take a deeeeep breath. Bring the muthpiece t yur lips and exhale as quickly as humanly pssible! 4
Try nt t inhale again until the scpe trace is dne (takes 5 secnds). The scpe trace shuld lk like a pulse with sme fuzz (see Fig. 4a). Save this scpe trace fr yur lab reprt (e.g. use swave in MATLAB). Fig. 4: (a) Scpe trace f AD620 utput shuld shw a pulse with sme "fuzz". (b) The utput f the TL081 p amp shuld be MUCH smther due t the lw pass filter. Step 1d: Measure the utput f the lw-pass filter. Mve the scpe prbe t the utput f the TL081 p amp. Repeat the FEM prcedure. The scpe trace shuld lk much cleaner (see Fig. 4b)! Save this scpe trace fr yur lab reprt (e.g. use swave in MATLAB). Once yu have saved bth scpe traces, g ahead t Part 2. (End f Part 1) 5
PART 2: ARDUINO Fr this lab, we want t recrd 5 secnds f data frm ONE analg input pin (A0). We ll chse a sampling interval f dt = 10 ms and N = 500 samples. Step 2a: Starting with the Lab 4 (ptical heart rate mnitr) Arduin cde, mdify it t d the fllwing: Time between readings is T = 10 millisecnds. Number f samples per trace is N = 500. NOTE: If yu nly have yur Lab 5 Arduin cde, that s fine. Just mdify it s that it nly recrds frm ONE analg input pin (A0). Step 2b: 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. The Arduin s yellw Tx LED shuld be blinking rapidly during the data burst. Remember t save yur prgram! (End f Part 2) 6
PART 3: MATLAB (2 prgrams) This week, we will nce again write TWO MATLAB prgrams! The first prgram acquires data frm the Arduin. The secnd prgram analyzes the measured vltage t display FLOW and VOLUME curves. Step 3a: Starting with yur MATLAB cde frm Lab4 r Lab 5, make the fllwing changes: The number f samples is N = 500. The input buffer size f serobj is back t 8*N, since we nly have ONE channel f data. The sampling interval is dt = 0.010 secnds. We nly need ONE data vectr (such as Vmeas0). Since we are acquiring nly ONE wavefrm: We must wait until 7*N bytes are received. During the fr m=1:n lp, yu nly need t use fscanf ONCE t get each Vmeas0 value. Create a figure windw and plt Vmeas vs time. Save this prgram as smething like Lab6_acquiredata.m. Step 3b: Perfrm a trial data acquisitin: Start yur MATLAB data acquisitin cde, wait a cuple secnds, then perfrm an FEM. Hpefully yu will see a figure appear that lks smething like Fig. 5. Fig. 5: The MATLAB plt f Vmeas0 shuld lk smething like this. Step 3c: Create a new MATLAB prgram (New >> Script) t display Flw and Vlume curves. Call this prgram smething like Lab6_DataPrcessing.m. First, cnvert Vmeas0 t Flw. Define flw resistivity R (kpa s/l), sensr sensitivity S (V/kPa) and amplifier gain Ad. Define the reference vltage Vref as 1.5 and Calibratin as 1.0 fr nw (tweak this later). Cnvert Vmeas0 t Flw using yur frmula frm PreLab6. 7
Next, integrate Flw t btain Vlume. Fr the scpe f this curse, it is sufficient t use a cumulative sum t integrate flw: This is the cumsum cmmand in MATLAB. What d yu have t d t apprximate an integral using the cumsum cmmand? Remember that cumsum simply adds tgether values (see MATLAB dcumentatin). Think abut hw t apprximate an integral as a discrete sum. Hint: The time increment dt plays an imprtant rle. Create a new figure windw shwing bth Flw and Vlume curves (e.g. ne abve the ther). Remember t use the subplt(2,1,1) and subplt(2,1,2) cmmands t d this. Step 3d: Zer the system. This invlves finding the prper value f Vref. This zering is similar t Lab 1 (lad cell), where n weight is suppsed t prduce ZERO n yur display. Re-run yur data prcessing MATLAB cde as many times as needed t make the Vlume plt be ZERO and FLAT befre the FEM ccurs (see Fig. 6). Yu will prbably find that yur Fig. 6: The prper value f Vref will cause the vlume curve t be frced vital capacity (FVC) is ZERO and FLAT befre the FEM ccurs. disappintingly lw (it shuld be 4 t 6 liters). We ll fix this sn with the calibratin step. Step 3e: Calibrate the system This invlves finding the prper value f Calibratin. This is similar t the calibratin step in Lab 1, where a knwn 200 g weight is suppsed t prduce a displayed weight clse t 200 g. Fr this lab, we will inject a knwn vlume f air int the spirmeter using a 3 liter syringe (Ellis Hspital was nice enugh t give us an ld calibratin syringe ). Carefully attach the syringe tip t the flw head (remve the muthpiece and filter). 8
(End f Part 3) Yu can use sme tape t seal the cnnectin (e.g. prevent air leaks). Let the syringe rest hrizntally n the bench tp. Perfrm a calibratin experiment by ding the fllwing: Pull the syringe knb all the way back. Start yur MATLAB data acquisitin cde. Inject all the air int the spirmeter (d this in abut ne secnd). Next, run yur MATLAB data prcessing cde. Think abut hw t interpret yur flw and vlume plts in rder t adjust the Calibratin value in yur cde. Hint: What knwn quantity are yu injecting int the spirmeter? Re-run yur prgram as many times as needed until yu get the crrect result. Depending n the system, yur Calibratin value will mst likely be smewhere between 1 and 3. Save yur syringe flw and vlume plts fr yur lab reprt. PART 4: SPIROMETER MEASUREMENT Step 4a: Nw that yur system is zered and calibrated, it is time t measure yurself! (End f Lab 6) Replace the syringe with the muthpiece + filter, then perfrm an FEM experiment. Based n yur plts, what is yur PEF (peak expiratry flw) and FVC (frced vital capacity)? Yur lab reprt needs the fllwing: (1) Scpe traces (like Fig. 4). (2) Syringe flw and vlume plts frm Step 3e. (3) Values f Vref and Calibratin. (4) Yur Flw and Vlume plts (like Fig. 7), PEF, and FVC. Shw yur plts t Buma. Buma will tabulate everybdy s peak expiratry flw (PEF) and frced vital capacity (FVC) and declare the respective winners! Fig. 7: Yur flw and vlume curves shuld lk smething like this. Save the Calibratin and mst recent Vref values fr yur reprt. 9