Aquarium Controller

From Flav's Wiki
Revision as of 20:16, 9 October 2014 by Flav (Talk | contribs) (Input switches)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Aquarium Controler


The objective of the Aquarium controler is to control the lights intensity, to stop/start 110-240V devices (lights, CO2 solenoid) and to display the temperature.

The intensity of two of the lights is controled by PWM.

Future enhancements will be to display pH, to control CO2 distribution and to record the parameters.

First Version


I started by using an Arduino Uno controler and some parts I already had.

Two chanels will drive led lights controled by Meanwell ldd-1000h 1000mA led driver and a CO2 solenoid using an Arduino relay module.


The parts available that I had were:

  1. arduino uno (~20€)
  2. Temperature meter TMP36(~3 for 5$ on Ebay)
  3. lcd display 16x2 (~2$ on Ebay)
  4. Tiny RTC based on Maxim DS1307 (~1.5 to 3$ on Ebay)
  5. several switches
  6. several LEDs
  7. LM 358 Dual Op-Amp (~1.5$)


  • The 16x2 LCD is takeing 6 I/O on the Arduino
  • The Tiny RTC is connected on I2C interface of the Arduino: pins A4 and A5 are not available in this case (I2C uses A4/A5).
  • 2 PWM are need for the led driver.
  • I want to use the Serial Port for debugging: D0 and D1 are then not available.

Git Hub Repository

The repository for this version is here:

The Breadboard Prototype

Aquarium bb v1.png

The Schematics for v1

Aquarium sch v1.png

The LCD 16x2 Screen

The LCD screen is a classical mount like explained in the Arduino Tutorials I have changed the design to use pins: 13, 12, 5, 4, 3, 2 instead of those in the tutorial.

Tiny RTC

The Tiny RTC is a real time clock. It means that it keeps the time even when the power is off. It is based on DS1307 I2C real time clock IC. It also has a 24C32 32K I2C EEPROM storage that we do not use in this application. You can have a look at this link for more information: (the DS18B20 is not present on my version).

The connexion is a direct connection on I2C pins SDA/SCL. Also GND/5V are connected to TinyRTC in order to supply power.

For the software, I used the RTC lib from (version 573581794b73dc70bccc659df9d54a9f599f4260).

TMP36 temperature sensor

Use of an TMP36 temperature sensor:

The TMP36 was the most tricky device to implement. Basically it is easy to set as on the Adafruit webpage but the readings are not stable and the prescision is not good.

In the mountig like "Simple Thermometer", connection the output of TMP36 to A0 pin of Arduino, the precision is in 5V: 5V/1024=5mV. Temperature formula is: Centigrade temperature = [(analog voltage in mV) - 500] / 10 . So the precision is 5mV/10 = 0.5°C.

But that is not all. The supply voltage is used as reference for the Arduino AD converter. If it is not very stable, as I expericenced the you will easily have severals °C of error.

That is why I have amplified the signal using a LM358.

Aquarium sch tmp36.png

The output of the TMP36 is amplied by a non-inverting circuit. The output voltage is multiplied by: (R10+R8)/R8=(500+220)/220=3.27. At 25°C , TMP36 provides 750mV so there will be 2,45V on A0. For un aquarium we supose the temperature will not be greather than 30°C. This means on A0 we will have 2,6V.

The mesured voltage has now to be divided by 3.27 in order to calculate the temperature: T(in °C) = (V/3.27-500)/10 in mV. The precision will be now around 0.5/3.27=0.15°C.

As the measure is not stable we are going to make an average on the measurement on some samples.

Also as the resistors and the supply voltage is not exact you should mesure the exact values on AREF and off R8 and R10 resistors. You can then use these values in your software.

Input switches

The input switches schematics are based on the same schematics as in and

This can be also part of the LCD screen module, example:

The Code

The code, including the schematics for this version is here:

to describe

The LED lamp

The LED system based on 9 x CREE XML XM-L T3 and T6 (~ 5.5 US$ each) and two meanwell ldd-1000h led driver 1000mA (~7 US$ each).

The LED are mounted in serie on the output of the LED driver. We have one serie of 4 and another of 5.

Forward Voltage in one XM-L is arround 3V and up to 3.5V.

For the 5 serie the total voltage is around 15V and up to 17.5V. The power supply must be more higher than this last value.

The consumed total power of leds is around 27W (3W each).

I used an old 19V PC laptop power supply. This has enough voltage and power.

Future Enhancements

Add a flow meter based on this:

For enhancement there are some other parts here: Aquarium Controller/other_parts

Change the TMP36 for something more stable

Add a pH meter

Use an Arduino Pro

My Notes


Please leave me comments here: