Skip to content

About

IoT automatic feeder built with ESP32 and C++, featuring Wi-Fi, NTP scheduling, a local web interface, and servo motor control.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Automatic Feeder

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.

Overview

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.

Features

  • 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

Technologies

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

System Architecture

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.

How It Works

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.

Web Interface

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.

HTTP Routes

Route Method Description
/ GET Displays the feeder interface
/set GET Updates the feeding schedules
/feed GET Triggers an immediate feeding cycle

Hardware

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.

Project Structure

esp32-automatic-feeder/
│
├── src/
│   └── automatic_feeder.ino
│
├── docs/
│   ├── architecture.md
│   ├── hardware.md
│   └── setup.md
│
├── images/
│
├── .gitignore
├── LICENSE
└── README.md

Getting Started

Requirements

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

Clone the Repository

git clone <repository-url>
cd esp32-automatic-feeder

Configure Wi-Fi

Open:

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.

Upload to ESP32

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.

Default Configuration

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.

Current Limitations

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.

Roadmap

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

Documentation

Additional technical documentation is available in the docs directory:

  • architecture.md — System architecture and software responsibilities
  • hardware.md — Hardware components, wiring, and power considerations
  • setup.md — Installation, configuration, and troubleshooting guide

License

This project is distributed under the MIT License.

See LICENSE for more information.

About

IoT automatic feeder built with ESP32 and C++, featuring Wi-Fi, NTP scheduling, a local web interface, and servo motor control.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages