Introduction: Sensor-Based Pet Food Dispneser

Our project is focused on finding a reliable way to feed your pets when you are gone out for a long period of time or are under any circumstances unable to feed them. The primary and perhaps the most important step of an engineering project is to begin by finding and defining a problem. Here, the above-mentioned scenario is our problem. Consider this, you are going for an overnight trip. You pack everything you would need. But who feeds your pets? It would be irresponsible to leave them hungry. You cannot leave the food outside as it may go stale and accumulate bacteria. Also, leaving the food in the pet bowl might put your pet through the risk of over-eating or perhaps falling sick.

What if there was an alternative solution to the problem that would feed your pets automatically?

Step 1: Concept and Working of the Dispenser

As shown in the video representation, as and when our model senses an object in front of it, it will dispense the food contained in it for 2 seconds and then stops. The flow of the food contained in the reservoir to the collector below is controlled by a trap door located inside the chute which is attached to the servo motor. When the sensor detects an object, the servo motor turns, opening the chute up, stays open for two seconds, and then closes back up. This mechanism ensures that over-flow of food is prevented and no food pellet gets stuck in the chute.

Step 2: Materials Required

1. HC-SR04 Arduino ultrasonic distance sensor

2. MG996R Servo Motor

3. NodeMCU microcontroller

4. Connecting wires

5. USB cable

6. Breadboard

7. a plastic/carboard enclosure for storing the food

Step 3: Step 1: Assembling the Circuit

The first step of this project involves procuring all the materials required and setting up the circuitry. The circuitry involved in this project very complicated, however it is advised to use color-coodinated wires in order to maintain uniformity and minimise errors due to incorrect connections of the electronics involved. The circuit involves a simple connection between the NodeMCU, the servo motor and the ultrasonic distance sensor. We used our laptop itself via a USB cable to power the NodeMCU, however, if larger number of sensors need to incorporated or a more extensive model needs to be constructed, we recommend using an external battery to power the entire circuit.

The images above represent how the set-up should look like. Here we have used four sensors to have a wider range however the model doeds work with a single sensor as well. For the purpose of testing your code and simplifying the complexity, we suggest you use a single sensor.

Step 4: Step 2: Writing the Code

After assembling the circuit, the next step is to write the pseudocode and test the working code. We have used micropython for coding in our project. The file below consists the working code required for the functioning of this project. Below is the pseudocode that was used for the project and the WebREPL library.

int timer starts at 0
ticks in increment of 1 sec

if detects an input then check the timer

if under time constraint of x secs

Then do nothing



then reset timer to 0


Step 5: Step 3: Fabrication and Set-up

After we have set-up the circuitry and tested the working code, we work on the fabrication aspect of this project. Our original plan was to 3D print the dispensing chute and laser cut the box itself, in pieces, and assemble it using hot glue. We ran into a problem with our design quite late in the process which ended up requiring us to both make a dispensing tube that was longer, and to change the inner structure of the project. Because the tube we needed to use would be too large to print, we had to utilize more basic materials for the construction of our project.

Here we have used cardboard to set-up our model although we recommend laser cutting and assembling the parts individually to give the model more stability and durability and at the same time, make it more like a finished prototype. The sketches represent a rough idea of how the set up should look like. The images represent the exterior of our finished model and the set-up of the circuitry inside the model (we have not included the food reservoir for the purpose of making the circuitry set-up more visible).

Step 6: Step 4: Finishing the Project

After completing the above mentioned steps, the last and final step is to assemble all components of the model together and test the functioning of the final model. Here is a video representation of our completed project. Thank you for your time and we hope you have a good time working on this project!