Smart Pill Dispenser with Naive Bayes Algorithm for Predicting Medication Compliance Based on Patient Behavior Patterns

Authors

  • Achmad Ridwan Prima Indonesia University Author https://orcid.org/0000-0003-1466-0985
  • Samuel Sembiring Prima Indonesia University Author
  • Sere Lonian Sihombing Prima Indonesia University Author
  • Diventranus Lei Prima Indonesia University Author
  • Rio Utama Putra Pasaribu Prima Indonesia University Author

DOI:

https://doi.org/10.35314/ercsa238

Keywords:

ESP32, Medication Compliance, Naive Bayes, Patient Behavior Monitoring, Smart Pill Dispenser

Abstract

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

Download data is not yet available.

Downloads

Published

28-05-2026

Issue

Section

Articles

How to Cite

Smart Pill Dispenser with Naive Bayes Algorithm for Predicting Medication Compliance Based on Patient Behavior Patterns. (2026). INOVTEK Polbeng - Seri Informatika, 11(2), 639-648. https://doi.org/10.35314/ercsa238