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)
08-06-2016 03:24 AM
trogdan
Code for LED+ Pro

So, not sure why the sketch didn't work before, but the codes on the pro remote match the regular remote buttons, the functions have just changed. I did re-write the 3.6 version of the code so that it actually reflects what is on the remote, and this actually uses liquidcrystal_i2c, since it's easier to wire up.

Code:
///////////////////////////////////////////////////////////////////////
// Current Satellite LED+ Pro Controller  V3.6b+                     //
//   Indychus...Dahammer...Trogdan...mistergreen @ plantedtank.net   //
//   This code is public domain.  Pass it on.                        //
//   Confirmed on Arduino Duemilanove 1.0.6                          //
//   Req. Time, TimeAlarms, RTClib, IRremote                         //
///////////////////////////////////////////////////////////////////////
//
// This version uses Ken Shirriff's IRremote library to Rx/Tx the IR codes
// http://www.righto.com/2009/08/multi-protocol-infrared-remote-library.html
// 
// This code does NOT use PIN 13 on the Uno, as do previous versions
// Instead PIN 3, which is a PWM pin, is used. So you'll need to connect
// your LED to PIN 3 instead of PIN 13 for it to work.

// Install LCD per instructions at http://learn.adafruit.com/character-lcds/overview

#include <Wire.h>
#include <RTClib.h>
#include <Time.h>
#include <TimeAlarms.h>
#include <IRremote.h>
//#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>

RTC_DS1307 RTC;
IRsend irsend;
//LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
LiquidCrystal_I2C lcd(0x3f, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

/*********** BEGIN USER DEFINED VARIABLES ***********/
// DEBUG_IR adds the option to test the IR commands via the Arduino software's serial monitor
// You can send any value from 1 to 32 and it send the corresponding IR code
// The codes follow the remote controller, left to right, top to bottom
// e.g 1 = Orange, 2 = Blue, 21 = Moon1, etc
#define DEBUG_IR 0

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
// for the LED+ Pro Remote
unsigned int codeSetClock = 0x3AC5;
unsigned int codeOnTime = 0xBA45;
unsigned int codeOffTime = 0x827D;
unsigned int codePowerOnOff = 0x02FD;
unsigned int codeHour = 0x872D;
unsigned int codeMinute = 0x9A65;
unsigned int codeEnter = 0xA25D;
unsigned int codeResume = 0x22DD;
unsigned int codeOrange = 0x2AD5; 
unsigned int codeYellow = 0x1AE5;
unsigned int codeBlue = 0x926D; 
unsigned int codeViolet = 0x12ED; 
unsigned int codeRedUp = 0x0AF5;
unsigned int codeGreenUp = 0x8A75;
unsigned int codeBlueUp = 0xB24D;
unsigned int codeWhiteUp = 0x32CD;
unsigned int codeRedDown = 0x38C7;
unsigned int codeGreenDown = 0xB847;
unsigned int codeBlueDown = 0x7887;
unsigned int codeWhiteDown = 0xF807;
unsigned int codeM1Custom = 0x18E7;
unsigned int codeM2Custom = 0x9867;
unsigned int codeDaylight = 0x58A7;
unsigned int codeMoonlight = 0xD827;
unsigned int codeMoon1 = 0x28D7;
unsigned int codeMoon2 = 0xA857;
unsigned int codePartlyCloudy = 0x6897;
unsigned int codeDawnDusk = 0xE817;
unsigned int codeMostlyCloudy = 0x08F7;
unsigned int codeStorm1 = 0x8877;
unsigned int codeStorm2 = 0x48B7;
unsigned int codeEveningClouds = 0xC837;

void SetAlarms()
{
  // Set up your desired alarms here
  // The default value of dtNBR_ALARMS is 6 in Alarms.h.
  // This code sets 12 alarms by default, so you'll need to change dtNBR_ALARMS to 12 or more
  Alarm.alarmRepeat(7,00,0, DawnDusk);
  Alarm.alarmRepeat(9,00,0, PartlyCloudy);     // (HR,MIN,SEC,FUNCTION)
  Alarm.alarmRepeat(21,58,0, Daylight);
  Alarm.alarmRepeat(15,00,0, PartlyCloudy);
  Alarm.alarmRepeat(19,00,0, DawnDusk);
  //Alarm.alarmRepeat(21,00,0, Moon2);

  // Comment these out if you don't want the chance of a random storm each day
  Alarm.alarmRepeat(12,00,00, ThunderStorm);
  ThunderStorm();  // Sets up intial storm so we don't have wait until alarm time
}
/************* END USER DEFINED VARIABLES *************/

void setup()
{
  Wire.begin();
  RTC.begin();
  lcd.begin(20, 4);
  Serial.begin(9600);
  //Serial.println(freeRam());

  if (! RTC.isrunning()) { 
    Serial.println("RTC Error");
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }  //Adjust to compile time


  setSyncProvider(syncProvider);     //reference our syncProvider function instead of RTC_DS1307::get()

  Alarm.timerRepeat(900, digitalClockDisplay);  // Display the time every 15 minutes
  digitalClockDisplay();
  SetAlarms();
  Serial.print("SRAM : ");          //un-comment these line to check available SRAM
  Serial.println(freeRam());
}   

void loop()
{
#ifdef DEBUG_IR 
  if (Serial.available() > 0) {
    delay(5); //Wait for transmission to finish
    CurrentCMDs(SerialReadInt());
  }
#endif
  Alarm.delay(100); 
  // Service alarms & wait (msec)
  lcdClockDisplay();
}

time_t syncProvider()
{
  //this does the same thing as RTC_DS1307::get()
  return RTC.now().unixtime();
}

void ThunderStorm ()
{ 
  // Schedules a storm between 1 & 9 in the evening
  // It sets Storm2, followed by Cloud2 or DawnDusk or Moon2, depending on when the storm is over
  randomSeed(analogRead(randAnalogPin));  // Generate random seed on unused pin
  byte RH = random(23);                   // Randomizer for thunderstorm
  byte RM = random(59);
  byte RS = random(59);
  byte TSDurationH = random(2);
  byte TSDurationM = random(59);

  if (RH <= 12)
  {
    Serial.println("No storm today");
    lcd.setCursor(0,1);
    lcd.print("No storm today");
    return;
  }

  if (RH > 12)                             // If random value is after 1 pm, allow storm
  {
    Alarm.alarmOnce(RH,RM,RS,Storm2);
    Serial.print("Next Storm: ");
    Serial.print(RH);
    printDigits(RM);
    printDigits(RS);
    Serial.print("   ");
    Serial.print("Duration = ");
    Serial.print(TSDurationH);
    printDigits(TSDurationM);
    Serial.println();
    lcd.setCursor(0,1);
    lcd.print("Next Storm: ");
    lcdHRdigits(RH);
    lcdDigits(RM);
  }

  if ((RH + TSDurationH) < 19)   // Return to Cloud2 if storm ends between 1-7pm
  {
    Alarm.alarmOnce((RH + TSDurationH),(RM + TSDurationM),RS,PartlyCloudy);
  }
  else if ((RH + TSDurationH) < 21)  // Return to DawnDusk if storm ends between 7-9pm
  {
    Alarm.alarmOnce((RH + TSDurationH),(RM + TSDurationM),RS,DawnDusk);
  }
  else                                       // Return to Night2 if storm ends after 9pm
  {
    Alarm.alarmOnce((RH + TSDurationH),(RM + TSDurationM),RS,Moon2);
  }
}


void digitalClockDisplay()          // Digital clock
{ 
  Serial.print("Time = ");
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.println(); 
}


void lcdClockDisplay()  
{
  lcd.setCursor(0,0);
  lcdHRdigits(hour());
  lcdDigits(minute());
}

void printDigits(int digits)        // Add :
{
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

void lcdDigits(int digits)        // Add :
{
  lcd.print(":");
  if(digits < 10)
    lcd.print('0');  
  lcd.print(digits);
}
void lcdHRdigits(int HRdigits)        // Preface hour with 0
{
  if(HRdigits < 10)
    lcd.print('0');  
  lcd.print(HRdigits);
}

#ifdef DEBUG_IR
int SerialReadInt()
{
  int i, numAva;
  char inBytes[3];                  // Array to hold the bytes
  char * inBytesPtr = &inBytes[0];  // Pointer to the first element of the array

  numAva = Serial.available();    // Read number of input bytes
  if (numAva > 2)
    numAva = 2;                   // Only allow 2 characters to prevent overflow

  for (i=0; i<numAva; i++)        // Load input bytes into array
    inBytes[i] = Serial.read();
  inBytes[i] =  '\0';             // Put NULL character at the end
  return atoi(inBytesPtr);        // Call atoi function and return result
}

void CurrentCMDs (int cmd)
{
  switch (cmd)
  {
  case 1:
    SetClock();
    break;
  case 2:
    OnTime();
    break;
  case 3:
    OffTime();
    break;
  case 4:
    PowerOnOff();
    break;
  case 5:
    Hour();
    break;
  case 6:
    Minute();
    break;
  case 7:
    Enter();
    break;
  case 8:
    Resume();
    break;
  case 9:
    Orange();
    break;
  case 10:
    Yellow();
    break;
  case 11:
    Blue();
    break;
  case 12:
    Violet();
    break;
  case 13:
    RedUp();
    break;
  case 14:
    GreenUp();
    break;
  case 15:
    BlueUp();
    break;
  case 16:
    WhiteUp();
    break;
  case 17:
    RedDown();
    break;
  case 18:
    GreenDown();
    break;
  case 19:
    BlueDown();
    break;
  case 20:
    WhiteDown();
    break;
  case 21:
    M1Custom();
    break;
  case 22:
    M2Custom();
    break;
  case 23:
    Daylight();
    break;
  case 24:
    Moonlight();
    break;
  case 25:
    Moon1();
    break;
  case 26:
    Moon2();
    break;
  case 27:
    PartlyCloudy();
    break;
  case 28:
    DawnDusk();
    break;
  case 29:
    MostlyCloudy();
    break;
  case 30:
    Storm1();
    break;
  case 31:
    Storm2();
    break;
  case 32:
    EveningClouds();
    break;
  default:
    Serial.println("Invalid Choice");
  }
}
#endif

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);
  }

  Serial.println(sMessage);  // Print message
  lcd.setCursor(6,0);
  lcd.print(sMessage);
  for(byte i = sizeof(sMessage); i <= 14; i++)
    lcd.print(" ");
  digitalClockDisplay();
}

void SetClock()
{
  SendCode(codeSetClock, 2, "SetClock");
}

void OnTime()
{
  SendCode(codeOnTime, 2, "OnTime");
}

void OffTime()
{
  SendCode(codeOffTime, 2, "OffTime");
}

void PowerOnOff()
{
  SendCode(codePowerOnOff, 1, "Power On/Off");
}

void Hour()
{
  SendCode(codeHour, 2, "Hour");
}

void Minute()
{
  SendCode(codeMinute, 2, "Minute");
}

void Enter()
{
  SendCode(codeEnter, 2, "Enter");
}

void Resume()
{
  SendCode(codeSetClock, 2, "Resume");
}

void Orange()
{
  SendCode(codeOrange, 2, "Orange");
}

void Yellow()
{
  SendCode(codeYellow, 2, "Yellow");
}

void Blue()
{
  SendCode(codeBlue, 2, "Blue");
}

void Violet()
{
  SendCode(codeViolet, 2, "Violet");
}

void RedUp()
{
  SendCode(codeRedUp, 1, "Red Up");
}

void GreenUp()
{
  SendCode(codeGreenUp, 1, "Green Up");
}

void BlueUp()
{
  SendCode(codeBlueUp, 1, "Blue");
}

void WhiteUp()
{
  SendCode(codeWhiteUp, 1, "White Up");
}

void RedDown()
{
  SendCode(codeRedDown, 1, "Red Down");
}

void GreenDown()
{
  SendCode(codeGreenDown, 1, "Green Down");
}

void BlueDown()
{
  SendCode(codeBlueDown, 1, "Blue Down");
}

void WhiteDown()
{
  SendCode(codeWhiteDown, 1, "White Down");
}

void M1Custom()
{
  SendCode(codeM1Custom, 2, "Custom Mix 1");
}

void M2Custom()
{
  SendCode(codeM2Custom, 2, "Custom Mix 2");
}

void Daylight()
{
  SendCode(codeDaylight, 2, "Daylight");
}

void Moonlight()
{
  SendCode(codeMoonlight, 2, "Moonlight");
}

void Moon1()
{
  SendCode(codeMoon1, 2, "Moonlight 1");
}

void Moon2()
{
  SendCode(codeMoon2, 2, "Moonlight 2");
}

void PartlyCloudy()
{
  SendCode(codePartlyCloudy, 2, "Partly Cloudy");
}

void DawnDusk()
{
  SendCode(codeDawnDusk, 2, "Dawn/Dusk");
}

void MostlyCloudy()
{
  SendCode(codeMostlyCloudy, 2, "Mostly Cloudy");
}

void Storm1()
{
  SendCode(codeStorm1, 2, "Thunderstorm 1");
}

void Storm2()
{
  SendCode(codeStorm2, 2, "Thunderstorm 2");
}

void EveningClouds()
{
  SendCode(codeEveningClouds, 2, "Evening Clouds");
}

int freeRam () {
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}
08-02-2016 03:32 AM
trogdan
Quote:
Originally Posted by aviphysics View Post
Anyone looked into incorporating an ambient light sensor, to automatically adjust the light relative to the room light?

My plan will be to get a Current Satellite LED+ Pro for now; and work out the fancy arduino stuff, if I can find the time.

My end goal would be to have the light in the tank always slightly higher than room light level, to give the tank that nice gentle glow. Also maybe tracking the mean light level in order to adjust the response of the ambient light sensor, with the goal of maintaining an average daily light dosage for the plants (let me know if that last part doesn't make sense, and I can try to explain what I am thinking better.)
So, I believe I have currently wired up my arduino, but it does not appear to control the Satellite LED+ Pro I just purchased. LCD works fine, and I can see the LED flashing in the phone camera.

I'm going to grab a IR receiver, and do a dump of the codes. In the mean-time, maybe my LFS will let me try the rig on one of their Current LED+ to make sure it works. I think they're interested in me building them one XD.
04-30-2016 08:16 PM
aviphysics Anyone looked into incorporating an ambient light sensor, to automatically adjust the light relative to the room light?

My plan will be to get a Current Satellite LED+ Pro for now; and work out the fancy arduino stuff, if I can find the time.

My end goal would be to have the light in the tank always slightly higher than room light level, to give the tank that nice gentle glow. Also maybe tracking the mean light level in order to adjust the response of the ambient light sensor, with the goal of maintaining an average daily light dosage for the plants (let me know if that last part doesn't make sense, and I can try to explain what I am thinking better.)
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 +?
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