Inspiration
Respiratory diseases pose an immense global burden, affecting hundreds of millions of people per year. Unfortunately, they are also one of the most commonly underdiagnosed medical conditions in developing countries across the world because many of these underserved populations do not have access to affordable healthcare services. In particular, spirometry is the most common pulmonary function test to detect breathing pattern abnormalities associated with various diseases including asthma and COPD. However, members of rural impoverished communities often do not have access to the expensive equipment to perform this crucial screening. If we ensure diagnosis and early treatment of respiratory diseases becomes more prevalent, we will observe a significant positive impact on patient prognosis and overall long-term health outcomes.
For example, COPD is routinely underdiagnosed in South-East Asia, South Asia, South America, sub-Saharan Africa at rates of up to 70-90%. Proactive relief to these communities must be provided to mitigate these grave statistics. Populations in rural low-income countries are not only at high risk for respiratory diseases because of their lack of access to spirometry but also because of frequent exposure to biomass fuel and pollutants, a low level of education, and no direct connection to a healthcare provider. Thus, we need to take all these factors into account as we develop a comprehensive solution.
To address this multidimensional issue, a solution must integrate straightforward data collection, diagnostic capabilities, and flexible communication all into one device. As such, this device must also be affordable, easy to use, and utilize a wealth of information to make accurate interpretations to warn its users, while also transmitting this critical data to local and global healthcare providers. This project marks the beginning of our long term mission to bring personalized healthcare to all communities across the world.
What is a Spirometer?
According to the Mayo Clinic, “Spirometry is a common … test used to assess how well a patient’s lungs work by measuring how much air is inhaled, how much air is exhaled and how quickly the patient exhales.” This test can be used to diagnose any host of lung diseases such as chronic obstructive pulmonary disease (COPD), asthma, lung cancer, etc. After an initial detection of reduced lung function, one knows to seek further treatment and clinical help. There are several form factors surrounding existing spirometers, but several physics concepts are necessary to understand the design of our device.
Bernoulli's Principle explains how a change in area can result in a difference in flow velocity of air indicative of pressure differences. Thus, we have designed our 3D printed breathing tube (renderings attached below – Figure 1) accordingly. There is a diameter change of 2.8cm to 0.8cm halfway through the 20cm tube and two extruding 4 mm diameter tubes that snugly fit into two silicone tubes without room for air to disturb the sensors. The material was printed using PLA material in the Fused Deposition Modeling method. The bottom left image depicts the mouthpiece and the bottom right depicts the device casing.
How We Built It
We started off by designing our prototype with easily available, affordable, and sustainable materials capable of withstanding all conditions and terrains. To minimize e-waste and maintenance costs, we specifically chose to minimize the number of parts used. While slightly more expensive than typical IoT development boards, the Raspberry Pi 4 is well worth the price for bringing to the table intelligence in the form of on board machine learning, higher computing power, internet and bluetooth connectivity, power efficiency, and high capability. In addition, the single port for power means any source that can connect to USB C can power the device, including, but not limited to, solar panels and power banks. We used a 3.5mm audio jack compatible speaker, an analog MPX5010DP differential pressure sensor, an ADS1115 ADC, and an USB microphone, all of which are cheap and readily available. The silicone plastic tubing is resistant to wear and tear and the custom 3D printed spirometer breathing tube and casing is strong, lightweight, and affordable. As you will see throughout this project, these few affordable materials can be used to make a meaningful impact on health, greater than that typically found in affordable spirometer solutions. Figure 2 depicts the circuit schematic for our device.
Key Terms
FEV1: volume of air forcibly exhaled after full inspiration in the first second
FVC: volume of air forcibly exhaled after full inspiration.
FEV1/FVC: FEV1/FVC <70% where FEV1 is reduced more than FVC suggests an obstructive pathology. FEV1/FVC >70% where FVC is reduced more so than FEV1 is seen in restrictive pathology.
PEF: peak expiratory flow when blowing out at a steady rate
Calculating Lung Function Parameters
1. Converting between analog and digital signals: When an analog signal (like the voltage produced by our pressure sensor) is processed by the Raspberry Pi, it is converted to a digital value that cannot be utilized. For this reason, an analog to digital converter like the ADS1115 must be used. We wired the ADS1115 and the sensor to a 5V power source and grounded each. The output of the sensor was connected to an analog pin of the ADS1115 and the ADS1115 SDA and SCL pins were connected to the corresponding Raspberry Pi GPIO pins. The Adafruit python library allowed us to read the pressure sensor’s raw values and the voltage.
2. Converting from a voltage to pressure: A pressure transducer turns the differential pressure into voltage we can access. Looking at the datasheet written for our specific sensor model, we found various equations we could work with (attached in Figure 3).
3. Signal amplification, gain adjustment, and error adjustments: With these sensors, there is the possibility of a wide data variation. Utilizing the Temperature and the Pressure Error Bands from the datasheets should account for environmental conditions. Using different voltage inputs can also lead to significant value changes. To accurately account for such changes, we used a constant 5V input to both the ADS1115 and the MPX5010 and ensured the wiring was not loose such that there would be minimal fluctuations. However, the ADS1115 also came equipped with a Programmable Gain Amplifier. We manipulated the gain of the signal before it reached the ADS1115 to ensure a varied range of output values. We then calibrated the variations in voltage output from the sensors such that it realistically portrayed pressure changes.
4. Psi to Pa and mass flow calculations The earlier equation gave us the pressure in psi which we then converted to pascals. This value can be turned into a mass flow rate in kg/s using: dP=((W^2)/2rho)*(1/A2^2−1/A1^2), where dP is the change in pressure across the tube in Pa, W is the mass flow rate in kg/s, rho is the density of air in kg/m^3, and A1 and A2 are the cross section areas of the two different sections of the tube in m^2. We can use L/s instead of m^3/s by also multiplying by a factor of 1000.
5. Mass flow to volumetric flow and volume calculation: Volumetric flow is the mass flow divided by the density of the air. Volumetric flow rate equals volume over time, so we can integrate and determine the total volume over the total amount of time the sensors read for.
All measurements used are the voltage output readings collected between the commands the device speaker issues the patient.
6. Noise reduction and curve fitting: Given the fast fluctuations in our data, we cannot always determine the best data points to use. After plotting the data as a scatter plot, we can use matplotlib and numpy and scipy (all Python libraries) to produce a clean interpolation of points that also uses polynomial fitting functions.
We generate this initial Volume (Liters) vs Time (Seconds) graph shown in Figure 4, which can be manipulated later for various calculations. The best of three measurements, decided by the graph with the highest PEF value, is used.
Generating Flow-Volume Loop
Lung function parameters can be converted from the Volume (L) vs. Time (s) graph above into a flow-volume loop. Restrictive lung diseases (such as pulmonary fibrosis) affect the ability to inhale. Obstructive conditions (such as asthma and COPD) affect the ability to exhale. These differences are reflected on the flow-volume loop depicted in Figure 5.
Our device compares the flow-volume loop of the user against the standard values computed according to normal reference values. It is notable to mention that many of these reference values do not account for certain races and lack specificity of age. Our device possesses the potential for correcting such disparities in healthcare (See section on “Our Updates and Future”). Demographic specific reference values for FEV1 and FVC are derived from the current gold-standard values utilized by the CDC. Demographic specific reference values for PEF and other values are derived from a multitude of equations derived throughout the years and that use parameters such as age, height, gender, and race, all of which we ask the patient for during the device’s operation. For example, according to a 1999 Hankinson et al. study, the PEF of a Hispanic female over the age of 18 can be predicted by PEF (L/min) = 60 [0.2401 + 0.06174A − 0.001023A2 + 0.00022203H2].
Machine Learning and using Convolutional Neural Nets
An added benefit of using the more expensive Raspberry Pi is the ability to run Python, utilize machine learning, and to accurately use a microphone. These features elevate the functionality of our device. To better diagnose the conditions of patients, we used machine learning frameworks to analyze both the graphs produced earlier and an audio recording of their breathing.
We utilized TensorFlow’s image classification framework to determine how well the graphs of data collected fit other known graphs of various respiratory conditions. We first created a small dataset of various Pressure vs Time as well as Flow-Volume Loops graphs from various lung conditions. We then trained a model using TensorFlow with this dataset and used it to predict if graphs produced by the device matched those of a certain lung condition.
The microphone is also an essential part of the device. The microphone allows the device to incorporate voice commands as well as vital demographic information into the analysis, as was shown in the initial demonstration video. Various python libraries can convert the audio recording of patient responses directly into text information that can be understood.
In addition, we utilize a convolutional neural net to find crackles and wheezes in an audio recording of the lung. This is yet another diagnostic that can potentially predict a developing lung issue. We found a Kaggle dataset of respiratory sounds created by two research teams in Portugal and Greece. It includes 920 annotated recordings of varying length taken from 126 patients.
Implementation of a convolutional neural network was painstaking especially when using audio from a device meant for IoT prototyping. We built the model trainers using TensorFlow and then conferred the model into TensorFlow Lite so that they would be able to quickly predict new diagnoses on a device such as the Raspberry Pi. Further information can be found within the device code. The advantage of such features is that the diagnostic capability is always improving. Anytime the device connects to the internet, we optimize it by uploading its new data onto our servers (an accessible de-identified global repository) while also downloading the most recent prediction models to vastly improve the device’s performance.
Calibration (and lack thereof) is one of many reasons that pulmonary disease is underdiagnosed in developing countries with outdated healthcare infrastructure. We are working to ensure proper calibration through updates encoded into the device that allow users to calibrate it periodically. The flexibility of our innovation to adapt to a wide range of environments will be vital.
Alignment with United Nations 2030 Agenda for Sustainable Development
With our innovation, we directly address six of the seventeen sustainable development goals drafted by the United Nations (as seen in Figure 6) to guide prospective international partnerships as we collectively strive for an equitable future of peace and prosperity.
Unfortunately, climate change poses an alarming threat to global health. One of the most concerning aspects of this complex generational crisis has been worsening air quality, which promotes and exacerbates various respiratory diseases. Glaring health disparities exist due to certain populations being more affected by this phenomenon. For example, impoverished women in rural communities are often disproportionately exposed to risk factors contributing to poor air quality (such as traditional cookstoves). Thus, our primary overall focus is to promote good health and well-being by making essential medical diagnostic equipment accessible to all, regardless of gender or socioeconomic status. Currently, spirometers cost hundreds to thousands of dollars, leading to severe underdiagnosis of respiratory diseases across underdeveloped communities. Through partnerships among local healthcare providers, NGOs, and public health authorities, our innovation will ideally lead to the creation of public health infrastructure and deployment of our device in these communities.
Our Future
Primarily, we envision working with a pulmonologist to obtain IRB approval and collect preliminary clinical data to validate our device’s diagnostic capabilities
Our main priority has been expanding our predictive models by utilizing tools like TensorFlow directly integrated into our device to analyze the flow rate data we have collected from each patient and to match it with an extensive repository of parametric data associated with multiple specific respiratory diseases. As more patients use our devices, these predictive models will become more accurate. Collecting a wide range of data across different ages, genders, and races aligns with our principle of non-discriminatory health. This expanded data collection will not only improve the quality of our device but will also inform researchers across the globe by updating old equations and making overall diagnostic standards more effective.
Ensuring the affordability of the device without sacrificing its quality will be one of the defining features of our innovation. Currently, developing our prototype without its exterior shell costs us $70, which is almost three times less than the most affordable at home spirometer on the market and much more affordable than spirometers used in medical clinics which often costs thousands of dollars. We anticipate that as we scale up production, we will be able to cut down on manufacturing costs to about $30 per unit. This can be achieved with custom circuit boards that embed various sensors all into one mass-producible chip.
We have created a modular 3D printed shell for our device with detachable mouthpieces for hygienic usage (an especially important consideration for deployment in villages and small communities). We also aim to add expanded audio translation capabilities (perhaps through the use of a small LCD panel) to expand accessibility due to the fact that many rural and impoverished people have high rates of illiteracy.
We are deeply grateful for this opportunity to present our story. For us, this is only chapter one, and we sincerely hope to continue writing our next chapter with your guidance and support!
Built With
- kaggle
- machine-learning
- python
- raspberry-pi
- tensorflow
Log in or sign up for Devpost to join the conversation.