Introduction: Automatic Food- and Water Dispenser for Your Pet

About: Student MCT at Howest in Kortrijk, Belgium

If you love and want to take care of your pet as much as I do, you've come to the right place. I will show you how to build an automatic feeder for food and water controlled on Raspberry Pi, using some sensors and motors. There is also a website where you can set the time and quantity when and how many food must be given. You can also control when your pet ate and drank the last time. You can see also how much food and water is currently in the bowl.

Step 1: Materials

Microcontroller

  • 1x Raspberry Pi 4

Sensors

  • 2x Distance measuring sensors
  • 2x Force sensing resistors
  • 1x Water level sensor

Actuators

  • 1x Stepper motor 5V
  • 1x DC motor (water pump) 12V
  • 1x LCD Display

Others

  • 2x Button
  • 3x 470Ohm Resistor
  • 4x 10K Ohm Resistor
  • 1x Transistor TIP120
  • 1x MCP3008
  • 1x Breadboard power supply 3.3V-5V
  • 1x 12V power supply

In the attached document can you find where I bought all the materials.

Attachments

Step 2: Building a Circuit

I made two fritzing circuits to show you how all electronics components should be connected. I used a Raspberry Pi and connected Stepper motor, Water pump, LCD Display, two Force sensing resistors, two Distance measuring sensors, a water level sensor and two buttons.

Step 3: Creating a Database

If you want to be able to control when your pet ate and drank the last time, to change the feeding and drinking times and to control of how much water and food is currently in the bowl, you have to make a Database. My DB has four different tables.

Device

This table contains all information about the sensors and actuators.

ID, Name, Description, Type (Sensor or Actuator), Price and Measuring unit.

History

This one we will use the most often. We will save all data in this table. For example if you start the motor, the date and time when you started him will be saved.

The rows of this table are:

Reference number, DeviceID, ActionID, Action date, Value and comment.

Action

In this table we will collect all the action informations.

ActionID, Description

Feeding schedule

In the table Feeding schedule we will be able to save the hours of serving the food and water.

Reference number, Day, Hour, Quantity, ActionID

You can find my database-export in my GitHub Repository.

Step 4: Backend

It's impossible to make a project without any backend.

All you need for this stap can you find in my GitHub Repository under Backend.

helpers

In this folder you will find three different classes: Class LCD, Class MCP and Class stepper motor.

If you want to make a good working project, the use of this classes will be necessary.

repositories

In the repositories folder you will find two python files:

  • Database.py
  • DataRepository.py

You'll need this two to read and update the data.

app.py

This is the main backend code of Pawbie project. It combines all together.

config.py

This file has the configuration to connect to the Database.

Step 5: Frontend

This is my favorite part of my project. First, I made a design of how my website should look like. I used Adobe xd to do this. Before starting the design, I chose some colors I wanted to use. Always try to keep it simple as possible. Don't use too much colors.

Everything you need to make a frontend you'll find in my GitHub Repository under Frontend.

Step 6: Case

Now that everything is programmed, it's time to make a case. To make mine, I used 3D printing techniques. First, I made a sketches, then I made it on the computer. It took about 75 hours to print the entire case. As you can see on the picture, in the tank for food I decided to make a screw to transport food to the bowl. In the second tank, for water, I made 2 holes. One for my water sensor- to check the level of the water and the second one for silicone hose to transport water to the bowl. Don't forget to make holes for buttons, LCD display and Distance measuring sensors!

Step 7: Finish

If you want to do this project, please share it in the comment.

If you have any questions or you need help with something, you can always message me!

Thanks for reading.