To test for hypochlorhydria or hyperchlorhydria (too little or too much acid), the Heidelberg Test uses a capsule containing a pH meter that is swallowed.
The capsule is usually tethered by a thread so it may be held in the stomach while you are fed sodium bicarbonate to see how quickly the stomach produces acid to compensate.
The test capsule can also help determine the effectiveness of the pyloric sphincter and peristalsis and diagnose gastroparesis (delayed stomach emptying) and dumping syndrome (rapid stomach emptying).
A similar test using an untethered capsule can be used to record acidity in the duodenum and intestines generally.
This is not the same as the camera capsule that may be swallowed to examine the whole gastrointestinal tract nor the tethered camera capsule that may be used to visually examine the oesophagus.