Pill Dispenser
I am a student at Howest Kortrijk, to show what we learned at the end of the year we had to make a project. I chose to make a pill dispenser where you can see when medication was taken. I came up with this idea because sometimes they dont know if they have already taken their medication.
You identify yourself with a rfid badge and the dispenser looks in the database wich medication should be taken.
You can set up a time when the dispenser will notify you its time to take the medication.
The project needed to have 3 sensors,
- Infra red sensor (detect the pill that drops)
- rfid scanner (identifies the person)
- potentiometer (is used for the contrast of the lcd, data is stored in volts in the database)
On the website you can see when the person took his medication for the last time, see all the times someone took medication, you can add a hour when you should take medication and you can delete a hour.
Supplies
I ordered most things online, the plexi was recycled but you can find those at a lot of DIY-companies
The total cost was around €193
for this project you need:
- Raspberry pi 4 model b
- mcp 3008
- pcf8574
- buzzer
- lcd display
- 4x stepper motor with drivers
- infra red sensor (emitter and receiver)
- potentiometer
- push button
- breadboard
- breadboard power supply
- corner profile
- plexi
- metal tube
- angle iron
- jumper wires
Fritzing Schema
Everything is connected to the pi but they get power from the breadboard power supply.
It may look a bit overwhelming but if you connect everything step by step it is not that bad.
Making a Database
Here you can see my ERD diagram.
it stores:
- the users, wich medication they should take and at what time
- the data of the sensors
- the state of the actuators.
Here is my sql dump with some test data
Building Setup and Programming
For this code to work you need:
- to turn on the spi bus on the raspberry pi
- install a library for the rfid sensor (sudo pip3 install mfrc522)
- install the spidev library (sudo pip3 install spidev)
Making Webstie
You can dispense someone his medication with the website, you can see when someone has taken medication and you can add/remove hours when a person has to take medication.
Building My Case
Once you have done the previous steps you can start making the case.
i chose to make my case in plexi
the pills are in the tubes and beneath the tubes there is a disc with a hole in it the size of the pill, when a pill needs to get dispensed the disc spins one round and the pill falls down into a cup.
the tubes are not fixed in place because some pills are thicker then others and now you can easily adjust them.