Scientists invented a sensor patients can swallow that shows their doctors the gas forming in their guts in real time. Peter Clarke/RMIT University

One day you might be able to watch your farts forming in real-time. For now, scientists have designed an ingestible gas sensor that could give doctors insight into individual digestive issues and needs.

The team described their invention in the journal Nature Electronics, saying it senses oxygen, carbon dioxide and hydrogen to create “gas profiles” of patients and get a better look at what is going on in the gut as it happens.

Although people swallow some of those gases, they are mostly created when microbes in the intestines come in contact with food, so their values provide information about the inner workings of the digestive system.

“Our gas capsule offers an accurate and safe tool for monitoring the effects of diet of individuals, and has the potential to be used as a diagnostic tool for the gut,” according to the study. “The gases of the gut have been shown to be of significant value in understanding the pathogenesis of disorders of the gut.”

The scientists tested the electronic capsule while human subjects were on different diets, watching the gas profiles change with the food.

According to the team, in addition to its use in diagnosing gut-involved disorders, the capsule could have applications in studying the effect of medicines on the digestive system, getting more information about the gut’s microbiome and creating individual diets that best fit people.

RMIT University explained that the pill is the size of a vitamin.

In an editorial accompanying the research, University of Nebraska mechanical engineer Benjamin Terry wrote that the feedback the capsule could provide can close gaps in medical diagnostics. When a doctor prescribes a certain diet, for example, the information from gas sensors could support the foods or provide evidence against them.

As the microbes that live in people’s guts play roles in digestive disorders and weight, cardiovascular diseases and other conditions, “the concentration of gases produced by the microbiome is an indicator of gut health,” the editorial said. “For example, a healthy individual will have different gas concentrations in the stomach, small intestine and colon, and it is currently very difficult to accurately and noninvasively measure gut gas at specific locations.”

Previous research also indicates that a person’s gut microbiome plays a role in mental health, including one study showing that a bacteria common in probiotics could reduce stress and anxiety.

Swallowable instruments like the new gas reader could be the future in this field.

“As the size and cost of electronics continues to decrease, it might not be too long before a routine healthcare visit involves a check of your vital signs and a request to swallow a tiny electronic monitoring device,” Terry wrote.