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. 

Parts Needed
  • 1 Microcontroller - For this project I used a Parallax Propeller microcontroller (Board of Education model), but an Arduino would work as well.
  • 1 Pill Dispenser - an Ezy Dose XL 7 Day Pill Reminder with Push Button Pop-up Covers
  • 1 Project Box - I used a wooden ex-toolbox from a salvage store
  • 8 Micro-switches - one for each day of the week and one to detect the pill box is missing
  • 1 Momentary switch - used to answer prompts from the microcontroller
  • 1 4-digit seven-segment display - displays messages
  • 2 Shift registers or for easier wiring, I used a Shift-me! card from tymkrs.com 
  • 1 breadboard
  • wire
  • 1 speaker - the Propeller BOE has a 3.5mm headphone jack and voice synthesized messages are played through the speakers
  • 1 PC - a serial connection over USB is used to log events to the web server.
  • (optional) XBee modules - instead of a USB connection as shown in the attached video, you could optionally use XBee modules to send messages wirelessly from the PIL Box to the PC 

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.
Video Demonstration
If a picture is worth a thousand words, then a video must be even better…please see my video demo on YouTube

Any idea what the part number of the micro switches you used?
has a great potential. would make a all in one type box. would also try incorporating a alarm clock into it's design. would be a good replacement for a standard alarm clock on a nightstand or elsewhere.
Thanks much. Good idea to add an alarm, it does already show the time of day when not in countdown mode, so that would be an easy thing to add...it could then do an voice to wake you up ....or flash the lights or play a sound...or all three :-). Maybe I should add internet radio too
You're welcome :) I figured the more uses that could be built Into a small unit would also help people remember :)<br>Best of luck on this project! Look forward to seeing more!
Great idea.
Thanks techbitar!
This such a great idea for Mom. Heck, a great idea for me! <br> <br>Congrats on getting Featured.
Thank you!
Great job on this project ! Nice video as well to help describe operation . <br>Build_it_Bob
Thanks Bob, thanks for pointing that out, I guess I do explain the workings in the video more than the Instructable.
longest path between 2 points?
Great project!
great work!!, you could add a reservoir for &quot;auto-refill&quot; of the pills so there is always one dose on each slot to avoid overdose and/or empty slot. <br>Maybe you could (i don&acute;t know if it&acute;s possible) add also blood pressure and/or blood glucose meter logging for dosage adjust on patients with high blood pressure or diabetes. <br>keep it up!
Thanks for your comments, good ideas! I have definitely thought about adding a blood pressure test into the picture. I know some drugstores already will optionally sell you meds pre-distributed into pill reminders like this, so on the video I suggest that the pill minder could simply be exchanged each week...take out the empty one and insert a new one.

About This Instructable




More by mazzmn:Build a Lawn Chair from Recycled Skis - The Ski Chair! Control Video Games with Icicles!  Custom Crazy Taxi Video Game Controller with Makey Makey 
Add instructable to: