It was inspired by a lemon battery which uses citric acid to charge a zinc nail and copper penny electrodes.
A version of the pill, that powers up when a zinc electrode interacts with stomach acid, was tested on pigs.
Small sensors continually monitor temperature and heart rate.
The 30mm-long device took six days to travel through the digestive tract of a pig.
Scientists want to create a smaller version of the pill for humans - the prototype measures 10mm.
The version with star-shaped arms is designed to stay in the stomach without risking blockages.
Brigham and Women's Hospital's Giovanni Traverso said: "Taking a capsule once a month could change how we think about delivering medication."