The PIC12F683 microcontroller (Microchip Technology, Inc., Chandler, AZ, USA) was chosen as the basis of the adherence-monitoring IVR design. The PIC12F683 is a miniature 8-pin, Flash-based, 8-bit CMOS microcontroller, with a size of 4 mm × 4 mm × 0.9 mm in the DFN surface-mount package. The PIC12F683 has numerous features making it a good choice for this application, including: low-power sleep and operating modes to preserve battery life (50 nA standby current; 11 μA operating current at 32 kHz), analog comparator with on-chip programmable voltage reference, external oscillator functionality for precision long-term timing stability, six I/O pins individually programmable for sensor input or LED indicator output, and 256 byte non-volatile EEPROM memory capable of storing 2048 1-bit IN/OUT readings. The adherence monitor consists of the following functional modules (Fig 2A):