Introduction: The Automatic Pill Dispenser

We are first Master students Electro-mechanical engineering on the The Brussels Faculty of Engineering (in short "Bruface"). This is an initiative of two universities located in the centre of Brussels: the Université Libre de Bruxelles (ULB) and the Vrije Universiteit Brussel (VUB).

As part of the program we had to make a real working mechatronic system for the course Mechatronics.

In theoretical courses we learnt how different components should be combined into real applications. After that, we got an introduction about the basics of an Arduino microcontroller and how to control a mechatronics system. The aim of the course was to be able to design, produce and program mechatronic system.

This should all be done in group. Our group was an international team which consists out of two Chinese students, two Belgian students and one Cameroonian student.

First of all we want to express our thanks for the support of Albert De Beir and Professor Bram Vanderborght.

As a group we decided to tackle a social relevant problem. As the ageing population becomes a global issue, the workload of caregivers and nurses becomes too big. As people are getting older, they often have to take more medicines and vitamines. With an automatic pill dispenser it is possible for absent-minded elderly to cope with this task independently a bit longer. By this caregivers and nurses can have more time to spend on more depended patients.

Also it would be very handy for everyone who is a bit forgetful at times and doesn't remember to take his or her pills.

Thus the mechatronic system should deliver a solution which is reminds the user to take his or her pills and also dispenses the pills. We also prefer the automatic pill dispenser to be user-friendly in order to make it possible for everyone to use: regardless of their age!

Step 1: Materials

Casing:

  • Mdf: 4 mm thickness for the inner case
  • Mdf: 3 and 6 mm thickness for the outer case

Assembly

  • Bolts and nuts (M2 and M3)
  • Small ball bearing

Microcontroller:

Electronic parts

  • Blank circuit board [Order link]
  • Small Servo motor 9g [Order link]
  • Small DC-motor 5V [Order link]
  • Transistor: BC 237 (NPN bipolar transistor) [Order link]
  • Diode 1N4001 (Peak Inverse Voltage of 50V) [Order link]
  • Passive buzzer: Transducteur piezo
  • LCD1602
  • Resistors:
    • 1 x 270 ohm
    • 1 x 330 ohm
    • 1 x 470 ohm
    • 5 x 10k ohm
  • Infrared emitter
  • Infrared detector

Step 2: Inner Case

The inner case can be seen as the box that contains all inner mechanics and electronics. It consists of 5 plates of 4mm MDF that are laser cut into the right shapes. There is also an optional sixth plate one can add. This optional sixth piece has a square shape and can used as a lid. The 5 plates (the bottom and the four sides) are designed in a puzzle shape so that they fit perfectly within each other. Their assembly can be reinforced using screws. The planes already have the holes where the other parts should fit in or where the bolts should be placed.

Step 3: Inner Mechanism

THE DISPENSING MECHANISM

  • Mechanism

Our pill dispensing mechanism is as follows: the user puts the pills in the storage compartment in the top of the box. As the bottom plate of that compartment is slanted, the pills will automatically slide down into the first tube, where they stack up. Under this tube is a cylinder with a small hole in where just one pill fits perfectly in. This small hole is located right underneath the tube so that the pills stack up above it, while the first pill lays in the hole of the cylinder. When a pill has to be taken, the cylinder (with a pill in) rotates 120 degrees so that the pill in the cylinder falls down into a second cylinder. This second cylinder is where a sensor is located that detects if a pill has actually fallen down from the cylinder. This serves as feedback system. This tube has one side that sticks out higher than the other one. This is because this side prevents the pill from falling over the second tube, and thus helps guarantee that the pill will drop into the tube and will be detected by the sensor. Underneath this tube is located a small slide such that the dropping pill will slide trough the hole in the front of the inner box.

This whole mechanism needs several parts:

  • Laser cut parts
    1. The bottom slanted plate of the storage compartment.
    2. The side slanted plates of the storage compartment
  • 3D printed parts
    1. The upper tube
    2. The cylinder
    3. The axis
    4. The lower tube ( see the lower tube and sensor compartment)
    5. The slide
  • Other parts
    1. Roll Bearing

All files of our parts that are needed to laser cut or 3D print can be found below.

  • Different parts and their assembly

THE STORAGE COMPARTMENT PLATES

The storage compartment consists of three plates that laser cut. These plates can be assembled and connected to each other and the inner box because they have some holes and small pieces standing out. This is so that they all fit in each other like a puzzle! The holes and standing out pieces are already added to the CAD files one can use the laser cut it.

UPPER TUBE

The upper tube is only connected to one side of the inner box. It is connected with the help of a plate that is attached to it (it is included in the CAD drawing for the 3D printing).

CYLINDER & ROLL BEARING

The cylinder is connected to 2 sides of the box. On one side, it is connected to the servo motor that induces the rotating motion when a pill has to drop. On the other side, it

THE LOWER TUBE AND SENSOR COMPARTMENT

Sensing is an important action when it comes to pill dispensing. We must be able to get a confirmation that an allocated pill has been taken by patient at an appropriate time. To get this functionality, it important to considered the various design steps.

  • Choosing the correct detecting components:

From on set when the project was validated, we had to search for and appropriate component that will confirm the passage of a pill from the box. Knowing sensors can be of use for this action, the main challenge was to know the type that will be compatible with the design. The first component we found was a photointeruptor composing of an IR emitter and IR phototransistor diode. The 25/64’’ slot PCB HS 810 photointeruptor was a solution due to its compatibility making us to avoid the possible problem of angle configuration. We decided not to use this due to it geometry, it will be difficult to incorporate with the nozzle. From some related project we saw that it’s possible to use an IR emitter with an IR detector with fewer other components as a sensor. These IR components could be found in various shapes.

  • 3D printing of the pill nozzle that holes the sensor

Being able to sort out the main component to be used as sensor, it was then time to check on how they will be place on the nozzle. The nozzle has an inner diameter of 10mm for the free passage of pill from the rotating cylinder. By the data sheet of the sensing elements, we realized that introducing holes around the nozzle surface corresponding to the dimension of the component will be an added advantage. Should these holes be place at any point along the surface? no because to achieve maximum detection the angularity needs to be evaluated. We printed a prototype based on the specifications above and did check for detectability.

  • Evaluating the possible beam angle and detection angle

From the data sheet of the sensor components, the beam and detection angle are 20 degrees, this means that both the emitting light and detector have a wide span of 20 degrees. Though these are manufactures specification, it’s still important to test and confirm. This was done by simply playing with the components introducing a DC source alongside an LED. The conclusion reached was to place them opposite to each other.

  • Assembly

The 3D print design of the tube has a plate connected to it with 4 holes. These holes are used to connect the tube to the inner case by using bolts.

Step 4: Electronics Inner Mechanism

  • Dispensing mechanism:

The dispensing mechanism is achieved by using a small servomotor for the rotation of the big cylinder.

The drive pin for the 'Reely Micro-servo 9g' servo motor is connected directly to the microcontroller. The microcontroller Arduino Uno easily can be used for the control of the servo motor. This because of the existence of the built-in library for servo motor actions. For example with the 'write'-command, the desired angles of 0° and 120°can be reached. (This is done in the project-code with 'servo.write(0)' and 'servo.write(120)').

  • Vibrator:

Small brushless DC motor with unbalance

This unbalance is achieved with piece of plastic which connects the motor axis with small bolt and nut.

The motor is driven by a small transistor, this is done because the digital pin can not deliver higher currents than 40.0 mA. By providing the current from the Vin pin of the Arduino Uno microcontroller, one can reach currents up to 200.0 mA. This is enough to power the small DC-motor.

When the motor powering is abruptly stopped, you get a current peak due to the self inductance of the motor. So a diode is placed over the motor connections in order to prevent this back flows of the current which can damage the microcontroller.

  • sensor system:

Using an infrared emitter diode(LTE-4208) and an infrared detector diode (LTR-320 8) connected to Arduino Uno microcontroller to confirm the passage of a pill. Once a pill fall down, it would shade the light of infrared emitter diode in a short time. Using an analogpin of the arduino we would get this information.

for detection:

analogRead(A0)

Step 5: Outer Case

  • Size:200 x 110 x 210 mm
  • Material:medium density fiberboard
    • Thickness of sheet: 3 mm 6 mm
  • Processing method:laser cutting

For the outer case, we used different kinds of thicknesses because of errors of the laser cutting. We choose the 3 mm and 6 mm to make sure all sheets can be combined tightly.

For size, considering the space for the inner case and electronic devices, the width and height of the outer case is litter bigger than the inner one. The length is much longer to allow space for the electronic devices. Moreover, in order to make sure the pills can drop out of the box easily, we kept the inner and outer case very close.

Step 6: Outer Electronics

For external electronics, we had to let our robot interact with people. To achieve this, we chose a LCD, a buzzer, a LED and 5 buttons as our components. This part of the pill dispenser functions as an alarm clock. If it is not the right time to take pills, the LCD wil just display the time and date. When the patient has to take a pill, the LED will light up, the buzzer will play music and the LCD will show “I wish you health and happiness”. We can also use the bottom of the screen to change the time or date.

  • Enable LCD

We used the LCD-1602 to connect directly to the microcontroller and used the function: LiquidCrystal lcd to enable the LCD.

  • Buzzer

We chose a passive buzzer which can play sounds of different frequencies.

In order for the buzzer to play the songs "City of the Sky" and "Happy Acura", we defined four arrays. Two of which are named "tune", which store the note information of the two songs.The two others arrays were named "Duration". Those arrays store the rhythm.

We then build a loop that plays music, which you can see in the source code.

  • Timing

We wrote a series of functions for the second, minute, hour, date, month, week and year.

We used the function: millis() to calculate the time.

Using three buttons, 'select', 'plus' and 'minus', the time can be changed.

As we all know, if we want to control some component we need to use the pins of arduino.

The pins we used were the following:

LCD: Pin 8, 13, 9, 4, 5, 6, 7

Bruzzer: Pin 10

Servo motor: Pin 11

Motor for vibration: Pin12

Sensor: A0

Button1(s): A1

Button2(plus): A2

Button3(minus):A3

Button4 (take the pills): A4

LED: A5

Step 7: Total Assembly

At last, we get the total assembly like the picture shown above. We used glue in some places to make sure it is tight enough. At some places on the inside of the machine we also used tape and screws to make it strong enough. The .STEP file of our CAD drawings can be found at the bottom of this step.

Step 8: Uploading the Code

Step 9: Epilogue

The machine is able to warn the user to take the medicine and delivers the right amount of pills. However after a discussion with a qualified and experienced pharmacist there are some remarks to make. A first problem is the contamination of the pills which are exposed during long time to the air in the container, hence the quality and efficacy will decrease. Normally pills should be contained in a well closed in an aluminium tablet. Also when the user dispenses during a certain time pill A and afterwards needs to dispense pill B, it is quite complex to clean the machine in order to ensure that there are no particles of pill A contaminating pill B.

These observations are give a critical look at the solution that this machine delivers. So more research is needed to counter these shortcomings...

Step 10: References

[1] https://learn.adafruit.com/adafruit-arduino-lesson...

[2 ] Wei-Chih Wang. Optical Detectors. Department of Power Mechanical Engineering, National Tsing Hua university.