Seasonal Temperatures

Do you have a question on how to do something.
Ask in here.

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Thu Oct 12, 2017 5:08 pm
Code: Select all
void SeasonalTemps ()
 {
  static int heatArray[][2] = { {792,796},// default in case of error in month=0 (June)
                    {770,774},//January (winter)
                    {774,778},//February (winter)
                    {775,779},//March (early spring)
                    {779,783},//April (spring)
                    {785,789},//May (spring)
                    {792,796},//June (early summer)
                    {799,803},//July (summer)
                    {806,810},//August (summer)
                    {796,800},//September (early fall)
                    {787,791},//October (fall)
                    {780,784},//November (fall)
                    {775,779} };//December (early winter)
                   
               
  ReefAngel.StandardHeater( Port2,heatArray[month()][0],heatArray[month()][1]);
 }//end seasonalTemps


hi, saw this and would love to add this to my ino but am worried I won't implement it properly.

is there anything I need to change or remove from my current code?
Code: Select all

#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here


void setup()
{
    // This must be the first line
    InternalMemory.LCDID_write(0); //this line was added when i got a replacement RA+ board
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;
   
 

    // Ports that are always on
    ReefAngel.Relay.On( Port4 );
   

    ////// Place additional initialization code below here
   

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.ActinicLights( Port1 );
    ReefAngel.DayLights( Port2 );
    ReefAngel.StandardHeater( Port3 );
    ReefAngel.Relay.DelayedOn(Port5 );
    ReefAngel.DosingPumpRepeat1( Port7 );
    ReefAngel.DosingPumpRepeat2( Port8 );
    ReefAngel.PWM.DaylightPWMSlope();
    ReefAngel.PWM.ActinicPWMSlope();
    ReefAngel.DCPump.LowATOChannel = Sync; // WP40
    ReefAngel.DCPump.HighATOChannel = AntiSync; // SW-8
    ReefAngel.DCPump.AntiSyncOffset = 125;
   
    ////// Place your custom code below here
   
    // Wavemaker
   
    if ( ((hour() >= 2) && (hour() < 8)) || ((hour() >= 15) && (hour() < 19)) ) // off from 2am-8am & 3pm-7pm
      {
        ReefAngel.Relay.Off(Port6);
      }
        else
      {
        ReefAngel.WavemakerRandom( Port6, 30, 150 ); // random between 30 and 150 seconds
      }
 
 
    // DC pumps....................................
    static int rmode;
    static boolean changeMode=true;

    // These are the modes we can cycle through. You can add more and even repeat...
    byte modes[] = { ReefCrest, Lagoon, TidalSwell, ShortPulse, Sine, Else, Gyre, NutrientTransport };

    if (now()%1800==0 || changeMode==true)  // Change every 30 mins (1800seconds) or controller reboot
    {
    rmode=random(100)%sizeof(modes); // Change the mode by picking from our array
    changeMode=false;
    }

    // Set timer when in feeding mode
    static unsigned long feeding;
    if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
   
    // Continue NutrientTranspot Mode for 30 minutes after feeding
    if (now()-feeding<1800)
    {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
    ReefAngel.DCPump.Mode=ReefCrest;
    ReefAngel.DCPump.Speed=75;
    }
   
    // Night/Quiet mode
      else if (hour()>=2 && hour()<8 ) // 2am to 8am
    {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.SetMode( Gyre,40,10 );
    }
      else if (hour()>=15 && hour()<19) // 3pm and 7pm
    {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.SetMode( ShortPulse,40,30 );
    }
   
    //Storm mode
    else if (hour()>=1 && hour()<2) // 1am and 2am
    {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.SetMode( Else,70,15 ); 
    }
      else if (hour()>=11 && hour()<12) // 11am and 12pm
    {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.SetMode( ReefCrest,80,15 ); 
    }
   
    // Custom Mode and nothing else going on
    else if (InternalMemory.DCPumpMode_read()==11)
    {
    ReefAngel.DCPump.UseMemory=false;
    ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
    ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode :)
    ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
    } else {
    ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
    }
    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "" );
    ReefAngel.DDNS( "" ); // Your DDNS is
    ReefAngel.ShowInterface();
}

Image
User avatar
Posts: 2602
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Thu Oct 12, 2017 7:13 pm
you will want to change the port in the seasonaltemps function to use port3, like your code.
then you will want to remove /comment out the standardheater function call from your loop and instead just call SeasonalTemps(); function.

it shouldn't affect anything else. the only other thing to check on is your overheat temperature value and make sure it is higher than the temperatures listed in the seasonaltemps function.

Sent from my XT1585 using Tapatalk

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Fri Oct 13, 2017 4:13 am
thats awesome, thanks Curt.

is there a way to do something similar with my lighting? i.e.. longer days when it's warmer and shorter days when the water is cooler.
Image
User avatar
Posts: 2602
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Fri Oct 13, 2017 5:50 pm
in theory, you certainly could. if you did it this way, you would have to hard code the light schedule instead of using the memory (although you could do memory, it would just be more complicated).
do you have an idea of what what the light schedule would be?
would there be a ramp up or ramp down for leds or is it just an outlet turning on/off?

Sent from my XT1585 using Tapatalk

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Fri Oct 13, 2017 6:40 pm
I don't want anything complicated so hard code would be just fine. I currently ramp my white leds from 0 to 65 on slope over 90 mins and my actinics from 0 to 80 over 90 mins as well.

how would I go about hard coding this?
Image
User avatar
Posts: 2602
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Fri Oct 13, 2017 8:02 pm
to do it, you will need to create an array of the parameters that would be used. if the slope ranges always stay the same, then that will simply things. I'm assuming that they will and you will be adjusting the overall total daylight.
so, what I would start with is creating an array of start/stop times for the daylight, like the low and high temps.
{8,0,16,0} - on at 8am and off at 1600 (4p). so on hour, on minute, off hour, off minute.
make an array for all the months of the year.
once you have that, then we need a function that calls the sloping of the lights with the hard coded values based on the month. like the temp calls the hard coded standardheater function with values.

that's a start for you.

Sent from my XT1585 using Tapatalk

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Sat Oct 14, 2017 5:43 am
Thanks for your help Curt

so something like this for daylight on port 2?
Code: Select all

void SeasonalDaylight ()
 {
  static int heatArray[][2] = { {13,0,22,0},// default in case of error in month=0 (May)
                    {15,0,22,0},//January (winter)
                    {14,30,22,0},//February (winter)
                    {14,0,22,0},//March (early spring)
                    {13,30,22,0},//April (spring)
                    {13,0,22,0},//May (spring)
                    {12,30,22,0},//June (early summer)
                    {12,0,22,0},//July (summer)
                    {12,30,22,0},//August (summer)
                    {13,0,22,0},//September (early fall)
                    {13,30,22,0},//October (fall)
                    {14,0,22,0},//November (fall)
                    {14,30,22,0} };//December (early winter)
                   
               
  ReefAngel.DayLights( Port2,heatArray[month()][0],heatArray[month()][1]);
 }//end SeasonalDaylight


and actinics on port 1

Code: Select all

void SeasonalActiniclight ()
 {
  static int heatArray[][2] = { {12,30,22,30},// default in case of error in month=0 (May)
                    {14,30,22,30},//January (winter)
                    {14,0,22,30},//February (winter)
                    {13,30,22,30},//March (early spring)
                    {13,0,22,30},//April (spring)
                    {12,30,22,30},//May (spring)
                    {12,0,22,30},//June (early summer)
                    {11,30,22,30},//July (summer)
                    {12,0,22,30},//August (summer)
                    {12,30,22,30},//September (early fall)
                    {13,0,22,30},//October (fall)
                    {13,30,22,30},//November (fall)
                    {14,0,22,30} };//December (early winter)
                   
               
  ReefAngel.ActinicLights( Port1,heatArray[month()][0],heatArray[month()][1]);
 }//end SeasonalActinics


thats my best guess at coding :D not sure how to ramp lights up via slope or adjust the intensity by month/season?

thanks
Image
User avatar
Posts: 2602
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Sat Oct 14, 2017 9:11 am
close, but you need some tweaking. give me a few hours to tweak it some for you and I'll post some code for you to test

Sent from my XT1585 using Tapatalk
User avatar
Posts: 2602
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Sat Oct 14, 2017 10:02 am
Do you have 2 sets of lights? Looking at your code, you toggle Port 1 for your Actinic lights and Port 2 for your Daylight Lights. Plus, you also have the PWM channels using the ActinicPWMSlope and DaylightPWMSlope.
I'm assuming that you have the power supplies for your LEDs plugged into the Relay Box and you just turn the power supplies off when you want the LEDs to be off in addition to dimming them down.

Is this correct?

Posts: 173
Joined: Fri Dec 26, 2014 6:38 pm
PostPosted: Sat Oct 14, 2017 10:26 am
I have one set of lights. I use pwm channels for the same lights because they dim down low but won't shut down completely unless they are plugged into the relay box. I would like to use those ports for something else, is there a way to shut them down with the pwm alone?
Image
Next

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 2 guests

cron