Introduction: How to Make an Automatic Pill Dispenser
This is my Automatic Pill Dispenser. I made this for a project in my school. The reason why I made it was because my boyfriend's grandmother has to take a lot of pills, and it's very difficult for her to know which one's she has to take at that time. So I made a pill dispenser that gives you the correct pill on the correct time.
We also had to make a website for this course. Here is the link to the website: http://femkeneirinck.be/portfolio/
Step 1: The Components You Need:
Here's a list of the components you will need:
- Raspberry Pi 3 model B+
- 16GB micro SD
- Raspberry Pi supply 5,1V/2,5A
- Green LED
- Blue LED
- LCD Display with I2C
- Touch sensor
- Steppermotor with driver (ULN2003A)
- Resistor 10K Ohms 5%
- 2 x resistor 470 Ohms 5%
For the housing I used:
- A glue gun
But you can also make the housing like you want it.
Step 2: Connecting Your Raspberry Pi to Your Wi-Fi
If you are connected to your Pi you can set your Wi-Fi with the following steps.
- Go to Network Options.
- Go to Wi-Fi.
- Enter your SSID (name of your network).
- Enter your password.
Now you should have access to your Wi-Fi and can update your Pi with the following code.
sudo apt update
sudo apt upgrade -y
This ensures that your Pi is up to date.
Step 3: Hardware
Now that your Pi is completely ready you can start setting up the circuit.
We had to make a scheme with the parts and an electric scheme of our project before we really started.
In the beginning my scheme was a little different but this is the result. When you're done with drawing your scheme you can start and build your circuit. If you want you can download the scheme's here.
Step 4: SQL-database
Time to create a database. Open your MariaDB environment on your Pi with the code below.
First you create a user with:
CREATE USER 'mct'@'%' IDENTIFIED BY 'mct';
Then you make sure he has all the privileges:
GRANT ALL PRIVILEGES ON *.* TO 'mct'@'%' WITH GRAND OPTION;
Last but not least, you flush everything:
Now restart the service:
sudo service mysql restart
Open MySQL Workbench. Make a new connection. For more details see picture.
Now open import, import the file and execute the code.
Step 5: The Website
To put a web server on your Pi, add the following code to your Pi:
sudo apt-get install apache2 -y
To gain access as a dp-user:
sudo chown dp-user:root *
To access the folder and add files to it.
sudo chown dp-user:root /var/www/html
Open WinSCP. Create a new session and fill in the file as chown in the image.
Select your files and drag them to your var/www/html folder.
Step 6: The Housing
I made a couple of designs. My final design is in cardboard, which it wasn't supposed to be. Because I was in need of time, I had to make something easier and faster. And this is the result.
The Bottom Part
The bottom part is where the electronics need to be put in.
To make the bottom part:
- Cut out a circle with a diameter of 18cm.
- Then cut a rectangle with a height of 10cm and a length of 63cm.
- Cut some holes in the rectangle, because some of the components should come through the housing (As you can see in the pictures).
- And at least glue the rectangle as an edge to the circle (with a glue gun), so it becomes a box.
The disk is the part that is put on the Steppermotor. This is the part where the pills should go in and when you need one, the steppermotor will turn to the next compartment.
To make the disk:
- Cut out a circle with a diameter of 17cm.
- Cut out 8 little rectangles with a height of 2cm and a length of 8,5cm.
- Glue them on the circle in a shape of a star, so you get compartments. I used superglue to glue this in the circle.
- Then you need another rectangle with a height of 2cm and a length of 54cm. This is to make the edge around the circle so the pills won't fall of. To glue this together I used a glue gun.
- Then you need to make a little hole at the underside and in the middle of the circle, and put it on the Steppermotor.
This is the lid that comes over the whole box. There is a part cut out, so you can take your pill out of the box.
To make the lid:
- Cut out a circle with a diameter of 20cm.
- Then draw on the inside lines to make even pieces. Cut one of those pieces, but leave an edge so you can't look inside the box and just take the pill.
- Then cut out a rectangle with a length of 64cm and a height of 4cm. This is the part you need to glue on the circle, use a glue gun to glue it together.