Everyone with pet fish, either in a pond or an aquarium, has had the issue of not being able to feed them when on holiday. To solve this, I decided to make an automatic fish feeder. Since my fish are in a pond outside, I wanted to make this project solar powered.
The feeder also allows you to feed them smaller quantities of food several times a day – as recommended by the producers of the food (although this could also be a trick to sell more). Besides the solar panel, we will use a few other cheap components to keep the project low cost.
Don't forget to vote if you like what you see, but for now: let’s get building!
Step 1: Parts & Tools
- Arduino nano
- Solar panel
- Lithium cell (mine came from an old laptop battery)
- Lithium cell holder (18650 size)
- Lithium charger & protection circuitry (TP4056)
- Boost converter (variable or fixed to 5V)
- Real time clock (DS3231 module)
- Small servo motor
- Small signal mosfet (200 mA): 2N7000
- Molex (or other) connectors
- Empty water bottle
- Fish food (you didn’t expect that, right)
- Handful of M3 screws
- Soldering iron
- 3D printer
- Hot glue gun
Total cost: <$15
Step 2: The Build
We will start the project by building the mechanical part. The idea is pretty easy: a wheel with a cutout is filled with food (by gravity) and rotates to dump its contents, as can be seen in the drawing.
The very first step is 3D printing all the required parts, and having a lot of patience. I printed all of the parts at 0.3 mm layer height, and supports where necessary. Make sure the wall thickness is set at 0.8 mm or more. When the prints are finished, we can start with the assembly of the mechanism.
The first part to be assembled is the feeding mechanism itself. Take the wheel and screw or glue the servo connector in place. The wheel can now be inserted in its armature (WheelBody) and should be able to spin freely (if not, you might need to sand the parts). The cover (WheelCover) can be attached to close the feeding channel. This subassembly can be completed by attaching the servo and screwing it in place.
Next up is the top of our fishfeeder. We start by installing the switch and the solar panel in their appropriate cutouts. Apply some hot glue around the edge of the solar panel to make it watertight. Next, we can insert our previously made subassembly in the top.
The last part of the build is the base. It will provide a funnel for the food, as well as preventing our structure from tipping over. Therefore, I filled the base cavity with small nails, but you could also use some concrete. Cover this off to prevent the nails from spilling (BottomCover). We can now join the bottom to the top with some M3 screws to finish our structure.
We now have a food dispenser, but no place to store the food yet. So we'll add a water bottle for food storage; it simply screws into the top. As a final touch, I added a 3D printed fish at the front of the unit.
Step 3: The Electronics
The electronics for the project are fairly simple, since we are going to use prebuilt modules. I suggest building the circuit on a breadboard first before soldering everything on a perfboard.
We will start with the power supply of the project. The power will come from a solar panel, and we will use a battery to handle current spikes when the motor turns.
We can solder the solar panel to the input of the battery charger module TP4056. Next, the battery holder can be soldered to the corresponding terminals. The output will be around 3.7V, which is not enough for the arduino or servo motor, so we'll boost it to 5V with the boost converter; I desoldered its USB port to save space.
The switch I soldered between the charger and boost converter was just for testing purposes and can be omitted.V
We now have a circuit that puts out 5V for the servo and the brains of the circuit.
The brain of the project is the beloved Arduino Nano. We connect it to the realtime clock via the I2C line as can be seen on the schematic. We will power the RTC with the Arduino, so that we can turn it off to save power.
The servo will also only be powered when it needs to turn, but since it draws more current than the Arduino can provide, we will power it via a mosfet.
The circuit we have just created will work, but we will need to use some tricks to ensure operation with the limited power constraints. We need to modify the components to make them more energy efficient.
First of all, this means removing all unnecessary LEDS from the RTC, boost converter and Arduino.
At this point, our circuit will consume about 7 mA (when the Arduino is in power saving mode, more on this later). This is not much, but since the solar panel can only deliver 3 mA, we need to lower the power consumption.
The Arduino chip (Atmega328p) alone consumes less than 1 mA, so where is the additional current coming from? The culprit is the voltage regulator on the Arduino nano board, so we'll need to desolder it.
(Even though we power the arduino nano from 5V, which means the voltage regulator is not used, the regulator still draws a quiescent current of several mA.)
At this point, the Arduino still consumes about 7mA in powerdown mode (more on this later); while this is not much, it is too high to be solar powered. The ATMEGA328P chip alone consumes much less however, so where is the additional current coming from? The culprit is the voltage regulator. Even though we power it from 5V, the converter also draws a current when there is a voltage on its output pin. As a result, we need to desolder the 5V regulator from the board; the current is now less than 1mA!
We now have all the components needed to make the magic happen. Solder them nicely on some perfboard, and use headers for the switch and servo motor. The battery holder and circuit can now be glued in place in the top of our fish feeder. The battery can also be inserted.
In the next step we will blow life into the hardware with some software!
Step 4: The Software
The only thing left to be done is uploading some code to make things move!
When uploading the code for the first time, the real time clock should be configured automatically. If the battery ever runs out, the RTC can be set by re-uploading the code.
At the top off the code, we can set the specifications for our feeding scheme. You can set the months in which the fish need to be fed (normally between march and october), the time at which to feed and the amount of food.
The loop is pretty straightforward:
- The RTC is enabled and the time is queried
- The time is checked against the feedtime
- If the time is right, the servo will turn
- Go to sleep for 8s, this is to save power
The button we added can be used to feed the fish manually, to give them a treat so to speak.
When it is pressed, an interrupt is triggered, and this will be detected in the loop.
Once the code has been uploaded our creation is alive!
Step 5: Test & Enjoy
We're done! The only thing left to do is to see if our fish are happy!
After a few days, my fish are already used to their new feeding scheme. Every day at 1 o'clock, they gather at the feeding spot and enjoy their meal. And if I want to give them some extra (or rather: show off my creaton) I press the button to give them a bonus. I hope you liked the project as much as my fish do!
Feel free to check out my other instructables here: https://www.instructables.com/member/ThomasVDD/
Grand Prize in the
Automation Contest 2017
Runner Up in the
First Prize in the
Solar Contest 2017