Build it step by step
0 of 6 doneBuild the hopper
A bottle or tube with a sliding gate fixed to the servo horn. Test the gate by hand first.
Wire the electronics
RTC and LCD on A4 and A5, servo signal on D9, separate servo supply with a shared ground.
Set the clock
The first upload sets the RTC to the compile time. Upload just after compiling.
Test a feed
Temporarily set FEED_H and FEED_M to a minute from now and watch the gate open and close.
Set the portion
Use the buttons to change the open time. Weigh the feed from a 5 second open.
Fit it
Fix the hopper above the feed tray and run it for two days without feed before filling.
How do you build an automatic poultry feeder?
A servo opens a feed hopper gate for a few seconds at set times each day, so birds get fed even when nobody is home. You need Arduino Nano, DS3231 RTC module, MG996R metal gear servo, 16x2 LCD with I2C backpack (PCF8574), Tactile push button 6 mm × 2, 5 V 2 A USB adapter, Electrolytic capacitor 1000 µF, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data). It takes 6 steps and about 90 minutes.
- Level
- Beginner
- Time
- About 90 min
- Parts
- 10
Wiring
| From | To | Why |
|---|---|---|
| RTC SDA, SCL | Nano A4 and A5 | Clock |
| LCD SDA, SCL | Nano A4 and A5 | Display, shared bus |
| RTC and LCD VCC, GND | Nano 5V and GND | Supply |
| Servo signal | Nano D9 | Gate servo |
| Servo power | Separate 5 to 6 V supply of at least 2 A | Not from the Nano |
| Servo ground | Supply ground and Nano GND | Common ground |
| 1000 µF capacitor | Across the servo supply | Absorbs starting surges |
| Portion + button | Nano D2 and GND | Longer feed |
| Portion - button | Nano D3 and GND | Shorter feed |
Code
Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "RTClib", "LiquidCrystal I2C"; Servo comes with the IDE. An MG996R can draw over an amp and far more when stalled, so power it from its own supply and join the grounds. The portion time is not saved if power is lost. Check the feeder over a day or two with an empty hopper before you put in feed.
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Wire.h>
#include <RTClib.h>
#include <Servo.h>
#include <LiquidCrystal_I2C.h>
RTC_DS3231 rtc;
Servo gate;
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte SERVO_PIN = 9, UP = 2, DOWN = 3;
const byte FEED_H[2] = {7, 17}, FEED_M[2] = {0, 0}; // 7 am and 5 pm
byte portionSec = 5;
int lastFedMinute = -1;
const byte OPEN_ANGLE = 90, CLOSED_ANGLE = 0;
void showNext(DateTime now) {
lcd.setCursor(0, 0);
char buf[17]; snprintf(buf, sizeof(buf), "Now %02d:%02d:%02d ", now.hour(), now.minute(), now.second()); lcd.print(buf);
lcd.setCursor(0, 1);
snprintf(buf, sizeof(buf), "Feeds 07:00 17:00"); // fixed times shown, portion below
lcd.print("Portion "); lcd.print(portionSec); lcd.print(" s ");
}
void feed() {
gate.attach(SERVO_PIN);
gate.write(OPEN_ANGLE);
delay(portionSec * 1000UL);
gate.write(CLOSED_ANGLE);
delay(800); // give it time to close fully
gate.detach();
}
void setup() {
pinMode(UP, INPUT_PULLUP); pinMode(DOWN, INPUT_PULLUP);
rtc.begin();
if (rtc.lostPower()) rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
lcd.init(); lcd.backlight();
gate.attach(SERVO_PIN); gate.write(CLOSED_ANGLE); delay(500); gate.detach();
}
void loop() {
DateTime now = rtc.now();
showNext(now);
if (digitalRead(UP) == LOW && portionSec < 30) { portionSec++; delay(250); }
if (digitalRead(DOWN) == LOW && portionSec > 1) { portionSec--; delay(250); }
int minuteStamp = now.hour() * 60 + now.minute();
for (byte i = 0; i < 2; i++) {
if (now.hour() == FEED_H[i] && now.minute() == FEED_M[i] && minuteStamp != lastFedMinute) {
lastFedMinute = minuteStamp; // feed once only in that minute
feed();
}
}
delay(200);
}Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| At feed time | Gate opens for the portion time then closes fully |
| Portion buttons | Time changes 1 to 30 s |
| Between feeds | Gate stays closed and the display shows the time |
| Power cut and return | RTC keeps correct time |
If it does not work
Gate jams
The servo cannot push through feed. Increase the gate size or use a stronger mechanism.
Nano resets when the servo moves
The servo is on the Nano supply. Use its own supply and a 1000 µF capacitor.
Feeds twice
The minute check failed, so keep the lastFedMinute logic.
Time is wrong
Re-upload to reset the RTC or fit a fresh coin cell.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the automatic poultry feeder?
Arduino Nano, DS3231 RTC module, MG996R metal gear servo, 16x2 LCD with I2C backpack (PCF8574), Tactile push button 6 mm × 2, 5 V 2 A USB adapter, Electrolytic capacitor 1000 µF, Breadboard 830 Tie Points, Jumper wires male to male (40 pcs, 20 cm) and USB A to micro-USB cable (data).
How long does the automatic poultry feeder take to build?
About 90 minutes for a beginner maker, in 6 steps.
How do I know the automatic poultry feeder works?
At feed time: Gate opens for the portion time then closes fully. Portion buttons: Time changes 1 to 30 s. Between feeds: Gate stays closed and the display shows the time.
Gate jams: what should I check?
The servo cannot push through feed. Increase the gate size or use a stronger mechanism.
Nano resets when the servo moves: what should I check?
The servo is on the Nano supply. Use its own supply and a 1000 µF capacitor.
Feeds twice: what should I check?
The minute check failed, so keep the lastFedMinute logic.
Time is wrong: what should I check?
Re-upload to reset the RTC or fit a fresh coin cell.
