Raspberry Pi powered fishtank


My fishtank is now internet-connected. It is run by a Raspberry Pi that can do three things: Feed the fish, switch the lights and take pictures.

To feed the fish, the Raspberry Pi sends commands to an automatic fishfeeder that I modified. It can empty any container in any order. This is achieved by an Arduino Pro Mini, two servos and a motor (more). The plate prevents hot air from flowing into the feeder. In an early iteration of the project, this made the food sticky and kept it from falling into the tank. Switching the lights is done using a remote light switch and 433Mhz transmitter. Finally, there is a webcam that is connected directly to the Raspberry Pi to take pictures.

The setup sits on top of my aquarium:

Raspberry Pi and fish feeder on the fish tank

The Raspberry Pi runs a python / flask server that provides a web interface. If everything works, the web interface of my fishtank is available here:

http://fishtank.marian42.de/

The food stored in each container is remembered by the python script. This allows rules like “Feed the oldest food first” or “Prefer flake food”. The script will also try to minimize the rotation time.

Feeder

The Raspberry Pi performs planned events that can be set up and monitored through the web interface.

Automated Schedule

To prevent overfeeding, the server remembers a “saturation value” for the fish. Whenever the fishfeeder adds food, the saturation value is increased (eg. by one for a typical one day portion). The saturation is gradually decreased by one per day, but doesn’t go below zero. A value below 1 means that the fish are hungy. Planned feed events are only automatically performed by the Raspberry Pi when the saturation is below 1. This mechanism makes sure that on average the fish get about one portion unit of food per day.

Webcam

The web interface allows guests to feed the fish. This feature is only available if the fish are hungry and the lights are on. Guests can choose what kind of food to feed. Once the process is complete, a picture is taken and displayed on the website.

Webcam

The pictures taken with the webcam can be used to verify that everything worked.

Pushbullet

Whenever the fish are fed or a picture is taken, the picture is sent to my phone using the pushbullet API.

The server keeps a log of all events and errors that can also be viewed on the web interface.

All the source code for this project can be found on github.

2 thoughts on “Raspberry Pi powered fishtank

  1. Miguel

    Hello Marian! First of all congrats for the good work and thanks for sharing it!! I’ve seen this project a few months ago and I started trying to implement it by my self a few days ago. It was a bit difficult in the beginning (I’m a bit new to the web world, I’m a c++/c# developer) but I’ve managed to make almost everything working (for now I’m just trying to set a light schedule, I’m ignoring the camera and fish container). I think that the code you have on git might be uncompleted. It seems that the light events icons are not being used anywhere… After I create an event is does not show the icon on the timeline. Also I cannot choose if the light event it is to turn on or off since the icons don’t appear. Can you please help me with this? I’m a bit noob with js, so if I had the original code it would be great for me to understand correctly how everything is working.

    Btw, I found out that unfortunately your fish tank is not online anymore 🙁 . I gave some food to your fishes a couple of times eheh, did you disassemble it?

    I hope you will reply to me. Cheers, Miguel

    Reply
    1. Marian Post author

      Hi Miguel,

      sorry for the late reply.
      The code on github is the code I’m using on my project, so this is at least the version that worked for me. Since my setup isn’t running right now, I don’t have a quick method to test. The reason my fishfeeder isn’t running is because the food dispensing mechanism was not reliable enough. The mois air from the fish tank would flow into the feeder and make the food stick to the container. This kept the food from falling into the tank. Sorry I can’t be more helpful right now…

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *