Americans are taking more prescribed medications than ever before. As a result, we see a series of issues related to properly taking medication. Failing to take medication properly leads to losses of $289 billion in the American healthcare industry and 10% of US hospitalizations. Additionally, senior citizens and people with motor impairments have difficulty opening pill bottles. This instructable gives instructions to fabricate a functional automated pill dispenser with the ability to dispense medication at scheduled times every day. This device can help combat our national problem with prescribed medication.
The user inputs time values for when the first pill needs to be released and how often a pill must be released. When those times are reached, the motor located inside the funnel rotates a top disk, which catches a pill and guides it to a hole in a second bottom disk, causing the pill to fall into a tray area below.
Step 1: Materials
To complete this project, you will need a NodeMCU, a micro USB adapter, acrylic cement, a DC dual-shaft motor, 24-gauge solid copper wire, 24-gauge stranded copper wire, a buzzer, a breadboard, a motor driver, heat shrink tubing, a .25-in acrylic sheet, a .125-in acrylic sheet, a .1-in acrylic sheet, a hot glue gun, hot glue, a drill, and PMA filament. Links to these items with technical specifications are provided below. You will also need access to a laser cutter, soldering materials, a heat gun, and an Ultimaker 2+ 3D printer. The software requirements are Cura software for Ultimaker (for 3D printing), Adobe Illustrator, a platform to run a Python code (we recommend Visual Studio), ampy, and a COM driver (Windows users only). A command to install ampy and a link to install the driver are listed with the materials below.
Micro USB adapter: https://www.digikey.com/product-detail/en/stewart...
Acrylic cement: https://www.amazon.com/Weldon-Applicator-Bottle-P...
DC Dual-shaft motor: https://www.amazon.com/gp/product/B07DQGX369/ref=...
24-gauge solid copper wire: https://www.digikey.com/products/en?keywords=ksw2...
24-gauge stranded copper wire: https://www.amazon.com/BNTECHGO-Silicone-Flexible...
Motor driver: https://toshiba.semicon-storage.com/us/product/li...
Heat shrink tubing: https://www.digikey.com/product-detail/en/alpha-w...
.25-in acrylic sheet: https://www.interstateplastics.com/Hdpe-Black-She...
.125-in acrylic sheet: https://www.acmeplastics.com/hot-deals/18-x-24-x-... .1-in acrylic sheet: https://www.acmeplastics.com/hot-deals/18-x-24-x-...
Hot glue gun and glue: https://www.amazon.com/FLY5D-Sticky-Sticks-Sealin...
PMA filament: https://www.amazon.com/HATCHBOX-3D-Filament-Dimen...
ampy: In terminal, input the following command: pip2 install adafruit-ampy
Step 2: Circuitry Design and Creation
The circuit creation requires the NodeMCU, solid and stranded copper wire, the motor, the motor driver, and the buzzer. Insert the NodeMCU into the breadboard so it is centered on a short edge of the board. Make sure the UART port is facing the outside of the board. Solder the NodeMCU into the board. Then insert the motor driver so it is centered on the other side of the NodeMCU. Solder the driver. Use 24-gauge solid wire to make connections such that the PWMA pin on the driver connects to the D5 pin on the NodeMCU, Vm on the driver connects to Vin on the NodeMCU, the ground and AIN2 driver pins are connected to GND on the NodeMCU, and the AIN1, VCC, and STBY driver pins to the 3.3V NodeMCU pin. Insert the buzzer into the breadboard past the motor driver so that its pins are in two separate lines of the board. Connect the positive end of the buzzer to the D4 pin on the NodeMCU and the negative end to a GND NodeMCU pin. Solder all wires into place. Use the schematic and picture above for guidance.
Solder two 6-in pieces of stranded wire to the small loops on the motor. Cut two small pieces of heat shrink tubing approximately a quarter inch in length. String one piece of tubing through each of the two wires until the tubing covers the joint between the metal loops and the wires. Apply heat to the tubing using a heat gun for 20 seconds, or until the tubing shrinks snugly around the wires.
Step 3: Laser Cutting
The attached files contain the models for the top and bottom disks and the chassis parts. Laser cut the bottom disk on a 0.1-in acrylic sheet, the top disk on a 0.125-in acrylic sheet, and the chassis parts on a .25-in acrylic sheet. Be sure to calibrate the laser so that it can completely cut through the acrylic and convert files to the format required for your laser cutter.
Step 4: 3D Printing Design and Fabrication
Download the attached files and prepare the 3D printer. Be sure to use a printer with a .8 mm nozzle. Print the designs and cut out all the supports. Your prints should look just like the attached picture.
Step 5: Assembly of Funnel
Apply hot glue to adhere the motor onto the inner funnel ledge within the circular motor housing. Be sure the white shaft on the motor is centered in the housing.The wired end should just barely stick into the funnel's square hole.
Place the bottom disk onto the motor so that its oval hole is not over the motor. Preferably, the hole should be positioned to the right of the motor, as shown in the image above. Use acrylic cement to secure the disk to the side of the circular housing and motor. The disk should not be able to move. Finally, use cement to adhere the cone piece to the bottom of the circular motor housing.
Step 6: Beginning Assembly of Chassis
There are six laser-cut parts that make up the chassis: a 8.25-in long rectangle, a 7-in long rectangle, a 4-in long rectangle, a rectangle with a square hole cut in it, and two "L"-shaped side pieces. Lay the 8.25-in rectangle flat. Set one L-piece against the edge of the 8.25-in rectangle such that the pointed triangular end is lined up with the short end of the rectangle and pointing upward, as shown in the picture above. Adhere the two pieces together using acrylic glue. Repeat this on the other side of the rectangle with the second L-piece.
Insert the 4-in rectangle lengthwise on top of the 8.25-in rectangle and between the ends of the two L-pieces such that the 1-in width is pointing upward. Secure this small rectangle in place with acrylic glue. Refer to the image above for guidance. This forms the tray portion of the chassis.
Take the 7-in long rectangle and use a drill with a bit approximately a quarter inch in diameter to drill a small hole (wide enough to accommodate the micro USB adapter wire) at the top center of one of the short ends of the rectangle. Slide the 7-in rectangle between the triangular ends of the L-pieces. The 7-in rectangle should come all the way down and not rest on top of the 8.25-in rectangle below. The drilled hole should face upwards. Secure this piece with acrylic glue.
Reinforce adhesion joints with hot glue as desired.
Step 7: Finish Chassis/Funnel Combined Assembly
The final assembly steps combine the electronics, funnel, and chassis together. First, string the motor wires through the funnel hole and the corresponding square hole in the remaining rectangular piece. Then solder the ends of the wires to the A01 and A02 pins of the motor driver on the breadboard.
Use hot glue to attach the breadboard upright on the inside wall of the chassis. Be sure the micro USB port of the NodeMCU is facing upward. Insert the micro USB adapter into the NodeMCU and align the wire with the drilled hole at the back of the chassis. Once the glue has dried, rest the remaining rectangular piece against the sloped edges of the "L"-shaped pieces. Adhere this piece into place using acrylic glue and reinforce with hot glue as needed. Make sure the micro USB adapter wire remains threaded through the drilled hole during this process.
After this rectangular piece has been secured, thread the rest of the motor's wire through the two square holes until all of the wire is inside the chassis. As a result of this, the funnel and chassis should be brought together. Have a partner hole the funnel in place so that the square holes of the funnel and chassis are aligned. The flat portion of the funnel should rest against the chassis, putting the funnel at an angle. Glue the flat portion of the funnel to the chassis.
Step 8: Code
Below is a Github link to the code for the pill dispenser:
Open the code in Visual Studio (or your preferred software). Be sure you have ampy installed. Windows users should also have a COM driver downloaded. In line 23, input the number of hours the machine should wait until releasing the first pill. In line 24, input the time interval in hours that a pill must be taken after. The default values for both of these variables are 10. In line 25, specify the number of pills in your box. The default value for this is 20. Save the code. Connect the USB end of the adapter to your computer. Open a terminal and run one of the following sets of commands, depending on your computer type. Make sure you are in the correct directory.
ampy -p /dev/tty.SLAB_USBtoUART put pill dispenser.py
ampy -p /dev/tty.SLAB_USBtoUART run pill dispenser.py
ampy -p COM3 -d 0.5 put pilldispenser.py
ampy -p COM3 -d 0.5 run pilldispenser.py
You are now ready to use your Automated Pill Dispenser! We hope this device will help you remember to take your medication on time.