Introduction: The Ultimate DIY Automatic Fish Feeder: Tier 1
Tier 1 is the most basic feeder. Use this if you're on a tight budget or, like me, you can't get Tier 2 working before you leave for a week and a half for the holidays. There is no lighting control.
Amount and Type of Food:
I have a betta and 5 neon tetras in a 13 gallon tank, one feeding cycle puts enough food into the tank for all of them. The feeding mechanism is the same for all three tiers, so if the amount of food it meters out is too much for your tank, I've provided the CAD files from Fusion 360 for you to edit, simply reduce the size of the pocket in the feeder wheel to reduce the amount of food coming out. If the amount of food coming out is not enough, simply copy/paste the feeding code in the arduino to dump a second or third portion into the tank.
As for the type of food, I've only tested it with ground-up fish flakes. In theory, any solid food should work, and I have found that unground flakes will clog the hopper. So, if you use flakes like me I highly recommend you grind them up to the point where they will all fit into the wheel in any orientation, and pay special attention to this if you're planning on leaving the tank unattended for a long period of time (like, more than a week), a clogged hopper will prevent your fish from being fed!
Step 1: What You Will Need
- Arduino Nano
- Access to a 3D printer
- 3D printed parts x4 (STL files provided)
I recommend using food-safe plastics to avoid contaminating your tank. When cleaning up the printed parts, make sure there are no plastic particles that can fall into your tank or chemicals that will leach into the food.
9 gram servo, I used an SM22 I had laying around
Hot glue gun (and hot glue)
Basic light timer
Wire (I used breadboard jumper wires)
An old phone charger to power the arduino
Your preferred Fish Food
Step 2: How It Works
The hopper holds all the food, I filled mine about 1/2 of the way up with crushed flakes and it lasted a month with 2 daily feeding cycles.
The arduino is plugged into the light timer, and the timer is set to turn on at the times you want to feed the fish and turn off at the smallest interval it can, or more than 30 seconds if your timer can turn off immedietly for some reason.
The feeding cycle is in the arduino's setup code, so it only runs once. the arduino then runs an empty loop cycle until the light timer turns off.
The feeder meters out a portion of food and puts it into the tank, then returns the servo to a default state before resting until the next feeding cycle. There is no housing for the arduino, I had intended this tier to be a test-bed for the mechanism before I moved onto the harder bits for tier 2, but the holidays arrived and I was forced to use this as a stop-gap measure to ensure my fish survived my absence.
Step 3: Print the Files
You're not going to get far without them.The .zip folder contains two sets of STL files, one for the original SM22 servo motor that I used and another for the far more common SG90 servo. Both contain the Fusion 360 files if you want/need to modify any of the parts. The SM22 STLs definitely fit together, since they are the ones I have used. I have not printed or tested the SG90 parts.
Make sure the bottom will fit on your tank. By default it's designed to fit on my tank's 13mm rim. Simply adjust the Fusion 360 file to fit your tank.
If you modify the feeder wheel, remember to keep the pocket as wide as the opening in the hopper, too small and food could get stuck and too big and it may slip past the wheel and overfeed your fish. I recommend calculating about how much food you want dispensed at a time by volume and changing the pocket's dimensions to match.
When printing, be sure to use support material for the wheel pocket and bottom. You can print the hopper upside down without support material, and I printed the bottom upside down as well so the support material was in the servo's cutout for cosmetic reasons, and it leaves the mating surface smooth and level.
For materials, I recommend using a food-safe plastic. I used Raptor PLA from makergeeks, which comes in a ton of colors and is super strong after you anneal it for 10 minutes. That can be done by boiling the parts, which I recommend you do for just the wheel if it doesn't quite fit since annealing will shrink the parts by about .3%.
All the parts should take about 1-3 hours to print depending on your machine's settings, plenty of time to complete the next step!
Step 4: Programming the Arduino
While those parts are printing, upload the Emergency Feeder sketch to your arduino and attach the servo to the proper pins (Power to 5V, GND to GND, signal to pin 3) with some wire.
Every time the arduino is powered on, it should run one feeding cycle, then do nothing until it is powered off and powered on again or reset. If you want more than one feeding cycle, copy/paste the code until you have the number of cycles that you want. make sure void loop() stays empty.
Once you confirm that the servo only runs when the arduino turns on or resets, I recommend hot-gluing the wire connections to prevent them from getting pulled out accidentally. Test the servo again to make sure everything is still connected. If you somehow mess this up, just remove the hot glue and try again.
Step 5: Assembly
Once the 3D printed parts are ready, test the fits. The servo should fit within the hopper and bottom along with the wheel. Make sure the servo is in the default position the code brings it to (just wire it to the arduino and let it run a feed cycle), and hot-glue the feeder wheel to the axle of the servo, a medium-sized drop should be enough, you want the wheel firmly attached but don't want excess glue to clog the servo itself. The pocket in the wheel should face upwards towards the hopper when the glue solidifies. If you mess up, remove the glue and try again.
Test fit everything again, this time, run the feeder code to make sure that the wheel is spinning freely. If it is, put some of your food in the hopper and run the feeding cycle to make sure the amount of food you want is coming out and that no plastic is coming out with it.
When you're satisfied with the feeder, hot glue the hopper and bottom parts together, be sure to only glue the flat areas, if you glue too close to the wheel it could get stuck. The servo is held in by the two halves of the feeder and does not need to be glued, but you can glue it down too if you want.
Step 6: Setup
Now you can fill the hopper up as much food as you want and put on the lid, I filled mine 1/2 of the way up and it lasted a month, so use the lid to protect the food from excess moisture or pests.
Plug the arduino into the light timer and set the feeding times you want. Only have the timer turn on at these times (and shut off as soon as it can) since the arduino will feed your fish every time it turns on. I recommend choosing times you will most likely be around to see the feeding happen, that way you know it is still working days or weeks later.
Congratulations! Your feeder is done, simply place it on the edge of your tank and just be sure to check the food levels every few days. I left mine running for a full month before I got the next level working. Tier 2 uses a wifi module to sync its clock and controls the tank lighting, be sure to check it out!