Apparatus (18) is provided for sensing electrical activity of a pancreas (20) of a patient. The apparatus (18) includes a set of one or more electrodes (100), adapted to be coupled to the pancreas (20), and to generate activity signals indicative of electrical activity of pancreatic cells which are in a plurality of islets of the pancreas (20). The apparatus (18) also includes a control unit (90), adapted to receive the activity signals, and to generate an output signal responsive thereto.