top of page
robot
Auriculares elegantes
Circuito electrónico
Junta de Circuito
intercambios
bllll

Spirometry

  • Foto del escritor: carolina2223
    carolina2223
  • 12 nov 2018
  • 4 Min. de lectura

Actualizado: 15 nov 2018


Spirometry is a painless study of the volume and rhythm of air flow within the lungs. This procedure is frequently used to evaluate lung function in people with obstructive or restrictive lung diseases such as asthma or cystic fibrosis [1].


Figure 1. Spirometry

Figure 1. Spirometry


How the test is performed


Spirometry measures the flow of air. By measuring the amount of air you exhale and how quickly you do it, a wide range of lung diseases can be evaluated with spirometry. In a spirometry test, while you are sitting, breathe into a mouthpiece that is connected to an instrument called a spirometer. It records the amount and frequency of inspired and expired air over a period of time. While standing, some numbers may be slightly different.

For some of the test measurements, you can breathe normally and calmly. Other tests require a forced inhalation or exhalation after a deep breath. Sometimes, you will be asked to inhale a different gas or medication to see how this changes test results [2].


Components


Figure 2.

Flow sensor



This flow sensor is constructed of solid plastic, easily installed in a standard pipe system (1/2), measures the flow of water by means of an internal water rotor that activates a Hall effect sensor, this sends pulses for each rotation, the sensor is isolated from the water and the rotor, so that it is always kept dry and safe [3].


Distance sensor


The HC-SR04 is an ultrasonic distance sensor capable of detecting objects and calculating the distance it is in a range of 2 to 450 cm. The sensor works by ultrasound and contains all the electronics responsible for making the measurement. Its use is as simple as sending the start pulse and measuring the width of the return pulse. Of very small size, the HC-SR04 stands out for its low consumption, high precision and low price so it is replacing the polaroid sensors in the most recent robots [4].

MATERIALS

SCHEMATIC DRAWING

Figure.5


Code

This section explains the development of the code in Arduino corresponding to the operation of the Spirometer.


In the first part of the code we assign variables for each one of the sensors used in the spirometer, such as flow sensor and ultrasound sensor, the latter needs a pin for trigger and another for Echo, to work properly. In addition, some variables that will be used in the development of the code and those that will represent the flow, volume and time values obtained in Spirometry are also named and initialized. Also included is the Arduino library "NewPing. h" for the ultrasound sensor that measures the distance that travels the sphere in the incentive.

As the flow sensor works with pulses, this part creates a function that counts the pulses at the moment of inspiration and exhalation, obtained from the reading of the sensor from the pin 2 of the Arduino. Then you do the calculation to get the flow at every moment.


To display the flow, volume and time data obtained in inspiration and exhalation, a 2x16 LCD was used and in this part of the Code the Library is included and the Arduino pins are assigned to which each pin of the LCD is connected.


Here you can see the void Setup function in which you define each variable named at the start as input (intput) or output and also the high or low state. The LCD is initialized and a "ESPIROMETRO" message is is indicated.

The void loop function shows the entire process for data collection, as there are two modes, inspiration and exhalation, two switches were defined and depends on the state (high or low) of each one of them, enter each mode. We use a while for each mode and within the we obtain the flow, from a formula equal to the variable one that is shown in the code and then proceed to program the ultrasound sensor that records the volume in inspiration and exhalation.

Then we proceed to characterize the ultrasound sensor to detect the distance to which the sphere is in the incentive and to calculate the Inspiratory and expiratory volume. It defines conditions with respect to the distance and if they are fulfilled, one can obtain a volume depending on the fulfilled condition, for 400 ml, 300ml, 200ml, 100ml and 0ml. This can be viewed below:



Finally, lines of code were created that allowed to visualize the results obtained, both of time and of volume and flow, in the LCD.




In the following image you can see the respiratory incentive and the position in which the sensors were placed for the correct functioning of the system. The ultrasound sensor was placed at the top so you can detect the sphere as it moves away and closes to it, allowing you to define the volume at the moment of exhaling and inspiring, taking into account the distance the sphere is at any moment.




GLOSSARY


Spirometry: Apparatus used to measure the respiratory capacity of the lungs.


Rhythm: Way to happen and to alternate a series of things (movements, palpitations, events, etc.) that are repeated periodically in a certain interval of time.


Lung: Organ of the breathing of vertebrate animals in which the exchange between air and blood takes place.


Breathe: Perform the function of breathing.


Mouthpiece:Small and hollow piece that adapts to the tube of different instruments, in which the lips are placed to blow.


Slightly:In a light way.


BIBLIOGRAPHY

[1]2018. [Online]. Available: https://medlineplus.gov/spanish/ency/esp_imagepages/1142.ht006D.


[2]"PreviewArticle", Cms.stg.adam.com, 2018. [Online]. Available: http://cms.stg.adam.com/Content/PreviewArticle.aspx?pid=5&gid=003853.


[3]YF-S201, "Sensor de flujo de agua (Hall) 1/2" YF-S201", Naylamp Mechatronics - Perú, 2018. [Online]. Available: https://naylampmechatronics.com/sensores-liquido/108-sensor-de-flujo-de-agua-12-yf-s201.html.


[4] "Sensor de Distancia de Ultrasonido HC-SR04 - Electronilab", Electronilab, 2018. [Online]. Available: https://electronilab.co/tienda/sensor-de-distancia-de-ultrasonido-hc-sr04/.


 
 
 

Comments


Social Animal

© 2023 BY SOCIAL ANIMAL. PROUDLY CREATED WITH WIX.COM

A BLOG BY DAN STEIN 

Social wiz in the media biz 

WEEKLY NEWSLETTER 

bottom of page