Introduction: Arduino - Digital Clock With Aquarium RGB Light Control
For my new fish tank, I noticed that I sometimes forgot to turn on the lights or kept the lights on too long. Since I'm lazy, I made a simple solution for this, and controlled the lighting of my aquarium using an arduino and a real time clock.
Goal of this project:
1. Let the aquarium lights go on automatically in the morning
2. Let the lights switch to blue lights in the evening
3. Turn the lights of automatically at 1:00am.
Edit on November 9th, 2015:
I dug a bit deeper into the code and made the lights gradually change over a 30 minutes timespan. Link to both codes is placed in the Code chapter.
Step 1: Parts List
The parts that I used are:
- DS3231 Real Time Clock module
- Arduino Mega / Uno
- 5050 RGB Led strip
- 3x BV547 NPN transistor
- 12v-5v voltage regulator
- 12v power supply
- 12v connector for breadboard
If you want to show the time on the LCD display (optional), you also need:
- 16x2 LCD display
- 10k potentiometer
- 220ohm resistor
Step 2: Wiring
Wire everything up as shown in the picture. You can skip the LCD part if you don't want this.
Note that the image shows a different clock module than the DS3231, but there was none available for fritzing.
If you use an Arduino Mega, wire up as shown in the picture. If you use an Arduino UNO, the SDA and SCL pins are at a different location. Make sure that you use the correct pins.
Step 3: Code
The arduino code can be found here, on Github: click
Note: The first time you use the DS3231, you have to set the time. You do this by uncommenting line 38 and set the current time, as explained in the rows before it. Then upload the code to the arduino, comment this line OUT again and reupload the script. Otherwise, the time will be reset to the time you put there every time the arduino restarts.
In the code behind the link mentioned above, the lights will change suddenly. I rewrote the code to make them change more gradually, over the timespan of 30 minutes. This code can be found here: Github
Step 4: Finish
Now make a nice aquarium cover, put in the RGB led strip and hook it all up!
Later on, I'll try to edit the code so that the change between every phase won't be so sudden, but for now at least I don't have to switch the lights manually anymore. ;)
We have a be nice policy.
Please be positive and constructive.
I have never worked with arduino, but this is exactly the project I want to do.
My idea is to make an RGB ledstrip do 11 hour "daylight", 1 hour fade over "dusk". 11 hour all blue and then 1 hour "dawn".
How would you go about that?
I want the red and green channels at different fade times as I want dusk and dawn to look more red.
Thank you for a great start anyway and thank you for any help you can provide.