DIY Smart Pet Feeder with Arduino and WiFi
Do you sometimes forget to feed your pets on time? In this fun project, we will make a smart pet feeder that works with WiFi. You can press a button on your phone, and the feeder will drop food for your pet.
This project is simple to understand and shows how technology + care = happy pets!
🛠️ Materials Needed
Arduino board with WiFi (NodeMCU or ESP8266)
Servo Motor (to open/close food container)
Small food container / box
Wires
Breadboard
Mobile phone (to control over WiFi)
⚡ Circuit Diagram (Basic Connections)
[ESP8266 / NodeMCU]
|
——————-
D1 Pin → Servo Signal (Orange wire)
5V Pin → Servo VCC (Red wire)
GND Pin → Servo GND (Brown wire)
——————-
👉 The WiFi board sends a signal to the servo motor. The servo rotates and opens the food container.
📝 Step-by-Step Instructions
Mount the servo motor on your food container lid or flap.
Connect the wires:
Servo signal wire → D1 pin of NodeMCU/ESP8266
Servo red wire → 5V
Servo brown wire → GND
Upload the code to your NodeMCU (using Arduino IDE).
Connect WiFi: The board connects to your home WiFi.
Open the app or simple web page on your phone → Tap the button → The feeder opens!
Arduino Code
#include <ESP8266WiFi.h>
#include <Servo.h>
// ———- Servo Setup ———-
Servo foodServo;
// ———- WiFi Credentials ———-
const char* ssid = “YourWiFi”; // Replace with your WiFi name
const char* password = “YourPassword”; // Replace with your WiFi password
// ———- Web Server on Port 80 ———-
WiFiServer server(80);
// ———- Setup ———-
void setup() {
// Attach servo to GPIO D1
foodServo.attach(D1);
foodServo.write(0); // Keep servo closed initially
// Start Serial Monitor
Serial.begin(115200);
Serial.println();
Serial.println(“Connecting to WiFi…”);
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(“.”);
}
// Print IP address
Serial.println();
Serial.print(“Connected! IP Address: “);
Serial.println(WiFi.localIP());
// Start Web Server
server.begin();
Serial.println(“Server started!”);
}
// ———- Loop ———-
void loop() {
WiFiClient client = server.available();
if (!client) return; // Wait for a client to connect
Serial.println(“New client connected”);
// Read HTTP request
String request = client.readStringUntil(‘\r’);
Serial.println(request);
client.flush();
// ———- Handle Feed Request ———-
if (request.indexOf(“/feed”) != -1) {
Serial.println(“Feeding…”);
dispenseFood();
}
// ———- Webpage Response ———-
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println(“Connection: close”);
client.println();
client.println(“<!DOCTYPE HTML>”);
client.println(“<html>”);
client.println(“<head><title>ESP8266 Fish Feeder</title></head>”);
client.println(“<body style=’font-family:Arial;text-align:center;’>”);
client.println(“<h2>ESP8266 WiFi Fish Feeder</h2>”);
client.println(“<p><a href=’/feed’><button style=’font-size:20px;padding:10px;’>Feed Now</button></a></p>”);
client.println(“</body>”);
client.println(“</html>”);
}
// ———- Dispense Food Function ———-
void dispenseFood() {
// Rotate to release food
foodServo.write(90);
delay(2000);
// Return to closed position
foodServo.write(0);
delay(500);
}
Video
🎓 What You Learned
WiFi control → you can operate devices from your phone.
Servo motor → converts signal into movement.
Automation for pets → technology helps in daily life.
✅ Safety Tips
Use rechargeable batteries for long use.
Avoid running servos for too long without breaks.
Keep robot wires neat to prevent tangling.
Conclusion
This DIY WiFi Pet Feeder is a fun and practical project for kids and beginners. It combines Arduino coding, WiFi, and servo motors to create a useful tool for pet care.
Next steps:
Add a timer for automatic feeding.
Use a mobile app for better control.
Add a camera to see your pet while feeding.
















