Introduction: IDC2018IOT IoPill Box

This is the IoPill Box - the internet connected weekly pill box.

For our final project of our IoT course, we decided to offer a solution that will help ensure that elderly people (or any other person that uses a weekly pill box) do not forget to take their pills daily, and on time.

In the following steps we will describe the different processes of our project, including future suggested implementations and improvements to the project.

  1. Day Indication – according to the day of the week, the corresponding cell in the box will be illuminated, indicating which pills are to be taken.
  2. Indication that the pills of the given day have been taken – through an LDR sensor installed in each cell, the box automatically knows whenever a cell has been opened in order to withdraw the daily pills, all the 7 LEDs will give indication to the patient.
  3. Reminder 1 – in case the daily pills have not been taken within the time-frame required, an email reminder will be sent to the user, to remind him to take his pills
  4. Reminder 2 – in case the user has yet to take his pills, after the given time frame and after the first reminder, an email will be sent to a family member or medical assistant – informing them that the daily pills have not been taken
  5. End of Week reminder – at the end of the week, a reminder to fill up the pills for the next week will be sent to the user, including instructions of the dosages and types of pills for each day – via email.
  6. Data Log – history of pill taking dates and times is kept in a data log feed via MQTT.

Step 1: Required Hardware, Software and Material

  1. ESP8266 NodeMCU
  2. 7 LEDS
  3. 7 LDR
  4. 7 x 10k Ohm resistor (for ldrs)
  5. 7 x 200R Ohm resistors (for leds)
  6. 4.7k Ohm resistor (for MCP23017)
  7. 16-ch-analog-multiplexer
  8. MCP23017
  9. Pill Box
  10. A cardboard box

Step 2: The Box, and the Pill Box

We found some cardboard box and put the circuit in it and glued the pill box on top of it.

Because of the ldr's light sensitivity and our goal to make it's accuracy good - we had to spray paint the pill box.

For each ldr we "drilled" 2 holes on the back of each day of the pill box - using the old fashion "hot needle" method.

For each led we pinched twice the box with the cold needle.

For the power cable we made a hole on the back of the cardboard box.

Step 3: Circuit Diagram

As you can see in the pictures we soldered all the components as in the diagram - we did it after the pill box was painted, the ldrs was inside each day and the leds in the cardboard box as well.

In the pictures you can see just 2 of the ldrs and the leds (the lower ones represent Sunday and the top ones represent Saturday), in order to have all 7 from both just copy those in the diagram and connect them to the gap between those who appear in the diagram.

The nodeMCU will be power by a usb cable.

Step 4: Adafruit MQTT Feed

We set up 2 data feeds:

  1. IOP_PatientDemoPT - represents timestamps of each day when the patient took that day pills
  2. IOP_PatientDemoHR(not implemented yet, future work) - represents BPM of the patient.

Step 5: IFTTT Configuration

We made 3 IFTTT events:

  1. reminder_1 - in case the daily pills have not been taken within the time-frame required, an email reminder will be sent to the user, to remind him to take his pills
  2. reminder_2 - in case the user has yet to take his pills, after the given time frame and after the first reminder, an email will be sent to a family member or medical assistant – informing them that the daily pills have not been taken
  3. fill_pill - at the end of the week, a reminder to fill up the pills for the next week will be sent to the user, including instructions of the dosages and types of pills for each day – via email

Step 6: The Code

The code is very simple and filled with helpful comments.

For your configuration make sure you changed the IFTTT and Adafruit secret keys, and the wifi configuration as well.

The state machine diagram of the code is as described in the added picture to this step.

Step 7: Extras

Challenges in the project

Do we need to ensure the pills were indeed taken? – this is a question we asked ourselves during the brainstorming process of the project, because at the end of the day, the user is a human being and not a machine, and even if there is an indication of him taking the pills out of the box, there is still a limitation on the indication whether he indeed used the pills or not.

We decided however that this question is not the main focus of our project and this device, and we focused on how to minimize the chances of a user missing a daily dose of his medicine.

Another problem we wanted to solve was ensuring a user doesn’t take pills of a different day. Our solution was a specific and clear indication of the current cell to be used, however there are better and safer solutions to ensure this mistake doesn’t happen, however we didn’t have the tools to support such solutions (e.g a lock on the cells, see future application for the project)

Limitations

Our project refers to a single weekly box – one dosage of pills per day – the solution can be further extended to support several dosages of pills a day / multiple boxes

Mechanics – we didn’t use any moving parts/engines as these were not part of the course. Could have been useful in order to allow us to lock cells that are not to be used, auto-filling the cells with pills at the end of the week etc.

Future applications/improvements to the project

Heart Rate – adding a sensor to measure the patient heart rate and by pressing a button send the data to a MQTT feed for further tracking

App – a user-friendly app that controls the system - through this app the user can update the different

variables of the device:

  1. What time to take the pills
  2. Update pills types and dosages to fill
  3. Receive the reminders via the app
  4. Save data and log of drug-use.
  5. Order drugs through the app when finished

Extend the device to support 2 dosages a day/multiple boxes

Auto-fill of cells – by the end of the week or after the drugs have been used, the device will refill the daily cells with the drugs needed.

Lock cells that are not to be used – all cells but the daily cell to be used will be locked in order to ensure users do not accidentally take the wrong pills/overdose.

Design improvements.

Connect device to medical/insurance companies that monitor the users, save relevant information, update subscriptions and send drugs when needed etc.