Build — Smart Pillbox

Forgetting medicines is normal!
Forgot medicines?

Recently I started to take medicine daily. Sometimes I forget to take my pills after food, especially after dinner. I started using the ‘Alarm’ on my mobile phone. But there are situations where I remember that the alarm went off, but I forget whether I really consumed the pills or not. Then I have to resort to counting the remaining number of pills to confirm.

I asked around to know the medicine intake experience of people I know, including my parents. It appears that I’m not alone and many struggle to build a regular habit of taking medicines. When someone is a carer of elderly patients, they also would like to know that medicines are correctly consumed by the patients. If they haven’t, the carer can remind them.

Incidentally my daughter, who is a high school student, received an assignment in her Product Design subject to design any form of a container/storage box for any target user group. She discussed it with me and together, we zeroed in to medicine pillboxes. “How might we empower patients and their carers to ensure that the medicines are consumed regularly at the prescribed time?”

An Idea at IKEA!

We did some research online to see the current products available for end users. There are pillboxes that work with a companion app on a mobile phone, connected via Bluetooth or home WiFi.

IKEA Home Automation sensors using Matter protocol
IKEA Home automation sensors using Matter communication standard

One day I happened to visit the IKEA store, I saw that they are selling some cheap home automation sensors using Matter application-layer communication standard. Then I had an idea: can I buy a door open/close sensor and install it on a container where I can store my medicines? With this setup, I will get a daily report of whether the container was opened following a set alarm!

Not so fast…

On researching further, I understood that this is not as simple as I thought. Let me list the important learning.

  • Home automation sensors using the Matter communication standard need a Thread IPv6-based mesh networking protocol.
  • To connect the Thread mesh networking protocol to my home intranet, we need to buy a border router. Although IKEA sells a border router, to take the complete control of the Thread network, it is better to buy the Home Assistant Connect ZBT-2 from Nabu Casa, the company behind Home Assistant.

ZBT-2 Border Router
Home Assistant Connect ZBT-2 Border Router
  • The underlying admin dashboard can be a Home Automation App running on a self-hosted server, or a Home Automation OS (HAOS) that runs on a virtual machine.
  • A Home Assistant Companion Android app on the mobile phone will be used to register the door open/close sensors.

Parts List

To build the Smart Pillbox, I did the following:

Smart Pillbox Prototype
The prototype of Smart Pillbox

How my Smart Pillbox Works

Smart Pillbox version 1.0 block diagram
Smart Pillbox version 1.0 block diagram

Today I’m not going to explain the boring technical bits of installing and configuring Home Assistant OS, registering IKEA door open/close sensor for the Smart Pillbox. But here is how everything works.

  • I need to take my pills daily after my dinner — any time between 5:30 PM and 8:30 PM (also after breakfast — any time between 5:30 AM and 8:30 AM). So this is saved as an ‘Automation’ — with trigger, conditions and action.
  • Helpers (Boolean flags) are defined to retain the current state of the pillbox — whether the lid is open or closed.
  • A push notification is configured to be sent to my mobile phone if the pillbox is not opened in the specified duration.
  • A persistent notification on the Home Assistant Companion app is also configured which will appear on the app ‘Notifications’ menu.
  • If I haven’t opened the pillbox within the specified duration, I will receive a reminder on my mobile phone as a push notification. Tapping it opens the Home Assistant Companion app’s notification screen — showing the message reminding me to take the pills.
Push notifications from Home Assistant Companion App on my Android mobile phone
Push notifications from Home Assistant Companion App on my Android mobile phone
  • If I ignore it and don’t open the pillbox, I will get a second reminder after 10 minutes.
  • If I open the pillbox and consume the medicine, no notifications are sent — but the lid open/close activity is recorded on the companion app.

UPDATE 04-JULY-2026

It is observed that even though the Smart Pillbox is generating reminders correctly, I’m not getting real time notifications on my Android mobile phone. On further research, I came to know that Android OS controls background running of processes by third party apps to get more battery life after each recharge. There are settings to bypass this, but the mobile manufacturer (like Samsung or Motorola) makes this hard to enable.

Real time activity logs on Home Assistant
Real time activity logs on Home Assistant

One option is to deliver the notifications as an email to your Gmail ID. Since the Gmail app is from Google, Android OS ensures that real time notifications work for it. Another option is to configure integrations with a messaging app — like WhatsApp or Telegram.

Real time push notifications from Pillbox Bot of Telegram App on my Android mobile phone
Real time push notifications from Pillbox Bot of Telegram App on my Android mobile phone

Creating a tailored chat bot and configuring Telegram integration on Home Assistant OS is very easy and popular. So I created a ‘Pillbox Bot’ and now I always get real time notifications on Telegram — irrespective of whether my Android Phone is screen locked or sleeping.

The Future of Smart Pillbox

The current prototype was fun to build and works perfectly for me. But if I want to make and sell it as a product to people who take regular medicines, the setup is very difficult for a normal user. Also, you need to have WiFi connectivity at home, an IPv6 Thread network and a border router, and configurations on the Home Assistant Companion App. So, what if I can make a Smart Pillbox ensuring an excellent out-of-box experience (OOBE) with minimum setup and no extra hardware?

Smart Pillbox version 1.0 block diagram
Smart Pillbox version 2.0 block diagram using an LTE-M/NB-IoT Modem

I’m planning to build a new prototype with a cellular engine (LTE-M/NB-IoT Modem) at heart. A Smart Pillbox with an eSIM configured with a cellular network provider should solve the problems of connectivity and setup. I will post an update as soon as I finish the latest build.

Watch this space…

References

Resource used in this design

Aching young blonde ill slavic man wearing winter hat and scarf by StockKing: Magnific