Arduino Aquarium Controller V.2




Intro: Arduino Aquarium Controller V.2

This is my first Instructables and English is not my native language, so I'm sorry fot the mistakes.

On the internet you can find many Arduino aqurium controllers. This is my version, improved from one of them.

I hope, that this will help somebody, or somebody else will improve it further.

Step 1: Follow This Instructables

First of all, you need to follow theses instructions.

As you can find out, these instruction are very detailed, so any debugging is quite simple, although I have noticed one problem. I wanted to use time for sunrise/set 90 minutes. Problem is, how the step is calculated. The program use simple definition step=255/time. In my case, the calculated step is 2. So after 90 minutes, the rest is 255-2*90=75 and the last step "75" is done at once. So I realised that is necessary to use minutes 255, 127, 85, 63, 51 etc.

I've tried to change the format of constant in the program, but it's not working. If somebody else will find the solution, I will be happy to be told.

My second notice is about the display. I use 10k resistor instead of jumper on the pins which control the backlight. This secure good contrast and the display is not too bright in the dark room.

Step 2: Adding the Temperature Sensor

The temperature sensor I use, is water resistant variant of DS18B20. You can buy it on eBay or Ali-express. The basic wiring is on the picture. On the variant we used is red = +5V, black = GND, yellow = DATA PIN.

The DATA PIN of sensor is connected to D4 on Arduino board. You will also need the arduino libraries OneWire and DallasTemperature. Reading of temperatur takes arduino about 1 second, so it is read only every minutes.

Step 3: The Moonlight

For simulating the moonlight I use RGB strip. First of all I wanted to use just the blue LEDs, but after short searching i figured out, that moonlight is not just blue.

To simulate this, I added one menu, when you can set RGB value. This value works like lower limitations and the values of RGB powers never drop below.

Step 4: The Code

Here are the necessary libraries and the code for Arduino. Before you upload it, don´t forget to change the I2C address of time module and display.

I have also done few changes about setting the time. Now there are displayed the names of values (sec, min, day etc.)

Step 5: Conlusion

I hope my notes were helpful. If there are any questions don't be shy and left the comment.



    • Fix It! Contest

      Fix It! Contest
    • Metalworking Contest

      Metalworking Contest
    • Tiny Home Contest

      Tiny Home Contest

    8 Discussions


    7 days ago

    hola el trabajo es impresionante,e bajado los ficheros pero a la hora de compilar me produce muchos errores,creo que hay algo mal, me dice que positive no esta declarado en scope y ya me pierdo, lo sienpo pero solo hablo español,me podrias proporcionar los ficheros a mi correo? gracias por todo.

    3 replies

    Reply 6 days ago

    Do you have all the libraries properly downloaded and installed?


    Reply 5 days ago

    hola gracias por responder era culpa mia por las bibliotecas,ya esta funcionando sobre arduino uno ,estoy esperando el nano,me queda prepar el sistema de dimeo para la pantalla, ya os comentare,carrareare un poco a ver que sale je je gracias.


    Reply 4 days ago

    I'm glad to be helpful. Also, I'm looking forward to your version.

    Edgar MakotoA

    10 months ago

    TKS!!! you remind me!! int/int=int

    Edgar MakotoA

    10 months ago

    Hello Tks for the code.

    I made some changes.

    Configured to turn off at 23:30hs with the lines

    if(current_time_in_min > sun_set_in_min && pwm[2]< moon[0] && current_time_in_min < 1410)

    but one question, i want to fade the moon light, but having problems. Tried put this line without success.

    byte A=(255/(sun_rs_step[4]+4*90)), B=(sun_set_in_min-(sun_rs_step[4]/4));


    if(current_time_in_min > sun_set_in_min && pwm[2]< moon[0] && current_time_in_min < 1410)


    pwm[2] = (moon[0]*(1410 - current_time_in_min))/((1410-((64+A*B-moon[0])*(sun_rs_step[4]+4*90))/A));

    pwm[3] = (moon[1]*(1410 - current_time_in_min))/((1410-((64+A*B-moon[1])*(sun_rs_step[4]+4*90))/A));

    pwm[4] = (moon[2]*(1410 - current_time_in_min))/((1410-((64+A*B-moon[2])*(sun_rs_step[4]+4*90))/A));


    1 reply
    jandy171Edgar MakotoA

    Reply 10 months ago

    I suggest the main problem is "byte" value and the way, how arduino calculate it. In your case" A=255/360 So A is in this case just 0 no matter the value of sun_rs_step is.

    So going further, you are using dividing by zero.

    DIY Hacks and How Tos

    11 months ago

    Good idea. With an Arduino monitoring system, it might be a little easier to actually keep a fish alive.