Somewhere in the darkness, something moves. Your heart beats a quick percussion inside your chest. Panic rises. It's hard to think straight. And deep inside your gut, there's a queasy feeling that something terrible is about to happen.

According to a yet-to-be-peer-reviewed study led by researchers from the Sapienza University of Rome, that stomach-churning, visceral reaction to horror is more than just nerves – your gastric system really is preparing for the worst.

Evolution, for some reason, seems to have decided the best course of action when we feel disgust or fear is to drive down the pH in the gut to make it more acidic.

Viewed in light of research demonstrating a robust connection between gut reactions and the brain's response to threatening situations, the finding reinforces models that suggest the gastric network plays a major role in our body's emotional responses.

Feeling disgust in the pit of your stomach isn't unusual. In fact, self-reported 'body maps' of emotions often associate negative emotions with the gastric system. It's not just a mental thing either – recordings of the electrical activity in the gut's muscular wall also reflect our experiences of revulsion.

This response seems to be a two-way street. Giving volunteers medication that eases reflux and nausea before they're presented with a revolting scene has a significant effect on whether they subconsciously avert their gaze, a common sign of disgust.

Our bodies appear to be driven to ramp up gastric activity when we experience things we ought to stay clear of, evoking a sense of nausea. In turn, this sensation becomes part of the fear response, driving us to act accordingly.

One marker of stomach-churning horror that hasn't been measured in depth, though, is the internal environment of the stomach. It's becoming increasingly evident that the microscopic denizens of the gut are intertwined with mood disorders, but how the chemistry they swim in changes with moments of revulsion isn't clear.

In the new study, psychologist Giuseppina Porciello led a small team of researchers in an investigation into the "endoluminal milieu of the GI system" using ingestible sensors that can measure acidity, temperature, and pressure as they pass through the digestive system.

A sample of 31 healthy men without any known psychological, neurological, or digestive disorders were recruited and asked to swallow a 'smart pill', containing a sensor, battery, and wireless transmitter.

While it was recording from the inside, the researchers measured the muscular electrical activity of the digestive system from without, as well as other physiological reactions.

The volunteers were then asked to participate in four viewing sessions that featured 9-second long video-clips selected for their happy, disgusting, sad, and fearful content. Neutrally-emotive content was also woven into the sessions to serve as a control.

By responding to the clips via a questionnaire, the participants gave the researchers an idea of how they subjectively felt about what they saw. Meanwhile, the smart pill was busy collecting data from within, pinging back details from the stomach, small intestine, and the large intestine.

In line with previous findings, gastric sensations were raised during fearful scenes, topping out while watching the disgusting clips. Breathing was also elevated, as it was during the sad scenes.

Deep down inside, the digestive system was squirting more stomach acid into the cavity. As the volunteers watched the disgusting video-clips, their gastric pH dropped. The more disgusted or fearful they felt, the lower the pH.

While not altogether surprising, this extra detail describing the functions of the gut when we're experiencing strong emotions helps flesh out the complex relationship between the mind and the gastric system.

With data like this, we can better model not just the workings of our bodies operating at their best, but also conditions related to bowel or digestive disorders, and how they might impact our mental states.

Of course, a pre-print study limited to a small group of male volunteers can't be interpreted too broadly. Future investigations including a more diverse group of volunteers would be needed to generalize the findings.

It's a field of science that miniaturized technology is bound to make a lot easier to explore, especially compared with times past.

Nearly two centuries ago, a somewhat similar experiment was conducted without the aid of smart pills or sensors. Just a gunshot wound that refused to heal, in the belly of a Canadian fur-trader named Alexis St. Martin.

A US army surgeon by the name of William Beaumont took the opportunity presented to study the functions of digestion – including the influences of emotion on the color of the gut's secretions – through this convenient flesh window.

And if that doesn't evoke a visceral response in your stomach, nothing will.

This research is available on the preprint site bioRxiv.