Introduction: Automatic Pill Dispenser : Project by Arjan West
Hi, in this instructable i will help you make a pill case that lets the user know when they have to take a pill and what pill they have to take. This case will come with a piezzobuzzer that alerts the person when it is time to take a pill and 12 leds that are placed in 12 slots that can all hold a different pill. The pill case will be connected to a raspberry pi. The raspberry pi will host a website which is connected to a database. Here you can setup which pills you want to put in the box and when you have to take them.
Link to a list of the required materials : https://files.fm/u/prntggsh .
Step 1: Making 12 Seperable Slots ( Original Box Has 7 )
First lets begin by making our box have 12 equal slots to put the pills in. This is easily accomplished by filling in the gaps with a piece of carton or plastic. Cut out 5 pieces of carton / plastic and make them 4.3cm in length and 2.5cm in height. Now to put them in place we put glue on the 3 sides and put it in its slot. Now we let it dry for a few minutes ( depending on what glue you used ) and we are ready to go to the next step.
Step 2: Make 12 Holes in the Slots for a Led to Come Through
Now we have to make 12 seperate holes in the top right corner of each slot so the leds can come through it.
This can be done with any drill u have at home.The holes that I drilled were 2mm. Try to drill the hole as much in the upper right corner as you can. If you have done this we are ready to go to the next step!
Step 3: Solder 12 Leds With a Resistor of 220 Ohm on Each Led and 2 Wires Attached to the + and -
This part is tedious but it has to be done. Solder a resistor on the led and a wire to it for each led, the - side can be connected with the female part of a wire. If this step is done we will put the top of the led in a straw and glue it so just the top of the led is visible in the straw.
Step 4: Putting the Straws With the Leds in In the 12 Slots
Now we put all the straws with the leds in in each slot. This is easily done by inserting the wires first into the hole and then pulling them from beneath the box. If every straw is in the box u can glue the bottom part of the box where the wires come out so they stick in their place.
Step 5: Inserting the Wires Into the Breadboard to Connect Them to the Raspberry Pi
Now all u have to do is connect each led with the raspberry pi which is connected through a cobbler on the breadboard. The pins i used for each led are : Led1 = 26, Led2 = 19, Led3 = 13, Led4 = 6, Led5 = 16, Led6 = 12 Led7 = 17, Led8 = 27, Led9 = 20, Led10 = 25, Led11 = 24, Led12 = 23 ,Piezzobuzzer = 21, drukknop = 18.
The drukknop is a simple pull up button, the piezzobuzzer will make the sound of the alarm. Make sure to connect everything to a GND so there aren't any issues! Once this is done you can secure your wires by glueing them on the breadboard. This will make it so they are all secured and they won't come loose easily.
Step 6: A Bigger Box to Put Under the Pill Case
Now we need to have a bigger box than the pill case itself to put under it. This can be from plastic or carton or any material as long as it's strong enough to hold the pill case. Make a hole in the bigger box that is just a bit smaller than the pill case so the breadboard can fit through it but the pill case is still bigger than the hole. If you have done this you can secure the breadboard to the bottom of the box. Make 2 holes for the pull up button to come through and for the piezzobuzzer to come through. Once this is done we will need a small hole for the cobbler cable to come through. After this is done you can glue the pillcase to the top of the box. Once this is done your project is as good as finished, now all that remains is the code!
Step 7: The Code
All code can be downloaded from here : https://github.com/ArjanWest/1NMCT2_West_Arjan_P1....
The query to make the database can be found here : https://pastebin.com/pcGfvS6e .