Skip to content

Latest commit

 

History

History
335 lines (209 loc) · 6.42 KB

setup.md

File metadata and controls

335 lines (209 loc) · 6.42 KB

Setup Guide

Overview

This guide explains how to configure, compile, upload, and run the ESP32 Automatic Feeder firmware.

Requirements

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
  • ESP32Servo library

1. Install Arduino IDE

Download and install the Arduino IDE from the official Arduino website.

After installation, open the Arduino IDE.

2. Install ESP32 Board Support

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.

3. Install ESP32Servo

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.

4. Download the Project

Clone the repository:

git clone <repository-url>

Enter the project directory:

cd esp32-automatic-feeder

Alternatively, download the repository as a ZIP file and extract it.

5. Configure Wi-Fi

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";

6. Configure the Servo

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 Pin

SERVO_PIN

Defines the ESP32 GPIO connected to the servo signal wire.

Closed Position

SERVO_CLOSED_POSITION

Defines the servo position when the dispensing mechanism is closed.

Open Position

SERVO_OPEN_POSITION

Defines the servo position used to release food.

Feeding Duration

FEEDING_DURATION_SECONDS

Defines how long the dispensing mechanism remains open during a feeding cycle.

7. Connect the Hardware

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

8. Select the ESP32 Board

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.

9. Compile the Firmware

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.

10. Upload the Firmware

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

11. Check the Wi-Fi Connection

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.

12. Access the Web Interface

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.

13. Configure Feeding Times

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.

14. Manual Feeding

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

NTP Time Synchronization

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.

Troubleshooting

ESP32 Does Not Connect to Wi-Fi

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.

Web Interface Does Not Open

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

Servo Does Not Move

Check:

  • GPIO configuration
  • Signal connection
  • Servo power supply
  • Common ground connection
  • Servo voltage requirements
  • Mechanical obstruction

ESP32 Restarts When the Servo Moves

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.

Important Notes

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.