Projects / Fish feeder

Fish feeder

A servo or auger releases a small amount of food at set times.

Beginner1.5 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANO59°

    Test the servo

    Move between two angles.

  2. NANO

    Make the cup

    Measure one portion of food.

  3. NANO

    Mount the hopper

    Food falls into the cup by gravity.

  4. NANODS323116:06

    Add the clock

    Set the DS3231.

  5. NANO

    Add the schedule

    8 am and 6 pm.

  6. NANO

    Add the daily limit

    At most three feeds.

  7. NANO

    Watch for a week

    Adjust the portion.

In short

How do you build a fish feeder?

A servo or auger releases a small amount of food at set times. You need Arduino Nano, SG90 Micro Servo, DS3231 RTC module and Tactile push button 6 mm. It takes 7 steps and about 90 minutes.

Level
Beginner
Time
About 90 min
Parts
4

Parts list

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

Wiring

FromToWhy
Servo signalNano D9Feeder motion
Servo plus and minusNano 5V and GNDPower
RTC SDA and SCLNano A4 and A5Clock
Manual buttonNano D2 to groundExtra feed

Code

A small servo carries a measuring cup from a hopper opening to a spot over the tank, so each feed is the same amount of food. Most fish should be fed only what they finish in a couple of minutes, and overfeeding fouls the water faster than underfeeding harms the fish, so the sketch allows at most three feeds a day, whatever the button does. Count total feeds in EEPROM so you can see usage. Set the DS3231 clock once with the RTClib example. Mount the hopper dry and away from water splashes, keep humidity off the Nano, and for a holiday of more than a few days ask someone to check the tank as well, since an automatic feeder cannot notice a failing filter or heater. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).

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).

// Fish feeder: a servo turns a measuring cup twice a day. Libraries: Servo, RTClib, EEPROM. Board: Arduino Nano.
#include <Servo.h>
#include <Wire.h>
#include <RTClib.h>
#include <EEPROM.h>
Servo cup;
RTC_DS3231 rtc;
const int BTN = 2;
const int FEED_HOUR[2] = {8, 18};
const int MAX_PER_DAY = 3;
int fedToday = 0, lastDay = -1;
unsigned int totalFeeds;
void feed() {
  if (fedToday >= MAX_PER_DAY) return;                // stops accidental overfeeding
  cup.write(160); delay(900);                         // tip the cup over the water
  cup.write(10);  delay(900);                         // back to refill from the hopper
  fedToday++; totalFeeds++;
  EEPROM.put(0, totalFeeds);
}
void setup() {
  pinMode(BTN, INPUT_PULLUP);
  cup.attach(9); cup.write(10);
  rtc.begin();
  EEPROM.get(0, totalFeeds);
  if (totalFeeds == 0xFFFF) totalFeeds = 0;
}
void loop() {
  DateTime now = rtc.now();
  if (now.day() != lastDay) { lastDay = now.day(); fedToday = 0; }
  static int doneHour = -1;
  for (int i = 0; i < 2; i++)
    if (now.hour() == FEED_HOUR[i] && now.minute() == 0 && doneHour != now.hour()) { doneHour = now.hour(); feed(); }
  if (now.minute() == 1) doneHour = -1;
  if (digitalRead(BTN) == LOW) { feed(); delay(1000); }
  delay(500);
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
8:00One portion is released
18:00Another portion
ButtonExtra feed up to the daily limit
Fourth feed in a dayRefused

If it does not work

Food jams

Use dry flakes and widen the hopper opening.

Servo buzzes

Check the end angles do not hit the stops.

Wrong times

Reset the clock.

No feed

Check the schedule hour matches the clock.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the fish feeder?

Arduino Nano, SG90 Micro Servo, DS3231 RTC module and Tactile push button 6 mm.

How long does the fish feeder take to build?

About 90 minutes for a beginner maker, in 7 steps.

How do I know the fish feeder works?

8:00: One portion is released. 18:00: Another portion. Button: Extra feed up to the daily limit.

Food jams: what should I check?

Use dry flakes and widen the hopper opening.

Servo buzzes: what should I check?

Check the end angles do not hit the stops.

Wrong times: what should I check?

Reset the clock.

No feed: what should I check?

Check the schedule hour matches the clock.