A capsule for detection of gastrointestinal motility and a method for preparing such a capsule is provided. The capsule comprises a capsule enclosure and a preset quantity of radiopaque markers filled in the capsule. The radiopaque markers further comprise a solid X-ray contrast agent, a medical plastic with a density of at most at 1.4 g/cm3 and an auxiliary agent.