An IoT-based automatic feeding system built with ESP32 and C++, featuring scheduled feeding, NTP time synchronization, servo motor control, and a local web interface for configuration and manual operation.
ESP32 Automatic Feeder is an embedded IoT project designed to automate food dispensing at predefined times.
The ESP32 connects to a Wi-Fi network, synchronizes its internal clock through NTP, and hosts a local web server that allows users to configure feeding schedules directly from a browser.
When a configured feeding time is reached, the ESP32 automatically activates a servo motor responsible for opening the dispensing mechanism.
Users can also manually trigger a feeding cycle through the web interface.
- Automatic scheduled feeding
- Three configurable daily feeding schedules
- Manual feeding through the web interface
- Wi-Fi connectivity
- NTP-based time synchronization
- Embedded HTTP server
- Servo motor control
- Browser-based configuration
- Responsive web interface
- Feeding schedule validation
- Duplicate feeding prevention
| Technology | Purpose |
|---|---|
| C++ | Firmware development |
| Arduino Framework | ESP32 application framework |
| ESP32 | Main embedded controller |
| Wi-Fi | Local network connectivity |
| WebServer | Embedded HTTP server |
| NTP | Time synchronization |
| ESP32Servo | Servo motor control |
| HTML/CSS | Embedded web interface |
The application follows a simple embedded IoT architecture:
┌───────────────────────┐
│ Browser │
│ │
│ Configure schedules │
│ Manual feeding │
└───────────┬───────────┘
│
│ HTTP
▼
┌───────────────────────┐
│ ESP32 │
│ │
│ Web Server │
│ │ │
│ ▼ │
│ Feeding Scheduler │
│ │ │ │
│ ▼ ▼ │
│ NTP Servo │
│ │
└───────────┬───────────┘
│
▼
Dispensing Mechanism
More information about the system design is available in docs/architecture.md.
After startup, the ESP32 connects to the configured Wi-Fi network and synchronizes its clock with an NTP server.
The ESP32 then starts a local HTTP server on port 80.
Users connected to the same network can access the ESP32 through its local IP address and configure three feeding schedules.
The firmware continuously compares the current time with the configured schedules.
When a scheduled time is reached:
Scheduled Time
│
▼
Schedule Match
│
▼
Activate Servo
│
▼
Open Feeder
│
▼
Wait Configured Duration
│
▼
Close Feeder
The system prevents the same feeding schedule from being triggered repeatedly during the same minute.
The ESP32 hosts a lightweight web interface directly from the firmware.
Through the interface, users can:
- Configure three daily feeding times
- Save the schedules
- Trigger an immediate feeding cycle
No external web server or cloud service is required.
The interface can be accessed using the ESP32 local IP address:
http://192.168.x.x
The client device must be connected to the same local network as the ESP32.
| Route | Method | Description |
|---|---|---|
/ |
GET | Displays the feeder interface |
/set |
GET | Updates the feeding schedules |
/feed |
GET | Triggers an immediate feeding cycle |
The basic hardware configuration consists of:
- ESP32 development board
- Servo motor
- Compatible servo power supply
- Jumper wires
- Mechanical food dispensing mechanism
The servo control signal is connected by default to:
GPIO 13
The default servo positions are:
Closed: 0°
Open: 90°
Detailed wiring and power information is available in docs/hardware.md.
esp32-automatic-feeder/
│
├── src/
│ └── automatic_feeder.ino
│
├── docs/
│ ├── architecture.md
│ ├── hardware.md
│ └── setup.md
│
├── images/
│
├── .gitignore
├── LICENSE
└── README.md
Before running the project, make sure you have:
- Arduino IDE
- ESP32 board support for Arduino
- ESP32 development board
- ESP32Servo library
- USB data cable
- Wi-Fi connection
git clone <repository-url>
cd esp32-automatic-feederOpen:
src/automatic_feeder.ino
Configure your Wi-Fi credentials:
const char* WIFI_SSID = "YOUR_WIFI_NAME";
const char* WIFI_PASSWORD = "YOUR_WIFI_PASSWORD";Do not commit personal Wi-Fi credentials to the repository.
Open the firmware using Arduino IDE.
Select your ESP32 board and the correct serial port.
Compile and upload the firmware.
Open the Serial Monitor using:
115200 baud
After connecting to Wi-Fi, the ESP32 will display its local IP address.
Open that address in your browser to access the feeder interface.
For complete installation instructions, see docs/setup.md.
The default feeding schedules are:
| Schedule | Time |
|---|---|
| Feeding 1 | 08:00 |
| Feeding 2 | 14:00 |
| Feeding 3 | 20:00 |
The default feeding duration is:
5 seconds
These values can be adjusted in the firmware.
The current version has some known limitations:
- Feeding schedules are stored only in RAM
- Custom schedules are lost after restarting the ESP32
- Servo operation temporarily blocks the main execution flow
- The web interface is accessible only through the local network
- Wi-Fi credentials are currently configured directly in the firmware
These limitations are planned to be addressed in future versions.
Planned improvements include:
- Persistent feeding schedules using ESP32 NVS
- Non-blocking servo control using
millis() - Separate Wi-Fi credentials from the main firmware
- Device status endpoint
- Feeding history
- Configurable feeding duration through the web interface
- Improved error handling
- Food-level monitoring
- Feeding confirmation sensor
- Remote monitoring
- Custom PCB
Additional technical documentation is available in the docs directory:
architecture.md— System architecture and software responsibilitieshardware.md— Hardware components, wiring, and power considerationssetup.md— Installation, configuration, and troubleshooting guide
This project is distributed under the MIT License.
See LICENSE for more information.