My name is Branco Bruyneel, I'm a student MCT at Howest Kortrijk. For my final assignment I had to make a project that would combine all the skills I have learned through out this school year. I decided to make a Smart Pet Feeder, so I don't have to worry about feeding my cat every often anymore.
The pet feeder will be controlled by a website hosted on the Raspberry Pi. The back end will be written in python with Flask as web framework. You can setup feeding schedules on the site that will be stored in a database so that your pet can enjoy his food at certain times without you being there.
- Raspberry Pi 3 model B
- Pi Camera V2
- 16x2 LCD
- 74HC595 Shiftregister
- Servo Motor or any other motor
- Load cell with HX711 sensor
- 3W 4Ohm Speaker
- MAX98357 I2S Class-D Mono Amp
- Wood & screws
- 3D printed wheel for the motor
Step 1: Step 1: Wiring It All Together.
First make sure every component works independantly before you wire them all together at once. I have provided a eletrical scheme how I wired my components.
Step 2: Step 2: Installing All the Requirement Tools on Your Pi.
Make sure u have a working linux distro on your Pi. I used the latest version of raspbian.
First make your distro is up to date before installing the packages.
sudo apt-get update sudo apt-get upgrade -y
Next enable your camera and I2C.
Use the down arrow to select 5 Interfacing Options
Arrow down to P1 Camera.
Select yes when it asks you to enable the Camera.
Do the same for I2C.
Also select yes if it asks about automatically loading the kernel module.
Use the right arrow to select the button.
Select yes when it asks to reboot.
Install these packages:
sudo apt-get install motion apache2 pip3 install flask flask-socketio flask-cors flask-mysql
Step 3: Step 3: Creating a Mariadb Database.
sudo apt-get install mysql-server
In this stage you can just say yes to everything except change to root password since you only just set it.
In MySQL Workbench I created an EER diagram that I used to reverse engineer my database. This is an easy and fast way to develop a small database.
Then I exported the database and made an connection to my Pi's mysql server and imported the database.
Step 4: Step 4: the Fun Part! Writing the Code...
I won't be explaining all my code step by step but to put it briefely I created classes for all the sensors that I stored in a models folder. Then I use the HWInterface class to speak with each sensor, so that I can use the HWInterface class in my flask app to communicate with all the attached hardware.
The source code can by found on my github.
Step 5: Step 5: Creating the Case
This can be a hassle if you make the funnel like I did in wood. I would recommend you if you are not expierenced with wood to go and buy a simple food dispenser. That will save you alot of time ;)
The case is just a simple box out of wood the only tricky part was the funnel that lead to the motor. As for the front panel I used a laser cut machine to get the precise holes as needed for my components.
I 3D printed the 5x5cm wheel that I attached on my motor. Then I hotglued it to a horn that came with the servo.
Once I had all my pieces ready I assembled them all together by first drilling the side pannels together. Then I made the funnel and placed my components inside the box.
After I tested if all the components still worked I drilled the box together.