Respiratory diseases are one of the most commonly under-diagnosed 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 become more prevalent, we will observe a significant positive impact on patient prognosis and overall long-term health outcomes.
For example, COPD is routinely under-diagnosed in South-East Asia, South Asia, South America, sub-Saharan Africa at rates of up to 70-90%. After diving deeper into these startling statistics, we started thinking of specific ways to bring proactive relief to these communities. 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 needed to take all these factors into account as we developed a comprehensive solution.
After weeks of brainstorming ways to develop such a product, we realized we had the potential to affect the entire healthcare system in these areas. In other words, we could combine data collection, diagnosis, and communication all into one device. Such a device would be affordable and utilize a wealth of information to make accurate and easily interpreted warnings to its users while also transmitting this critical data to local and global healthcare providers. This project is just the beginning in what we hope to be a long term mission to bring personalized healthcare to all communities across the world.
With our innovation, we directly address six of the seventeen sustainable development goals drafted by the United Nations to guide global partnerships as we collectively strive for an equitable future of peace and prosperity.
To create this device, we first started off by collecting and designing easily available and cheap materials capable of holding up to varied conditions and operation at full potential. While slightly more expensive than typical IoT development boards, the Arduino Nano RP2040 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. Next, we utilized a 9V battery, a cheap and easily obtainable power source. We also used a buzzer system and an analog differential pressure sensor, both of which are cheap and readily available. The silicone plastic tubing is resistant to wear and tear and the specifically designed and 3D printed spirometer breathing tube is strong, lightweight, and affordable. As you will see throughout this project, however, these few affordable materials can be used to make a meaningful impact on health, greater than that typically found in affordable spirometer solutions.Scientific Concepts:
The first thing we set off to do, of course, is prepare ourselves by learning a host of scientific information on existing lunch performance research, machine learning models, and various useful physics concepts, all of which we will explain as best we can in the following sections.
So what is a spirometer?
We can go even further - what is spirometry? And how is any of this related to lung function? According to the Mayo Clinic, “Spirometry is a common … test used to assess how well your lungs work by measuring how much air you inhale, how much you exhale and how quickly you exhale.” This test can be used to diagnose any host of lung diseases such as chronic obstructive pulmonary disease (COPD), asthma, lung cancer, you-name-it. The idea is that 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, as shown in the above diagram, explains how a change in area can result in a difference in flow velocity of air. We can take advantage of this concept to figure out pressure differences created from breathing into a tube with different diameters.
This is a .STL file of our breathing tube. As you can see, there is a diameter change of 5cm to 2cm halfway through the approx 18cm tube and two holes that snugly fit two silicone tubes without room for air to disturb the sensors. The material was printed using PLA material in the Fused Deposition Modeling method.
Now that we've gone through the logistics of our device, below we've provided a brief review of certain pulmonary parameters and their significance.
How will our device get the peak flow/volume/time graph?
1. Converting between digital and analog signals:
When an analog signal (like the voltage produced by our pressure sensor) is processed by the Arduino, it is converted to a digital value between 0 and 1023. We need to convert it back to an analog value with the following equation.
inputVolt = analogRead(analogInPin); // Voltage read in (0 to 1023)
volt = inputVolt*(vs/1023.0);
2. Converting from a voltage to pressure:
A pressure transducer turns a pressure difference into a voltage, and thus, we can calculate pressure from the voltage signal with the following formula.
pressure_psi = (15/2)*(volt-2.492669); // Pressure in psi
3. Psi to Pa
The equation above gives us the pressure in psi. We will convert this to Pascals (SI unit).
pressure_pa = pressure_psi*6894.75729; // Pressure in Pa
4. Calculating mass flow from pressure
Next, we convert the pressure difference into a mass flow rate. The follow equation can be rearranged to solve for W, the mass flow rate in kg/s:
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 solve for W with the following code:
massFlow = 1000*sqrt((abs(pressure_pa)*2*rho)/((1/(pow(area_2,2)))-(1/(pow(area_1,2))))); // Mass flow of air
We included a factor of 1000 so that in step 5, we work with L/s instead of m^3/s, which allows the volume to be in a standard unit.
5. Mass flow to volumetric flow
We convert mass flow into volumetric flow by dividing by the density.
volFlow = massFlow/rho; // Volumetric flow of air
6. Computing volume
Since Arduino does not have the capability to perform integrals, we manually add up our volumetric flow rate over time. Since volumetric flow rate equals volume over time, we sum up the volumetric flow rate over small increments of time to compute total volume. We include a delay in Arduino and multiply each volumetric flow rate value by incremental dt values.
volume = volFlow*dt + volume; // Total volume (essentially integrated over time)
dt = 0.001;
That's all the math! The rest of the code is just defining variables.
Often, spirometry results are depicted as a flow-volume loop.
Fundamentally, respiratory diseases can be split into two broad categories – obstructive and restrictive. Examining the flow-volume loop of a patient can help us determine what specific condition they may have. Restrictive lung diseases (such as pulmonary fibrosis) affect the ability to inhale. Obstructive conditions (such as asthma and COPD) affect the ability to exhale. Further differences between them are depicted below.
Here are a couple of studies and equations that came in handy for our prototype. Notice though, how so many of these are missing data on entire races and lack a specificity of age. Don’t worry though! While it may not have it now, this device will certainly have in it the potential for correcting such disparities in healthcare (See section on The Future). One issue we faced is finding the right set of equations from such a large library of available ones. For this reason, we forced on equations that could predict FEV1 and FVC for various populations, as well as any equations relating to PEF that we could use. These equations themselves are an embodiment of analytics. They were created by using thousands of spirometry graphs from a large study and thus can reasonably predict the values for certain populations. However, as we mentioned before, many populations continue to be underrepresented in these studies and so we will have to use equations that cover the largest breadth of people.Diagnosis Parameters:
Here are the constants associated with each populace.
FEV1 Predictive Equations (Hankinson 1999):
Females < 18
Males > 20
Females > 18
FVC Predictive Equations (Hankinson 1999):
Females < 18
Males > 20
Females > 18
PEF Predictive Equations (Radeos 2004):
After generating the volume (L) vs Time in seconds graph, our device can easily compare the values from these equations to the regular equations.Microphone and using Convolutional Neural Nets:
An added benefit of using the more expensive Arduino Nano with the processor of a Raspberry Pi is the ability to run Python, utilize machine learning, and to use the microphone.
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.
For example, we were able to utilize a GitHub repository utilizing TensorFlow Light we found to convert audio from our device directly into speech.
It also allows for more neat tricks to improve analysis. For example, we can utilize AI 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. Thankfully, there were some resources we could implement after modifying into our own codebase to utilize these predictive analytics. Figuring out how to run the entirety of the training locally will likely be difficult. However, we have yet to utilize the Wi-Fi module on the Arduino Nano RP2040 to access such datasets remotely. Perhaps in the future!
Further information can be found in the code section.Future of Project:
Thank you for reading our story up till now! For us, this is only chapter one. We have many new exciting developments and plans currently in progress, and we look forward to sharing these future advances with you all. Below, we’ve included a fraction of the steps we’re taking towards improving our innovation further.
Our main priority now is 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 and make overall diagnostic standards more effective.
Currently, we are working with academic institutions to gain wider access to resources and will be partnering with a prominent pulmonologist to compile this comprehensive dataset as well.
We also strive to fully convert our code from Arduino to CircuitPython for ease in using various libraries.
One of the critical device functionalities we are developing is the ability to transmit measured pulmonary parameters and complex graphs through the phone. Encoding this information in a series of characteristic signals/chirps that can then be decoded by an online program at a physician’s office essentially connects rural impoverished populations without Internet access to qualified pulmonologists from across the world. This mechanism gives tele-health a whole new meaning!
Even with the aforementioned feature implemented, we would still like to make use of the Wi-Fi and Bluetooth modules for better information visuals on smarter devices with screens that may be connected to the Internet. The flexibility of our innovation to adapt to a wide range of environments will be vital.
Calibration (and lack thereof) is one of many reasons that pulmonary disease is underdiagnosed in developing countries with outdated healthcare infrastructure. We are also working to ensure proper calibration through updates encoded into the device that allow users to calibrate the device periodically.
We are creating a modular 3D printed shell for our device and are anticipating this to be completed soon. Along with the microphone synced to our device, we also aim to add a speaker with full audio translation capabilities due to the fact that many rural and impoverished people have high rates of illiteracy.
Of course, making the device as affordable as possible without sacrificing its quality will be one of the defining features of our innovation. Currently, developing our prototype costs us $50, which is 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 $20 per unit.
With your support, we can make this project reach its full future potential!