Smart Pet Feeder Project

Introduction

This smart pet feeder allows you to feed your pet remotely using IoT technology. The system uses an ESP32 or NodeMCU microcontroller to control a servo motor, which dispenses food at scheduled times or upon user command via a mobile app or web interface. It also monitors the food level and can send notifications when it’s time to refill.

Components Required

Circuit Diagram

The microcontroller is connected to a servo motor to dispense the food and a load cell to measure the remaining food. The RTC module is used for scheduling, while the Wi-Fi module allows remote operation via a mobile app or web interface.

Smart Pet Feeder Circuit

Sample Code

Below is a sample code snippet to control the servo motor using the ESP32. This code connects to Wi-Fi and allows you to control the feeder via a simple web interface.


// ESP32 Smart Pet Feeder - Servo Control Code
#include 
#include 

Servo feederServo;
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";

void setup() {
  Serial.begin(115200);
  feederServo.attach(15);  // Attach servo to pin 15

  // Connect to Wi-Fi
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("Connected to WiFi");

  // Initialize web server
  WiFiServer server(80);
}

void loop() {
  // Check for web client connections
  WiFiClient client = server.available();
  if (client) {
    String request = client.readStringUntil('\r');
    client.flush();

    // Check if the command is to feed the pet
    if (request.indexOf("/feed") != -1) {
      feederServo.write(90);  // Rotate servo to dispense food
      delay(1000);
      feederServo.write(0);   // Reset servo position
    }

    // Send a response to the client
    client.println("HTTP/1.1 200 OK");
    client.println("Content-Type: text/html");
    client.println();
    client.println("Pet Feeder Activated!");
  }
}
            

Features

Future Enhancements