Smart Pill Dispenser with Naive Bayes Algorithm for Predicting Medication Compliance Based on Patient Behavior Patterns
DOI:
https://doi.org/10.35314/ercsa238Keywords:
ESP32, Medication Compliance, Naive Bayes, Patient Behavior Monitoring, Smart Pill DispenserAbstract
Medication adherence is a critical challenge in chronic disease management, with global non-adherence rates estimated at 50% or higher among patients with long-term conditions. This study presents the design and implementation of an ESP32-based smart pill dispenser prototype integrating a Naive Bayes classification algorithm for real-time, on-device prediction of patient medication compliance behavior. The system collects multimodal interaction data through an RTC DS3231, a load cell weight sensor, and a push button to extract four behavioral features: time delay (ΔT), weight change (ΔW), compliance frequency, and signal quality. These features are locally classified on the ESP32 into three categories: Compliant, Late, and Non-Compliant. A dataset of 100 interaction records was generated through controlled laboratory experiments, with a stratified 80:20 train-test split applied for evaluation. The trained Naive Bayes model achieved an overall accuracy of 80.0% on the test set, with per-class precision, recall, and F1-score reported. Class imbalance effects are analyzed, and results are compared against decision tree, k-NN, logistic regression, and random forest. The prototype demonstrates feasibility as a low-cost, portable medication management device, though clinical validation with real patients remains required.
Downloads
Downloads
Published
Issue
Section
License
Copyright (c) 2026 INOVTEK Polbeng - Seri Informatika

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

