« Return to News

The Food Allergy Detective

Mahadevan poses with The Allergent, a food allergy detection device.

(Pictured above: Samvith poses with The Allergent, a food allergy detection device. Photo by Lisa Fryklund/Licensed by Society for Science.)

This young inventor created an AI-enabled, electronic nose to sniff out allergens lurking in your food.

Every time young inventor Samvith Mahadevan went out to eat, he faced a problem – what ingredients might be in his meal that could trigger his food allergies? Hoping for an easier way to avoid allergic reactions than having to interrogate the wait staff, he decided to invent a solution.  

Using his STEM skills, this middle school student in Austin, Texas created The Allergent, a device that employs Artificial Intelligence to “electronically smell” food allergens like nuts and eggs. His innovative device not only provided a potential solution for countless allergy sufferers, but also won the 2024 Lemelson Foundation Award for Invention at the Thermo Fisher Scientific Junior Innovators Challenge. 

We recently spoke to Samvith about his inventor’s journey, how he approaches problem-solving, and how the behavior of ants in his kitchen helped inspire his invention.

When did you get involved in STEM?

I think my first introduction to STEM fields was through school. Within our elementary school, there was a part of every day devoted to doing some STEM-focused activities. They would introduce us to a STEM concept — for example, maybe structural engineering — and then they’d talk to us about how it connects to the real world, like how there are jobs where people design buildings that won’t fall over in earthquakes, things like that.

The Allergent at work live testing a Twinkie for potential allergens.
The Allergent at work live testing a Twinkies® snack cake for potential allergens. (Photo courtesy of Samvith Mahadevan)

What was your very first invention?

The invention I remember working on most clearly was in elementary school when I noticed a problem in my daily life: I just took way too much time eating every day — like an hour to an hour-and-a-half for every meal. I was a slow eater, just sitting there for so long and wasting so much time. So I made a little timer with an Arduino and LEDs. As time went on, the LEDs would turn from green to yellow to red, indicating how much time was passing. That little timer helped keep me in check. It introduced me to identifying problems in daily life, and finding ways to solve them.

How did you get interested in inventing solutions for food allergies?

I’ve had food allergies since I was a baby. Oftentimes, I’d be at an event such as a wedding or maybe a restaurant, and they would have catered food, unlabeled and unpackaged, so I wouldn’t know exactly what’s inside of it. 

I used to feel sorry for myself, and wonder why I had allergies. Eventually, I wondered how I could prevent the impact allergies had on my life, and looked towards finding solutions for myself and others like me.

How did ants help inspire your invention? 

When I was thinking about how to do this detection, I saw the little ants in my kitchen, and how they were able to find sugar only based on their sense of smell. I began to wonder if this same principle could be applied to the detection of allergens in food.

How did you want to differentiate your prototype from other allergy detection devices?

When doing background research, I found that many sensors on the market aimed to solve the issue from a biological perspective. They attempted to analyze the proteins that were present in the sample. But I came at this from a technological- and sensor-based method, which was a new take on this issue.

Plus, many of them are really expensive. They often cost hundreds to thousands of dollars.  Another thing that I noticed was that the detection range was also really limited. So for a person like me — I’m allergic to many types of nuts and to eggs — these allergy detection devices only focus on one specific allergen. And all these products on the market are contact sensors. You have to actually take a sample of the food and put it into the sensor or dip the sensor in the food to get the reading, which isn’t sanitary or practical.

What technology did you use to help with allergen detection? 

I sourced a low-cost industrial olfactory sensor. There are eight metal oxide sensors on the array. The sensor is heated to a variety of different temperature points. At each of those temperatures, the metal oxide has a reaction with compounds in the air — these tiny particles that are floating up from the food that contain little traces of the allergen.

That reaction actually creates a drop in voltage or conductance, and based on that change in voltage, we can classify it. A specific change in voltage can be associated with a certain allergen. That’s how the machine learning algorithm is trained to do the detection. You place the sensor over the food and it makes the predictions, and then that’s transmitted to the host phone where the results can be translated and displayed.

Samvith Mahadevan poses with his Lemelson Foundation Award.
Samvith poses with The Allergent, a food allergy detection device that uses machine learning. (Photo by Lisa Fryklund/Licensed by Society for Science)

How important was AI for the device?

The entire process behind the detection runs on AI. But initially it was really challenging for me since I’ve never done a big project with AI before. I was really confused on how to make the logic work, and was kind of learning as I went. I was able to reach a solution, which was enabled by the AI’s ability to find patterns in the data that humans are not able to detect.

Did you experience any other setbacks?

In the first few months of the project, I had everything set up. I recorded my training data and I trained the algorithm, but the first results I had were incredibly low accuracy. It was like 55%-50%, essentially a coin flip or random chance. That’s clearly not viable for a project like this.

It was really discouraging having that first step of the process be a failure. For a long time, I didn’t know how to get past it. I tried using different machine learning frameworks and adjusting the hyperparameters a lot, and eventually through all that trial and error and experimenting with different configurations, I was able to figure out the optimal settings for it to properly work.

What’s your hope for this device? 

One of the main goals that I have for this is to develop it as a product and release it to market since it’s helped me so much. The fact that it is able to detect allergens in a variety of foods means that it can prevent accidental exposure and life-threatening reactions. There’s millions of people across the world who have similar conditions with allergies, and I think it can have a huge impact in helping them as well.

“Expect that problems will come up in the invention process, and don’t be daunted by them.”

Who were your mentors?

My parents have always been my mentors throughout my life. We talk a lot about problems that we see and how we can possibly make them better, and it’s something I carry with me. They were mentors even for this project, but it wasn’t in the way that you might think. Since my parents haven’t done any work in this field, they probably knew less about it than I did. But they were able to guide me on when to ask for help, and how to reach out to people.

What is your advice to other young inventors?

Expect that problems will come up in the invention process, and don’t be daunted by them. Getting discouraged by failures early on can prevent a lot of your ideas from taking flight. Don’t be afraid to pivot from one idea to another if you need to. And always stay curious and observant of the things that you see around you, since I was inspired for this project by the tiny ants in my kitchen.

Important Disclaimer: The content on this page may include links to publicly available information from third-party organizations. In most cases, linked websites are not owned or controlled in any way by the Foundation, and the Foundation therefore has no involvement with the content on such sites. These sites may, however, contain additional information about the subject matter of this article. By clicking on any of the links contained herein, you agree to be directed to an external website, and you acknowledge and agree that the Foundation shall not be held responsible or accountable for any information contained on such site. Please note that the Foundation does not monitor any of the websites linked herein and does not review, endorse, or approve any information posted on any such sites.