What better way is there to spend holidays than doing DIY projects. This project will be perfect for anyone who owns a planted aquarium.
This project is a combination of the following
- An aquarium temperature monitor
- Timer controls for light
- Timer controls for CO2 system
- An automatic fish food feeder
- A web interface to control all the above
Before we get into the engineering side of this project let me introduce you to the more fascinating world of planted aquariums. Until I had my first aquarium almost a year back, I thought all I had to do was get a glass tank fill it up with water, put some stones and drop in some fish.

And unfortunately, this is how I started off, with a 5-liter tank, and two mollies. But soon those mollies died and then when I tried to figure out what went wrong, I soon realized that there was nothing I had right. Then youtube took me down the rabbit hole of aquascaping and aquarium maintenance and several weeks later with regained confidence, I decided to go all in. Got a 2 feet tank( approx 70 liters).
Thanks to several channels on youtube and especially Mayur sir
If you think about it, setting up a planted tank is actually straightforward
What do plants need to thrive?
- Light source
- Fertilizer
- Carbon Dioxide
And what do the fish require?
- Food
- Clean water
- Oxygen
That is all there is to a planted aquarium:
- Keep your water clean ( A good aquarium filter helps you do that)
- Use a good light
- Inject carbon dioxide into the tank
- Feed you fish
What is important is that you maintain the balance of light, CO2 in your aquarium so that you hit the sweet spot where the plants can thrive and the fish are not subjected to CO2 poisoning.
With that basic crash course on planted aquariums let us now get into automating one. This project can be done with any microcontroller board as long as it can somehow connect to your wifi network.
I had a RaspberryPi B+ board lying around and hence ended up using it with the Raspbian OS.
My Raspberry Pi was configured to work in the headless mode which means all I needed was an ssh connection.
I will not get into the details of how to configure a Raspberry pi as the internet is already full of such tutorials.
This whole project was made as separate modules and I integrated them at the end.
The entire code for the project is available at https://github.com/vineethkartha/AquariumMonitor

Temperature Monitor
I used the standard DS18B20 Temperature Sensor, which can be submerged in water.
The DS18B20 is a temperature sensor that uses the 1-wire protocol. That means other than the Vcc and Ground connections all it needs is a single wire to send and receive data from the Raspberry pi

In the above diagram the Data pin of the DS18b20 has been connected to GPIO4 of the Rapsberry Pi B+. Once the wiring is complete we will have to configure the Raspberry pi to enable the 1-Wire interface.
Open a terminal on Raspberry Pi and run the following
sudo raspi-config
and follow the steps shown below



You should get a confirmation window once the 1-wire interface is enabled for the Raspberry Pi. After this step you might have to reboot your Raspberry pi.
Now we are all set to read the temperature.
import os
import glob
from datetime import datetime
class DS18b20:
def __init__(self):
os.system('sudo modprobe w1-gpio')
os.system('sudo modprobe w1-therm')
self.deviceFile = glob.glob('/sys/bus/w1/devices/' + '28*')[0]+ '/temperature'
def readTemperature(self):
sensorFile = open(self.deviceFile, 'r')
lines = sensorFile.readlines()
while not lines:
lines = sensorFile.readlines()
temperatureString = lines[0]
temperatureInCelsius = float(temperatureString) / 1000.0
return temperatureInCelsius
Relay Modules to control lights and CO2
You will get relay modules to buy online but I wanted to put some of my soldering skills to test. So I decided to make my custom relay module.

Automatic Fish Feeder
For the fish feeder I used a servo motor and attached a small plastic container to one end. Made a small hole in the container such that when the servo rotates 180 degrees, the food will fall .

And the web interface to the whole project looks like this

The post has been kept brief to share the general idea and I hope this gives the readers a chance to explore this project on their own and comeup with more ideas for their aquariums.
