This guide explains how to configure, compile, upload, and run the ESP32 Automatic Feeder firmware.
Before starting, make sure you have:
- ESP32 development board
- USB data cable
- Computer with Arduino IDE installed
- Wi-Fi network with internet access
- Servo motor
- Compatible power supply for the servo
- Arduino ESP32 board support
ESP32Servolibrary
Download and install the Arduino IDE from the official Arduino website.
After installation, open the Arduino IDE.
Open:
File → Preferences
Add the ESP32 board package URL to the Additional Boards Manager URLs field.
Then open:
Tools → Board → Boards Manager
Search for:
esp32
Install the ESP32 board package provided by Espressif Systems.
Open the Arduino Library Manager:
Sketch → Include Library → Manage Libraries
Search for:
ESP32Servo
Install the library.
The project also uses:
#include <WiFi.h>
#include <WebServer.h>
#include <time.h>These libraries are provided by the ESP32 Arduino framework and normally do not require separate installation.
Clone the repository:
git clone <repository-url>Enter the project directory:
cd esp32-automatic-feederAlternatively, download the repository as a ZIP file and extract it.
Before uploading the firmware, configure your Wi-Fi credentials.
Locate:
const char* WIFI_SSID = "SUA_REDE_WIFI";
const char* WIFI_PASSWORD = "SUA_SENHA_WIFI";Replace the placeholder values with your local Wi-Fi credentials:
const char* WIFI_SSID = "Example";
const char* WIFI_PASSWORD = "123";The default servo configuration is:
constexpr int SERVO_PIN = 13;
constexpr int SERVO_CLOSED_POSITION = 0;
constexpr int SERVO_OPEN_POSITION = 90;
constexpr int FEEDING_DURATION_SECONDS = 5;Adjust these values according to your hardware and mechanical feeder design.
SERVO_PINDefines the ESP32 GPIO connected to the servo signal wire.
SERVO_CLOSED_POSITIONDefines the servo position when the dispensing mechanism is closed.
SERVO_OPEN_POSITIONDefines the servo position used to release food.
FEEDING_DURATION_SECONDSDefines how long the dispensing mechanism remains open during a feeding cycle.
Connect the servo signal wire to:
ESP32 GPIO 13
Connect the servo to an appropriate power source.
Make sure the ESP32 and servo power supply share a common ground.
For additional information, see:
docs/hardware.md
Connect the ESP32 to your computer using a USB data cable.
In Arduino IDE, select the appropriate ESP32 board under:
Tools → Board
Then select the serial port assigned to the ESP32:
Tools → Port
The exact board option depends on the ESP32 development board being used.
Use the Verify option in Arduino IDE to compile the project.
Resolve any compilation errors before continuing.
A successful compilation confirms that the required board support and libraries are correctly installed.
Click Upload in Arduino IDE.
Wait until the firmware has been successfully transferred to the ESP32.
After the upload finishes, open the Serial Monitor.
Configure the baud rate to:
115200
After startup, the Serial Monitor should display messages similar to:
Starting Automatic Feeder...
Connecting to WiFi....
WiFi connected.
IP address: 192.168.x.x
Web server started.
Take note of the IP address displayed by the ESP32.
Make sure your computer or smartphone is connected to the same local network as the ESP32.
Open a web browser and enter the ESP32 IP address.
For example:
http://192.168.1.100
The exact IP address depends on your network.
The feeder interface should appear in the browser.
The web interface provides three configurable feeding schedules.
Select the desired times and click:
Save Schedules
The ESP32 will compare the current time against these schedules and automatically trigger the feeder when a configured time is reached.
The web interface also provides a manual feeding option.
Selecting:
Feed Now
immediately activates the servo and performs a feeding cycle.
This can be useful for:
- Testing the dispensing mechanism
- Adjusting the servo positions
- Checking the amount of food released
- Manually dispensing food outside the configured schedule
The ESP32 obtains the current time using an NTP server:
configTime(-3 * 3600, 0, "pool.ntp.org");The current configuration uses a UTC-3 offset.
If the device is deployed in another timezone, adjust the configuration accordingly.
An internet connection is required for NTP synchronization.
Check:
- Wi-Fi network name
- Wi-Fi password
- Network availability
- ESP32 signal strength
Also make sure the network is compatible with the ESP32 board being used.
Confirm that:
- The ESP32 successfully connected to Wi-Fi
- The IP address is correct
- The client device is connected to the same network
- The ESP32 is still powered and running
Check:
- GPIO configuration
- Signal connection
- Servo power supply
- Common ground connection
- Servo voltage requirements
- Mechanical obstruction
This can indicate a power supply problem.
Servo motors can draw significant current during movement. Using an inadequate power source may cause a voltage drop and restart the ESP32.
Consider powering the servo from a separate, adequately rated power supply while maintaining a common ground with the ESP32.
The current firmware stores feeding schedules only in RAM.
If the ESP32 is restarted or loses power, schedules configured through the web interface are lost and the default schedules defined in the firmware are restored.
Persistent schedule storage is planned for a future version.