Introduction: AUTOMATIC PILL DISPENSER

This is a pill dispenser robot able to provide the patient the correct amount and type of medicine pills. The dosing of the pill is performed automatically at the correct time of the day, preceded by an alarm. When empty, the machine is easily refilled by the user. The dispensing and refilling mechanism is controlled by means of an application connected via Bluetooth to the robot and by means of two buttons.

Bruface Mechatronics Project Group 2

Team members:
Federico ghezzi

Andrea Molino

Giulia Ietro

Mohammad Fakih

Mouhamad Lakkis

Step 1: Shopping List

  • Adafruit Motor Shield v2.3 (assembly kit) – Motor/Stepper/Servo Shield for Arduino
  • Kwmobile humidity temperature sensor
  • AZDelivery Carte for Arduino PCM2704 KY-006 Buzzer Passive
  • AZDelivery Real Time Clock,RTC DS3231 I2C, Rasperry Pi
  • 2. 28byj of 48 DC 5 V 4 Phase of fil de 5 Micro Step with ULN2003 module for Arduino
  • AZDelivery Prototypage Prototype Shield for Arduino UNO R3
  • AZDelivery PAQUET HD44780 LCD 1602, 2X16 characters + l'interface I2C
  • OfficeTree® 20 Mini magnets OfficeTree® 20 6x2 mm
  • SHAFT COUPLER POLOLU-1203 UNIVERSAL MOUNTIBG HUB
  • 40 Pins 30 cm Male To Female Jumper Wire
  • Solderless Breadboard – 830 Holes
  • USB 2.0 A – B M/M 1.80M
  • Pir Motion Sensor for Arduino
  • Set of AWG Breadboard Jumper Wires One Pin
  • R18-25b Push Switch 1p Off-(on)
  • L-793id LED 8mm Red Diffused 20mcd
  • L-793gd LED 8mm Green Diffused 20mcd
  • 2 x Poussoir Mtallique Carr+Avec Capuchon Bleu
  • Tactile switch 6x6mm
  • 2 charn 70x40 mm
  • greep plast wit 64 mm
  • knop aluminium 12 mm
  • ultragel 3gr
  • 50 nagels 2x35
  • LCD rgb backround light
  • 2 ball bearings 6.4 mm shaft
  • 2 full mdf sheet for laser cutting
  • 1 piece of plexiglass for laser cutting
  • 1 potentiometer
  • Arduino uno

Step 2: Technical Hints on the Choice of the Components

The mechanisms of dispensing and of refilling require great precision and little movements of the wheels that contain the pills. For this reason, we decide to use two stepper motors.

Stepper Motors are stables, can drive a wide range of frictional and inertial loads, don't need feedback. The motor is also a position trasducer: sensors of position and speed are not required. Moreover, they have excellent repeatability and return to the same location accurately.

A Motor Shield drives the two stepper motors. It contains 4 H-Bridge that allow to control both direction and speed of the motors. Using a motor shield, we increase the number of free pins.

To be sure that pills are always in good conditions, a Humidity and Temperature sensors measures costantly the temperature and humidity inside the dispenser.

To notify to the user that it is time to take his therapy we built an alarm with a Buzzer and a Real-Time Clock. The RTC module runs on a battery and can keep track of the time even if we reprogram the microcontroller or disconnect the main power.

Two Buttons and a RGB Liquid Crystal Display permit to the user to interact with the dispenser. The user can also set his therapy and the dispensing time through an App for smarphone. He can link his personal device via Bluetooth connection (a Bluetooth module is connected to Arduino).

A PIR sensor detects a movement if the user takes his medicine and gives a feedback of the correct work of the dispenser. Because of its great sensibility and its wide range of detection, it is intentionally obstacled in some directions to avoid useless measurements.


Step 3: Manufacturing Part

In the following, a detailed list of the parts which are produced either by 3D printer or by Laser cutter is provided. All dimensions and geometrical aspects are chosen in order to have a proper matching between all the parts with strong connections as well as a good looking design.

However, dimensions and geometrical aspect may be changed according to the different purposes. In the next sections it is possible to find the CAD of all the components listed here.

In particular, the initial idea for the project was creating a pill dispenser with more wheels so as to dispense the highest amount and the highest variety of pills. For the scope of the course, we limited our attention only to 2 of them, but with little modification on the design, more wheels can be added and reach the goal. That's why we let you the possibility to modify our design freely so that, in case you like it, you are able to change it and to adapt it to whatever personal taste.

Here is the list of all the 3d printed and laser cutted parts with the thickness in between parenthesis:

  • back plate (mdf 4 mm) x1
  • base plate (mdf 4 mm) x1
  • frontal plate (mdf 4 mm) x1
  • lateral plate_no hole (mdf 4 mm) x1
  • lateral plate_hole (mdf 4 mm) x1
  • arduino plate (mdf 4 mm) x1
  • plate for vertical sustain (mdf 4 mm) x1
  • connector plate (mdf 4 mm) x1
  • plate for the cap of the wheel (mdf 4 mm) x2
  • plate for the wheel (mdf 4 mm) x2
  • top plate (plexiglass 4 mm) x1
  • opening plate (mdf 4 mm) x1
  • bearing holder (3d printed) x2
  • cap wheel (3d printed) x2
  • funnel (3d printed) x1
  • funnel foot (3d printed) x2
  • PIR holder (3d printed) x1
  • plug for the wheel cap (3d printed) x2
  • wheel (3d printed) x2

Step 4: Technical Drawings for Laser Cutting

The assembly of the box is design in order to avoid the use of glue. This allow to realize a cleaner work and, if needed, disassembly can be done to fix some issues.

In particular, the assembly is performed by means of bolts and nuts. In a hole of a proper geometry, a bolt from one side, and a nut from the other side, perfectly fit in in order to have a strong connection between all the mdf plates. In particular for what regards the various plates:

  • The lateral plate has a hole positioned in order to let the cable passing through so as to have a connection between the Arduino and the computer.
  • The frontal plate has 2 apertures. The lowest one is intended to be used when the person has to take the glass where the pill has been dispensed. The other one is used when it’s time for refill. In this particular situation there is a plug (see later the design) that can close the aperture on the cap of the wheel from below. The positioning of this cap is indeed performed by exploiting this second aperture. Once the plug is positioned, using the buttons or the app, the person can let the wheel rotate one section at a time and place a pill in each section.
  • The sustain plate is positioned in order to have a vertical support for the rails where the wheel and the cap are positioned so as to have a more reliable and stiff structure.
  • The opening plate is designed as the word says in order to facilitate the refilling mechanism by the user
  • The top plate, as can be seen from the picture, is done in plexiglass in order to enable from outside the vision of what’s happening inside.

All the other plates have no special purposes, they are designed in order to enable all the parts to match perfectly together.Some parts can present particular holes with different dimension and geometry in order to let all the electronic stuff (like Arduino and motors) or the 3d printed stuff (like the funnel and the PIR holder) to be connected in a proper way.

Step 5: Step 5: CAD for the Laser Cutted Parts

Step 6: Technical Drawings for 3d Printing

The 3d printed parts are realized using the Ultimakers 2 and Prusa iMK printers available at the Fablab laboratory of the University. They are similar in the sense that they both use the same material which is the PLA (the one used for all our printed parts) and have same dimension of the nozzle. In particular the Prusa’s work with a thinner filament, are more user friendly thanks to the removable plate (no need to use the glue) and to the sensor that compensate for the non flat surface of the base plate.

All the 3d printed parts are realized leaving the standard settings unless for the wheel where an infill material density of 80% is used in order to have a more stiff shaft. In particular at first attempt, an infill material density of 20% was left as a standard setting without noticing the mistake. At the end of the print the wheel was perfectly realized but the shaft broke immediately. In order not to reprint back again the wheel, since it takes a quite long amount of time, we decided to go for a smarter solution. We decided just to reprint the shaft with a base that would be fixed to the wheel with 4 additional holes as it will be seen in the figures.

Here will follow a particular description of each component:

  • Bearing holder: this component is realized in order to hold and support the bearing in a proper position. The bearing holder indeed is realized with a centered hole with the exact dimension of the diameter of the bearing so as to have a very precise connection. The 2 wings are intended just to have a proper fixing of the component onto the plate. It has to be remarked that the bearing is used so as to sustain the shaft of the wheel that otherwise could bend.
  • Wheel: The 3d printed represent almost the core of our project. It is designed in a way to be as big as possible so to hold the maximum amount of pills but at the same time remaining light and easy to be driven by the motors. It has moreover designed with smooth edges all around so as not to have pills stucked. It has in particular 14 sections where is possible to allocate the pills. The central part, as well as the border in between each section, has been emptied in order to leave the wheel being as light as possible. Then there is a shaft of 6.4 mm of diameter and 30 mm long which can perfectly fit into the bearing on the other side. Finally a strong connection with the motor is achieved by a shaft coupler connected on one side with the wheel by the 4 holes that can be seen in the picture and on the other side with the stepper motor.
  • Wheel cap: The cap of the wheel is designed in a way such that the pills once inside the wheel cannot exit from it unless they reach the opened section on the bottom of the wheel. Moreover, the cap can protect the wheel from the outer environment ensuring a proper storage. Its diameter is slightly larger then the wheel itself and has 2 main apertures. The one on the bottom is intended to release the pill while the one on the top is used for the refilling mechanism previously detailed. The main hole in the center is for letting the shaft of the wheel pass through and the remaining 6 holes are used for the connection with the plate and the bearing. Additionally, on the bottom side, 2 holes are present where 2 little magnets are placed. As detailed after, these will be intended to have a strong connection with the plug.
  • Funnel: The idea of the funnel, as can be clearly guessed, is to collect the pills falling from the wheel and to gather them in the glass on the bottom. In particular for its printing, it has been divided into 2 different step. There is the body of the funnel and then 2 feet that have been printed apart otherwise the printing would have implied too much supports. For the final assembly the 2 parts have to be glued together.
  • PIR holder: its function is to hold the PIR in a proper position. It has a squared hole in the wall so as to let the cables passing through and 2 arms to hold the PIR without a permanent joint.
  • Plug: this little component has been designed so as to facilitate the refilling mechanism. As previously mentioned, once it is time to refill, the bottom of the cap of the wheel should be closed by the plug, otherwise pills during the refill would fall down. To facilitate its connection with the cap 2 small holes and two magnets are present. In this way the link with the cap is strong and user friendly. It can be placed in position and removed with a very easy task.

Step 7: Step 7 : CAD for 3d Printed Parts

Step 8: Step 8: Final CAD Assembly

Step 9: Tests for Individual Components

Several individual tests have been performed before connecting all the electronics components together.In particular, the videos represent the tests for dispensing and refilling mechanism, for the button functioning, for the alarm for the leds testing.

Step 10: Final Assembly

The first part of the assemble has been devoted to the mounting of the structural part of the robot. On the base plate, the 2 lateral plates and the frontal plate have been set and the funnel was fixed. In the meanwhile, each wheel was linked to its stepper motor by means of the shaft coupler and then mounted with its cap. Afterwards, the wheel-cap system has been mounted directly on the robot. At this point the electronic components were set on the robot. Finally, the remaining plates were assembled to complete the project.

Step 11: Wiring Components to Arduino

Step 12: Program Flowchart

The following flow-chart shows the logic of the program we wrote, for one wheel.

Step 13: Programming

Step 14: Robot- Smartphone Application Connection

As already said, the communication with the robot is ensured by an smartphone application connected via a bluetooth module to the robot. The following images represent the functioning of the app. The first one represents the application's icon while the second and the third, deal with the manual dispensing mechanism and the setting time menu respectively. In the latter case, the dispensing mechanism is performed automatically at the time selected by the user.

This application was built on the Massachusetts Institute of Technology App Inventor (ai2.appinventor.mit.edu/?locale=en#6211792079552512) .

First Time Author

Participated in the
First Time Author