The following are instructions on how to build your very own spirometer!! We had to build this for an engineering class at my university. Our project uses a pressure transducer, arduino, and a switch to compute the change in breath volume through a tube with two different diameters. We used a simple circuit in order to cut down on possible complications.
Step 1: Step 1: Supplies
-Plastic Tubing (inner diameter: 1/16 inch) (Free!-Lab already had it)
-Pressure Sensor (Honeywell RR Transducer ASDXRRX010ND7A5) ($53.06)
-Arduino Uno (Free!-Lab already had it)
-LCD Screen (Free!- Lab already had it)
-Micro USB Cable (Free! Lab already had it)
-3-D Printed shaft (radius1: 2.33cm, radius 2: 1.06 cm) (Free! with free access to 3D printer)
Step 2: Step 2: Coding
While we waited on our parts to arrive, we worked on the arduino code for the Spirometer.
First, we read in the analog signal from the transducer and converted it to a digital signal using:
inputVoltage = analogRead(analogInPin);//
voltage = inputVolt*(vs/1023.0);
Next, we converted the voltage to pressure (and into the correct units) using:
pressure_psi = (15/2)*(volt-2.5);
pressure_Pa = pressure_psi*6894.76;
Then, we calculated the mass flow from the pressure using:
dP = ((W^2)/2rho)*(1/A2^2-1/A1^2)
massFlow = 1000*sqrt((abs(pressure_pa)*2*rho)/((1/pow(area_2,2)))-(1/pow(area_1,2)))));
Lastly, we converted the mass flow to volumetric flow and computed the volume using:
volFlow = massFlow/rho;
volume = volFlow*dt+volume;
***Attached is the actual code with more information on variables.
Step 3: Step 3: Build It!
First, hook the arduino uno up to the computer using the micro USB cable. Attach the LCD screen (be careful not to bend the pins) and then, use wires to attach Pin 1 of the transducer to the 5V pin on the arduino, Pin2 to A1, and Pin 3 to ground. Glue the tubing to the shaft and connect the other ends to the pressure transducer. Blow into the shaft (larger diameter end) and voila! Your breathe volume will be displayed on the LCD screen!