Eating out with a food allergy can be tricky. Have a waiter misinform about a dish’s ingredients, the cook make a last-minute swap, or have a meal prepared on machinery where cross-contamination occurred and you could be in for a deadly surprise. But in the not-so-distant future, mystery foods may be a thing of the past.

Thanks again to that nifty intersection where make-life-easier tech meets (and solves) everyday medical dilemmas, UCLA scientists have figured out a way to turn a smartphone into an allergy sensor that can determine whether a food sample contains an allergen.

How it works: A lightweight device called the iTube (weighing 40 grams) attaches to a smartphone, then, using the phone’s built-in camera, in tandem with a smart-phone app that runs a high-sensitivity test, the device detects whether a food sample contains an allergen. The platform can test for multiple allergens including almonds, eggs, hazelnuts, and peanuts.

The kit converts cell-phone images digitally into concentration measurements detected in food samples and can determine whether an allergen is present or not, and, when present, can even measure how much, in parts per million, of the allergen the sample contains. Results are time- and location-stamped and can be uploaded from cell phones to iTube servers to create individualized archives.

Prior to this development, detecting allergens in food samples required clunky machinery best kept in the laboratory.

The iTube researchers recently tested the device on store-bought cookies to determine whether they contained nuts, a common allergen, with success. Their findings will appear in an upcoming issue of Lab on a Chip journal.

“We envision that this cell-phone-based allergen testing platform could be very valuable for parents, schools, restaurants, and other public settings,” said Aydogan Ozcan, PhD, who led the research team and is an associate professor of electrical engineering and bioengineering at UCLA’s Henry Samueli School of Engineering and Applied Science, in a statement.

What’s the catch? The kit does require a mad-scientist home-edition routine of grinding up the food sample, mixing it with hot water and an extraction solvent in a test tube, letting it settle 20 minutes, and mixing in more chemicals before placing the sample solution along with a control liquid in the device. Of course, once the dirty work is done, presto, allergen detection takes, oh, about a second.

Dr. Ozcan tells us the technology is not yet available commercially, but that the LA-based start-up Holomic LLC, which he founded, is tinkering with how to make it happen. Cost and timeline have not been solidified, but the future looks promising.

Could You see yourself using such a device?