My project is an automatic pet feeder. It uses an arduino and a rapsberry pi. The arduino powers a load cell, which is connected to a HX711 board. The raspberry pi hosts the webserver, database server and executes the biggest part of code.
It uses a 3d printed screw to make sure no food is stuck in the pipe, and we can give a quantity of food.
On the website you have the possibility to set your pet's name and his weight. After entering its weight the program will calculate how many calories your pet needs to be healthy. If you don't enter any weight the standard portions are used.
On the website you can see when your pet will be fed and how much calories his meal will contain. You can also view a chart with the amount of calories consumed from the last 5 days.
The total cost to create this project is around 155 euros, not including the wooden casing
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials Needed
- continuous servo motor
- jumper wires
- 1 k resistor
- pi cobbler
- load cell 1kg
- HX711 board
- arduino uno
- raspberry pi
- 9V dc adapter
- 5V Power Supply Module for Bread Board Arduino Raspberry Pi
- USB cable
- break away headers (to solder on HX711 board)
3D printed parts:
- 3D printed screw(file is found at the end of this instructables)
- Wooden parts(size and amount at the end of this instructables)
At the end of this instructables file there is a BOM file with all the links to get the equipment to create this project.
Step 2: Placing the 3D Printed Screw in the PVC Tubes
I wanted to make sure I could edit how much food I wanted to give. The only way to do this was to use a screw in a PVC tube. No food could slip through and I could calculate how much food I gave.
I used a couple of PVC pieces to make it work.
First of all, I used a T-piece where my screw fits in. Above it is a straight PVC tube where the food falls through and gets in the T-piece. At last I wanted to make sure the food falls inside the container and not on my electronics so I used a bent piece of PVC to add to my T-piece. Now I'm sure no food will reach my electronics.
But how do we rotate the screw? This is where the continuous servo motor comes in. This drives the screw.
There is a catch when printing the screw, there is a base part and the screw itself. While printing they will be stuck together, but this won't be enough since the glue in between will dissolve when placing it in water. So you have to separate the pieces and glue them together yourself.
I screwed the servo to the auger base, making sure it would rotate without wobble.
Step 3: Hardware
In my setup I used an arduino UNO, raspberry pi, servo motor, HX711 board and a load sensor.
The first thing I did was setting up the load sensor with the arduino. With the load sensor there is a HX711 board which you have to use if you want this to work. It's a analog/digital converter. We need this so the arduino can understand what the load cell is sending.
There is another catch in the setup. The power to the servo will need to be provided by an external battery as powering the servo from the Pi itself is likely to cause it to crash as the Servo draws too much current as it starts to move.
At the end you can find the fritzing schemes which shows you how to connect everything together.
Step 4: Programming
To measure the weight which is still in the box we have to use a load cell. The one I used was a 1kg load cell so I could get a precise weight.
First of all you need to solder the wires of the load cell to the HX711 board. Make sure you use some sort of electronic resistant tape or heat shrink to avoid electronic interference.
When you use a load cell you need to first calibrate it. This means you have to place no weight on the load cell, reset it to 0 and then use weights to get the right weight. (The code for the calibration will be uploaded at the end of the file)
After that, the load cell measures right and you can use a plank on top of it to catch the food and measure it. (That program will be at the end of the file as well)
When you use a plank on top of your load cell you have to reduce the weight given by the weight of the plank itself so your measurement of weight is accurate.
When your load cell works and the code is uploaded we have to create a serial connection between the arduino and the raspberry pi. The arduino serial communication part is already programmed in the program file. With the rapsberry however I have an extra file which reads the weight and uploads it to the database server.
This is already a big part of our code but now the most important one comes.
The file servoMotorMetLibrary drives the screw and uploads the data to the database server. This file will run the whole time and will give portions 3 times a day depending on which weight you have set up in the browser.
Step 5: Create Database
On the raspberry pi we have to create a new database in which we will insert our tables. Because we want our application to be secure we can't use the root account. We have to create a new account which we will give privileges so we can read and write data to our database.
In the added file you can follow these steps to create the database, create your tables, make a user and connect your pycharm to your database.
There is a dump file as well, which includes all the tables already created. With filezilla you can transfer this file to your pi and import it in command line. With this method it will be a lot quicker to create all the tables correctly.
Step 6: Create Website
Create the website with following code, when all the files are downloaded, create a connection to the database. Don't forget to make another connection to the raspberry pi itself, so you can run your website on the pi.
When running this code you will need to surf to :8080.
Step 7: Casing
Sizes of panels:
- 9,6 x 1,6 x 5,8 (2x)
- 19,8 x 1,6 x 5,8
- 25 x 1,6 x 25
- 25 x 1,6 x 25
- 25 x 1,6 x 30,8 (2x)
- 12,4 x 1,6 x 32
If you want to make sure your screw is steady and won't move you can create a small platform inside the box.
This is what I did now my screw is steady and won't move.
- 10 x 1,6 x 5 (2x)
Platform itself(will be glued on top of support blocks)
- 12,4 x 1,6 x 21