Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home IoT & Smart Home

Smart Pet Feeder with ESP32: Automated Food Dispenser Build

Smart Pet Feeder with ESP32: Automated Food Dispenser Build

March 11, 2026 /Posted byJayesh Jain / 0

Building a smart pet feeder with ESP32 DIY is one of the most rewarding IoT home automation projects you can undertake — and one of the most practical. Whether you are a software engineer in Bangalore who works long hours, or a family in Delhi that travels on weekends, an automated pet feeder ensures your dog or cat is fed on schedule even when you are away. In this comprehensive guide, we will build a fully functional Wi-Fi-connected pet feeder with scheduled dispensing, remote control via a web interface, portion control, and feeding history logs.

Table of Contents

  1. Components and Materials List
  2. Mechanical Design: The Food Dispenser Mechanism
  3. Circuit Wiring and Connections
  4. ESP32 Firmware: Scheduling and Web Server
  5. Web Interface for Remote Control
  6. Enhancements: Camera, Weight Sensor, Telegram Bot
  7. Frequently Asked Questions

Components and Materials List

Here is everything you need for this smart pet feeder project. Most components are available at Zbotic.in with fast delivery across India:

Electronics

  • ESP32 development board — the brain of the feeder
  • DS3231 RTC module — accurate timekeeping even without internet (optional if always connected)
  • Servo motor (MG996R or SG90) — to drive the dispensing mechanism
  • DHT11/DHT22 sensor — optional, to monitor food storage temperature/humidity
  • HC-SR04 ultrasonic sensor — to detect if food bowl is full
  • 5V buzzer — to alert when food is low
  • 16×2 LCD with I2C adapter — to display next feeding time and status
  • 18650 battery shield + batteries — for backup power during power cuts (common in India)
  • 5V 2A USB power supply

Mechanical/Structural

  • Food-grade plastic container (2-3 litre) for food hopper
  • 3D printed or PVC pipe auger/screw mechanism
  • Food bowl (stainless steel)
  • Velcro or brackets for mounting
Ai Thinker NodeMCU-32S-ESP32 Development Board

Ai Thinker NodeMCU-32S-ESP32 Development Board – IPEX Version

The NodeMCU-32S is an excellent choice for the smart pet feeder — strong Wi-Fi, plenty of GPIO for servo + sensors + display, and runs reliably 24/7.

View on Zbotic

Mechanical Design: The Food Dispenser Mechanism

The most important part of a pet feeder is the dispensing mechanism. There are three popular approaches for DIY builds:

Option 1: Rotating Drum (Easiest)

A cylinder with cutout compartments rotates to drop a measured portion of food. Drive it with a servo motor. One rotation = one feeding. This works well with kibble-type dry pet food commonly used in India (Pedigree, Royal Canin, etc.).

Option 2: Auger Screw (Most Reliable)

An auger screw is turned by a servo or DC motor inside a tube. Food is pushed forward and drops out the end. Rotation time = portion size. More consistent for different food sizes and shapes. Can be 3D-printed easily.

Option 3: Gravity + Servo Flap (Simplest)

A flap at the bottom of the hopper is held closed by a servo. Open the flap for a set duration, food falls out, close flap. Simple but portion control is less precise.

For this tutorial, we will implement Option 1 (Rotating Drum) as it requires no 3D printing and can be built with an old PVC cap or kitchen container.

Servo Motor Connection to ESP32

Connect the servo motor to the ESP32:

  • Servo Red wire → 5V (use external power supply, not 3.3V from ESP32)
  • Servo Brown/Black wire → GND
  • Servo Orange/Yellow wire → GPIO18 (PWM-capable pin)
  • Connect ESP32 GND to servo power supply GND (common ground)
2 x 18650 Lithium Battery Shield

2 x 18650 Lithium Battery Shield for Arduino, ESP32, ESP8266

Power failures are common in India. Add this battery shield to your pet feeder to ensure your pets are fed even during power cuts. Supports simultaneous charging and output.

View on Zbotic

Circuit Wiring and Connections

Here is the full wiring summary for the smart pet feeder:

Component ESP32 Pin Notes
Servo Motor Signal GPIO18 Use external 5V supply for power
DHT11 Data GPIO4 10K pull-up to 3.3V
HC-SR04 Trig GPIO5 Bowl level detection
HC-SR04 Echo GPIO19 Use voltage divider (5V→3.3V)
Buzzer GPIO21 Low-level active
LED Status GPIO2 (built-in) Blink patterns for status

ESP32 Firmware: Scheduling and Web Server

The firmware implements: (1) NTP time sync for accurate scheduling, (2) configurable feeding schedules stored in NVS, (3) a web server for remote control, and (4) automatic dispensing at scheduled times.

#include <Arduino.h>
#include <WiFi.h>
#include <WebServer.h>
#include <ESP32Servo.h>
#include <Preferences.h>
#include <time.h>
#include <ArduinoJson.h>

// Config
const char* ssid = "YourWiFi";
const char* password = "YourPassword";
const int SERVO_PIN = 18;
const int BUZZER_PIN = 21;

Servo feederServo;
WebServer server(80);
Preferences prefs;

// Schedule: up to 4 feeding times per day
struct FeedingSchedule {
  int hour;
  int minute;
  int portionRotations;  // How many rotations = how much food
  bool enabled;
};

FeedingSchedule schedule[4];
bool lastFedFlag[4] = {false};

void dispenseFood(int rotations) {
  Serial.printf("Dispensing food: %d rotationsn", rotations);
  tone(BUZZER_PIN, 1000, 200); // Beep to alert pet
  delay(500);
  
  for (int i = 0; i < rotations; i++) {
    feederServo.write(0);
    delay(500);
    feederServo.write(180);
    delay(500);
  }
  feederServo.write(90); // Rest position
  Serial.println("Dispensing complete");
}

void checkSchedule() {
  struct tm timeinfo;
  if (!getLocalTime(&timeinfo)) return;
  
  int currentHour = timeinfo.tm_hour;
  int currentMin = timeinfo.tm_min;
  
  for (int i = 0; i < 4; i++) {
    if (!schedule[i].enabled) continue;
    
    if (currentHour == schedule[i].hour && currentMin == schedule[i].minute) {
      if (!lastFedFlag[i]) {
        lastFedFlag[i] = true;
        dispenseFood(schedule[i].portionRotations);
      }
    } else {
      lastFedFlag[i] = false;
    }
  }
}

void setup() {
  Serial.begin(115200);
  feederServo.attach(SERVO_PIN);
  feederServo.write(90);
  pinMode(BUZZER_PIN, OUTPUT);
  
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) delay(500);
  Serial.println("IP: " + WiFi.localIP().toString());
  
  // Sync time with NTP (India timezone: UTC+5:30)
  configTime(5 * 3600 + 30 * 60, 0, "pool.ntp.org", "time.google.com");
  
  // Load saved schedule from NVS
  prefs.begin("feeder", true);
  prefs.getBytes("schedule", schedule, sizeof(schedule));
  prefs.end();
  
  // Default schedule if nothing saved
  if (schedule[0].hour == 0 && schedule[0].minute == 0) {
    schedule[0] = {7, 0, 2, true};   // 7:00 AM, 2 rotations
    schedule[1] = {13, 0, 2, true};  // 1:00 PM, 2 rotations
    schedule[2] = {19, 0, 3, true};  // 7:00 PM, 3 rotations
    schedule[3] = {0, 0, 0, false};  // Disabled
  }
  
  // Web server routes
  server.on("/feed", HTTP_POST, []() {
    int portions = server.arg("portions").toInt();
    if (portions < 1 || portions > 5) portions = 1;
    dispenseFood(portions);
    server.send(200, "text/plain", "Feeding complete");
  });
  
  server.begin();
  Serial.println("Smart Pet Feeder Ready!");
}

void loop() {
  server.handleClient();
  checkSchedule();
  delay(1000);
}

Web Interface for Remote Control

Add a simple web interface so you can control the feeder from your phone’s browser while on the same Wi-Fi network. For remote control from anywhere, set up port forwarding or use a service like Cloudflare Tunnel or ngrok.

The web interface should include:

  • “Feed Now” button with portion size selector (1x, 2x, 3x)
  • Schedule editor — set up to 4 daily feeding times with portion amounts
  • Status display — last feeding time, Wi-Fi strength, uptime
  • Feeding log — last 10 feedings with timestamps (stored in SPIFFS)
DHT11 Digital Relative Humidity and Temperature Sensor Module

DHT11 Digital Relative Humidity and Temperature Sensor Module

Monitor the temperature and humidity inside your pet feeder to ensure food stays fresh. Alert yourself if conditions exceed safe thresholds for your pet’s food.

View on Zbotic

Enhancements: Camera, Weight Sensor, Telegram Bot

Add an ESP32 CAM to Watch Your Pet Eat

Mount an ESP32-CAM module near the food bowl to capture a photo or short video each time food is dispensed. Get a notification on Telegram with a photo of your pet eating. This feature is incredibly popular among Indian pet owners who travel for work.

Telegram Bot Integration

Use the Universal Telegram Bot library to send feeding notifications and accept remote commands:

  • Send a Telegram message every time the feeder dispenses food
  • Reply to “/feed” command with immediate dispensing
  • Reply to “/status” with last feeding time and Wi-Fi signal strength
  • Alert when food level is low (detected by ultrasonic sensor)
ESP32-CAM-MB MICRO USB Download Module

ESP32-CAM-MB MICRO USB Download Module for ESP32 CAM

Add a camera to your pet feeder to capture photos when food is dispensed. Send the images to your phone via Telegram to see your pet eating in real time.

View on Zbotic

Frequently Asked Questions

Is this pet feeder safe to use with my pet’s food?

Use only food-grade plastic or stainless steel components that come in contact with food. The servo and electronics should be sealed away from the food path. Avoid exposed metal that could rust. Clean the food hopper and bowl regularly — the electronics make automation easy, but hygiene requires your attention.

What if the Wi-Fi goes down? Will my pet still be fed?

Yes! The schedule is stored in NVS (non-volatile memory) and the ESP32 uses the onboard RTC or the saved NTP time. Once the schedule is programmed, the feeder operates autonomously without internet. Wi-Fi is only needed for remote control and notifications, not for basic operation.

How accurate is the portion control?

With a rotating drum mechanism, one rotation delivers a consistent amount — typically 20-50 grams depending on kibble size and drum dimensions. For precise weight-based feeding, add a load cell (HX711 module) under the food bowl and have the ESP32 keep dispensing until the target weight is reached.

Can this work for cats and dogs both?

Yes, with different hopper and dispenser sizes. For cats eating dry kibble, a small auger or drum mechanism works well. For larger dogs needing bigger portions, scale up the container and use a more powerful motor (like NEMA 17 stepper with A4988 driver) for a high-torque auger.

How long does the battery backup last?

Two 18650 cells (7.4V, ~5000mAh combined) powering an ESP32 + servo will last approximately 8-12 hours depending on feeding frequency. For longer backup, use 4x 18650 cells with the V9 battery shield. This is sufficient for most Indian power cut durations.

Build Your Smart Pet Feeder Today

Zbotic.in has all the components you need — ESP32 boards, sensors, battery shields, and more. Give your pets the care they deserve even when you are not home. Fast shipping across India with quality-checked components.

Shop IoT Project Components at Zbotic

Tags: Arduino, DIY, ESP32, home automation, IoT Project, servo motor, Smart Pet Feeder
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
ESP32 vs W600: Cheap WiFi MCU ...
blog esp32 vs w600 cheap wifi mcu for iot india comparison 595375
blog esp32 hall effect sensor detect magnets and rotation 595379
ESP32 Hall Effect Sensor: Dete...

Related posts

Svg%3E
Read more

IoT Home Insurance Sensor Kit: Leak, Smoke, and Motion

April 1, 2026 0
Table of Contents IoT and Home Insurance Water Leak Detection Smoke and Fire Detection Motion and Intrusion Sensing Building the... Continue reading
Svg%3E
Read more

IoT Pet Tracker: GPS Collar with Geofencing Alerts

April 1, 2026 0
Table of Contents Introduction and Overview Hardware Components Required GPS Module Integration with ESP32 Cloud Platform Setup Real-Time Tracking Dashboard... Continue reading
Svg%3E
Read more

IoT Aquaponics Controller: Fish and Plant Automation

April 1, 2026 0
Table of Contents The Water Monitoring Challenge in India Sensor Technologies for Water Building the Sensor Node Data Transmission and... Continue reading
Svg%3E
Read more

IoT Composting Monitor: Temperature and Moisture Tracking

April 1, 2026 0
Table of Contents Why Temperature Monitoring Matters Sensor Selection Guide Hardware Assembly and Wiring Firmware Development Cloud Data Logging Alert... Continue reading
Svg%3E
Read more

IoT Beehive Monitor: Weight, Temperature, and Humidity

April 1, 2026 0
Table of Contents Why Monitor Beehives Weight Measurement System Temperature and Humidity Sensing Building the Monitor Data Analysis for Bee... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now