Gastric apparatus is provided, including one or more sensors, adapted to generate respective sensor signals responsive to activity of a gastrointestinal tract of a subject. A control unit is configured with an eating detection threshold selected from the group consisting of: a predetermined threshold, and a threshold determined during a calibration procedure. The control unit is adapted to receive and analyze the sensor signals, and identify an aspect of at least one of the sensor signals indicative of periodic activity of the gastrointestinal tract. The control unit modifies the eating detection threshold responsive to identifying the aspect of the signals that is indicative of the periodic activity, and determines that an eating event has occurred responsive to the modified eating detection threshold and at least one of the analyzed sensor signals. Other embodiments are also described.