Introduction: Auto PetFeeder

Hi, my name is Gilian, I study at Howest Kortrijk Belgium and I’m a student MCT as a finale assignment I had to make a IOT-device.

I have a dog at home that get's fed 2 times a day at a specifiek time also the amount of food is precies so twice a day we weigh 56 grams of food and feed him. So i made a device that automates this proces and it's called PetFeeder. On the website you can add various schedules by choosing a time and specify the weight of food you want to dispence. If you don't want to wait to the next feeding time on the home page is a button that dispences the food immediately.

Step 1: Materials

Inside the case is a screw system that pushes the dry food into the bowl, i didn't design this myself because i found what i needed on thingiverse and was desinged by George Tsianakas. The design and download for what i used, you can find here.

Below is the list of parts that you further need for this project.

  • raspberry pi
  • micro sd card (minimum 8gb)
  • 20x4 lcd screen with i2c module on the back
  • rotary incoder + knob
  • srf-05 ultrasonic sensor
  • 1kg loadcell + hx711 amplifier
  • 12/5v power supply
  • nema 17 stepper motor + drv8825 stepperdriver
  • 2 resistors (2 kohm and 1 kohm)
  • 40 pin flatcable + cobler

Step 2: Wiring

Next step is to wire everything up on a breadboard and test if everything works. You can leave it this way but i decided to solder everything on a protoboard to make everything look beter and be less bulky and take up les space in the case later on.

Step 3: Database

This project makes uses of a database to store sensor data and all the feeding times and wieghts that go along with it. There are 3 tables:

  • Feeding where all the times and weights you put in on the website are saved.
  • History where the values of the ultrasonic sensor are stored along with date of recording
  • Sensors where al sensors are that are used in the project are saved along with an ID to now wich value is from what sensor in the History table.

Step 4: Code

First you will need to install apache2 to get your website to work, this you can do by the following command in the therminal of your pi.

  • sudo apt install apache2 -y

You shut also setup a wireless connection to your pi because after you put everything inside the case you wil not be able to plug in a ethernet cable easily.


You will also need to setup the MariaDB database so you can acces it.

After al this is done you can put al the frontend files in the following folder: /var/www/html

The backend code you just put it in the home folder.

It's also easier to make a service of the app.py so that when you pi boots the programs runs automaticly. To do this you just need to copie the service file (that is included in the zip file bellow) to the right folder with the following command:

  • sudo cp petfeeder.service /etc/systemd/system/ petfeeder.service

Step 5: Case

For the cas i designed it in Fusion 360 and exported the sketches to dxf files to lasercut at a local place i know. I designed it with finger joints so everything fits nicely together. After it was cut out i glued the pannels together exept for the back panel and mid panel where the lcd and ultrasonic sensor is placed to still have easy acces to everything must somthing be changed later on. Although they are not glued they stay nicely closed because of the finger joints.

That’s all I hope you enjoyed this project. - Gilian