Introduction: Smart Pet Feeder
Well, we all love our pet's, don't we.
But still we tent to forget them sometimes and that is something that we dont want.
Therefor in this insctuctalbe we will lear how to build your own smart pet feeder with a raspberry pi, a mysql database and a flask server.
Note: This instructable is a part of a semi-endproject at Howest Kortrijk (NMCT)
PS: I have dyslexia so it isn't easy to see grammer mistakes (even harden when it isn't your native language), if they do happen, sorry.
Step 1: Hardware and Tools Required
What we will need:
a raspberry pi and 8GB sd cart
5V/ 2A power supply
breadbord power supply + power supply
a sevo motor
a ultasonic distance module
some resistors (most 10k and 1k)5V
a load cell + amplifier
2 empty wine chests
2 dog bowls (look good at the type)
a empty box
some leftover wood
a piece of garding hose
bolts and nuts:
4: M5 * 100 mm
8: M5 nut
6: M4 * 40mm (or something similar)
6: M4 nut
25: M2 * 20mm
24: M2 * 20mm nut
some custom 3D printed parts (linked)
varnish + brush
a tiny saw
a saw (a tiny one will do the job but it's more work)
a pet that needs to be monitored
Step 2: Preparing the Pi, Installing Mysql
In order to store data we need to install a MySql server on your pi.
if you are readin this I suppose you already have raspian jessie installed, if not: click_here
Connect you pi to a monitor (or for the advced users a ssh client) and a ethernet cable from the pi to your pc
Log in (default loginname = root, pasword = raspberry)
Go to the terminal app and type the following rules:
sudo apt-get install mysql-server python-mysqldb
He will now asks to set a root pasword, remerber this!!!
mysql -uroot -p
You will be prompted to fill in your root pwd
CREATE USER 'petfeeder_sql'@'localhost' IDENTIFIED BY 'Tinfoil';
GRANT ALL PRIVILEGES ON *.* TO 'petfeeder_sql'@'localhost' WITH GRANT OPTION;
CREATE USER 'petfeeder_sql'@'%' IDENTIFIED BY 'Tinfoil';
GRANT ALL PRIVILEGES ON *.* TO 'petfeeder_sql'@'%' WITH GRANT OPTION;
After that type
and note the inet number that is next to the eth0 (see pic)
the terminal wil be closed
go back to your pc and install mysql workbench (link)
once this is done you will see the home page (pic)
click on the plus icon
and select tcp/ip over ssh (pic)
ssh hostname the ip you needed to note
ssh username: pi (if you haven't changed it)
ssh password: raspberry
if everything went ok you see an emtp field (pic)
download the attached file (petfeeder_create_db.sql)
open this by right click open with texteditor, then copy eveything and past it into the empy field you see.
click on the lightning icon
at the bottom of the sceen some messages will appear
Step 3: Make the Case
As you can see the case is made from 2 wine chests. One is layen down an the other one is staning on top.
It's important make all the measurements verry presicly. Otherwise it won't fit. (take a look at the pics to see all the measurements i made)
The flat chest
The flat chest houses the 2 bowls and the other chest. Measure the with of your bowl, subtract the border (add some kind of spacing to) and use this value to decide where your bowls needs to come. If you found the right place (I do recommend you to go as close as possible to the side) draw a square around it (yes a square, not a cirel). Use this square to find the center and prepare the dill holes (2 * M5) After this you can draw your circle.
At the top / side draw a rectaliag as big as the bottom of the other case. Draw in this some shapes to use for your wires, make sure that you also do this ath the bottom of the other case!
Standing chest: Draw at the sides the holes for the buzzer, and the 3D printed tube holder. At the top make a square big enough for the lcd, a hole for the flask and a hole for the arm, i do remmond you to use for his part all mine settings as the 3d are made for this.
These are the holes for the modules and should be the same.
Drawing done? Start Drilling
Drilling done? Start Sanding
Step 4: Assembly: Load Cell & Other Chest
Start with putting 2 M5 bolts though the holes you made.
Then connent the load cell to it.
After that use take the 3d printed adaptor and 2 M4 screws and mount them like in the picture.
Finnaly connenct the all of them together.
Doing this is harder then you think, always verify if evertyhing is straght and do chech with your bowl. One bowl shoud stay on this and 'floats" above the case.
If you followed the dimensions I used you can now put the chest on top of the other chest and use the 4 M4 screw to connect them
Step 5: Mount All the Sensors
Start with putting 2 screws at the lcd holes an screw a bit through the case.
Take the 3D printed overflow adaptor and screw that first. After his screw the other bolds and nuts (see pics for more and better info).
Take the "arm" and screw the ultrasonic and pir to it. Then connect some breadboard cables to the pins and put them through the hole at the top.
Buzzer + Led
Wire the buzzer and the led.
After this bring the cables down to the place where the pi is.
use the electrical tape for extra safety
Step 6: Make the Provision Box
Take your box and make a hole as big as the adatpor is. (you can sandpaper that if you want)
Chech if your hole is big enough: Yes = Make the holes for the servo. After that is done you can make the holes for the ldr's. Sipmy take a ruler: max lenght were food can come =100%, ... Do this for the 10%, 25%, 50%, 75 % After dat punch holes, put the ldr trough them and use some electral tape. You can solder the wires if you want.
Step 7: Wire Eveything:
Now that almost evey component is connected it's time to wire eveything!
Included is a breadbord schem how you need to do it.
I do reccomen you to use the same color.
(the load cell aplifier still needs to be conneted but he does not need a specific place)
Step 8: Download the Filles
download the filles from my github:
take your sd card out of the rbp
put the filles on it.
Then go back to the terminal and start them by the command:
python3 Website.py (for the website)
python3 Main.py (for the hardware)
when you now acces the ip of step 2 you wil see the website
wait and enjoy!!!