Arduino Aquarium Controller V.2





Introduction: 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.



    • Backpack Challenge

      Backpack Challenge
    • Stick It! Contest

      Stick It! Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    4 Discussions

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

    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

    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.

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