Pet Feeding Robot Project
The Pet Feeding Robot is an automated system designed to make feeding pets convenient and efficient. It leverages an ESP32 microcontroller and Arduino IDE to control a servo motor for dispensing food and a conveyor belt system for tray movement. This ensures food is delivered to your pet accurately and on time.
Automate the pet feeding process with precision and reliability.
Integrate a servo motor for controlled food dispensing.
Enable tray movement using a conveyor belt system to ensure food is accessible to the pet.
Build a cost-effective solution for pet owners.
Servo Motor Food Dispensing: Opens and closes a flap below the storage box, allowing the right amount of food to fall onto the tray.
Conveyor Belt Tray Movement: Moves the tray forward to make the food accessible to the pet.
Customizable Feeding Schedule: The feeding schedule can be programmed in the ESP32 using the Arduino IDE.
Low-Cost Design: Uses readily available components for affordability and scalability.
ESP32 Microcontroller: For controlling the servo motor and conveyor belt.
Servo Motor: To open and close the flap under the food storage box.
Conveyor Belt Mechanism: To move the tray forward after food is dispensed.
Power Supply: To power the ESP32 and motors.
Storage Box: To store and dispense pet food.
Tray: To hold the food after dispensing.
Food Dispensing Mechanism:
The servo motor is attached to a flap under the storage box.
When the feeding time arrives, the ESP32 sends a signal to the servo motor to rotate and open the flap.
Food falls onto the tray beneath the storage box.
Tray Movement Mechanism:
After dispensing the food, the ESP32 activates the conveyor belt.
The tray moves forward, positioning the food for the pet.
Programming:
The ESP32 is programmed using Arduino IDE to control the motor movements and feeding schedule.
The feeding schedule is pre-configured in the code, ensuring precise timing.
Input: Feeding time schedule (pre-programmed in ESP32).
Control Unit: ESP32 microcontroller.
Output: Servo motor opens the food flap, and the conveyor belt moves the tray forward.
Here’s a simplified example of the Arduino IDE code for controlling the servo motor and conveyor belt:
// Define pins
const int irSensorPin = 23; // IR sensor signal pin
const int motorPin1 = 25; // Motor driver IN1
const int motorPin2 = 26; // Motor driver IN2
// Motor state tracking
bool objectDetected = false; // Tracks if an object is detected
bool motorRunning = false; // Prevents repeated triggering
void setup() {
// Set up motor driver pins
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
// Set up IR sensor pin
pinMode(irSensorPin, INPUT);
// Initialize serial communication
Serial.begin(115200);
Serial.println("System ready. Waiting for object detection...");
}
void loop() {
// Read the IR sensor state
int irState = digitalRead(irSensorPin);
// If the IR sensor detects an object
if (irState == LOW && !objectDetected) {
Serial.println("Object detected! Rotating motor clockwise...");
objectDetected = true;
motorRunning = true;
// Rotate motor clockwise
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
// Wait for 4 seconds
delay(4000);
// Stop the motor
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
Serial.println("Motor stopped.");
motorRunning = false;
}
// If the object is removed
else if (irState == HIGH && objectDetected && !motorRunning) {
Serial.println("Object removed! Rotating motor anticlockwise...");
objectDetected = false;
motorRunning = true;
// Rotate motor anticlockwise
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
// Wait for 4 seconds
delay(4000);
// Stop the motor
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
Serial.println("Motor stopped.");
motorRunning = false;
}
// Add a small delay to reduce CPU usage
delay(100);
}
Servo Motor Code
#include <ESP32Servo.h> // Include the ESP32Servo library
Servo myServo; // Create a servo object
void setup() {
Serial.begin(9600); // Start serial communication
myServo.attach(19); // Attach the servo to GPIO pin 13 (change as needed)
Serial.println("Servo Test: Enter an angle between 0 and 180");
}
void loop() {
if (Serial.available()) { // Check if data is available in the Serial Monitor
String input = Serial.readStringUntil('\n'); // Read the input string
int angle = input.toInt(); // Convert input to integer
if (angle >= 0 && angle <= 180) {
myServo.write(angle); // Set the servo to the specified angle
Serial.print("Servo moved to: ");
Serial.println(angle);
} else {
Serial.println("Invalid input. Enter a value between 0 and 180.");
}
}
}
Ideal for feeding pets like cats, dogs, or even birds.
Useful for pet owners with busy schedules or those who travel frequently.
Add Wi-Fi connectivity for remote control using a mobile app or web interface.
Include sensors to monitor food levels in the storage box.
Integrate a camera for real-time monitoring of the pet.
This project demonstrates how automation can simplify daily tasks like pet feeding. Using the ESP32 and Arduino IDE, the Pet Feeding Robot provides a cost-effective and efficient solution for pet owners.