How to Program an Automatic Fish Feeder on Arduino UNO — Quick, No-Fuss Guide

How to Program an Automatic Fish Feeder on Arduino UNO — Quick, No-Fuss Guide

How to Program an Automatic Fish Feeder on Arduino UNO — Quick, No-Fuss Guide

Fast, friendly, and practical: this guide shows you how to plan, build, wire, program, and test an Arduino UNO automatic fish feeder so your fish are fed reliably without fuss — no advanced electronics degree required, just patience and a screwdriver.

What you'll need

Arduino UNO
Servo motor (or stepper + driver)
Breadboard, jumper wires
Separate power supply for motor
Hopper/container for food
Basic tools & soldering/assembly skills
Arduino IDE
Optional RTC module
Editor's Choice
Arduino Official Starter Kit with 12 Projects
Best for beginners learning electronics and coding
A complete, beginner-friendly kit with genuine Arduino parts and an easy-to-follow English project book. Teaches electronics and programming through 12 hands-on projects—great for classrooms and hobbyists.

Building an Automatic Fish Feeder with Arduino: A Fun Experiment


1

Step 1 — Choose your dispensing mechanism

Spoon, drum, or auger? Pick the simplest idea that won’t clog at 3 a.m.

Decide how food will move from hopper to tank: pick a servo-driven scoop, a rotating drum with cutouts, or an auger for pellets. Match the mechanism to your food type — flakes, pellets, or granules behave very differently.

Servo scoop: good for measured portions of flakes or mixed food.
Rotating drum: simple for uniform pellets; cutouts control portion size.
Auger: best for free-flowing pellets and granules; resists jamming.

Consider how to limit clogs: use steep chutes, anti-bridge shapes, or a small vibrator tap. Factor in hopper size, waterproofing, and ease of cleaning so mold won’t build up. Sketch a simple mockup or 3D-print a prototype piece to verify fit and smooth dispensing before you wire anything.

Best Value
Petbank Automatic Aquarium Feeder with 16 Compartments
Moisture-proof, USB rechargeable precision feeder
Dispenses precise portions from 16 sealed grids so food stays dry and provides up to 15 pre-set meals. USB rechargeable with an LCD timer lets you schedule up to three daily feedings or use manual feed.

2

Step 2 — Collect and prepare parts

Small details save headaches: check screws, clearances, and hopper fit before powering up.

Gather your servo, hopper/container, mounting hardware, and any chassis pieces. Dry-fit parts first: mount the servo to the feeder body and ensure the horn reaches the scoop or drum without binding. Modify the hopper mouth if pellets don’t flow — widen the outlet or add a small funnel.

Prepare simple splash guards and a removable drip tray to keep water off electronics. Sand rough edges on 3D-printed or laser-cut parts so pellets don’t crush or jam. Work tidy: label wires, bag screws by subassembly, and lay parts out in assembly order so you don’t hunt for bits.

Servo (e.g., SG90 or MG90S), hopper, lid
Mounting screws, brackets, servo horn/adaptor
Splash guard or small tray
Sandpaper, labels, zip-ties
Must-Have
MotorGuide MGA015PB6 Shock-Absorbing Mounting Isolator Kit
Protects electronics from shock and vibration
Set of four durable isolators that absorb shocks and reduce harmful vibration to protect sensitive electronics. Includes long, corrosion-resistant bolts for secure, long-lasting mounting.

3

Step 3 — Wire the Arduino and motor safely

Wiring mistakes are the silent killers — tie grounds, power the servo separately, and breathe easy.

Connect the servo signal to an Arduino PWM pin (for example, D9). Tie the Arduino ground and the servo power ground together so they share a common ground. Power the servo from a dedicated 5–6V supply if it draws significant current to avoid browning out the UNO.

Place a capacitor across the servo power rails (e.g., 1000 µF electrolytic) to smooth spikes. Fit a diode (e.g., 1N400x) if you use a separate motor driver for extra protection.

Wire any RTC module on I2C: SDA → A4, SCL → A5, and feed it the correct VCC (check 3.3V vs 5V). Use short, solid jumper wires for signals and thicker wires for power. Double-check every connection before powering up to avoid smoked components.

Quick checklist: servo D9, common ground, dedicated 5–6V, cap across power, diode if driver, RTC SDA/SCL, short signal wires, thicker power wires.
DIY Favorite
SG90 Micro Servo Motor Kit, Pack of 3
180° rotation, ideal for Arduino projects
Compact, low-voltage SG90 servos for hobby projects with roughly 180° movement and standard three-wire connections. Easy to integrate with Arduino or Raspberry Pi for robotics and motion control.

4

Step 4 — Upload code and set feeding schedules

Schedule like a pro — tiny code tweaks give you reliable daily feedings while you sleep.

Install the Arduino IDE and open a basic feeder sketch. Load the Servo library and write a clear dispense() function that moves the servo to a calibrated angle (example: 0 → 90 → 0), waits (500–1500 ms), then returns.

Use millis() or simple delay-based loops for quick setups. Use an RTC (e.g., DS3231) and the Time library for accurate daily times like 08:00 and 18:00. Implement a scheduler that triggers dispense() and enforces a safety timeout between feeds.

Include Serial.println() for time, state, and errors. Add a calibration mode toggled by a button or a serial command to adjust angles and portion counts on the fly.

Tip: keep angles, feed times, portion counts, and timeouts as top-level variables for easy tweaking.

Keep functions modular so you can change schedule logic without rewriting hardware code.

Precision Pick
AITRIP DS3231 High-Precision RTC Module Pack
Accurate I2C clock with temperature compensation
Three DS3231 RTC modules provide reliable, temperature-compensated timekeeping over I2C for Arduino and Raspberry Pi projects. Ideal when you need precise real-time clock functions (batteries not included).

5

Step 5 — Calibrate portions and test thoroughly

Measure, tweak, and repeat — overfeeding is easy; precise dispensing takes a few tests.

Calibrate how much food each servo action releases by running controlled trials. Use a cup or tray and run 10–20 dispenses, then weigh the food or count pellets to find servings per rotation (example: 15 pellets ≈ 1 serving).

Adjust servo movement and timing until portions are consistent:

Change angles (e.g., 0 → 60 → 0 vs 0 → 90 → 0) to reduce overpouring.
Adjust speed/delay (shorter or longer dwell at full open).
Vary pulses (multiple small tosses vs one big spin).

Simulate scheduled runs and test reset behavior between dispenses to avoid jams when the hopper is full. Simulate many cycles to spot wear, and finally observe live feedings to ensure no food falls onto electronics or into the tank water.

Top Choice
FISHNOSH Automatic Fish Feeder for Aquariums 2025
Programmable up to nine feedings per day
Programmable automatic feeder suitable for small tanks, large aquariums, and ponds to keep fish fed when you’re busy or away. Simple setup, refillable food cup, and clear instructions make it travel-friendly.

6

Step 6 — Install, secure, and plan maintenance

Mount once with common-sense backups: battery backup, easy cleaning, and fail-safes keep fish happy.

Mount the feeder above the tank so food drops cleanly into the water and away from electronics.
Clamp the unit to the hood or use an L-bracket bolted to a nearby rail for solid stability (example: C-clamp to the aquarium rim).
Weatherproof exposed electronics with a small plastic project box and silicone around seams; route wires through a grommet.
Add an RTC coin battery or a small UPS to keep schedules during outages, and install a manual feed button for guests to press.
Schedule routine cleaning to prevent mold and jams and leave the hopper easy to open for quick refills.

Keep spare parts: servo, jumper wires, screws, fuse
Document: take a photo of the pinout and save your code version (e.g., GitHub Gist)
Best for Outdoors
YETLEBOX IP67 Waterproof Outdoor Electrical Junction Box
IP67 rated, durable ABS with mounting plate
Weatherproof IP67 enclosure keeps electronics safe from dust and water and includes a mounting plate plus wall brackets for easy installation. Made from durable ABS with stainless steel latches for long-term outdoor use.

Ready, set, relax — automated feeding done

You now have a reliable plan: mechanism, wiring, code, calibration, and maintenance. These steps make your Arduino UNO feeder deliver portions on schedule, keep fish healthy, and let you travel worry-free. Ready to relax and enjoy peace of mind today?

Emily Stevens
Emily Stevens

Emily is a passionate pet care expert and the voice behind Pet Wool Bed.

11 Comments

  1. Mounting tips? I put mine on the rim with a 3D printed bracket but after a couple of days the vibrations loosened it.

    Step 6 says ‘install, secure, and plan maintenance’ — can we have more specifics like recommended screw types, periodic checks, and humidity protection? My tank room is a bit humid.

    • I used stainless self-tapping screws and a thin rubber gasket between bracket and rim. Also put the electronics in a small sealed box with foam for desiccant packs.

    • Good point — I’ll expand Step 6 with recommended mounting hardware (stainless screws, rubber washers), routine checks (weekly for the first month, then monthly), and ideas for moisture protection like silicone conformal coating for the circuit board.

  2. Great walkthrough — loved the clear steps. A few notes from my build:
    1) I used a micro servo for portion control (easier and cheaper), but if you want bigger pellets go with a geared DC motor.
    2) Make sure your power supply can handle the motor start current, otherwise strange resets happen during Step 3 (wire the Arduino and motor safely).
    3) Calibrate portions several times — I had to tweak the code in Step 5 three times before it was consistent.
    Overall: quick, no-fuss-ish 😉, but still expect to test and tweak.

    • Totally agree on the separate supply. I fried an UNO once when the motor drew too much during startup 😬

    • Thanks for the detailed tip, Alex — good call on the motor start current. I should add a short note on using a separate power supply and common ground in the guide.

    • Did you add a diode or snubber for the DC motor? I found back-EMF caused weird behavior until I added protection.

  3. Pretty solid instructions on wiring. One thing I had to remind myself: always disconnect power when re-wiring the motor — even a second with the wrong connection can short stuff.
    I also added some heat-shrink and zip-tied everything thanks to Step 6. Safety first!

  4. Build complete. The feeder works AND my cat thinks it’s a new snack dispenser for him. Not sure who benefits more. 😂

Comments are closed.