Design and Feasibility of a Safe Pill Bottle

Ubiquitous intelligence of Internet of Things (IoT) objects and new sensors provide innovative solutions for a variety of health issues. Unintentional child poisoning represents an increasingly important health issue worldwide, partially because of an increase in the use of drugs and food supplements. Although child-resistant bottle caps have probably saved many lives, they are not foolproof and do not provide warnings for parents and caregivers when children try to access the bottles. In this paper we present a design, implementation, and feasibility analysis of an intelligent “safe pill bottle” that can identify when a child is trying to open a bottle and then generate an immediate warning to deter a child from opening the bottle and send alerts to parents/guardians. The bottle controller uses capacitive sensing to identify the class of user. We present the results of pilot testing with eight adults and eight children using neural networks (NN). With 474 bottle-opening events, our NN had 96.4% accuracy of predicting whether the user was a child or an adult. Preliminary results demonstrate that smart pill bottles may be an effective tool to prevent unintentional child poisoning.


Introduction and Background
Unintentional child poisoning of children under six years of age represents nearly 50% of the 2.4 million poisoning exposures reported to US poison control centers annually [1,2].Moreover, not all exposures of children ages 0-5 years are reported to poison control centers, so existing numbers are believed to be underestimates.Currently used child-resistant caps have proven to be an efficient method of saving young children's lives, but they are not foolproof.Federal regulations permit child-resistant caps to be used if they are opened by 20% of children ages 42-51 months within 10 min (16 CFR 1700.20).Furthermore, child-resistant caps are frustrating to many consumers, including elderly and disabled individuals.
There are at least two primary reasons for high child poisoning rates.First, medications are more available than ever in our homes.The presence of prescription drugs, over-the-counter medicines, vitamins, herbs, and dietary supplements near young children is extremely common, and the simple presence of dangerous items in the home increases the odds of young children encountering them and unintentionally poisoning themselves [3].Second, because of our fast-paced lifestyles, adults might forget to properly store medicine away from children's reach, or a parent or grandparent might forget a pill bottle is in a handbag or briefcase.Young children who discover medicine while adults were not looking comprise 95% of unintentional medication overdose ER visits [4].
New sensing technologies and biometric identification may detect a variety of hazardous events.Biometric authentication could ensure that the right person is accessing the right data.The most popular biometric authentication methods include fingerprint authentication based on 2D image processing techniques to extract unique physiological features of the user [5].Palm features, such as palm prints and palm-vein networks have been proposed [6,7].Zhang et al. proposed a technique using 3D surface curvature maps for feature extraction [8].All methods demonstrate that hand geometry and surface curvature influence the contact area with an object and allow for unique identification of the user.Changes in contact area and pressure influence capacitance of the skin to object interface [9].We propose a new method of identification of the class of users and detection of critical events when a child is trying to open a pill bottle.
The Internet of Things (IoT) introduced a paradigm where everyday objects feature identification, sensing, networking, and processing capabilities that allows them to communicate with one another and with other devices and services over the Internet [10].Ubiquity of IoT sensors and services provides an opportunity for new devices and services.Smart pill bottles, such as the AdhereTech smart pill bottle [11], are increasingly used for monitoring of drug compliance.We plan to expand the existing functionality of connectivity of the smart pill bottle with detection of critical events to prevent child poisoning.The same technology can be used to reduce child poisoning from other household products.Our preliminary results demonstrated feasibility of use of capacitive measurement to identify the class of user (child vs. adult) [12].
Widespread use of capacitance-based human-computer interfaces motivates the integration of capacitance measurement interfaces in a number of commercially available microcontrollers.As an example, the microcontroller NXP MKL26Z64VFT4 used in the Teensy LC sensor platform [13] supports capacitive measurements from up to 11 pins with a default accuracy of 0.02 pF and a measurement time in the order of 1 millisecond.The microcontroller features low power consumption, a small 48QFN package, and a low price, thus making it suitable for embedded IoT platforms.
Herein, we describe a pilot study with the prototype safe bottle [12] to demonstrate the effectiveness of our system design for the real-time generation of warnings.Our sample comprised 16 participants: eight children and eight adults.The primary hypothesis of our study was that the system can properly detect users as a child (less than 10 years old) or an adult (more than 20 years old).

Materials and Methods
We implemented the prototype safe bottle with 15 capacitive segments around a standard pill bottle.The capacitive sensors were made of copper tape strips insulated with clear plastic tape.The first prototype featured 5 segments and provided insufficient resolution.Therefore, we implemented a second prototype with 15 capacitive segments, as shown in Figure 1.
Inside the bottle we placed an embedded microcontroller board and a battery.To facilitate measurements from multiple segments at a high sampling rate, we used two microcontroller boards: Teensy 3.2 [14] was used to measure capacitance from 6 channels and Teensy 3.6 [15] to measure capacitance from 9 channels and save data to an on-board microSD card.Capacitance was sampled at 50 Hz throughout the experiment.Teensy 3.6 served as the master controller that initiated measurements in each cycle and collected measurements from the slave board using serial (UART) communication.Inside the bottle we placed an embedded microcontroller board and a battery.To facilitate measurements from multiple segments at a high sampling rate, we used two microcontroller boards: Teensy 3.2 [14] was used to measure capacitance from 6 channels and Teensy 3.6 [15] to measure capacitance from 9 channels and save data to an on-board microSD card.Capacitance was sampled at 50 Hz throughout the experiment.Teensy 3.6 served as the master controller that initiated measurements in each cycle and collected measurements from the slave board using serial (UART) communication.
In the pilot experiment we collected real-time measurements of capacitance to detect two classes of users: children (in our pilot experiment, ages 5 to 10 years old), and adults (over 20 years old).We asked 16 participants-eight adults and eight children-to open and shut the bottle 30 times, simulating taking a pill out of the bottle.We recruited participants as volunteers from our circle of friends and collaborators, in many cases using children and adults from the same family to represent a realistic use case scenario.Participants represented a range of racial, ethnic, and cultural groups.The average age and standard deviation of adult users was 33 ± 14.9 years, and for children 7.5 ± 1.5 years.The experimental protocol was approved by the IRB at the University of Alabama at Birmingham (approval number IRB-300000806).
The capacitance of all segments was constantly recorded with a sampling frequency of 50 Hz.Subjects were not instructed how to hold or open the bottle, as we wished to capture their natural patterns of bottle use.We collected a total of 474 events during the experiment, 29.6 events per user.Two hundred and forty-eight events were from adult users and 226 events from child users.

Signal Processing and Feature Selection
All signals were collected by the embedded controller and stored on the microSD card for postprocessing.All processing was performed off line using Matlab 2017b.
A typical example of the change of capacitance on two out of 15 segments during bottle opening is shown in Figure 2. As shown, depending on the contact area between the capacitive segment and the palm or fingers, the capacitance of segments increases from approximately 25 pF to 36-43 pF.A time sequence of contact with different sensor segments can be also seen; in this case, segment seven (S7) is touched first and released later.Segment capacitance fluctuates somewhat during the event, depending on the contact area and pressure.Figure 2 illustrates the change of capacitance for two segments only (S6 and S7); similar patterns of change during bottle handling event can be seen in all 15 segments.Both signals are filtered using a 3-point median filter to remove high frequency noise.In the pilot experiment we collected real-time measurements of capacitance to detect two classes of users: children (in our pilot experiment, ages 5 to 10 years old), and adults (over 20 years old).We asked 16 participants-eight adults and eight children-to open and shut the bottle 30 times, simulating taking a pill out of the bottle.We recruited participants as volunteers from our circle of friends and collaborators, in many cases using children and adults from the same family to represent a realistic use case scenario.Participants represented a range of racial, ethnic, and cultural groups.The average age and standard deviation of adult users was 33 ± 14.9 years, and for children 7.5 ± 1.5 years.The experimental protocol was approved by the IRB at the University of Alabama at Birmingham (approval number IRB-300000806).

Capacitive Sensors
The capacitance of all segments was constantly recorded with a sampling frequency of 50 Hz.Subjects were not instructed how to hold or open the bottle, as we wished to capture their natural patterns of bottle use.We collected a total of 474 events during the experiment, 29.6 events per user.Two hundred and forty-eight events were from adult users and 226 events from child users.

Signal Processing and Feature Selection
All signals were collected by the embedded controller and stored on the microSD card for postprocessing.All processing was performed off line using Matlab 2017b.
A typical example of the change of capacitance on two out of 15 segments during bottle opening is shown in Figure 2. As shown, depending on the contact area between the capacitive segment and the palm or fingers, the capacitance of segments increases from approximately 25 pF to 36-43 pF.A time sequence of contact with different sensor segments can be also seen; in this case, segment seven (S7) is touched first and released later.Segment capacitance fluctuates somewhat during the event, depending on the contact area and pressure.Figure 2 illustrates the change of capacitance for two segments only (S6 and S7); similar patterns of change during bottle handling event can be seen in all 15 segments.Both signals are filtered using a 3-point median filter to remove high frequency noise.The user's contact pattern can be characterized using the relative change of segment capacitance caused by contact with the palm or fingers.Each segment has a different default capacitance, as shown in Figure 2. Therefore, we calculate the relative change of capacitance CRi for each segment i (Ci) using default capacitance (Cdefi) before the touch, via Equation (1): . ( Total capacitance Ct of all N segments is calculated as: The start of an event is recognized as a change of total capacitance greater than the threshold, which in our case is 20% higher than the default capacitance Ct.The region of interest (ROI) for each touch event is selected as the 500 ms period from the start of touch.We save the relative change of capacitance for each segment and characterize each event using the following parameters:  tRCC-total relative change of capacitance as the sum of all relative changes CRi, i  tRCCN-normalized total relative change of capacitance, calculated as sum of all normalized changes of capacitance according to Equation (3)  mspos-mid-segment position, calculated as a center of gravity of the sorted set of relative capacitances CRsorti Since touch capacitance depends on skin properties and current conditions, touch capacitance can be significantly different in the case of wet hands compared with contact with dry hands for the same user.Therefore, we use normalized changes according to Equation (3) and tRCCN to determine parameters that depend on touch area, not skin condition.
An example of the absolute change of capacitance (Ci − Cdefi) for a child and an adult for each segment is shown in Figure 3.As shown, the smaller child's hand is in contact with a smaller number of segments.Smaller contact area from the child also generated smaller change of capacitance on segments in contact with the palm or fingers.Note that because of the circular pattern of capacitive segments, with no markers on the bottle (as shown in Figure 1), each touch event will have a different The user's contact pattern can be characterized using the relative change of segment capacitance caused by contact with the palm or fingers.Each segment has a different default capacitance, as shown in Figure 2. Therefore, we calculate the relative change of capacitance CR i for each segment i (C i ) using default capacitance (Cdef i ) before the touch, via Equation (1): Total capacitance C t of all N segments is calculated as: The start of an event is recognized as a change of total capacitance greater than the threshold, which in our case is 20% higher than the default capacitance C t .The region of interest (ROI) for each touch event is selected as the 500 ms period from the start of touch.We save the relative change of capacitance for each segment and characterize each event using the following parameters: • tRCC-total relative change of capacitance as the sum of all relative changes • tRCCN-normalized total relative change of capacitance, calculated as sum of all normalized changes of capacitance according to Equation (3) • mspos-mid-segment position, calculated as a center of gravity of the sorted set of relative capacitances Since touch capacitance depends on skin properties and current conditions, touch capacitance can be significantly different in the case of wet hands compared with contact with dry hands for the same user.Therefore, we use normalized changes according to Equation (3) and tRCCN to determine parameters that depend on touch area, not skin condition.
An example of the absolute change of capacitance (C i − Cdef i ) for a child and an adult for each segment is shown in Figure 3.As shown, the smaller child's hand is in contact with a smaller number of segments.Smaller contact area from the child also generated smaller change of capacitance on segments in contact with the palm or fingers.Note that because of the circular pattern of capacitive segments, with no markers on the bottle (as shown in Figure 1), each touch event will have a different distribution of values between segments, even for the same hand contact pattern with the bottle.That is the reason why we use sorted sets of relative changes (CR sorti ) to generate the pattern, independent of the relative position of the bottle during opening, as defined in Equation (4).
distribution of values between segments, even for the same hand contact pattern with the bottle.That is the reason why we use sorted sets of relative changes (CRsorti) to generate the pattern, independent of the relative position of the bottle during opening, as defined in Equation (4).
Each user generates a specific touch pattern described with our set of parameters (Equations 1-4).As an illustration, a sorted set of normalized changes of capacitance for an adult and a child is represented in Figure 4.It can be seen that the adult has a larger contact area and more segments with significant changes than the child.The extracted parameter mspos represents the "center of gravity" of the change and the distribution of segments during a touch event.In this example, normalized change of capacitance for the 3 segments with the largest contact area has a similar change as the remaining 12 segments for a child (exact value is 3.29).For the same example, the adult has contact with more sensors, and therefore relative change of 5 segments is similar to the change of the remaining 10 segments (exact value is 5.17).Both values of mspos in Figure 4 were calculated according to Equation (4).Each user generates a specific touch pattern described with our set of parameters (Equations 1-4).As an illustration, a sorted set of normalized changes of capacitance for an adult and a child is represented in Figure 4.It can be seen that the adult has a larger contact area and more segments with significant changes than the child.The extracted parameter mspos represents the "center of gravity" of the change and the distribution of segments during a touch event.In this example, normalized change of capacitance for the 3 segments with the largest contact area has a similar change as the remaining 12 segments for a child (exact value is 3.29).For the same example, the adult has contact with more sensors, and therefore relative change of 5 segments is similar to the change of the remaining 10 segments (exact value is 5.17).Both values of mspos in Figure 4 were calculated according to Equation (4).

User Identification
Our preliminary investigation demonstrated effectiveness of user classification using both Support Vector Machines (SVM) and neural networks (NN), with the two techniques yielding similar performances [12].Since NN had a slightly better performance and are suitable for embedded implementation, we present in this paper only the NN method of user class identification.
The extracted parameters demonstrate significant variability between users and even for different events from the same user.An example of the relationship between tRCC and tRCCN is presented in Figure 5.Because of the overlap of values, it is necessary to use multi-parameter user identification.

User Identification
Our preliminary investigation demonstrated effectiveness of user classification using both Support Vector Machines (SVM) and neural networks (NN), with the two techniques yielding similar performances [12].Since NN had a slightly better performance and are suitable for embedded implementation, we present in this paper only the NN method of user class identification.
The extracted parameters demonstrate significant variability between users and even for different events from the same user.An example of the relationship between tRCC and tRCCN is presented in Figure 5.Because of the overlap of values, it is necessary to use multi-parameter user identification.

User Identification
Our preliminary investigation demonstrated effectiveness of user classification using both Support Vector Machines (SVM) and neural networks (NN), with the two techniques yielding similar performances [12].Since NN had a slightly better performance and are suitable for embedded implementation, we present in this paper only the NN method of user class identification.
The extracted parameters demonstrate significant variability between users and even for different events from the same user.An example of the relationship between tRCC and tRCCN is presented in Figure 5.Because of the overlap of values, it is necessary to use multi-parameter user identification.We used a 2-layer NN with 12 nodes in the first layer and one node in the second layer.All processing was performed using the NN toolbox in Matlab.In addition to the previously described parameters, we improved the performance by introducing two additional parameters:

•
CCdiff -difference of total capacitance from average total capacitance for all children (CCmean):

•
CAdiff -difference of total capacitance from average total capacitance for all adults (CAmean): Values of CCdiff and CAdiff are calculated using total capacitance Ct, adult group capacitance threshold CAthresh, and group capacitance means CCmean and CAmean using the following pseudo code: Therefore, the NN feature set we used for class identification contains five parameters, defined as:

Results
The average values and the standard deviation of the main event parameters are presented in Table 1.Although the mean values demonstrate significant differences between groups, individual events demonstrate significant variance, even for the same user.Therefore, we used multi-parameter user classification.We selected the first eight subjects (four adults and four children) to train NN, and the remaining eight subjects to test the network.During training, 80% of events were used to train NN, 15% for validation, and 5% for testing.The confusion matrix for the testing set is presented in Table 2.We also trained and tested a neural network with all events from all 16 subjects.The neural network was trained with 70% of the events, validated with 15%, and tested with 15% of the events.The confusion matrix for that test is shown in Figure 6.The receiver operating characteristic (ROC) performance of the test is shown in Figure 7. T arg et C lass  Training of the NN was performed off-line to optimize NN weights for classification, with bias for maximum accuracy for detection of children.NN weights were then implemented on an embedded microcontroller for real-time classification of an event.Processing time for a selected set of features is less than 1 ms.Therefore, total processing latency is 500 ms for data collection, and 1 ms for signal processing and classification, which allows the controller to work in real-time and generate timely warnings without delay.A long data collection window is necessary for a stable input data signal, as can be seen in Figure 2, but subsequent prototypes will be able to implement an on-bottle warning that is generated immediately to deter a child and to send a message to supervising adults through Wireless Local Area Network.Training of the NN was performed off-line to optimize NN weights for classification, with bias for maximum accuracy for detection of children.NN weights were then implemented on an embedded microcontroller for real-time classification of an event.Processing time for a selected set of features is less than 1 ms.Therefore, total processing latency is 500 ms for data collection, and 1 ms for signal processing and classification, which allows the controller to work in real-time and generate timely warnings without delay.A long data collection window is necessary for a stable input data signal, as can be seen in Figure 2, but subsequent prototypes will be able to implement an on-bottle warning that is generated immediately to deter a child and to send a message to supervising adults through Wireless Local Area Network.

Discussion
Results from this preliminary study of 16 participants demonstrate the feasibility of the proposed concept of a "safe bottle" that can recognize the class of user as a child or an adult.Accuracy of the NN was approximately 97%, with an error rate of just 3%.Furthermore, we emphasize that the safe bottle is intended primarily to protect children 0-5 years of age from unintentional poisoning,

Discussion
Results from this preliminary study of 16 participants demonstrate the feasibility of the proposed concept of a "safe bottle" that can recognize the class of user as a child or an adult.Accuracy of the NN was approximately 97%, with an error rate of just 3%.Furthermore, we emphasize that the safe bottle is intended primarily to protect children 0-5 years of age from unintentional poisoning, and our pilot test used for pragmatic reasons (availability, developmental maturity to complete the task) children with an average age of children 7.5 years (range = 5-10).We greatly outperformed our initial goal of less than 10% of errors for children ages 0-5.
Ultimately, we envision the use of "smart bottles" as devices that can replace or supplement current child-resistant lids on pill containers.We are unaware of any similar such initiatives in the field to improve the safety of children; the closest comparator we have located is a proposal, not yet prototyped to our knowledge, to use biometric characteristics such as fingerprints to restrict the use of firearms [16].
As our prototype moves into implementation, an embedded controller will be placed at the bottom or the side of the pill bottle, separate from pills in the bottle; this model replicates existing smart pill bottles from Adhere Tech [11].Since medical or advertising labels can be taped over the sensors without changing their performance, safe pill bottles would look identical to currently-used standard pill bottles.Given the frequency of unintentional child poisoning, and the fact that the current technology of child-resistant caps is imperfect, smart bottles may offer an alternative that provides greater protection and higher efficacy than currently used strategies.
Smart bottle technology is not without limitations.There will be an increase in price per bottle, primarily because of the price of the embedded controller.Capacitive sensors can be taped onto the bottle or integrated in the bottle during injection molding of the plastic bottle.Although costs are likely to decrease over time, and re-usable bottles could easily be manufactured (consider the precedent of reusable glass bottles in many eras and jurisdictions), some consumers and manufacturers are likely to continue to choose the lowest-cost legal strategies to reduce the child poisoning risk, which currently are child-resistant caps.As costs decrease, industry and consumer decisions may change, as evidenced by the early commercial success of the Adhere Tech bottle [11].
Engineering limitations exist also.Current processing of the event and selection of the region of interest can be significantly improved.We currently use only 0.5 s at the beginning of the event to detect the average of values in the region of interest.However, sophisticated pre-processing can significantly improve noise immunity in recorded signals.Furthermore, our pilot test did not provide enough data for training of the neural network.We expect to conduct additional tests in the future.
Finally, there is potential to improve our use of neural networks.NN allow analysts to set the thresholds for class separation.The results presented for our experiment used the default NN threshold of 0.5.Sensitivity analyses suggest that modified thresholds would reduce the number of events when children are detected as adults, but would also increase the number of errors when adults are detected as children, or "false alarms."Increased false alarms where adults are incorrectly classified as children might be preferred in our system over errors where children are misidentified as adults.With larger datasets, NN could be retrained based on feedback from users, thus optimizing performance for a given group of users.

Conclusions
Smart objects in the IoT age can provide better solutions for important problems.We presented data demonstrating the feasibility of using a safe pill bottle to prevent unintentional child poisoning.Our pilot study indicates that the approach is feasible, suggesting a safe pill bottle integrated into an IoT system [17] could provide warnings to parents and caregivers, reducing unintentional child poisoning risk.Similar methods can be embedded into other everyday objects that could potentially harm children, including cleaning fluids; alcohol, nicotine, or marijuana products; fuels; and so on.Ultimately, intelligent bottle designs might detect all critical events, such as children trying to access dangerous products, and generate aural and visual warnings to deter children.The bottle could also communicate information about events to a central server that would immediately notify parents/guardians about possibly critical events using preconfigured messages and modalities.The server would also store data for identification of patterns and re-conceptualization of potential poisoning situations.We plan future work along these lines, including system integration and additional optimization of processing to reduce the number of critical errors.

Figure 2 .
Figure 2. Pattern of capacitance change on two segments during bottle opening.

Figure 2 .
Figure 2. Pattern of capacitance change on two segments during bottle opening.

Figure 3 .
Figure 3.An example of the absolute change of capacitance during opening of the bottle for an adult and a child.

Figure 3 .
Figure 3.An example of the absolute change of capacitance during opening of the bottle for an adult and a child.

Figure 4 .
Figure 4. Sorted and normalized capacitance of all segments and calculated values of mspos for an adult and a child; figure represents the same data set from Figure 3.

Figure 5 .
Figure 5. Change of tRCC and tRCCN for adults and children.

Figure 4 .
Figure 4. Sorted and normalized capacitance of all segments and calculated values of mspos for an adult and a child; figure represents the same data set from Figure 3.

Figure 4 .
Figure 4. Sorted and normalized capacitance of all segments and calculated values of mspos for an adult and a child; figure represents the same data set from Figure 3.

Figure 5 .Figure 5 .
Figure 5. Change of tRCC and tRCCN for adults and children.

Figure 6 .
Figure 6.Confusion matrices of the neural networks (NN) trained and tested with all events.

Figure 6 .
Figure 6.Confusion matrices of the neural networks (NN) trained and tested with all events.

Figure 7 .
Figure 7.The receiver operating characteristic (ROC) performance of NN trained and tested with all events.

Table 1 .
Average values of main event parameters; all values represent mean ± standard deviation.

Table 2 .
Confusion matrix of the testing set of eight subjects (four adults and four children) The receiver operating characteristic (ROC) performance of NN trained and tested with all events.