The ESP32 Automatic Cat Feeder is a smart, IoT-enabled system designed to reliably automate pet feeding by dispensing food according to a customizable schedule. Whether the owner is away or simply wishes to automate daily pet care, the feeder — powered by an ESP32 microcontroller — ensures the cat is fed on time and receives the correct portion sizes to prevent overfeeding.
Block Diagram
The system uses an ESP32 microcontroller as its central processing unit, taking advantage of its built-in Wi-Fi capabilities to enable remote monitoring and control via the Blynk mobile application, along with optional integration with Google Home for voice-activated commands. The main goal of the project is to ensure reliable, portion-controlled food dispensing based on customizable schedules or proximity detection, while enabling remote access to support efficient and flexible pet care management.
When it comes to hardware, essential elements include a servo motor for triggering the food dispensing mechanism, an ultrasonic distance sensor for detecting the cat’s proximity and an LED indicator to show the general system status. The servo motor operates for a fixed duration to ensure consistent and portion-controlled food delivery.
The system operates in two main modes, which can be adjusted remotely via the Blynk mobile application or web dashboard:
Hardware Circuit
Connecting Components
Ultrasonic Sensor HC-SR04 Measures the distance to a detected object by calculating the time between sending and receiving the reflected ultrasonic signal, multiplying it by the speed of sound. It is used to detect the movement of the cat.
SG90 Servo Motor Required to move the built dispenser mechanism by 90 degrees to release the food.
LED Used to show state of system and functioning modes.
Physical Circuit (Initial Version)
At this stage, the hardware components were connected and part of the code was tested to check basic functionalities. However, for the final version of the system, the component placement was slightly adjusted to eliminate redundant wiring.
Workflow Description
The system uses the Blynk platform to remotely control and monitor the automatic cat feeder via virtual pins. The key interaction points are two virtual pins:
The Automatic Cat Feeder system functions according to the logic shown in the following diagram:
After initializations such as connecting to Wi-Fi, pins, servo motor and Blynk configurations in setup(), it is important to distinguish between operating modes, under currentAction:
The code also handles the timing of each feeding action using millis() for non-blocking delays. This makes sure the system remains responsive to both sensor data and user inputs. A cooldown mechanism prevents overfeeding or other conflicting actions in the system. Moreover, two particularly important functions in this code are BLYNK_WRITE(V0) and BLYNK_WRITE(V1), which respond to input from the Blynk app:
/** * @brief Handles updates to the virtual pin V0 from the Blynk application * @param param Value sent from Blynk app. Expected to be 1 (enable) or 0 (disable). */ BLYNK_WRITE(V0) { proximityV0 = param.asInt(); Serial.print("proximityV0 mode: "); Serial.println(proximityV0 ? "ENABLED" : "DISABLED"); }
/** * @brief Handles manual feeding requests from the Blynk app via virtual pin V1. * @param param The value received from Blynk, typically 1 (trigger) or 0 (off/reset). */ BLYNK_WRITE(V1) { if (param.asInt() && (currentAction == NONE)){ Serial.println("catFeederV1 triggered!"); feederServo.write(90); digitalWrite(LED_PIN, HIGH); actionStartTime = millis(); currentAction = CATFEEDER; actionActive = true; } catFeederV1 = param.asInt(); Serial.print("catFeederV1 mode: "); Serial.println(catFeederV1 ? "ENABLED" : "DISABLED"); }
One of the main challenges was integrating and configuring the device with Blynk. Beyond just authentication, some interesting steps included creating dashboards for both web and mobile, as well as setting up the synchronized data streams, specifically the virtual pins V0 and V1.
Additionally, I was able to implement several automations, such as notifications when motion is detected by the cat or scheduling feedings at specific time intervals.
Finally, the coolest challenge was definitely configuring a voice assistant to control the feeding commands via Google Home. For this, I used the IFTTT applet and integrated it with Google Home over Wi-Fi. This setup allows me to trigger the automatic feeder simply by speaking, which adds a great level of convenience and modernizes the system significantly. It was fascinating to connect cloud-based voice commands with my local IoT device, creating a seamless interaction between smart home technology and pet care.
The ESP32 Automatic Cat Feeder project successfully demonstrates how IoT technology can enhance everyday pet care by combining hardware control with cloud-based connectivity. Through the integration of sensors, actuators, and the Blynk platform, the system provides flexible, remote and automated feeding options. The addition of voice assistant control further elevates the user experience by enabling hands-free operation.
Overall, this project highlights the potential of smart devices to create more connected and responsive environments, making pet care easier and more efficient for owners.