Characterization of Respiratory Conditions Using LabVIEW and Digital Spirometer

Received Jan 6, 2018 Revised Mar 8, 2018 Accepted Mar 23, 2018 One of the effective ways to diagnose various respiratory diseases is using spirometry test. Good spirometer comes with excellent graphical user interface. Spirometer is used to measure lung parameters such as Forced Expiratory Volume in the first second and the sixth seconds (FEV1 and FEV6). This paper presents an algorithm with Graphical User Interface (GUI) for characterization of respiratory conditions using LabVIEW Software. The whole spirometry system consists of a breathing circuitry with pressure sensor and a data acquisition board (NI sbRIO FPGA board). Results obtained from three different volunteers with different health performances are also presented in this paper. The FEV1/FEV6 ratio of a healthy volunteer is 81.1%, an asthma volunteer is 72.04%, and suspected bronchitis volunteer is 33.4%. Based on these results, the unhealthy volunteers tend to have smaller value of FEV1 with lower area under the curve when compared to healthy volunteer.


INTRODUCTION
Spirometry is a painless test to evaluate respiratory performance by measuring how much air can be inhaled and exhaled in one force. In spirometry measurements, the quantity of air inhaled and exhaled by the patients together with the speed of the exhalation are needed to describe the conditions of lung. The device used for spirometry testing is called a spirometer. In general, a spirometer has three basic parts: mouthpiece, airflow tube and electronic device. A designed spirometer must be able of conducting analysis and diagnosis of the human respiratory system. The common function of a basic digital spirometer is to plot the expiratory air flow against total expiratory volume graph, also known as the spirogram that is used by health professionals to describe lung functions.
A spirometer is used to facilitate doctors in diagnosing respiratory related diseases such as asthma, pneumonia, bronchitis, chronic obstructive pulmonary diseases (COPD) and other lung deficiencies. A single spirometer test takes only ten to fifteen minutes of operation time. Spirometer allows us to evaluate the basic function of human respiratory system i.e., to provide enough oxygen into our body and to remove carbon dioxide from the body [1]. Ideally, we need a device like spirometer that can evaluate the performance of our breathing by measuring air volume in our lung.
Nowadays, spirometer was designed as such it is handheld and programmable to suit the always onthe-move modern lifestyle [2]. There are various portable spirometers that available in the market and 67 therefore its characteristics and functions depend on the type of sensors used to detect breathing patterns and parameters [1], [3]. Figure 1 shows the block diagram on how the spirometer works. There are several spirometric parameters used to evaluate respiratory conditions and lung disorder such as Forced Expiratory Volume in 1 second (FEV1), Forced Vital Capacity (FVC), FEV1/FVC (FEV1%), Forced Expiratory Flow (FEF) and Peak Expiratory Flow (PEF) [1]. FEV1 (Forced Expiratory Volume) is a measure of how much air can be exhaled in one second following a deep inhalation while FEV6 (Forced Expiratory Volume) is indicates the how much air can be exhaled in six second from deep inhalation. Sometimes, FEV6 can be replaced by FVC (Forced Vital Capacity) because both FEV6 and FVC return the same values. Both FEV1 and FEV6 parameters are the important to determine the lung's capacity and breathing performance. This paper describes the characterization algorithm used in developing a user-friendly portable digital spirometer using LabVIEW and National Instruments Single Board RIO (NI sbRIO) [4]. The algorithm is able to extract FEV1 and FEV6 from breathed air, process these parameters in order to distinguish between healthy and unhealthy breathing profiles. The project consists of breathing hardware, NI sbRIO FPGA board and LabVIEW Software to create the characterization algorithm of a working spirometer system. The LabVIEW program consists of two parts: 1) the data acquisition and 2) the disease diagnosis. The data acquisition part will obtain data from user in terms of breathed air. Meanwhile, the disease diagnosis part will use the obtained data to analyze the disease. The system uses National Instrument Single Board Rio 9636 (NI sbRIO) for digital data conversion and data acquisition and breathing hardware from which users will used to flow air into the spirometer. Details of the projects will be discussed in part II and III of the paper.

RESEARCH METHOD 2.1. Breathing Circuits
Breathing circuitry is the most crucial component in a digital spirometer. It captures the exhale and inhale patterns (breathing patterns) coming through the mouthpiece. The circuit consists of a mouthpiece and a differential pressure sensor (MPXV7002DP).In this project, the mouthpiece is designed specifically to follow Venturi's measurement principle; where the difference of the two pressures with different tube diameters are used to measure flow rate and volume of air exhaled over a period of time; to determine users breathing conditions. The amount of air coming into the spirometer is measured by a flow sensor. In order for the circuit to work, two tubes are attached at the narrow and large sections of the breathing tube and directly connected to the pressure sensor as shown in Figure 2.
There are three types of Pneumotachometer flow sensing principle that can be used to build up a spirometer. The Lily's and the Fleisch principles, both use resistive elements to create laminar flow in a breathing circuitry [3], [5], while the Venturi's principle measures the movement of air flowing from wide section to narrow section of a tube in its breathing circuit [6]- [7]. Note that, the Venturi sensing obeys the Bernoulli's theorem by constriction the airflow in tube which will result in pressure differences. Therefore, to profile lung conditions, patients are required to inhale and exhale through the mouthpiece with whatever effort possible. In brief, a spirometer that uses Venturi's principle, must obtain the pressure differences between the narrow and wide sections of the tube using a transducer, sent the values to amplifiers and then to the microprocessor [8] for data processing. When the airflow reaches the smaller dimension section, the speed becomes higher, hence low pressure is exerted. Therefore, the pressure difference between these two sections can generate a flow rate Q, given by:

NI sbRIO board
where ρ is air density in kg/m 3 , A 1 is the diameter of tube's large area, A 2 is the diameter of tube's narrow area, P 1 is the pressure measured at large tube's area and P 2 is the pressure measured at narrow tube's respectively. By knowing the flow rate, the volume of the exhalation can be determined. The lungs' volume is determined by integrating flow rate over time.
Different sections diameter is built to facilitate laminar flow as an initiative to support a full flow of patient's exhalation. The standard diameter of a spirometer mouthpiece is 2.54cm, 3.18cm, and 3.81cm [7]. Our digital spirometer design is using approximately 2.6cm diameter for A 1 for a flow velocity of 33.3m/s and 1.1cm diameter for A 2. By using formula in (1), the spirometer can achieve a linear flow-pressure relationship which means it can generate more accurate measurable value than the Fleisch tube or Venturi tube that has fixed diameter sections [2].
The MPXV7002DP pressure sensor is used in this design because of its ability to converts the parameter into air flow and its compatibility with the microcontroller. The sensor can also provide an accurate analog input signal proportional with respect to the input pressure. The breathing circuitry also includes a voltage generator to reduce the 9V battery to 5V voltage supply so that the pressure sensor is protected from over current. Then, the analog output of the sensor is connected to NI sbRIO 9636 microcontroller board and LabVIEW are used as the data acquisition module and create Graphic User Interface (GUI) for the system.

Microcontroller NI sbRIO 9636 and LabVIEW
LabVIEW software is a graphical language integrated development environment and multiple compilers. LabVIEW compile the measurements data from NI sbRIO with the algorithm code into machine codes. LabVIEW also provides a more reliable application in graphical editor, project view and interface to the hardware [9]. In this work, LabVIEW was used to produce a graphical desired interface. Meanwhile, the National Instrument Single Board Rio 9636 fpga board (NI sbRIO) was used for digital data conversion and data acquisition obtained from the breathing circuit. The NI sbRIO 9636 was chosen because it is compatible with LabVIEW, easy to program and support many communication protocols. The output from the breathing circuit was connected to analog input pin 1 and pin 3 of the board. Signals from the analog inputs are then converted to digital by NI sbRIO 9636 as shown in Figure 3.

69
The program to calculate spriometric parameters i.e., FEV1, FEV6, was developed using LabVIEW software and saved in the RAM of NI sbRIO board in (.exe) format. Once the program is uploaded to the RAM, NI sbRIO can function as a stand-alone spirometer. The board is also connected to the computer containing LabVIEW through Cat 5e Ethernet cable for GUI. The conversion from Pressure to Flow was reported in [10] using LabVIEW VI (Virtual Interface). Meanwhile details on the characterizations technique using spirometric parameters FEV1 and FEV6/FVC are discussed in the following subsection.

Characterization of respiratory conditions
Important spirometric parameters used to determine respiratory conditions are the FEV1 and FEV6. FEV1 is a measure of how much air can be exhaled in one second following a deep inhalation process. Meanwhile, FEV6 represents the air exhaled at the sixth seconds of deep inhalation process. Sometimes, FEV6 also known as the Force Vital Capacity (FVC) which indicates the volume of air in lungs that can be exhaled from a deep inhalation. These two parameters can be measured easily in LabView using equations in As the FEV1 and FEV6 values are proportional to the size of a lung, therefore men and women of different age or height will have different FEV1 and FEV6 values. In the designed GUI, important spirometric parameters such as pressure flow, velocity and volume, will be calculated and will be displayed in three different graphs as control parameter respectively [10]. At first, user particulars such as sex, age and heights must be recorded in a GUI menu shown in Figure 4. Then, these data will be converted into integer number in order to compare the recorded value with the constant values set for each disease. This comparison is vital to determine the FEV1/FEV6 threshold values which used to determine the kind of respiratory condition the patient has. The comparison is on predicted FEV value or percentage ratio of FEV1/FEV6. During breathing experiments, differences of the air flow were measured by the the pressure sensor and sent to the sbRIO board. Then the signals from the sensor were converted and calculated using the characterization algorithm saved in sbRIO. Finally these calculated spirometic parameters were displayed on the GUI.  Figure 5 shows the algorithm to characterize respiratory conditions that will be reflected on the GUI. For user who is affected by asthma disease, the percentage FEV1 will be less than 0.8. When the FEV1/FEV6 is equal to 0.8, it indicates that the user is at the early stage of asthma disease. In other words, if the FEV1/FEV6 ratio value decreases than 0.8, it means the severity of respiratory disease increases. Therefore, the minimum value for asthma disease was set to 0.8 or 80% .Otherwise, if the user having FEV ratio more than 0.8, it indicates the user has normal or healthy lungs.
Users with FEV/FEV6 ratio less than 0.7 or percentage less than 70%, they might be affected by COPD. Note that, it is normal and possible to have COPD and asthma at the same time. Similar to asthma, when the value is less than 0.7, the critical the COPD might be. Bronchitis is one of the symptoms for COPD. Hence, patients with lower FEV1/FVC value might be diagnosed to have bronchitis. There is no exact constant value to determine bronchitis but in this algorithm, the minimum FEV1/FEC value was set to 0.65 or 65%. Note that patient who is affected by chronic bronchitis can also be affected by asthma and COPD [11]. On the contrary, lung cancer cannot be accurately detected by a spirometry test. This is because, to detect any cancer including lung cancer, patient must undergo the blood test and biopsy procedure first. Nevertheless, in this algoritm the FEV1/FEV6 ratio was set to 0.3 for users to be suspected suffering from lung cancer. The 0.3 ratio is used to potray a severe number for respiratory function which means the patient might suffer from lung cancer due to very low value of FEV1. In brief, the GUI will show what kind of lung condition the user might have i.e., healthy, asthma, bronchitis, COPD or lung cancer.
To test the functionality of the disease characterization algorithm, a breathing test was conducted on three volunteers with different respiratory conditions ( Table 2). The volunteers were required to inhale a deep breath and exhale through a mouthpiece within 10 seconds. The test was repeated several times and average values will be calculated and displayed in LabVIEW GUI.  Table 2. Profiles of patient to test the respiratory disease characterization algorithm

RESULTS AND DISCUSSION
Three different curves were plotted in [10] to profile breathing patterns of the volunteers in Table 2. The curves are: 1)Voltage vs Time, 2)Air Flow vs Time and 3)Volume vs Time. By using FEV1/FEV6 ratio, respiratory performances can be categorized.The three classification studied in this project are healthy and two obstructive diseases, asthma and bronchitis. Note that the ratio of FEV1/FEV6 from Volume vs Time curve is used to determine the lung conditions using the formula below: From the results in [10], it can be seen that the Volume vs Time plots of the three volunteers gave similar ascending trend of curves but with different values. The FEV1/FEV6 ratios are approximately 81.1%, 72.04% and 33.4% for the healthy, asthmatic and the bronchitis volunteers respectively (Figure 6-8). In each figure, the GUI (green background) shown the details of each volunteers and the calculated FEV1 and FEV6, FEV1/FEV6 ratio, minimum values of diseases threshold with respect to volunteers sex, height and age, and the diagnosis of the respiratory conditions. It can also be inferred that the air volume exhaled by the volunteers at t=1s and t=6s resulted with different values of which can reflect the lung volume of each volunteers.  Results portrayed in these GUIs were calculated using the characterization parameters in Figure 5. This GUI can be used to facilitate users to identify their respiratory conditions and also can be early diagnosis of the conditions , whether users need to consult medical professionals or not.
Then data of the FEV1/FEV6 ratios for all volunteers were plotted in Figure 9. Respiratory conditions can be identified from the FEV1/FEV6 ratio distinctively with the healthy volunteer has the highest FEV1 values compared to the other volunteers with asthma and bronchitis conditions. The measurement range (maximum and minimum values) of FEV1 is bigger than the FEV6 can indicate that force used for exhalation at the t=1 is crucial to give better distinction between healthy and problematic lung conditions than at the end of the inhalation or at t=6 of deep inhalation. Volunteer A has larger FEV1 and FEV6 compared to volunteer B and C. Patient C who suspected to have poor lung's performance tends to have lower volume-time graph due to small volume of air inside her lungs. As a whole, these results also can be used as the proof of concept that the designed portable spirometer can distinguish differences in lung conditions. These results are also in agreement with literature where the normal value of FEV1/FEV6 ratio for a healthy person must be higher than 80 percent [8]. Hence, any values that are below 80 percent can be categorized as abnormal or unhealthy lung performance. For further improvement however, more testings on users are needed to ensure accuracy and precision of the algorithm as well as to create a database of the spirometer.

CONCLUSION
In a nutshell, this paper presents the development of a respiratory disease characterization algorithm for digital spirometer using NI sbRIO 9636 and LabVIEW software. Results from breathing experiments showed that the spirometer is capable of distinguishing between normal and abnormal respiratory conditions from the FEV1/FEV6 ratio and become the proof of principle for the development of a portable digital spirometer.