Automatic Pet Feeder

Author: Calinovschi Teodor
ACES 2022
Project repository
Demo video

I. Short Description

This project aims to reduce the workload of a pet owner and to make it possible to leave the pet(s) alone while being cost effective. It is also suitable for multiple pets, as it lets only authorized ones to eat. Via Arduino's IoT Remote app or web site, the user can schedule feeding time, set the amount of food, see if there is enough stock of food, check if it is working fine or if it is stuck and register/remove pets on/from the feeder.

II. How to use and what it can do

First of all, its purpose is to feed a pet a specific amount at a specific moment. This is accomplished by entering the food quantity and the hour of feeding in the app, as in the image below.

 App

In addition, the app shows if there is enough food supply or not by checking at 1 hour intervals and sends an email and turns on the low food LED every time it detects not enough stock.

When feeding time comes, if the food gets stuck, first, the feeder tries to unlock itself and if it fails it signals in the app that it is not working well, turns on the error LED and sends an email. The working well monitor can also mean that the feeder is plugged in or not.

If the user wants to add a new pet, it can type “1” in the last field and after that get the RFIG tag close to the reader. If there are already two tags registered, a new addition would fail. If the user wants to remove a pet, it can type “2” in the last field and after that get that tag close to the reader.

From the pet's perspective, it has to come near the bowl and if it is registered the lid would open and if it is not registered the lid would close.

III. Hardware implementation

The main components (besides wiring) used in this project are as follows:

  • 1 x ESP32-WROOM-32D Espressif development board - It uses an ESP32 microcontroller which is very cost effective while delivering many features for IoT applications. This project uses it to communicate with the app via Wi-Fi and directly with the actuators and sensors (via 14 digital pins).
  • 1 x 28BYJ-48 Stepper motor + ULN2003 driver - A stepper motor is a brushless DC electric motor which operates with great accuracy. It is used to control a spinning wheel which delivers an exact amount of food when it's scheduled. It requires 5V supply and it is driven by 4 digital pins via the ULN driver.
  • 1 x SG90 Servo motor - As opposed to the stepper motor, it is very lightweight, cheap, user friendly and outputs sufficient power with the cost of precision. It is a perfect fit for moving the eating bowl's cover when a registered pet is identified. It requires 5V supply and only one digital pin for driving it.
  • 1 x RFID-RC522 module - It is a low cost, low power and compact RFID reader which communicates at 13.56mhz. It is used to distinguish pets one from another, first by registering them and then by reading their RFID tags. It requires 3V3 supply and 6 digital pins to communicate with the board.
  • 2 x IR sensor modules - An IR module consists of one receiver and one transmitter of infrared light. One module is used to check the stock of food from the container and the other is used at feeding time in order to validate proper functionality of the stepper motor. They require 3V3 supply and one digital pin to send whether they detected something or not.
  • 2 x LEDs - One is used to indicate if there is not enough supply and the other one is for signaling that food is stuck. They require no additional resistors as they can operate at 3V3 voltage.
Schematic

 Schematic

Because the 2 motors require a 5V power supply, they were connected to the Vin pin of the board (which outputs 5V). In order for them to have enough torque, the board should receive supply through the Vin pin.

IV. Software implementation

I used Arduino IDE, as Espressif ESP32-WROOM-32D board is compatible with it. The programming language is C/C++. Being an IoT project, it requires some over the internet communication. That being said, I used the Arduino Cloud IoT platform from where I can control and monitor the feeder.

Any Arduino compatible code consists of 2 main void functions:

  • The first one is the setup function, which executes once at startup. Here I have:
    • Define the properties required by Arduino Cloud.
    • Initialize the connection to the Wi-Fi and to the cloud.
    • Configure options for getting the current time.
    • Configure the mail services.
    • Initialize SPI communication for the RFID reader.
    • Set the stepper motor speed.
    • Set up PWM control for the servo motor.
  • The second function is called loop and as in its name, after it finishes executing it is triggered again, until reset or power off occurs. In this function resides the functionality, as follows:
    • Send/receive variables to/from Arduino IoT Cloud. This could also trigger the execution of another function which refers to adding or removing known RFID tags. There can be a maximum of two known tags at a time and if the user tries to enter the third one, it will not override the others.
    • Get local time
    • Check if feeding should happen now. If so, move the stepper motor in order to give food while checking with an IR sensor if the food actually goes into the bowl. If not, the motor tries to unlock itself and the IR sensor checks if it succeeded and if not, the stuck LED turns on, the variable for the platform meaning stuck is set and an email is sent to the owner.
    • The second IR sensor monitors if the food supply is enough and if the level of food is below the sensor's level, the LED for not enough food left turns on, the variable for not enough stock is set and an email is sent to the owner.
    • The RFID sensor performs a read and if it had something to read, it verifies if the tag is known and, if it known and the bowl is covered, it triggers the servo motor to lift up the covering. If the tag is not known and the bowl is open, it triggers the servo motor to close it.

The code flow is presented in the diagram below, from the feeder's perspective.

 Diagram



V. Packaging

I used AutoCAD to design the feeder, shown in the image below.

 AutoCAD design

Then, I 3D printed the parts and assembled them, the final product looking like in the image below.

 Real life

VI. Challenges, conclusion and further development

The biggest milestone was designing a proper food delivery system which would not get stuck so easy. At first, I did not know how to do 3D designs at all and until I got to the final one it took many iterations of designing, printing and testing.

All in all, the project turned out well, it is user friendly, robust and you cannot let your pet starving, at least without knowing.

Future improvements may include:

  • Adding more LEDs for knowing when the device is on (without looking in the app) and when the RFID tag limit is reached.
  • Improve design for covering circuitry.
  • Get a better RFID reader with greater range.
  • Offer a way to configure Wi-Fi and email address without reuploading the code.
  • Find another method for measuring how much food drops.

VII. References

iothings/proiecte/2021/automaticpetfeeder.txt · Last modified: 2022/01/28 17:18 by teodor.calinovschi
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0