Introduction: Smart Pill Dispenser

Do you sometimes feel worried about your grandparents? Are you afraid that they'll forget to take their pills? that is why we made the Smart Pill Dispenser. Our Smart Pill Dispenser will help you help the elderly!

Note - In this Instructable we only have 2 types of pills but it will work with any number of pills you'd like.

Why Smart Pill Dispenser?

The Smart Pill Dispenser is a smart machine that will give your grandparents the pills they need, when the need it and in case they'll forget - you will get a notification about that!

How It Works?

The user will configure the relevant data about the pills - time of dispensing, amount of each pill and waiting time for notifying the family members that the pills were not taken.

Respective to the data, the machine will output the pill in the correct time into the drawer.

If the elder didn't take his pill within the required time then it will notify a family member about it via a telegram message.

Who Are We?

We are Danielle Guli Morad and Dekel Binyamin. Two Computer Scince students in IDC, Israel, who attend an IOT class in our third year.

Have fun building!

Supplies

Mechanical Supplies -

  • 1 x drawer
  • 0.5m Tube (pill 1 diameter)
  • 0.5m Tube (pill 2 diameter)
  • Utility knife
  • Hot glue gun
  • 4 x Cuttable thin plastic
  • Duct tape
  • Marker

Electric Supplies -

  • 1 x ESP8266 WeMos D1 Mini board
  • 1 x Arduino uno board
  • 1 x Arduino board USB cable
  • 1 x micro USB cable
  • 1 x Breadboard
  • 2 x Large Servos (MG996R)
  • 2 x Small Servos (Micro Servo 9G SG90)
  • 1 x Reed switch
  • 14 x Jumper cables

Step 1: ​Prerequisite Programs

Prerequisite programs to install:

Arduino IDE (link: https://www.arduino.cc/en/Main/Software )

Mosquitto (link: https://mosquitto.org/download/ )

Node.js (link: https://nodejs.org/en/download/ )

Telegram on your phone

Step 2: Node-Red

Now, Install Node-RED following the instructions here: https://nodered.org/docs/getting-started/local

Connect to http://localhost:1880 and install the following modules (press menu -> palette -> install) :

  1. node-red-dashboard - https://flows.nodered.org/node/node-red-dashboard
  2. node-red-contrib-moment - https://flows.nodered.org/node/node-red-contrib-mo...
  3. node-red-contrib-chatbot - https://flows.nodered.org/node/node-red-contrib-ch...

Import our json code (copy the text from the txt file) by pressing menu -> import.

  1. Within the node-red code you will need to make 2 changes: Within the "date/time formatter" you need to change the "adjustment" according to your time zone
  2. Within the "SmartPillBotConversation" you need to change the "ChatId" (I will specify how to get your ID in the telegram bot setup segment)

Step 3: Arduino Code

Open the SmartPillDispenser.ino and make the necessary changes within it, these are marked with an arrow <---

The comments will let you know what each change does. After making the necessary changes you can upload the code to the esp8266.

Please follow the instructions in the comments of the code to properly connect the esp8266 to your laptop :)

Step 4: Telegram Bot

Setting up a bot in telegram for our use is very simple. (in depth tutorial with extra info here: https://core.telegram.org/bots )

In short you can use "father bot", https://t.me/botfather , to create you own bot. Get your chat id by messaging here: https://t.me/botfather , and writing /myid , plug this ID into the SmartPillBotConversation module within the nod-red code.

Chat id getter created by Iotwithus.com (THANKS!) -more info about bots and node red here: https://t.me/botfather Thats it! now set up the hardware and you are good to go! note that we made a debug mode within the GUI to help with testing while aligning the servos and the holes :)

Step 5: Connect the Wires

Build the circlets as shown in the diagram.

If you are unsure you may reference the Arduino code.

~ We had power issues due to the multiple servos on the 1 WeMos, so we added the Arduino Uno as a power source of one of the large servos, this resolved our issues.

Step 6: Customize the Tube

    1. Verify that the pill can go through the tube.
    2. Measure the servo height and mark the tube at that height (with a little extra space) - let's call that point A.
    3. Measure the size of the pill, and mark it's size on the tube from point A - let's call the new mark point B.
    4. Cut the tube across half way in point A. Make sure that you don't cut all the way through!
    5. 180 degrees from point A, cut the tube across half way in point B. Make sure that you don't cut all the way through!
    6. At the end point it should look like picture.
    7. Repeat steps 1-6 with the second tube.

    Step 7: Separator

    1. Take the thin plastic and cut it into 4 D shapes around the servo's diameter.
    2. Glue each D to the servo.
    3. Make sure that the separator can go in and out the tube cuts you made without any problem.

    Step 8: Place, Cut and Glue

    1. Place the 4 servos in the corners of the top of the drawer.
    2. Place the each of the tubes in the middle between two servos
    3. Mark around the tube and cut the drawer.
    4. Cut the drawer top based on the marks you made.
    5. Stop when you can see that the tube can go through the hole.
    6. Place the servos again and make sure that the cuts you made on the tube are exactly where the servo can go through.
    7. Glue the tube in the exact height that you managed to put the servo in.
    8. Glue the servos to the correct place.

    Step 9: Reed Switch

    1. Make sure that the reed switch is capable of receiving input through the drawer.
    2. Glue the wireless part of the reed switch into the back corner of the drawer.
    3. Glue the wired part of the reed switch into the back of the drawer in the exact same corner.

    Step 10: YOU ARE DONE!

    Congratulations!

    You can now sleep soundly knowing your loved ones are properly taking their medication on time!

    We hope you enjoyed the building process and would love to hear if you implemented any of your own features :)

    Arduino Contest 2020

    Participated in the
    Arduino Contest 2020