Jump to content
Top Shelf Aquatics

old thread lol


jedimasterben

Recommended Posts

  • Replies 3.6k
  • Created
  • Last Reply
ToolboySA

I am planning on programming my Reef angel to make the lights somewhat mimic this graph.

 

image006.jpg

 

See the article here: http://www.advancedaquarist.com/2009/5/aafeature

 

and now the fun begins. Doing my RA lights settings this weekend and putting in some test SPS pieces on the new tank. Share your code once done I would love to have a look at it

Link to comment
Deckoz2302

That is a chalk bass tibs...

 

also why haven't you guys asked for my RA code??? lol

Link to comment
jedimasterben

That is a chalk bass tibs...

 

also why haven't you guys asked for my RA code??? lol

I still haven't done jack to set mine up lol.

 

Do you have an easy way of mimicking the graph I posted on the previous page?

Link to comment
Deckoz2302

I still haven't done jack to set mine up lol.

 

Do you have an easy way of mimicking the graph I posted on the previous page?

your talking about figure 3 - par above and below water at kahalu? thats the article I wrote the high nooon off of. So no not exactly with all those up and downs but yes as far as the arch with the spike in the middle

Link to comment
jedimasterben

your talking about figure 3 - par above and below water at kahalu? thats the article I wrote the high nooon off of. So no not exactly with all those up and downs but yes as far as the arch with the spike in the middle

What I wanted was with the ups and downs - basically random cloud cover that happens very often throughout the day, but it's awesome that you wrote your stuff off that same article. :)

 

Ugh, I gotta buy the PWM expansion for the RA so I can control all of this stuff. I also want to be able to control my Tunze powerheads, but I got the PWM RA instead, so I'll need to buy another dimming expansion that has 0-10v. :/

Link to comment
jedimasterben

Any recommendations from anyone on what to cover the two heatsinks in? I can make something like I have now (but much less tall) or am up for just about anything. Gotta make it look sorta nice. :)

Link to comment
Deckoz2302

What I wanted was with the ups and downs - basically random cloud cover that happens very often throughout the day, but it's awesome that you wrote your stuff off that same article. :)

 

Ugh, I gotta buy the PWM expansion for the RA so I can control all of this stuff. I also want to be able to control my Tunze powerheads, but I got the PWM RA instead, so I'll need to buy another dimming expansion that has 0-10v. :/

no you don't. The two ports on the relay box that are standard Daylight/actinic two pin fan connectors are 0-10v.

 

so basically you'll have 6 pwm ports on the expansion and 2 0-10v on the relay box.

Link to comment
bencollinz

What I wanted was with the ups and downs - basically random cloud cover that happens very often throughout the day, but it's awesome that you wrote your stuff off that same article. :)

 

Ugh, I gotta buy the PWM expansion for the RA so I can control all of this stuff. I also want to be able to control my Tunze powerheads, but I got the PWM RA instead, so I'll need to buy another dimming expansion that has 0-10v. :/

no you don't. The two ports on the relay box that are standard Daylight/actinic two pin fan connectors are 0-10v.

 

so basically you'll have 6 pwm ports on the expansion and 2 0-10v on the relay box.

unless he upgraded to the RA Plus at some point (and I didn't see it) or moves the code to the PWM module itself, he's going to be in the same situation with running out of room for code.

 

I haven't read EVERY page of your thread, so forgive me if I missed something.

Link to comment
Deckoz2302

 

unless he upgraded to the RA Plus at some point (and I didn't see it) or moves the code to the PWM module itself, he's going to be in the same situation with running out of room for code.

 

I haven't read EVERY page of your thread, so forgive me if I missed something.

All of my lighting code is on the PWM module, I use the standard 32kb RA with ORP, PWM, Salinity, RF and Wifi expansions and I only use 28kb on the main RA board. The PWM code is 16kb

 

PWM Module code

 

#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include "ReefAngel_Globals.h"
#include "ReefAngel_Features.h"
#include <ReefAngel_Colors.h>
#include <ReefAngel_CustomColors.h>
#include <Wire.h>
#include <avr/wdt.h>
 
#define LEDPWM0 0
#define LEDPWM1 1
#define LEDPWM2 2
#define LEDPWM3 3
#define LEDPWM4 4
#define LEDPWM5 5
 
 
//*********************************************************************************************************************************
//Globals Vavriables
long calcSec(long,long);
long calcTime(long,long);
short Ndays;
static byte lightningchance=0;
byte cloudduration=0;
int cloudstart=0;
int rhour = 0, rmin = 0, shour = 0, smin = 0;
byte PWMports[] ={3,5,6,9,10,11};
int ChannelValue[] = {0,0,0,0,0,0};
byte SeasonsVar[]={0,0,0,0,0,0,0,0,0,0,0,0}; // PWM0, sunrisehour, sunriseminute, sunsethour, sunsetminute, cloudstarthout, cloudstartminute, cloudduration,lightningchance, PWM1,PWM2,PWM3
byte cmdnum=255;
byte datanum=255;
boolean ForceCloud=false;
 
//*********************************************************************************************************************************
 
//*********************************************************************************************************************************
//Setup
void setup()
{
  Serial.begin(57600);
  Wire.begin(8);
  Wire.onReceive(receiveEvent);
  Wire.onRequest(requestEvent);
  randomSeed(analogRead(0));
  pinMode(3,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);
  //wdt_enable(WDTO_1S);
  setSyncProvider(RTC.get);   // the function to get the time from the RTC
  setSyncInterval(SECS_PER_HOUR);  // Changed to sync every hour.
  now();
}
//End Setup
//*********************************************************************************************************************************
 
//*********************************************************************************************************************************
//Loop
void loop()
{
  wdt_reset();
  //Serial.println(ChannelValue[0],DEC);
  if (cmdnum!=255)
  {
    ProcessCMD(cmdnum,datanum);    
    cmdnum=255;
    datanum=255;
  }
  Seasons();
  CheckCloud();
  //Serial.println("Start");
  //Serial.println(ChannelValue[0],DEC);
  //Serial.println(rhour,DEC);
  //Serial.println(rmin,DEC);
  //Serial.println(shour,DEC);
  //Serial.println(smin,DEC);
  //Serial.println(cloudstart/60,DEC);
  //Serial.println(cloudstart%60,DEC);
  //Serial.println(cloudduration,DEC);
  for (int a=0;a<6;a++)
  {
    analogWrite(PWMports[a],ChannelValue[a]);
  }
}
//End Loop
//*********************************************************************************************************************************
 
//*********************************************************************************************************************************
//Standard PWM Functions Receive/Process
void receiveEvent(int howMany) {
  wdt_reset();
  if (howMany==5)
  {
    byte cmd1, cmd2, cmd3, cmd4, cmd5;
    cmd1=Wire.receive();
    cmd2=Wire.receive();
    cmd3=Wire.receive();
    cmd4=Wire.receive();
    cmd5=Wire.receive();
    if (cmd1=='$' && cmd2=='$' && cmd3=='$')
    {
      cmdnum=cmd4;
      datanum=cmd5;
      //Serial.println(cmd4,DEC);
      //Serial.println(cmd5,DEC);
    }
  }
  else
  {
    for (int a=0;a<howMany;a++)
    {
      Wire.receive();
    }
  }  
}
 
void ProcessCMD(byte cmd, byte data)
{
  wdt_reset();
  // Individual Channel
  if (cmd>=0 && cmd<=5)
  {
    ChannelValue[cmd]=data;
    analogWrite(PWMports[cmd],data);
  }
  if (cmd==6) ForceCloud=true;
}
//End Standard Functions
//*********************************************************************************************************************************
 
//*********************************************************************************************************************************
//Send Data Function
void requestEvent() {
  SeasonsVar[0]=ChannelValue[0];
  SeasonsVar[1]=rhour;
  SeasonsVar[2]=rmin;
  SeasonsVar[3]=shour;
  SeasonsVar[4]=smin;
  SeasonsVar[5]=cloudstart/60;
  SeasonsVar[6]=cloudstart%60;
  SeasonsVar[7]=cloudduration;
  SeasonsVar[8]=lightningchance;
  SeasonsVar[9]=ChannelValue[1];
  SeasonsVar[10]=ChannelValue[2];
  SeasonsVar[11]=ChannelValue[3];
  Wire.send(SeasonsVar,12);
}
//End Send Data
//*********************************************************************************************************************************
 
//*********************************************************************************************************************************
// Random Cloud/Thunderstorm effects function
void CheckCloud()
{
 
  // ------------------------------------------------------------
  // Change the values below to customize your cloud/storm effect
 
  // Frequency in days based on the day of the month - number 2 means every 2 days, for example (day 2,4,6 etc)
  // For testing purposes, you can use 1 and cause the cloud to occur everyday
#define Clouds_Every_X_Days 3
 
  // Percentage chance of a cloud happening today
  // For testing purposes, you can use 100 and cause the cloud to have 100% chance of happening
#define Cloud_Chance_per_Day 0
 
  // Minimum number of minutes for cloud duration.  Don't use max duration of less than 6
#define Min_Cloud_Duration 6
 
  // Maximum number of minutes for the cloud duration. Don't use max duration of more than 255
#define Max_Cloud_Duration 30
 
  // Minimum number of clouds that can happen per day
#define Min_Clouds_per_Day 2
 
  // Maximum number of clouds that can happen per day
#define Max_Clouds_per_Day 5
 
  // Only start the cloud effect after this setting
  // In this example, start could after 11:30am
#define Start_Cloud_After NumMins(16,00)
 
  // Always end the cloud effect before this setting
  // In this example, end could before 8:00pm
#define End_Cloud_Before NumMins(19,00)
 
  // Percentage chance of a lightning happen for every cloud
  // For testing purposes, you can use 100 and cause the lightning to have 100% chance of happening
#define Lightning_Change_per_Cloud 40
 
  // Channels used by the actinic LEDs on the PWM Expansion module
  // These channels will not be dimmed when the cloud effect is triggered
  // Number is a binary form. B001100 means channel 2 and 3 are used for actinics
#define Actinic_Channels B010110
 
  // Channels used by the daylight LEDs on the PWM Expansion module
  // These channels will be used for the spike when lightning effect is triggered
  // Number is a binary form. B000011 means channel 0 and 1 are used for daylights
#define Daylight_Channels B001001
 
  // Note: Make sure to choose correct values that will work within your PWMSLope settings.
  // For example, in our case, we could have a max of 5 clouds per day and they could last for 50 minutes.
  // Which could mean 250 minutes of clouds. We need to make sure the PWMSlope can accomodate 250 minutes of effects or unforseen 
  // results could happen.
  // Also, make sure that you can fit double those minutes between Start_Cloud_After and End_Cloud_Before.
  // In our example, we have 510 minutes between Start_Cloud_After and End_Cloud_Before, so double the 250 minutes (or 500 minutes) can
  //fit in that 510 minutes window.
  // It's a tight fit, but it did.
 
  //#define printdebug // Uncomment this for debug print on Serial Monitor window
#define forcecloudcalculation // Uncomment this to force the cloud calculation to happen in the boot process. 
 
 
  // Change the values above to customize your cloud/storm effect
  // ------------------------------------------------------------
  // Do not change anything below here
 
  static byte cloudchance=255;
  static byte numclouds=0;
  static byte cloudindex=0;
  static byte lightningstatus=0;
  static int LastNumMins=0;
  // Every day at midnight, we check for chance of cloud happening today
  if (hour()==0 && minute()==0 && second()==0) cloudchance=255;
 
#ifdef forcecloudcalculation
  if (cloudchance==255)
#else
    if (hour()==0 && minute()==0 && second()==1 && cloudchance==255) 
#endif
    {
      //Pick a random number between 0 and 99
      cloudchance=random(100); 
      // if picked number is greater than Cloud_Chance_per_Day, we will not have clouds today
      if (cloudchance>Cloud_Chance_per_Day) cloudchance=0;
      // Check if today is day for clouds. 
      if ((day()%Clouds_Every_X_Days)!=0) cloudchance=0; 
      // If we have cloud today
      if (cloudchance)
      {
        // pick a random number for number of clouds between Min_Clouds_per_Day and Max_Clouds_per_Day
        numclouds=random(Min_Clouds_per_Day,Max_Clouds_per_Day);
        // pick the time that the first cloud will start
        // the range is calculated between Start_Cloud_After and the even distribuition of clouds on this day. 
        cloudstart=random(Start_Cloud_After,Start_Cloud_After+((End_Cloud_Before-Start_Cloud_After)/(numclouds*2)));
 
        // pick a random number for the cloud duration of first cloud.
        cloudduration=random(Min_Cloud_Duration,Max_Cloud_Duration);
        //Pick a random number between 0 and 99
        lightningchance=random(100);
        // if picked number is greater than Lightning_Change_per_Cloud, we will not have lightning today
        if (lightningchance>Lightning_Change_per_Cloud) lightningchance=0;
      }
    }
  // Now that we have all the parameters for the cloud, let's create the effect
 
  if (ForceCloud)
  {
    ForceCloud=false;
    cloudchance=1;
    cloudduration=10;
    lightningchance=1;
    cloudstart=NumMins(hour(),minute())+1;
  }
 
  if (cloudchance)
  {
    //is it time for cloud yet?
    if (NumMins(hour(),minute())>=cloudstart && NumMins(hour(),minute())<(cloudstart+cloudduration))
    {
      // let's go through all channels to pick which ones will be dimmed
      for (int a=0;a<6;a++)
      {
        if (bitRead(Actinic_Channels,a)==0)
        {
          // this will slope down the channel from the current PWM to 0 within 3minutes.
          // then it will stay at 0 for the duration of the cycle
          // and finally slope up from 0 to PWM value within 3 minutes
          // it is basically an inversed slope
          ChannelValue[a]=ReversePWMSlope(cloudstart,cloudstart+cloudduration,ChannelValue[a],0,180);
        }
      }
      if (lightningchance && (NumMins(hour(),minute())==(cloudstart/*+(cloudduration/2)*/)) && second()<3) 
      {
        int strikes = random(7);
        for (int b=0;b<strikes;b++)
        {
          if (bitRead(Daylight_Channels,==1)
          {
            if (random(100)<20) lightningstatus=1; 
            else lightningstatus=0;
            if (lightningstatus) ChannelValue[b]=100; 
            else ChannelValue[b]=0;
            if (b==(random(strikes))) delay(5);
          }
          else
          {
            ChannelValue[b]=20;
          }
        }
      }
    }
 
    if (NumMins(hour(),minute())>(cloudstart+cloudduration))
    {
      cloudindex++;
      if (cloudindex < numclouds)
      {
        cloudstart=random(Start_Cloud_After+(((End_Cloud_Before-Start_Cloud_After)/(numclouds*2))*cloudindex*2),(Start_Cloud_After+(((End_Cloud_Before-Start_Cloud_After)/(numclouds*2))*cloudindex*2))+((End_Cloud_Before-Start_Cloud_After)/(numclouds*2)));
        // pick a random number for the cloud duration of first cloud.
        cloudduration=random(Min_Cloud_Duration,Max_Cloud_Duration);
        //Pick a random number between 0 and 99
        lightningchance=random(100);
        // if picked number is greater than Lightning_Change_per_Cloud, we will not have lightning today
        if (lightningchance>Lightning_Change_per_Cloud) lightningchance=0;
      }
    }
  }
}
//End Cloud Function
//*********************************************************************************************************************************
 
//*********************************************************************************************************************************
//Reverse PWM slope from cloud function
byte ReversePWMSlope(long cstart,long cend,byte PWMStart,byte PWMEnd, byte clength)
{
  long n=elapsedSecsToday(now());
  cstart*=60;
  cend*=60;
  if (n<cstart) return PWMStart;
  if (n>=cstart && n<=(cstart+clength)) return map(n,cstart,cstart+clength,PWMStart,PWMEnd);
  if (n>(cstart+clength) && n<(cend-clength)) return PWMEnd;
  if (n>=(cend-clength) && n<=cend) return map(n,cend-clength,cend,PWMEnd,PWMStart);
  if (n>cend) return PWMStart;
}
//End Reverse PWM function
//*********************************************************************************************************************************
//*********************************************************************************************************************************
//Calculate Sunrise/set by date & predefined season & rise/set times
void Seasons()
{
  //Set the hour you want the calculations of rise an set to be based on
  int UserRiseHour = 13;
  int UserSetHour =  22;
 
#define forceseasoncalculation
  static byte ssn , ssnp = 0 , ssnpt ;
  long stime, wstime, vstime, wrtime, rtime, vrtime;
  int wrhour,wrmin,wrsec,wshour,wsmin,wssec,rsec,ssec,vrhour,vrmin,vrsec,vshour,vsmin,vssec;
  int iDiffrise = 0;
  int iDiffset = 0;
  int risediffperday = 0;
  int setdiffperday = 0;
  int totalrise = 0;
  int totalset = 0;
  byte s=0;
  int DaysPerYear;        
 
  //rise and set times set by hour and minute. there are 4 seasons however there are 8 highs & lows in rise and set throughout the year
  //first spot is second half of winter starting jan 1st - DO NOT CHANGE
  int risehour[8]= {
    UserRiseHour+1,UserRiseHour+1,UserRiseHour+1,UserRiseHour,UserRiseHour,UserRiseHour-1,UserRiseHour,UserRiseHour      };/*{
   7,7,7,6,6,5,6,6      };*/
  int riseminute[8]={
    00,30,00,30,00,30,00,30            };
  int sethour[8] = {
    UserSetHour-2,UserSetHour-1,UserSetHour-1,UserSetHour,UserSetHour,UserSetHour,UserSetHour,UserSetHour-1      };/*{
   17,18,18,19,19,19,19,18      };*/
  int setminute[8] = {
    30,00,30,00,00,30,00,00            };
 
/*  //
  if (hour()==0 && minute()==0 && second()==0) ssnp=0;
#ifdef forceseasoncalculation
  if (ssnp==0)
#else
    if (hour()==0 && minute()==0 && second()==1 && ssnp==0)
#endif
    {*/
      //leapyear or not to define DaysPerYear - DO NOT CHANGE
      if (year()%4 == 0 && !(year()%100 == 0 && year()%400 != 0))
      {
        DaysPerYear=366;
      }
      else 
      {
        DaysPerYear = 365;
      }
      //Call Day Number Calc to determin day ie december 31st on a non leap year is day 365 - DO NOT CHANGE
      DayNumber(year(),month(),day());
      //define days between beginning, middle and end of seasons high peaks -  DO NOT CHANGE
      int seasons[9] ={
        0,45,96,135,187,238,283,328,DaysPerYear                                    };
      //define season and array pulling variable - DO NOT CHANGE
      for (s=0; seasons[s] < Ndays; s++) ssn = s+1, ssnpt = s+1, ssnp = s;
      //set loop on array time pulling variable to go back to beginning instead of increasing array size - DO NOT CHANGE
      if (ssn >= 7) ssn = 0;
 
      //differece in seconds between two rise/set array times pulled - DO NOT CHANGE
      long rise1 = calcSec(risehour[ssn],riseminute[ssn]);
      long rise2 = calcSec(risehour[ssnp],riseminute[ssnp]);
      iDiffrise = calcTime(rise1, rise2);
      long set1 = calcSec(sethour[ssn],setminute[ssn]);
      long set2 = calcSec(sethour[ssnp],setminute[ssnp]);
      iDiffset = calcTime(set1,set2);             
 
      //calculate new sunrise/set difference from array value & last group of code - DO NOT CHANGE
      risediffperday = iDiffrise/(seasons[ssnpt]-seasons[ssnp]);
      totalrise = risediffperday*(Ndays - seasons[ssnp]);
      setdiffperday = iDiffset/(seasons[ssnpt]-seasons[ssnp]);
      totalset = setdiffperday*(Ndays - seasons[ssnp]);
 
      //creating time in seconds for main sun rise/set number - DO NOT CHANGE
      rtime=calcSec(risehour[ssnp],riseminute[ssnp]);
      if (ssnp == 0 || ssnp == 2 || ssnp == 4 || ssnp == 6){ 
        rtime += totalrise;
      }
      else {
        rtime -= totalrise;
      }
      stime=calcSec(sethour[ssnp],setminute[ssnp]);
      if (ssnp == 1 || ssnp == 3 || ssnp == 5 || ssnp == 7){ 
        stime -= totalset;
      }
      else {
        stime += totalset;
      }
 
      //These are the off set times, standard rtime and stime are for Royal Blues & Blues
      // DO NOT CHANGE the operators in these equations ie +- 
      // The number is in seconds (1200) change this number to change the offset for each color
       wrtime = rtime + 1800;//w r/stime is for Whites - shorter time span then blues
       wstime = stime - 3600;
       vrtime = rtime - 1800;//v r/stime is for Violets - Longer time then blues
       vstime = stime + 1800;
       
       //turning seconds back to Hours:Minutes:Seconds
       //Blues
       rhour=rtime/3600; 
       rtime=rtime%3600;
       rmin=rtime/60; 
       rtime=rtime%60; 
       rsec=rtime;
       if(rsec > 30) rmin++; 
       shour=stime/3600; 
       stime=stime%3600;
       smin=stime/60; 
       stime=stime%60; 
       ssec=stime;
       if(ssec > 30) smin++;
       //White
       wrhour = wrtime/3600;
       wrtime=wrtime%3600;
       wrmin=wrtime/60;
       wrtime=wrtime%60;
       wrsec=wrtime;
       if(wrsec>30) wrmin++;
       wshour = wstime/3600;
       wstime=wstime%3600;
       wsmin=wstime/60;
       wstime=wstime%60;
       wssec=wstime;
       if(wssec>30) wsmin++;
       //Violet
       vrhour = vrtime/3600;
       vrtime=vrtime%3600;
       vrmin=vrtime/60;
       vrtime=vrtime%60;
       vrsec=vrtime;
       if(vrsec>30) vrmin++;
       vshour = vstime/3600;
       vstime=vstime%3600;
       vsmin=vstime/60;
       vstime=vstime%60;
       vssec=vstime;
       if(vssec>30) vsmin++;
       
       if (rmin==60)rmin=00, rhour+=1;
       if (smin==60)smin=00, shour+=1;
       if (wrmin==60)wrmin=00, wrhour+=1;
       if (wsmin==60)wsmin=00, wshour+=1;
       if (vrmin==60)vrmin=00, vrhour+=1;
       if (vsmin==60)vsmin=00, vshour+=1;
      //This is the PWM Slope for each channel, each channel pulls an array value from above(hour,minute) to use, how you set them is up to you. 
        //Just always use a Rise hour in a Rise spot, always a set hour in a set spot ect ect
      ChannelValue[LEDPWM0]=PWMSlope(wrhour,wrmin,wshour,wsmin,0,2.55*28,120,ChannelValue[LEDPWM0]);
      ChannelValue[LEDPWM1]=PWMSlope(vrhour,vrmin,vshour,vsmin,0,2.55*58,70,ChannelValue[LEDPWM1]);
      ChannelValue[LEDPWM2]=PWMSlope(rhour,rmin,shour,smin,0,2.55*58,90,ChannelValue[LEDPWM2]);
      ChannelValue[LEDPWM3]=PWMSlope(wrhour,wrmin,wshour,wsmin,0,2.55*36,105,ChannelValue[LEDPWM3]);
      ChannelValue[LEDPWM4]=PWMSlope(vrhour,vrmin,vshour,vsmin,0,2.55*90,45,ChannelValue[LEDPWM4]);
      //ChannelValue[LEDPWM0]=PWMSlope(wrhour,wrmin,wshour,wsmin,0,2.55*85,180,ChannelValue[LEDPWM4]);
}
//End Seasons Calculation
//*********************************************************************************************************************************
 
//*********************************************************************************************************************************
//Calculators for Seasons function
long calcSec(long hr, long minu)
{
  long totalseconds;
  totalseconds=(hr*3600)+(minu*60);
  return totalseconds;
}
 
long calcTime(long seconds1, long seconds2)
{
  long timediff=abs(seconds1-seconds2);
  return timediff;
}
 
void DayNumber(unsigned int y, unsigned int m, unsigned int d)
{
  int days[]={
    0,31,59,90,120,151,181,212,243,273,304,334            };    // Number of days at the beginning of the month in a not leap year.
  //Start to calculate the number of day
  if (m==1 || m==2){
    Ndays = days[(m-1)]+d;            //for any type of year, it calculate the number of days for January or february
  }            // Now, try to calculate for the other months
  else if ((y % 4 == 0 && y % 100 != 0) ||  y % 400 == 0){  //those are the conditions to have a leap year
    Ndays = days[(m-1)]+d+1;     // if leap year, calculate in the same way but increasing one day
  }
  else {                 //if not a leap year, calculate in the normal way, such as January or February
    Ndays = days[(m-1)]+d;
  }
} 
//End calculators
//*********************************************************************************************************************************

 

Code to add to main RA above setup

 

 

//*********************************************************************************************************************************
//Start of PWM Expansion Code Header

 
//Variables we will pull from PWM module
byte SeasonsVar[]={
  0,0,0,0,0,0,0,0,0,0,0,0};
 

// This is just how we are going to reference the PWM expansion ports within the code.
// You can change the labels if you would like, just as long as they are changed all throughout the code too.
#define LEDPWM0 0
#define LEDPWM1 1
#define LEDPWM2 2
#define LEDPWM3 3
#define LEDPWM4 4
#define LEDPWM5 5
 
// Initial values to all 6 channels at startup. They will always be 0.
byte PWMChannel[]={
  0,0,0,0,0,0};
//End of PWM Expansion Code Header
//*********************************************************************************************************************************
Link to comment
jedimasterben

no you don't. The two ports on the relay box that are standard Daylight/actinic two pin fan connectors are 0-10v.

 

so basically you'll have 6 pwm ports on the expansion and 2 0-10v on the relay box.

I got the PWM RA, so it has two PWM port on it, unless there are 0-10v ports added on.

 

unless he upgraded to the RA Plus at some point (and I didn't see it) or moves the code to the PWM module itself, he's going to be in the same situation with running out of room for code.

 

I haven't read EVERY page of your thread, so forgive me if I missed something.

Nope, just standard RA.

 

All of my lighting code is on the PWM module, I use the standard 32kb RA with ORP, PWM, Salinity, RF and Wifi expansions and I only use 28kb on the main RA board. The PWM code is 16kb

 

PWM Module code

[insert awesome code here]

I'm glad you reminded me of that, since I was going to upgrade to the RA+. :)

Link to comment
bencollinz

 

 

^^ yup, I know. I copied one or two things from your code. Working on my PWM PDE right now as well.

 

Just, in his RA thread he had a page about being out of room, etc.

Link to comment
Deckoz2302

I got the PWM RA, so it has two PWM port on it, unless there are 0-10v ports added on.

 

Nope, just standard RA.

 

I'm glad you reminded me of that, since I was going to upgrade to the RA+. :)

....oh haha I thought you had the standard RA. If you did it would be like I said above.

 

and yea you just gotta know where to cut your code size. also knowing how to code minimalist helps that way your not doing large amounts of code for simple outcomes

Link to comment
jedimasterben

....oh haha I thought you had the standard RA. If you did it would be like I said above.

 

and yea you just gotta know where to cut your code size. also knowing how to code minimalist helps that way your not doing large amounts of code for simple outcomes

Unfortunately I know next to nothing about coding lol

 

I also need to custom-order the PWM expansion so that it can have 10v PWM ports instead of 5v. I just wish that there was a simple way to change my PWM on the controller itself to analog. :/

Link to comment
Deckoz2302

Unfortunately I know next to nothing about coding lol

 

I also need to custom-order the PWM expansion so that it can have 10v PWM ports instead of 5v. I just wish that there was a simple way to change my PWM on the controller itself to analog. :/

Yet you have an RA...lol im confused?

 

Also why do yoy need 10v? The pwm module has a separate transducer fo channel 1/2, 3/4, and 5/6. So the module will ayto adjust voltage output as you are supplying 12volt to it. Just make sure the drivers on each transducer is the same voltage dimmer. It works especially well when the driver creates its own reference voltage. For example

 

Ive used the same ra pwm module on

Buckpucks that create thier own 10v reference some are analog some accept pwm

Meanwell 60p - 10v analog but doesn't create its own reference

Meanwell ldd pwn series - 5v pwm lead without its own reference

Link to comment
Deckoz2302

Is RA a reef angel? And if so, is that like an Apex?

Yes ra is reef angel. Yes its like apex in the fact it can control a tank. But no In the fact that I can add any arduino shield to it and all programming is done via c++ code. So i can make it as complex as possible. where apex is simple preprogrammed calls you "code" by listing the calls

Link to comment

Ah ok. Reef Angel would be well out of my abilities. No arduino knowledge let alone c++ or programming.

Link to comment
Deckoz2302
The only code I care about is genetic code. Other code is confusing to me.

 

 

Combine the two. Biotechnology. Mmmmmm

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recommended Discussions


×
×
  • Create New...