The Planted Tank Forum - Reply to Topic
Planted Tank Forums
Your Tanks Image Hosting *Tank Tracker * Plant Profiles Fish Profiles Planted Tank Guide Photo Gallery Articles

Go Back   The Planted Tank Forum > Specific Aspects of a Planted Tank > DIY > Guide: Arduino based LED controller for Current Satellite LED+

Thread: Guide: Arduino based LED controller for Current Satellite LED+ Reply to Thread
Title:
  
Message:
Post Icons
You may choose an icon for your message from the following list:
 

Register Now

In order to be able to post messages on the The Planted Tank Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in

Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



Additional Options
Miscellaneous Options

Topic Review (Newest First)
04-16-2014 02:39 PM
zodduska
Quote:
Originally Posted by Curt_Planted View Post
Looks good. The change to the counter initialization isn't needed, but will speed up any initial sunset (assuming it is never set above 21 lighting level when you start the program). In the interest of robustness at the cost of an extra bit of time to fade down and then fade back up to another color (depending on when you start the code) it may be better to just leave it at 42.
The cross over from one day to another is something I didn't anticipate would be an issue... but if someone works night shift I guess that could come up. Is that a hypothetical question, or a real issue for you? :P

So half lighting is enough? What plant's are you growing?

Edit: Actually since the sunset is followed with a zero light M4 command, the lighting counters don't matter for the initialization... there would at worst case be a sudden jump to darkness if the lighting level was above 21 for any of the colors.
Great, thank you I'll give it a go tonight!

The light is suspended about 10-12" over the substrate on a 12 gallon long Mr. Aqua which a couple days ago switched to low-medium light, stopped dosing and turned off co2 for my shrimp's sake. I've got downoi, fissidens, xmas moss, rotala indica, rotala mini butterfly, hydrocotyle tripartita, Alternanthera reineckii, anubias nana petite and dwarf hairgrass. I'm sure some of them won't make the transition. Even with co2 and lots of ferts the Full Spec was too much, so 50% is just a starting point for this. Currently I'm using Cloud4.

Ideally I like the light to be on when I get home from work or shortly after (around 4pm) and sunset at midnight, after that accent light or moonlight until 1 or 2am since I'm usually still awake.

04-16-2014 05:15 AM
Curt_Planted Looks good. The change to the counter initialization isn't needed, but will speed up any initial sunset (assuming it is never set above 21 lighting level when you start the program). In the interest of robustness at the cost of an extra bit of time to fade down and then fade back up to another color (depending on when you start the code) it may be better to just leave it at 42.
The cross over from one day to another is something I didn't anticipate would be an issue... but if someone works night shift I guess that could come up. Is that a hypothetical question, or a real issue for you? :P

So half lighting is enough? What plant's are you growing?

Edit: Actually since the sunset is followed with a zero light M4 command, the lighting counters don't matter for the initialization... there would at worst case be a sudden jump to darkness if the lighting level was above 21 for any of the colors.
04-15-2014 03:46 PM
zodduska like this?

Code:
//these variables below store the number of steps each color is above completely dark for 
//your custom accent color. To get this number, set your tank to the lighting you want 
//then go through each color one by one and reduce the lighting to dark counting the number of 
//times you had to press the down button to do so. There are about 21 steps in brightness for the 
// remote for each color but they can vary with the length of the button press. This code uses the light's max 
// resolution of 42 steps so you will have to multiply the number of button presses by 2 with
// 42 being the max and zero meaning the led color is off. 

int Blue1=0;
int Red1=42;
int Green1=10;
int White1=6;

int Blue2=21;
int Red2=21;
int Green2=21;
int White2=21;
Code:
if ((Tnow > LowSunriseT) && (Tnow < BrightenUpT))
   {
   CustomAccent(Red1,Green1,Blue1,White1,tstep1);
   
   }
   else if ((Tnow > BrightenUpT) && (Tnow < SunsetT))
   {
    CustomAccent(Red2,Green2,Blue2,White2,tstep1);
   }
   else if ((Tnow > SunsetT) && (Tnow < SunriseT))
   {
   Sunset(tstep1);
   }
   else if ((Tnow > SunriseT) && (Tnow < BrightenDownT))
   {
   CustomAccent(Red2,Green2,Blue2,White2,tstep1);
   }
 else if ((Tnow > BrightenDownT) && (Tnow < LowSunsetT))
 {
    CustomAccent(Red1,Green1,Blue1,White1,tstep1);
   }
 else if ((Tnow > LowSunsetT) && (Tnow < LowSunsetT+Evening_Moon*60)){
   MoonPhase(tstep1);
   }
   else if ((Tnow > LowSunsetT+Evening_Moon*60) || (Tnow < LowSunriseT)){
   Sunset(tstep1);
   }
   }
this part too?

Code:
else if ((Tnow >= BrightenUpT) && (Tnow < SunsetT)){
   Serial.print("Tnow ");
   Serial.println(Tnow);
   Serial.print("BrightenUpT ");
   Serial.println(BrightenUpT);
  RedNow=0;
GreenNow=0;
BlueNow=0;
WhiteNow=0;
digitalWrite(CO2RelayPin, LOW);
digitalWrite(CO2RelayLED, HIGH);
   Serial.println("CO2 On");
   CustomAccent(Red2,Green2,Blue2,White2,tstep1);
   }
else if ((Tnow >= SunsetT) && (Tnow < SunriseT)){
Serial.print("Tnow ");
   Serial.println(Tnow);
   Serial.print("SunsetT ");
   Serial.println(SunsetT); 
 digitalWrite(CO2RelayPin, HIGH); 
 digitalWrite(CO2RelayLED, LOW);
   Serial.println("CO2 Off"); 
   
Sunset(initial_tstep);
}
else if ((Tnow >= SunriseT) && (Tnow < BrightenDownT)){
  Serial.print("Tnow ");
   Serial.println(Tnow);
   Serial.print("SunriseT ");
   Serial.println(SunriseT); 
  digitalWrite(CO2RelayPin, LOW);
  digitalWrite(CO2RelayLED, HIGH);
  Serial.println("CO2 On"); 
  RedNow=0;
GreenNow=0;
BlueNow=0;
WhiteNow=0;
   CustomAccent(Red2,Green2,Blue2,White2,tstep1);}
Code:
//initialize color counters to full lighting to assure sunset is completed smoothly
RedNow=21;
GreenNow=21;
BlueNow=21;
WhiteNow=21;
Another quick question, would setting the timers to extend beyond midnight (for the final sunset) screw with the programs time tracking triggers? (ex, 1am is now < than 4pm, rather than 11pm > 4pm)
04-15-2014 01:23 PM
Curt_Planted That should be pretty simple. Anywhere you see a sunrise command swap it for a custom accent function with the lighting level you want. FYI I'm down to 9 hours lighting on my tank. These lights are brighter than they appear!
04-15-2014 04:04 AM
zodduska IThe full spectrum ended up being too intense for my tank so I reverted to non ramping code for now. Curt, would it be possible for me to change something simple in your code to have it ramp up to say 50% intensity?
04-14-2014 04:29 AM
Curt_Planted Here is the latest code with moonlight and co2 control. Hope someone finds it useful. Had to zip the text doc as the limits on text docs are pretty skimpy on this forum. There is plenty of cleaning up to do in the code to minimize the file size but it's not even using half the memory of my arduino so if it aint broke....
04-12-2014 03:08 AM
Curt_Planted Mike, that's the same one. Your right about the normally opened/closed but the control voltage is inverted for normally closed. High=off, Low=on, and it turns off if the control signal is disconnected or the arduino looses power. Not sure if this has to do with using the jumper across the vcc pins (not using a second power supply and forgoing the opto-isolation).

BTW, the updated code is working great, no issues in 2 days. I'm still lagging on commenting the changes properly so maybe sometime this weekend I will get around to it and upload it. I have also added additional robustness to the code. No more issues no matter if you load it just prior to a lighting change.

There is also a new moonlighting function that comes on at sunset in the evening (the second sunset). The user sets how long it stays on after sunset and can set it to zero if it's not wanted. It uses some tricky math to go from full moon at month start to no moonlight at mid month and then back to full moonlight for the end of the month (16/42 blue, 8/42 red and green). Any higher lighting and I notice my fish don't reduce their activity. I have 2 of these lights (36") above my 36" long/24" high 50g so that may differ based on other peoples lighting.
04-11-2014 02:05 PM
Mustang5L5
Quote:
Originally Posted by Curt_Planted View Post
I know what you mean about adding stuff! I'm about to add a darn touch screen! Lol
I'm making one for myself and a friend....and he just requested a PH probe in addition to CO2 relay...


So looks like I'm going to wait for my 128x64 display to show up, and figure out how to modify the code to display on that and then add CO2 and PH to the Temp
04-11-2014 01:38 PM
Mustang5L5
Quote:
Originally Posted by Curt_Planted View Post
Just finished up the relay... was a bit perplexed by this! I wanted it to keep the power off when the arduino is reset or the control pin is not configured (or comes unplugged) so the relay doesn't keep the co2 on 24-7 in event of a connection issue. One would assume that the relay would then of course be operating in normally off mode. Umm... not so much. In order to do that I had to set the relay up to turn on when the pin is low and turn off when high otherwise if the control line is unplugged or arduino is powered off the relay turns on... makes no sense! but I have it working! lol, I tried it wired up to the opposite way as well and it is off when voltage is low, on when high, but when the pin is disconnected it turns on... . I gotta be missing something! For a mechanical relay does it matter if I connect the power wires to the same terminals but switch them around? Maybe because this relay uses an second 5v source to reduce the control current, the control voltage disconnects that second 5v source that actually powers the relay coil? then the high off low on would still be normally off...
I assume this is the relay you are using?



I just got one myself yesterday. I haven't wired it up, or played with code, but looking at the 4 relays, it looks like there is a normally open, and normally closed position.

Looks like if you use the two left pots, it's normally closed, and using the two right, it's normally open?

Again, have yet to put power to it, but that's how I took it. I was going to put the line in the center and have the relay ON when powered so it fails normally open if the power goes out.

Could be wrong though
04-10-2014 06:56 AM
Curt_Planted Just finished up the relay... was a bit perplexed by this! I wanted it to keep the power off when the arduino is reset or the control pin is not configured (or comes unplugged) so the relay doesn't keep the co2 on 24-7 in event of a connection issue. One would assume that the relay would then of course be operating in normally off mode. Umm... not so much. In order to do that I had to set the relay up to turn on when the pin is low and turn off when high otherwise if the control line is unplugged or arduino is powered off the relay turns on... makes no sense! but I have it working! lol, I tried it wired up to the opposite way as well and it is off when voltage is low, on when high, but when the pin is disconnected it turns on... . I gotta be missing something! For a mechanical relay does it matter if I connect the power wires to the same terminals but switch them around? Maybe because this relay uses an second 5v source to reduce the control current, the control voltage disconnects that second 5v source that actually powers the relay coil? then the high off low on would still be normally off...

I also configured a second pin to act as a second output that outputs high when co2 is on to light an led to act as an indicator. That may also work well for anyone with a more logically operating relay than my Sainsmart!

My plan is to keep this relay (a sainsmart 4 channel mechanical relay $7.99) and all the higher voltage stuff in the nice little $8 project box I got from radioshack and just velcro a proper case for the arduino on top. I was surprised how well the outlet plug-in seated in the side wall! I grabbed the output plug from the $4 walmart analog timer and wired the hot black line straight to the relay and then bypassed earth ground and ground straight into the power input wires.

The code has a user set co2 prestart (before lighting turns on) and prestop (before lighting turns off). For my setup the inline reactor takes a while to dissolve the CO2 in it, so I notice my fish gasping if I wait til the lights turn off to shut off CO2. I'll post pics and code tomorrow. Hopefully I will wake up to that indicator led lit and the co2 on with the lights.
04-08-2014 11:19 PM
Curt_Planted I know what you mean about adding stuff! I'm about to add a darn touch screen! Lol
04-07-2014 04:27 PM
Mustang5L5 I think I'm going to do something like this

http://www.spikenzielabs.com/Catalog...19d0e2ae7f00eb

They only have stands for a 16x2 or the 128x64 display.

Basically, what I'm going to do is make a project box to hold the boards, and the various wiring from the temp sensor, the power cord, the IR LED, and then run a small multi-conductor to the LCD just for the display. Then, i can put it on my desk next to the tank and use it as a clock, as well as let me know what the tank temp is, room temp, and what mode i'm on. The project box can stay under the tank out of the way and I'll run the IR LED wire up to the light to control that. I've ordered a waterproof DS18B20 with a 3 foot cable, so that should be long enough to reach the tank.

Thing is, i'm using a 20x4 display, so no stand. I might have to fab my own somehow.


I might try to integrate the 128x64 display. I know it's a different code than what the 16x2/20x4 uses.

Seems like the more i read and research, the more i learn and want to add.
04-05-2014 05:43 PM
Curt_Planted I'm thinking for the case your better off going DIY. I'm trying to figure out how to cut a square neatly into a plastic project box I bought at radio shack. Hot knife?

If there is a good case out there with the room needed for stacking the arduino, lcd, 5v power converter board and the inch tall relay module, I'd like one as well!

I did get the relay in and got it all wired up and working. The last couple days I've had the relay voltage hooked up to an LED while awaiting the relay, so I can confirm it works before actually controlling the co2 with it. Still working the bugs out though!
04-01-2014 01:36 PM
Mustang5L5 Interested in the CO2 function as well. Just checked out the relay module and probably would be interested in adding this later on.

Just got the V4.1b up and running with a single thermometer for my setup.

Couple general questions for the entire thread....

#1) Anyone find a good, visually appealing case to use with a 20x4 LCD to package this all up? I've found some for 16x2's, but want to use a 20x4 for temp display

#2) I want to dim the LCD at night so I do not see the bright display at night. Is there a way to accomplish this?
03-31-2014 01:25 AM
Curt_Planted Zodduska, it will be a really simple addition to the code. I will add in a co2 start up offset variable so you can set how far in advance the co2 turns on before the lights, and a separate one for how early it turns off before the lights do. It will just be an analog write to a pin to activate a opto-isolated relay that will power the co2 solenoid. I will be using a 7.99 relay module from Sainsmart and it is already on the way.
This thread has more than 15 replies. Click here to review the whole thread.

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 06:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright Planted Tank LLC 2012