In this tutorial I'll show you how to make an automatic fish feeder. This is what I use to feed my pets while I'm away and it works pretty well!

How does it work?

The ATtiny85 controls 2 channels of servos (4 (in parallel) on one channel, 2 (in parallel) on another channel) which will open the gate of each one of the food containers. If you want, you can easily change this configuration by modifying the Eagle Layout I made.

The Feeder will operate on a DC power supply from 6 to 9V.
(Be aware that using a higher value of supply voltage will result in need of heat dissipation for the voltage regulator)


I am sorry for the bad image quality (all were HD but it seems that while uploading they get compressed).
This is my first tutorial, any help is appreciated.

I hope you like it!

Step 1: Get the Parts

To make this device, you will need the following:
- 1 Microcontroller : ATtiny85 / ATtiny45
- 1 DIL8 Socket
- 1 Resistor (330 Ohm or 220 Ohm, it's for the LED)
- 1 Voltage Regulator 7805 (look for a low dropout voltage regulator if powering with 6V, LM2940CT-5.0 is fine) 
- 1 DC power adapter
- 2 Capacitors (10microFarad is fine, they're for the voltage reg.)
- 1 to 6 Servos (Small ones preferably)
- 1 to 6 Servo extention leads
- Some wire
- Some thin balsa wood
- Transparent plastic tube (This is the food container)
- Metal wire (aluminium wire)
- Glue
- Double sided sellotape or velcro
- 1 Project Box (70x50x25 mm)
- 1 SPST Switch
- 1 LED
- 1 Self-adhesive PCB Mounting Pillar (if you plan to use one make sure that it's small enough to fit inside the box)
- 1 Barrel Jack
- 1 Male pinhead connectors row
- Stuff to make your PCB : Copper board, etchant, laser printer, iron, soldering equipment, etc.

Appart from this list and if you don't have an AVR programmer, you will eventually need the components of the following tutorial:
Those are required to program your ATtiny with an Arduino Board!! (and that is how I programmed it)

Step 2: Make Your PCB and Prepare Connectors

Once you've got everything you need you can make your PCB. I won't cover the methods, you can find plenty of instrucables on how to make it on this very website. Personally I think that the toner transfer method works pretty well.

Solder the wires to the switch, the Jack barrel plug and the LED.

Some changes:
-I finally decided to put directly the switch between power input and the board instead of putting it on the board. I just had to short the switch pads I had made on the board. This is really up to you.

I post the schematics and Eagle PCB layout:

Step 3: Code

Now comes the hardest part of this tutorial. As I'm using the Arduino IDE the servo library that comes with it won't work with the Attiny (atmega uses a 16 bit timer while attiny uses an 8 bit timer). If you are not using the Arduino IDE you can check out this website to run your servos:

Otherwise you will need to create your own servo library (if you do please post it on the arduino website!) or you will have to write the signal that the servo requires. A servo basically needs PPM (pulse position modulation).
How does it work? The length of the "HIGH" pulse will tell the servo which position it has to move to. The "LOW" pulse is required between 2 "HIGH" pulses and has to be 5-25 ms long
You will have to play around with the pulses length because it depends on you servo, the angle you want to open the gate (dropped food), etc

The food is dropped differently in each channel (aquariums have different sizes). The first channel's servos make a little and quick movement (this is one is for the little aquarium). The second channel's servos make a little wider movement than the previous and does it 2 times. This is to avoid a sudden excessive food dropping.

Comments are welcome!

If you have an arduino and want to program your attiny using it you may want to take a look at this tutorial:

Some improvements that will be done shortly:

-Using sleep mode to lower the power consumption and run it on a battery

Here is the code:

Step 4: Make the Food Container

You will need to cut some transparent tube, its length will depend on the time you are away and the amount of food your fishes eat.
Make the servo stand in balsa. It has 3 parts, 2 are the same. (see pictures)
Once you glued them you can fit the plastic tube and leave its extremity just where the edge of the top part ends so everything is aligned and the servo gate can come exactly perpendicular to all parts when shut.
The gate can be made from the remaining square from the top part. Cut a bit in the middle of this square to introduce the servo arm and put some glue.

To make the stand  (when everything is dry) you can twist the metal wire around the transparent tube and shape it to your needs.
You can use double sided sellotape to stick the servo to the top of the structure, but before you do so make sure that your attiny won't tell the servo to turn to an angle smaller than 90º otherwise you may damage your setting.

Use double sided sellotape or velcro to fix the servo to the stand.

Improvements that will be done:
-Using an hermetic container and gate because humidity can damage food if left for a long period of time.

Step 5: Make Your Project Box

The box needs to be adapted to this project.
You will need to drill some holes:
- Jack plug hole
- Switch hole
- LED hole

I recommend to use drilling bits with smaller diameter and then use bigger ones, this enables you to drill more accurately.
Place all of these items with wires already soldered to their corresponding position.

Cut some other holes:
- carve 6 holes to fit the the cables of each servo on the sides of the box.

Now assemble the PCB and solder the wires you had on your plug, switch etc to the board.

Step 6: Finish

I recommend to use sellotape to fix your PCB to the bottom of your box or use a mounting pillar (mine did not fit).
Plug as many servo extension cables as you need.

Close the box, plug the servo to the extension leads, fill the containers with food and you're ready to go!

I hope you liked it! Comments are welcome! ;)
Useful new way to feed your fish. This automatic fish feeder is excellent for people who have busy lifestyles and still want to properly take good care of their fish and tanks. It's available at zeromartz.com
put a lid on that thing :0 last thing u want is him to jump out X3<br>he may never try but u dont wanna chance it
Actually there's a plastic top with a small hole to let the air flow and that lets you feed the fish, but I didn't put it when I took the picture! Anyway, thanks for the comment, people must know that fishes can jump! hehe
I have a fish pond that we raise goldfish in. During the winter we bring them inside and we have had 10 inch goldfish jump out of our holding tank and die
That is sad... A friend told me that some of these pond fishes can survive really low temperatures, even with a frozen water surface, but I guess that this might depend on other factors such as time exposed to the cold, etc..
The site you linked to actually has an Arduino library for servo control... it works pretty well... <br><br>http://www.cunningturtle.com/wordpress/wp-content/uploads/2011/11/servo8bit_arduino_example.zip
I remember giving it a try and not succeeding for some reason. Conflicts with something, I don't remember if it was because I had more than one servo, but there was something that did not wok for me. I can't state it does not work, but for me it didn't.
it sucks! lol just kidding. just an question.did you try to fit the mechanical parts inside the cover/lid of the tank? <br>but otherwise it still a nice instructable.
Thanks! There are some gaps on the cover so you can bend the wires and clip them there and the whole thing won't move. Placing everything inside the aquarium might not be the best idea because humidity could ruin the food and there is not much space under the cover..
I would suggest that since there are so many i'bles on how to make PCBs and if you have one that you prefer, that maybe you'll link to it?<br><br>Otherwise a nice one :) shame I don't keep fishes anymore
I'll make that instructable ;) I found a way that works every time without problems. As you can see on the pictures the PCB looks really nice hehe. I gathered information from many instructables and from youtube videos and picked the best techniques.

About This Instructable




More by gab3iel:Auto Power Off: save batteries (AT)tiny Fish Feeder 
Add instructable to: