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.
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:
- arduino uno (~20€)
- Temperature meter TMP36(~3 for 5$ on Ebay)
- lcd display 16x2 (~2$ on Ebay)
- Tiny RTC based on Maxim DS1307 (~1.5 to 3$ on Ebay)
- several switches
- several LEDs
- 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: https://github.com/flav1972/aquarium/tree/v1
The Breadboard Prototype
The Schematics for v1
The LCD 16x2 Screen
The LCD screen is a classical mount like explained in the Arduino Tutorials http://arduino.cc/en/Tutorial/LiquidCrystal. I have changed the design to use pins: 13, 12, 5, 4, 3, 2 instead of those in the tutorial.
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: http://www.hobbyist.co.nz/?q=real_time_clock (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 https://github.com/adafruit/RTClib.git (version 573581794b73dc70bccc659df9d54a9f599f4260).
TMP36 temperature sensor
Use of an TMP36 temperature sensor: https://learn.adafruit.com/tmp36-temperature-sensor/using-a-temp-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.
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.
The input switches schematics are based on the same schematics as in http://linksprite.com/wiki/index.php5?title=16_X_2_LCD_Keypad_Shield_for_Arduino and https://s3.amazonaws.com/linksprite/Shields/16X2+LCD+Keypad+shield/1602+LCD+Shield+Sch.pdf.
This can be also part of the LCD screen module, example: http://www.ebay.com/itm/1602-16x2-Character-LCD-Expansion-Board-Keypad-Shield-for-Arduino-Duemilanove-/181217146338?pt=LH_DefaultDomain_0&hash=item2a316235e2.
The code, including the schematics for this version is here: https://github.com/flav1972/aquarium/tree/v1.
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.
Add a flow meter based on this: http://www.seeedstudio.com/wiki/index.php?title=G1/2_Water_Flow_sensor.
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
Please leave me comments here: http://fritzing.org/projects/aquarium-controler