Projects / Automatic poultry feeder

Automatic poultry feeder

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANO71°

    Build the hopper

    A bottle or tube with a sliding gate fixed to the servo horn. Test the gate by hand first.

  2. NANODS323171°20:22PCF8574

    Wire the electronics

    RTC and LCD on A4 and A5, servo signal on D9, separate servo supply with a shared ground.

  3. NANODS323121:23

    Set the clock

    The first upload sets the RTC to the compile time. Upload just after compiling.

  4. NANO

    Test a feed

    Temporarily set FEED_H and FEED_M to a minute from now and watch the gate open and close.

  5. NANO

    Set the portion

    Use the buttons to change the open time. Weigh the feed from a 5 second open.

  6. NANO

    Fit it

    Fix the hopper above the feed tray and run it for two days without feed before filling.

In short

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

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
RTC SDA, SCLNano A4 and A5Clock
LCD SDA, SCLNano A4 and A5Display, shared bus
RTC and LCD VCC, GNDNano 5V and GNDSupply
Servo signalNano D9Gate servo
Servo powerSeparate 5 to 6 V supply of at least 2 ANot from the Nano
Servo groundSupply ground and Nano GNDCommon ground
1000 µF capacitorAcross the servo supplyAbsorbs starting surges
Portion + buttonNano D2 and GNDLonger feed
Portion - buttonNano D3 and GNDShorter 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.

CheckExpected
At feed timeGate opens for the portion time then closes fully
Portion buttonsTime changes 1 to 30 s
Between feedsGate stays closed and the display shows the time
Power cut and returnRTC 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 →

Ask Lark AI

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.