Create an Internet Connected Pill Dispenser
The P.I.L. Box – A Better Medication Reminder System
Studies show the consequences of patients not taking medications according to doctor’s orders can be serious, especially in older patients.With today’s low cost micro-controllers and sensors (and the incentive of the Radio Shack / Instructables Micro Controller Contest) I thought there must be a better way to ensure my elderly relatives are taking their medications on schedule. This Instructable describes how you can use a Parallax Propeller micro-controller to create the Propeller based Internet Logging Pill Dispenser…or the P.I.L Box for short.
What is the P.I.L. Box?
The P.I.L. Box is a modification to a standard pill dispenser, it uses a Parallax Propeller micro-controller to keep track of when a patient should take their medications. It displays a count down timer one hour before dosage time and then when the time arrives, it generates audible messages, LED 7 Segment messages and lights an LED under the correct compartment to be opened. When the patient opens a compartment, a sensor detects this and records the event to an internet accessible log file (thereby allowing relatives or health care providers to verify meds are being taken on time). More importantly the P.I.L Box logs the fact that a patient has missed their serving time and even sends a Twitter message to alert relatives and health care providers.
Step 1: Design Features of the P.I.L. Box Internet Connected Pill Dispenser
- Dosage Time Reminders – Automated, clear, reminders to the patient, informing of the proper time to take their medications.
- “Next Dosage” Time Display – by pressing the red Enter button on the front panel, a user can switch from viewing the current time of day, to viewing the next scheduled medication time
- LED backlighting – LEDs mounted beneath the dispenser highlight the proper compartment to be opened for the current dosage time.
- Audible English language reminders are provided by way of the Parallax Voice Synthesizer object and Propeller speaker jack.
- Local and Remote Logging – The device logs the date and time a patient accesses the dispenser compartments, as well as many non-compliance error situations (such as a missed dosage time). Logs are written to both a web-server accessible file and locally on the Propeller microSD card. I log the file locally to handle the case of a PC server failure or a power-outage (assuming the P.I.L. Box is using the optional 9V battery supply feature).
- Internet Accessible Logs – Remote logging allows a family member or other care provider to check on a patient remotely and verify that they are taking meds on schedule. A patient may even use the log themselves. Consider the case where a patient arrives at work and can’t remember if they took their morning medications, with the P.I.L. Box an up to date record of meds taken is available on your smart phone or networked computer.
- Twitter enabled – the P.I.L. Box is a registered Twitter application and by use of REST APIs, the python-based remote logging server sends Twitter messages to notify care providers about missed dosage events.
- Low Cost Standard Pill Containers – P.I.L. Box uses inexpensive standard 7 Day Pill Reminders made by Ezy Dose. The prototype design allows the container to easily be removed, enabling a care provider to visit weekly dropping off a new pre-filled med container and collecting the empty container for restocking. Being able to remove the box will help users actually get to their meds as well.
- Non-compliance Error Messages – If a patient misses a dosage time, forgets to replace the pill container or accesses meds early, visual and audible error messages are generated, and such issues are logged to the local and remote log-files.
- Extendable Design – The current prototype supports only seven compartments, one for each day of the week, but obviously many patients would require three or even four servings a day. The Propeller has 20 totally free I/O pins and I needed 12 simply to drive the LED display, so I used shift registers to provide additional pins. Because I used the Tymkrs Shift Me V1 shift register board, not only could I control 8 switches and 8 LEDs while only allocating 6 pins, I knew I could also chain together many such boards, thus easily supporting as many containers as desired. For example, with little design change, we could simply add 3 additional shift register boards, allowing us to handle 32 LEDs and 32 Switches and thus support the Ezy Dose 4X/Day Weekly Pill Organizer, which features 28 separate pill compartments.
If a picture is worth a thousand words, then a video must be even better…please see my video demo on YouTube
Step 2: The Internals, How does it Work?
How Does it Work?
The Propeller Based Internet Logging Pill Dispenser (P.I.L. Box) has the Parallax Propeller Board of Education at its heart.
- When started, the P.I.L. Box is aware of the current time and the patient dosage time.
- The next dosage time is displayed until we are less than one hour away.
- Once we are one hour away, a countdown timer is shown on the 4 digit LED display. This timer runs in a separate Propeller cog, allowing the main program to continue checking for buttons, error conditions and log events.
- When the countdown timer reaches zero, the appropriate LED is turned on indicating which compartment the patient is to access. A voice synthesized reminder is played as well.
- If the patient opens the proper compartment, a log entry is added to the local and remote log-files.
- If the patient opens the wrong compartment or does not access the compartment, an error message is played and an error event is logged.
- The Next Dosage time is calculated and we start again.
For more detail: Create an Internet Connected Pill Dispenser
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w
This Post / Project can also be found using search terms:
- arduino based e medicine dispensor
- arduino controlled pillbox
- internet connected pill dispenser