Saturday, 06 February 2016 04:48

Automatic aquarium controller

Written by
Rate this item
(0 votes)

And here’s one more project that shows: laziness makes the progress. I have a fish tank in my room – but I am too lazy to turn on the light in it and frequently forget to feed the fish. And the sound of constantly working air pump annoys me. The fish and water plants felt themselves bad in such a conditions. So the automatic aquarium controller became the one of my first DIY electronic devices.

DIY automatic aquarium controller


    It’s main functions are:

Turns the light in an aquarium on and off at a preassigned time

Turns on an air pump or water filter for a given time with given frequency.

Checks the water temperature and turns on the heater if it’s low.

Feeds the fish using my DIY automatic fish feeder.

All settings are stored in the microcontroller EEPROM memory – so discontinuities in power supply are not a problem.

Schematic and description

Fish tank controller is made using AVR ATMEGA 16 microcontroller

Automatic aquarium controller schematic

The AC power is switched to 3 outlets with BT136 triacs which are controlled  by a microcontroller through MOC3023 optocouplers. Capacitors C1-C3 must be 400V compatible, and resistors R1-R6 must sustain 1W power dissipation. The triacs have small heat sinks.

As you might spot at the photo, I changed one of the triacs to a relay. It’s because I use a cheap fluorescent lamp for my aquarium and it doesn’t work via triac.


The water temperature is measured with DS18B20 sensor, that is connected to a microcontroller PORTC 6 via OneWire bus. It’s not on the schematic because I decided to use it after the PCB was made. Before this sensor, I used LM35 temperature sensor – and it was connected to I2C bus near the RTC module.

The DS1307 real-time clock module (RTC) provides the data about time. Its main advantage is independent Lithium cell battery power source – so the clock remain ticking when the main power supply may be turned off. The RTC is connected to a microcontroller via I2C bus. In this schematic it is I2C_CONN1 and I2C_CONN2 headers.

The stepper motor driver for automatic fish feeder is a ULN2003A IC.  It was soldered a year after this controller was made. When I was planning the PCB - I placed the group of empty pins “just in case” – and now they came in handy. But I had to connect the IC to a microcontroller with wires.

 DIY automatic aquarium controller PCB

Data input-output

To input the data to a microcontroller I made a simple keyboard. It is just a four tact buttons soldered at a perfboard. Three of them are connected to PORTB0, PORTB1, PORTB4 of ATMEGA 16, and the fourth is connected to a RESET pin. Two LEDs are there, too. The keyboard is mounted at the front panel of the device casing.

To output the menu information from the microcontroller I used a 0802 text LCD. Minimalistic but cheap.

The LCD and keyboard are connected to microcontroller via flat cables with IDC-10 sockets. One more socket is used to connect the MC programmer (USBAsp or AVRISP MKII).

homemade aquarium controller

The power source is a 5 volts cell phone charger. It’s attached through 5.5x2.5 connector which I placed at the front panel just under the LCD screen/. Boring mistake – but it was my first experience, so don’t beat me too hard ;-)

The PCB is designed in Proteus 7.8. I Used single-layer PCB. The tracks at the Top Copper (red color) layer are made by wires.

The microcontroller program is made in Atmel Studio. I used the libraries from the Internet for the DS18B20, DS1307 and the LCD.

The device is very cheap - its total cost is under $20. 


The schematic of my automatic aquarium controller and the program for microcontroller you can download here.

Read 3346 times Last modified on Friday, 05 February 2016 09:29
Login to post comments