Sick Sniffer: Using AI to Detect Fungal Pneumonia

Education Health & Biohacking Machine Learning Science
Sick Sniffer: Using AI to Detect Fungal Pneumonia

Feature image by Heather Kodama.

I was born two months early, spending the first month of my life in the hospital. The doctors told my mother that I would probably have physical and cognitive delays. Bringing me home, my mom decided I would never be treated any differently because others told her something couldn’t be done about the challenges I could face in the future. As I grew, she never once held back, not when I needed speech therapy at age 3, nor when she was told that I was eight months behind my peers in 4th grade. No matter the obstacles that were put in front of me, she persevered and kept moving forward. She always played puzzle games with me and challenged me with riddles. I didn’t know it at the time, but these riddles and games like Myst and The Room helped me learn to look at the big picture while simultaneously seeing the smallest obscure details. My mother’s perseverance taught me that no matter what, there is always a way.

Later in my childhood, I got pneumonia. It was terrible, and unfortunately, I was misdiagnosed because I barely had symptoms. On our first trip to the hospital, I was sent home with antibiotic ear drops. Days later we returned, and my mother pushed the point with my doctor. Once I was finally diagnosed with pneumonia, which was almost a week after I got sick, they didn’t know the type. Generally, most people are diagnostically assumed to have bacterial pneumonia and given antibiotics; they gave me three different types over eight days. My fever just wouldn’t quit, and on the eighth day, I was scheduled to be admitted to the hospital. Thankfully my fever finally broke just beforehand, and I spent the next month recovering. We never did determine what type of pneumonia I had.

An Idea Is Born

This article appeared in Make: Vol 81. Subscribe today for more robot projects and tips.

Pneumonia had a profound effect on my life, and I began to wonder if I would have gotten sicker had it not been for my mother’s unrelenting persistence. Getting sick also helped plant a seed. I just couldn’t get the idea out of my head that there has to be an easier way to help people determine the type of pneumonia someone has. I had wondered about this for four years, and now, working on my 8th grade science fair, I thought I finally might have a chance to crack it.

To start, I began speaking to my aunt and uncle, who are both doctors. Initially, I simply wanted to identify the type of pneumonia faster, without having to rely on a blood test, x-rays, sputum samples, bronchial lavage, or the industry gold standard: gas chromatography mass spectrometry (GC/MS). Could I develop something like a breathalyzer for disease?

My aunt and uncle referred me to a pulmonologist colleague of theirs who had just so happened to be part of a study conducted on detecting invasive aspergillus, or fungal pneumonia, through patients’ breath. The study focused on identifying the metabolic signatures of the disease using a GC/MS, and interestingly the chemical compounds associated were all monoterpenes/terpenes. These are derived from plant essential oils, which was perfect! This meant I could use safe, easily accessible substances such as citrus oil (limonene) and nutmeg oil (camphene) for my testing, and overcome the challenges of using potentially harmful cultures of fungal pneumonia and acquiring the aid of someone who is authorized to deal with such samples.

The Nose Knows

I remembered reading, through my research, how dogs could detect cancer by scent. The idea of scent then led me to electronic noses, or E-Noses. There have been a few studies done on other diseases like renal disease, which affects the kidneys, and diabetes. The studies focused on making a handheld device with a large enough sensory array to detect those diseases on the breath. One study used a Raspberry Pi, and it gave me hope. Maybe I could build my own E-Nose to detect fungal pneumonia, and even better, maybe I could make my E-Nose wireless.

I spent almost five long months doing research, and I pivoted so many times during this period to keep the dream alive of quickly diagnosing fungal pneumonia — and possibly other respiratory diseases. Nothing would get in my way. By accident, I found an article in Make: Volume 77 called “Second Sense,” by a gentleman named Benjamin Cabé. Benjamin had created an E-Nose to detect sourdough starter, whiskey(s), and coffee. The E-Nose information in this article was priceless because it gave me the opportunity to use Benjamin’s framework to build my own E-Nose.

My E-Nose prototype and various sensors. Photo by Heather Kodama.

I cross-referenced several studies, including Benjamin’s original prototype, and determined that the ideal sensor array for my project would include Seeed Studio’s multichannel gas sensor, with nitrogen dioxide (NO2), carbon monoxide (CO), ethyl alcohol (C2H5OH), and volatile organic compounds sensors, and potentially a more extensive sensory array including Seeed’s MQ9 (carbon monoxide, flammable gases), MQ4 (methane), MQ135 (ammonia, benzene, NOx), MQ8 (hydrogen), TGS2620 (alcohols, organic solvents), MQ136 (sulfur dioxide), TGS813 (hydrocarbons), TGS822 (organic solvents), and MQ3 (alcohols).

The E-Nose build would utilize the Seeed Wio Terminal (2.4″ LCD screen, ATSAMD51 core, and Realtek RTL8720DN radio module with BLE 5.0 and Wi-Fi 2.4GHz/5GHz), utilizing its I2C interface, MOSFET fan control, Seeed-based sensor arrays, and Seeed expansion battery pack to enable wireless connectivity.

My DIY cleanroom with mechanical artificial lung. Photo by Heather Kodama.

My Procedure

I felt it was important to keep this as close to a human patient study as possible. I constructed a cleanroom out of a storage container, complete with gloves and a mechanical artificial lung that would breathe in the essential oil sample then breathe it out into another case that contained the E-Nose for sampling.

Next, and most importantly, cloning the framework of Benjamin’s project I interfaced my E-Nose with Edge Impulse. Edge Impulse is a platform that takes the data you collect through supported microcontrollers and builds an artificial intelligence (AI) that can be deployed back into your microcontroller. Effectively Edge Impulse allowed the AI to “smell” through the connected sensors by identifying the four distinct monoterpenes/terpenes of fungal pneumonia, separately and mixed. Though each sample took only minutes, the combination of samples added up to hours of sample taking for each chemical compound, to aid the AI in differentiating between each chemical. Once sampling was complete my E-Nose had a 96.5% accuracy before deployment and 87.7% optimized deployment.

One of the most important components of this experiment was to make this E-Nose accessible online in real-time. Benjamin’s project also included the ability to do this. Updating the necessary firmware to the Seeed Wio Terminal, I created an account on Microsoft’s Azure IoT platform. Then I had a Zoom call with Benjamin, who is based in France.

Benjamin downloaded my E-Nose framework and connected his own E-Nose to my Azure IoT platform. In real-time both of our E-Nose frameworks started to report their readings: they were both “smelling” ambient air and indicated it corresponded to “Caleb’s room.”

Real-time readings from my and Benjamin Cabé’s E-Noses. Photo by Heather Kodama.

This is incredibly important because this means doctors could have the opportunity of helping diagnose an ill patient who may not have the means to get to a hospital or a doctor’s office. Even better, regarding the Covid pandemic, as new strains develop doctors can diagnostically record data faster and identify different variants more efficiently without waiting for lab test results.

Moving Forward

This March I entered my project in the 2022 Los Angeles County Science Fair. I took second place! Most recently I won first place in the California State Engineering Science Fair (CSEF) 2022, and was awarded two special awards from: The Math Teachers, Mathematical Science Award, and The South Coast AQMD Air Quality Award. Next I’ll be competing in the prestigious national Broadcom Science Fair.

Granted, my E-Nose has a long way to go. This was just my first prototype. Better calibration and more-sensitive sensors will be needed —specifically, sensors that can also differentiate between the massive amount of volatile organic compounds in human breath.

Nonetheless, it is a great starting point. By joining highly sensitive sensors with AI and tiny machine learning (tinyML) to detect breath markers, in the very near future we may be able to breathe into our phones and have doctors diagnose our health issues remotely. I’m excited about what the future may bring in medical diagnostics.

A Note From Benjamin

I built the prototype of my infamous “artificial nose” in just a couple hours. As a software engineer and electronics enthusiast, I was convinced that I hadn’t invented anything new. Surely, “E-Nose” technology had to be available already if I could pull this together using cheap gas sensors and with zero machine-learning knowledge. I could not have been more wrong!

In retrospect, I’m glad I took the time to share this project with the world, as it has inspired many folks. For example, I had discussions with flavorists (yes, it’s a thing!) who knew about smell sensors but hadn’t realized what AI could bring to their field, and also with AI experts who had no idea about the landscape of available sensors. I experienced first-hand how much bias there is in the assumptions we tend to make about how others perceive a particular technology area.

When Caleb Kodama contacted me last year, I initially didn’t take the time to return his emails (sorry, Caleb!). As you see from his story, he’s not the kind of kid that takes silence for an answer, so he wrote to me until I finally replied. We eventually got on the phone, and as I learned more about his project, I was blown away by his creativity and what he had accomplished. His project is to me the perfect example of how the maker spirit — and open source in general — truly democratizes access to technology, and how it empowers anyone to innovate. —Benjamin Cabé

This article appeared in Make: Volume 81 as “Sick Sniffer.

Tagged
Caleb Kodama

Caleb Kodama is a 8th grader from Pasadena, California, who aspires to help the world through science and engineering. In 2020 he won 1st place in the Los Angeles County Science & Engineering Fair and Top 300 in the national Broadcom MASTERS.

View more articles by Caleb Kodama
Send this to a friend
FEEDBACK