The Planted Tank Forum - Reply to Topic
Thread: Guide: Arduino based LED controller for Current Satellite LED+ Reply to Thread
Title:
Message:
Trackback:
Send Trackbacks to (Separate multiple URLs with spaces) :
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:
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:
OR

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)
01-15-2016 02:55 PM
vanish Thanks Nathan. Does that RTC just plug in to the breadboard? I'm not terribly concerned with bundling it up pretty as it will be out of view anyway.
01-12-2016 08:28 PM
Nathan Triplett If it's mostly the soldering that worries you, you can build a simple version of this with no soldering required at all.

Grab the Arduino board, wires, resistors, LED, and a breadboard:
https://www.adafruit.com/products/193

You can get just those bits individually, but this link has it all and is easy.

You need a clock. The ones from adafruit are kits, but you can get one all soldered together already here:
Amazon.com: Holdding DS3231 AT24C32 IIC Module Precision Real Time Clock Memory Module Arduino/Precise Time Clock Module with a Temperature-compensated Crystal Oscillator: Computers & Accessories Amazon.com: Holdding DS3231 AT24C32 IIC Module Precision Real Time Clock Memory Module Arduino/Precise Time Clock Module with a Temperature-compensated Crystal Oscillator: Computers & Accessories

After that it's just a matter of connecting everything into the breadboard together which is way easier than you might think. You just use those jumper wires to connect it all. The end result won't be as slick and small as the ones people solder together, but it will work. Mine is still all on a breadboard at the moment as I keep putting off soldering it all together.

If you want to go this route and don't want to bother with the fancy display, I'm also happy to give you nice schematics on how to connect it all up on your breadboard.
01-11-2016 04:25 PM
vanish Does anybody have one of these they want to sell? I'd love to have one for my tank. I have this light that does all these cool functions and don't use them!

I can handle programming just fine, but I'm terrible when it comes to assembling electronics.
12-09-2015 09:10 PM
Nathan Triplett Hi to the thread (and forum in general).

First to the OP, thanks so much. This is awesome.
Second, I took your code and made my own version of it (attached below) which fades the lights smoothly on/off over a 24 hour period. And the fade up/down times, rates, and colors are all configurable. I thought I'd share the code in case it helps someone out.

My version is a stripped down as it comes. It doesn't have an LCD display (I may add that later) or IR receiver. It's just a 24 hour fader.

I'm running this version, but will probably clean up the code some next time I have a chance to dig in. I'll add some more comments and explain whats going on if people want as well. Cheers and thanks again for the guide.

Code:
#include <Wire.h>
#include <RTClib.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <IRremote.h>

RTC_DS1307 RTC;
IRsend irsend;

int postDelay = 100;         // Delay after codes are sent
int randAnalogPin = 0;       // This needs to be set to an unused Analog pin, Used by ThunderStorm()

// Current Satellite+ IR Codes (NEC Protocol)
unsigned long codeHeader = 0x20DF; // Always the same

// Remote buttons listed left to right, top to bottom
unsigned int codeOrange = 0x3AC5;
unsigned int codeBlue = 0xBA45;
unsigned int codeRose = 0x827D;
unsigned int codePowerOnOff = 0x02FD;
unsigned int codeWhite = 0x1AE5;
unsigned int codeFullSpec = 0x9A65;
unsigned int codePurple = 0xA25D;
unsigned int codePlay = 0x22DD;
unsigned int codeRedUp = 0x2AD5;
unsigned int codeGreenUp = 0xAA55;
unsigned int codeBlueUp = 0x926D;
unsigned int codeWhiteUp = 0x12ED;
unsigned int codeRedDown = 0x0AF5;
unsigned int codeGreenDown = 0x8A75;
unsigned int codeBlueDown = 0xB24D;
unsigned int codeWhiteDown = 0x32CD;
unsigned int codeM1Custom = 0x38C7;
unsigned int codeM2Custom = 0xB847;
unsigned int codeM3Custom = 0x7887;
unsigned int codeM4Custom = 0xF807;
unsigned int codeMoon1 = 0x18E7;
unsigned int codeMoon2 = 0x9867;
unsigned int codeMoon3 = 0x58A7;
unsigned int codeDawnDusk = 0xD827;
unsigned int codeCloud1 = 0x28D7;
unsigned int codeCloud2 = 0xA857;
unsigned int codeCloud3 = 0x6897;
unsigned int codeCloud4 = 0xE817;
unsigned int codeStorm1 = 0x08F7;
unsigned int codeStorm2 = 0x8877;
unsigned int codeStorm3 = 0x48B7;
unsigned int codeStorm4 = 0xC837;

int wdticks = 0;
int rdticks = 0;
int bdticks = 0;
int gdticks = 0;
int wuticks = 0;
int ruticks = 0;
int buticks = 0;
int guticks = 0;


void SetAlarms()
{
  
  Alarm.alarmRepeat(6 ,0,0,MorningR);
  Alarm.alarmRepeat(8 ,0,0,MorningG);
  Alarm.alarmRepeat(9 ,0,0,MorningW);
  Alarm.alarmRepeat(9,50,0,MorningB);
  
  Alarm.alarmRepeat(17 ,0,0,EveningG);
  Alarm.alarmRepeat(18 ,0,0,EveningW);
  Alarm.alarmRepeat(19 ,0,0,EveningR);
  Alarm.alarmRepeat(19 ,0,0,EveningB);  

  Alarm.timerRepeat(15,timeNow);
  
}

void MorningW(){  Ramp(10800,43,WhiteUp, wuticks ); }
void MorningR(){  Ramp(18000,43,RedUp ,  ruticks ); }
void MorningB(){  Ramp(10800,43,BlueUp,  buticks ); }
void MorningG(){  Ramp( 7200,43,GreenUp, guticks ); }

void EveningW(){  Ramp(10800,43,WhiteDown, wdticks ); }
void EveningR(){  Ramp(10800,43,RedDown ,  rdticks ); }
void EveningB(){  Ramp(18000,43,BlueDown,  bdticks ); }
void EveningG(){  Ramp(10800,43,GreenDown, gdticks ); }

void Ramp(unsigned int seconds, unsigned int steps, void(*f)(), int & cntr ){
  Serial.println("starting Ramp");
  int interval = (int) ( 0.5 + float(seconds)/float(steps) );
  cntr = steps;
  Serial.print("enabling with interval");
  Serial.print(interval);
  Serial.print("and for");
  Serial.print(steps);
  Serial.print("steps");
  Serial.println();
  Alarm.timerRepeat(interval, f);
}

void setup()
{
  Wire.begin();
  RTC.begin();
  Serial.begin(9600);
  Serial.println("begin");

  if (! RTC.isrunning()) { 
    Serial.println("RTC Reset");
    timeNow();
    RTC.adjust(DateTime(__DATE__, __TIME__));
    timeNow();
  }  //Adjust to compile time  
  
  setSyncProvider(syncProvider);
  timeNow();
  
  SetAlarms();
 
}

void timeNow(){
  Serial.print(year(), DEC);
  Serial.print('/');
  Serial.print(month(), DEC);
  Serial.print('/');
  Serial.print(day(), DEC);
  Serial.print(' ');
  Serial.print(hour(), DEC);
  Serial.print(':');
  Serial.print(minute(), DEC);
  Serial.print(':');
  Serial.print(second(), DEC);
  Serial.println();
}

void loop()
{
  Alarm.delay(100); 
}

void SendCode (unsigned int code, byte numTimes, const char *sMessage){
  unsigned long irCode = (codeHeader << 16) + code; // Header is 2 bytes, shift all the way to left & add code to it
  
  for( int i = 0; i < numTimes; i++){
    irsend.sendNEC(irCode,32); // Send code
    Alarm.delay(postDelay);
  } 
}

void WhiteDown(){
  if( wdticks > 0 ){
    wdticks--;
    Serial.println("White Down");
    SendCode(codeWhiteDown, 1, "White Down");
  }else{
    Alarm.disable(Alarm.getTriggeredAlarmId());
    Alarm.free(Alarm.getTriggeredAlarmId());
    uint8_t x = Alarm.count();
    Serial.println(x);
  }
}

void WhiteUp(){
  if( wuticks > 0 ){
    wuticks--;
    Serial.println("White up");
    SendCode(codeWhiteUp, 1, "White Up");
  }else{
    Alarm.disable(Alarm.getTriggeredAlarmId());
    Alarm.free(Alarm.getTriggeredAlarmId());
    uint8_t x = Alarm.count();
    Serial.println(x);
  }
}

void RedDown(){
  if( rdticks > 0 ){
    rdticks--;
    Serial.println("Red Down");
    SendCode(codeRedDown, 1, "Red Down");
  }else{
    Alarm.disable(Alarm.getTriggeredAlarmId());
    Alarm.free(Alarm.getTriggeredAlarmId());
    uint8_t x = Alarm.count();
    Serial.println(x);
  }
}

void RedUp(){
  if( ruticks > 0 ){
    ruticks--;
    Serial.println("Red up");
    SendCode(codeRedUp, 1, "Red Up");
  }else{
    Alarm.disable(Alarm.getTriggeredAlarmId());
    Alarm.free(Alarm.getTriggeredAlarmId());
    uint8_t x = Alarm.count();
    Serial.println(x);
  }
}

void GreenDown(){
  if( gdticks > 0 ){
    gdticks--;
    Serial.println("Green Down");
    SendCode(codeGreenDown, 1, "Green Down");
  }else{
    Alarm.disable(Alarm.getTriggeredAlarmId());
    Alarm.free(Alarm.getTriggeredAlarmId());
    uint8_t x = Alarm.count();
    Serial.println(x);
  }
}

void GreenUp(){
  if( guticks > 0 ){
    guticks--;
    Serial.println("Green up");
    SendCode(codeGreenUp, 1, "Green Up");
  }else{
    Alarm.disable(Alarm.getTriggeredAlarmId());
    Alarm.free(Alarm.getTriggeredAlarmId());
    uint8_t x = Alarm.count();
    Serial.println(x);
  }
}

void BlueDown(){
  if( bdticks > 0 ){
    bdticks--;
    Serial.println("Blue Down");
    SendCode(codeBlueDown, 1, "Blue Down");
  }else{
    Alarm.disable(Alarm.getTriggeredAlarmId());
    Alarm.free(Alarm.getTriggeredAlarmId());
    uint8_t x = Alarm.count();
    Serial.println(x);
  }
}

void BlueUp(){
  if( buticks > 0 ){
    buticks--;
    Serial.println("Blue up");
    SendCode(codeBlueUp, 1, "Blue Up");
  }else{
    Alarm.disable(Alarm.getTriggeredAlarmId());
    Alarm.free(Alarm.getTriggeredAlarmId());
    uint8_t x = Alarm.count();
    Serial.println(x);
  }
}


time_t syncProvider(){ return RTC.now().unixtime(); }
07-04-2015 12:31 AM
Curt_Planted Sweet! That's pretty cheap!! Thanks for the links and info! I'll look it over in more depth later.
07-03-2015 01:06 PM
jeffkrol
Quote:
Originally Posted by Curt_Planted View Post

Has anyone directly hardware hacked this light? One of my connectors got screwed up and fried the lighting controller in the light but the LED's are still good and the wiring clearly labeled. I may save myself $100 and hack it with some directly arduino controlled regulators. If anyone has done it, any tips?
AFAICT the controller circuit is just like this (I assume there are programming differences.. ):
http://www.lightingever.com/44-key-r...FYQ8aQodkbIJ7g


Since the LED's are run in constant voltage mode "external drivers" are unnecessary and really wouldn't do..

The above pictured controllers do PWM chopping directly on the feed voltage.
You just need to make sure the I/O specs are OK..
AS to Aduino direct control.. This might help:
http://www.elcojacobs.com/using-shif...-with-arduino/
https://learn.adafruit.com/rgb-led-strips/usage
07-03-2015 04:57 AM
Curt_Planted To answer the questions I saw earlier:

There is a 42 step resolution on the controller for each color and the remote gives a double command for each step. This is why you can see a noticeable jump when you press the button, but the fades are so much smoother in the automated lighting modes like cloudy day ect.

I did get my lighting control code working. I have since added in additional code for having a different lighting schedule on the weekends. I found on weekends I tended to sleep in and would wake up to the lights out and would also want to show off the tank later in the evening when I had company and the lights would be out. If anyone wants the latest code, let me know.

Has anyone directly hardware hacked this light? One of my connectors got screwed up and fried the lighting controller in the light but the LED's are still good and the wiring clearly labeled. I may save myself $100 and hack it with some directly arduino controlled regulators. If anyone has done it, any tips?
06-02-2015 10:11 PM
gerwen I think my previous problem is still waiting mod approval to show. I've solved it.

Versions 4.1 and up of the controller sketches seem to require the Arduino Dev enviroment version 1.0.6, rather than the newer 1.6.x that I had been using. I haven't tested yet, but it compiled with no errors.

The older 3.6 (iirc) on the first page of the thread works just fine with the newer dev environment.

*edit in case my previous post never shows up*

I had the page one code version 3.6 working, but trying to compile 4.1, i threw a bunch of errors. The first of which complained about this line:

PROGMEM unsigned int arrCodes[32] = {0x3AC5, // 1 - Orange

saying that PROGMEM needed a CONST in order to push the array into flash

there were other errors, but that's the first one, so if you see something to that effect, check your environment version.
06-02-2015 03:16 PM
gerwen Another noob here.

Huge thanks for all the work done here. This is a fantastic project and something that pushed me into trying out the Arduino. I've been interested in it for years, but had no suitable project to try.

Now my problem:

I've got everything up and running with the version 3.6 sketch and a 16x2 LCD.

I'd like to get up to speed on the newer 4.1 based sketches, but it won't compile for me. I've gone over my libraries a few times to see if there was anything missing, but haven't had time to really dig into the problem. Here's the error:
Code:
 Arduino: 1.6.4 (Windows 7), Board: "Arduino Uno"

light_cont_4_1:59: error: variable 'arrCodes' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
light_cont_4_1:94: error: 'prog_char' does not name a type
light_cont_4_1.ino: In function 'void SendCode(int, byte)':
light_cont_4_1:264: error: 'arrMSG' was not declared in this scope
Multiple libraries were found for "IRremote.h"

 Used: C:\Users\gerwen\Documents\Arduino\libraries\IRremote

 Not used: C:\Program Files (x86)\Arduino\libraries\RobotIRremote

 Not used: C:\Program Files (x86)\Arduino\libraries\IRremote

Multiple libraries were found for "LiquidCrystal.h"

 Used: C:\Users\gerwen\Documents\Arduino\libraries\LiquidCrystal

 Not used: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal

variable 'arrCodes' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
Has anyone seen this and solved it?

It seems to have a problem with progmem dumping into flash. If i put a const on that, then the 'does not have a type' errors persist.

Any ideas where i should be looking?
04-23-2015 07:02 PM
alpha1172 oph awesome i think i have a few megas sitting around. gonna have to try it out id need to order that button/lcd shield though
04-23-2015 06:44 PM
kman
Quote:
Originally Posted by alpha1172 View Post
U still using the sat +?
Me? I have both Sat+ and E-Series on my main tank.
04-23-2015 12:03 AM
alpha1172 U still using the sat +?
04-22-2015 08:57 PM
kman I never tried it. I have since moved over to the iAqua Lite for my smooth fading needs. (which borrowed Curt's crossfade code, IIRC)

Now I have to decide if I'm going to sell my two controllers off, or break them down to play with on other projects...
04-22-2015 07:17 PM
alpha1172 So i built one of these a bit ago, running version 3.6 works great!

I really wanted to try the version 1.0 by curt with the built in fading but it never controlled the light correctly. Did anyone ever get it to work correctly
04-22-2015 06:37 PM
kman
Quote:
Originally Posted by Dazzlin Dave™ View Post
Heres the link to the file : https://www.pjrc.com/teensy/td_libs_IRremote.html

Everything is looking/working good as far as your alarms kman. I will adjust/change them as needed. Thanks for all the assistance last night !

And once again, thanks to everyone involved in this project. Your work is awesome and very much appreciated by me !
There is so much good code and help around here...woot
No problem, thanks for the link! I added a pointer to it to help people with future issues. If I think about it, at some point, I'll zip up all the libraries I used, so working versions will all be collected in one place they can download right from here.
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

 
For the best viewing experience please update your browser to Google Chrome