DmnYnkee's Code

Share you PDE file with our community

Posts: 81
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida
PostPosted: Tue Oct 20, 2015 7:28 pm
My current code tweaked after move to Florida. Went from standard Oceanic 90 gallon before move, to SCA150 gallon, custom built into wall.

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 <ReefAngel.h>
#include <SunLocation.h>
#include <Tide.h>
#include <Moon.h>
#include <WiFiAlert.h>


////// Place global variable code below here
 
  SunLocation sl;
 
  int avgph[10];
    unsigned long totalavgph=0;
    byte avgindex=0;

void DrawCustomMain()
    {
      byte x;
      byte y = 2;
      char text[7];

      // *********** CHANGE TEMP READOUT COLOR DEPENDENT ON FAN AND HEATER STATUS ***********
      int TempColor;                                    // Color for drawing temperature
      boolean HeatOn = ReefAngel.Relay.Status(Port6);   // Get the status of the heater relay
      if (HeatOn)
      {
        TempColor = COLOR_NAVY;                         // Blue text, too cold, heater is on
      }

      if (!HeatOn)
      {
          TempColor = COLOR_GREEN;                      // Green text, no fan or heater on
      }
      // ***********************************************************************************
           int pHColor;                                 // Color for drawing pH
      boolean LowpH = (ReefAngel.Params.PH < 780) ;     // Check for Low pH Value
      boolean HighpH = (ReefAngel.Params.PH > 850);     // Check for High pH Value
      if (LowpH)
      {
        pHColor = COLOR_NAVY;                          // Blue text, Low pH value
      }
      if (HighpH)   
      {
        pHColor = COLOR_RED;                           // Red text, High pH value
      }
      if (!LowpH && !HighpH)
      {
        pHColor = COLOR_GREEN;                         // Green text, pH acceptable
      }
      // ***********************************************************************************
      ReefAngel.LCD.DrawLargeText(COLOR_DARKSLATEBLUE,DefaultBGColor, 6, 3, " Thunder Reef",Font8x8);   // Put a banner at the top
      ReefAngel.LCD.DrawDate(6, 119);                                                                   // Put the date and time at the bottom
      ReefAngel.LCD.Clear(COLOR_BLACK, 1, 12, 132, 12);                                                 // Draw a cyan line under the banner
      x = 6;
      y += MENU_START_ROW*1.4;                                                                          // MENU_START_ROW is 10, according to globals.h, so y=2+10+1=13
      ReefAngel.LCD.DrawLargeText(COLOR_BLUE, COLOR_WHITE, x, y+1, " Temp      pH");

      ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);                                    // Get T1 temp and convert
      x = 2;
      y += MENU_START_ROW*1.6;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_BLACK, TempColor, x, y, text);                                // Draw the temperature, white numbers on a colored background
      ConvertNumToString(text, ReefAngel.Params.PH, 100);                                               // Get pH reading and convert
      x = 2;
      y = MENU_START_ROW*2.6;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_YELLOW, pHColor, x+65, y+6, text);                            // Put pH on the screen
     
      x += 6;
      y += MENU_START_ROW*3.3;
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,25,y,"Sump Level",Font8x8);      // Draw the Sump Float switch status
  if (ReefAngel.HighATO.IsActive()) {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_RED);
  } else {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_GREEN);
  }
  x += 6;
  y += MENU_START_ROW*2.0;
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,25,y,"Skimmer Cup",Font8x8);     // Draw the Skimmer Cup Float switch status
  if (ReefAngel.LowATO.IsActive()) {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_RED);
  }
     
     
      byte TempRelay = ReefAngel.Relay.RelayData;                                          // Code for drawing the relay box
      TempRelay &= ReefAngel.Relay.RelayMaskOff;
      TempRelay |= ReefAngel.Relay.RelayMaskOn;
      ReefAngel.LCD.DrawOutletBox(12, 100, TempRelay);
   }
void DrawCustomGraph()
{
}

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();                                                                        //Initialize controller
    ReefAngel.Use2014Screen();                                                               // Let's use 2014 Screen
    ReefAngel.FeedingModePorts = Port5Bit | Port7Bit;                                        // Ports toggled in Feeding Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port7Bit | Port8Bit;                  // Ports toggled in Water Change Mode
    ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit;                                // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit;   // Ports turned off when Overheat temperature exceeded
    ReefAngel.TempProbe = T1_PROBE;                                                          // Use T1 probe as temperature and overheat functions
    ReefAngel.OverheatProbe = T1_PROBE;
    InternalMemory.OverheatTemp_write( 830 );                                                // Set the Overheat temperature setting

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


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port7 );
 

    ////// Place additional initialization code below here
   
    sl.Init(28.5708, -81.6995);    // Lat/long for Clermont, FL
    sl.SetOffset(-3,0,-3,0);       // rise_hour, rise_seconds, set_hour, set_seconds (set 1 hr later for better viewing time)

    randomSeed(now()%SECS_PER_DAY);
     
      //Custom Variable [0] =  Month/Season
   
    ReefAngel.CustomLabels[0]="Return"; 
    ReefAngel.CustomLabels[1]="Daylights"; 
    ReefAngel.CustomLabels[2]="Actinics"; 
    ReefAngel.CustomLabels[3]="Fuge Light"; 
    ReefAngel.CustomLabels[4]="Reactor"; 
    ReefAngel.CustomLabels[5]="Heater"; 
    ReefAngel.CustomLabels[6]="Skimmer"; 
    ReefAngel.CustomLabels[7]="ATO"; 
   
    ReefAngel.ReverseATOHigh();

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

void loop()
{
 

    // seasonal temperatures
    SeasonalTemps();

    ReefAngel.DayLights( Port2 );             // ATI DayLights (White+Purple)  On 120 min after sunrise, off 120 min before sunset.
    ReefAngel.ActinicLights( Port3 );         // ATI Actinic+ Lights (Blues).   On at sunrise, off at sunset.
    ReefAngel.MoonLights( Port4 );            // Refugium light.  On 120 min before sunset, off 150 min after sunrise.
 
   
    ////// Place your custom code below here
   
if (hour()>=8 && hour()<10)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,60,5,true) ); // Long pulse at 60% with 5s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,60,5,false) ); // Long pulse at 60% with 5s pulse on Anti-sync mode
}
else if (hour()>=10 && hour()<11)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,63,2,true) ); // Long pulse at 63% with 2s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,63,2,false) ); // Long pulse at 63% with 2s pulse on Anti-sync mode
}
else if (hour()>=11 && hour()<12)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,68,408,true) ); // Short pulse at 68% with 408ms pulse on sync mode (3/4" surface wave)
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,68,408,false) ); // Short pulse at 68% with 408ms pulse on Anti-sync mode (3/4" surface wave)
}
else if (hour()>=12 && hour()<14)
{
 ReefAngel.PWM.SetDaylight( GyreMode(35,80,25,true) ); // Gyre 35% ramping up to 80% for 25 minutes on sync mode
 ReefAngel.PWM.SetActinic( GyreMode(35,80,25,false) ); // Gyre 35% ramping up to 80% for 25 minutes on Anti-sync mode
}
else if (hour()>=14 && hour()<15)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,72,408,true) ); // Short pulse at 72% with 408ms pulse on sync mode (1" surface wave)
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,72,408,false) ); // Short pulse at 72% with 408ms pulse on Anti-sync mode (1" surface wave)
}
else if (hour()>=15 && hour()<17)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,68,408,true) ); // Short pulse at 68% with 408ms pulse on sync mode (3/4" surface wave)
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,68,408,false) ); // Short pulse at 68% with 408ms pulse on Anti-sync mode (3/4" surface wave)
}
else if (hour()>=17 && hour()<18)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(38,75,3,true) ); // Long pulse at 38%/75% with 3s pulse on sync mode (Nutrient transport mode)
 ReefAngel.PWM.SetActinic( LongPulseMode(38,75,3,false) ); // Long pulse at 38%/75% with 3s pulse on Anti-sync mode (Nutrient transport mode)
}
else if (hour()>=18 && hour()<19)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,63,5,true) ); // Long pulse at 63% with 5s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,63,5,false) ); // Long pulse at 63% with 5s pulse on Anti-sync mode
}
else if (hour()>=19 && hour()<20)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,60,10,true) ); // Long pulse at 60% with 10s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,60,10,false) ); // Long pulse at 60% with 10s pulse on Anti-sync mode
}
else
{
 ReefAngel.PWM.SetDaylight( ReefCrestMode(46,10,true) ); // reefcrest at 46% +/- 10% on sync mode  (night Mode)
 ReefAngel.PWM.SetActinic( ReefCrestMode(46,10,true) ); // reefcrest at 46% +/- 10% on sync mode  (night mode)
}
 
if( ReefAngel.DisplayedMenu==FEEDING_MODE )
{
 ReefAngel.PWM.SetActinic(0);
 ReefAngel.PWM.SetDaylight(0);
}

if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE )
{
 ReefAngel.PWM.SetActinic(35);
 ReefAngel.PWM.SetDaylight(35);
}
   
   
   
//    if(ReefAngel.LowATO.IsActive())           //  Float switch in Skimmer Cup
 {
    ReefAngel.Relay.On(Port7);
 }
    else
 {
    ReefAngel.Relay.Off(Port7);               //  Turn off Skimmer when Cup full.
 }
   
    ReefAngel.SingleATO(false,Port8,180,1);   //  Sump switch.  If ATO runs for 180 seconds, then shut off and send alert. Max times on is 1 per hour for bounce purposes.
   
  {
    sl.CheckAndUpdate();  // handle updating sunrise and sunset values
  }
 
    ////// Place your custom code above here

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

 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( Port6,heatArray[month()][0],heatArray[month()][1]);
 }//end seasonalTemps
Image
User avatar
Posts: 5328
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Oct 21, 2015 1:25 pm
Pics or it didn't happen!

Posts: 81
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida
PostPosted: Wed Oct 21, 2015 4:17 pm
It most definitely happened, haha! Still trying to figure out how to add pics to the forum. Looking like I can only add 3 at a time??

IMG_2088.JPG
IMG_2088.JPG (546.49 KiB) Viewed 3000 times

IMG_2102.JPG
IMG_2102.JPG (58.82 KiB) Viewed 3000 times

IMG_2146.JPG
IMG_2146.JPG (98.71 KiB) Viewed 3000 times
Image

Posts: 81
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida
PostPosted: Wed Oct 21, 2015 4:25 pm
These pics are all from the build. New tank has been up and running for about 3 months now. Have made many changes to sump and tank since I took these. Will take more pics later.

You can see my current stock list on Pinterest. https://www.pinterest.com/dmnynkee01/current-aquarium-stock/

IMG_2131.JPG
IMG_2131.JPG (162.88 KiB) Viewed 3000 times
IMG_2138.JPG
IMG_2138.JPG (35.47 KiB) Viewed 3000 times
IMG_2148.JPG
IMG_2148.JPG (158.03 KiB) Viewed 3000 times
Image
User avatar
Posts: 5328
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Oct 21, 2015 9:38 pm
Wow that looks awesome! Congrats on the new build. I really like the scape and the in-wall view.

Posts: 81
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida
PostPosted: Thu Oct 22, 2015 5:40 am
The scape has grown a bit. That pic was taken early in the cycling process.

The main thing I am needing to do, is a lighting upgrade. I am still using the 4 bulb t5 fixture from the 90 gallon. There are so many options, that I can't commit to one enough to pull the trigger. I over think to a fault, lol.

The tank is only 24" in depth, with a 5' x 2' footprint, euro braced. I like the idea of Radions, but with the shallower depth, I would most likely only run them around 40% max, so why pay for 60% that I will not use.... I want controllability, and compatibility with the RA unit.
Image
User avatar
Posts: 5328
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Thu Oct 22, 2015 2:33 pm
Buy chinese black boxes. If you want good ones check out the chinese blackbox led proof group on facebook. We can modify them for dimming control and you might be able to buy pre modified (not sure yet) as well. The group buy lights have a great spectrum and the admin's premium boxes are even better for like 20-30 more. They start at 99 and will grow everything. Dont waste tons of money for radions.

Posts: 81
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida
PostPosted: Thu Oct 22, 2015 3:10 pm
Here are some scape pics as it is today.

IMG_2238[1].jpg
Full
IMG_2238[1].jpg (134.81 KiB) Viewed 2986 times

IMG_2239[1].jpg
Left side
IMG_2239[1].jpg (139.17 KiB) Viewed 2986 times

IMG_2240[1].jpg
Right side
IMG_2240[1].jpg (137.67 KiB) Viewed 2986 times
Image

Posts: 81
Joined: Mon Aug 11, 2014 6:45 am
Location: Clermont, Florida
PostPosted: Fri Oct 30, 2015 10:43 am
Latest code.

Changes:
Updated from single ATO system to dual ATO system. ATO 1 (port 5) with RoDi/Kalk running from 8pm-8am, but only if pH is below 8.3 (failsafe), otherwise just RoDi on ATO 2 (port 8). Moved BRS dual reactor from port 5 to return pump port 1(always on).

Prior to implementing this change, pH was fluctuating from ~8.05 low at night, to ~8.35 daytime peak. Goal is to reduce .3 pH daily swing to <.2, with ideal results being <.15 (and still keep Alk/Ca/Mag within limits).

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 <ReefAngel.h>
#include <SunLocation.h>
#include <Tide.h>
#include <Moon.h>
#include <WiFiAlert.h>


////// Place global variable code below here
 
  SunLocation sl;
 
  int avgph[10];
    unsigned long totalavgph=0;
    byte avgindex=0;

void DrawCustomMain()
    {
      byte x;
      byte y = 2;
      char text[7];

      // *********** CHANGE TEMP READOUT COLOR DEPENDENT ON FAN AND HEATER STATUS ***********
      int TempColor;                                    // Color for drawing temperature
      boolean HeatOn = ReefAngel.Relay.Status(Port6);   // Get the status of the heater relay
      if (HeatOn)
      {
        TempColor = COLOR_NAVY;                         // Blue text, too cold, heater is on
      }

      if (!HeatOn)
      {
          TempColor = COLOR_GREEN;                      // Green text, no fan or heater on
      }
      // ***********************************************************************************
           int pHColor;                                 // Color for drawing pH
      boolean LowpH = (ReefAngel.Params.PH < 780) ;     // Check for Low pH Value
      boolean HighpH = (ReefAngel.Params.PH > 850);     // Check for High pH Value
      if (LowpH)
      {
        pHColor = COLOR_NAVY;                          // Blue text, Low pH value
      }
      if (HighpH)   
      {
        pHColor = COLOR_RED;                           // Red text, High pH value
      }
      if (!LowpH && !HighpH)
      {
        pHColor = COLOR_GREEN;                         // Green text, pH acceptable
      }
      // ***********************************************************************************
      ReefAngel.LCD.DrawLargeText(COLOR_DARKSLATEBLUE,DefaultBGColor, 6, 3, " Thunder Reef",Font8x8);   // Put a banner at the top
      ReefAngel.LCD.DrawDate(6, 119);                                                                   // Put the date and time at the bottom
      ReefAngel.LCD.Clear(COLOR_BLACK, 1, 12, 132, 12);                                                 // Draw a black line under the banner
      x = 6;
      y += MENU_START_ROW*1.4;                                                                          // MENU_START_ROW is 10, according to globals.h, so y=2+10+1=13
      ReefAngel.LCD.DrawLargeText(COLOR_BLUE, COLOR_WHITE, x, y+1, " Temp      pH");

      ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);                                    // Get T1 temp and convert
      x = 2;
      y += MENU_START_ROW*1.6;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_BLACK, TempColor, x, y, text);                                // Draw the temperature, white numbers on a colored background
      ConvertNumToString(text, ReefAngel.Params.PH, 100);                                               // Get pH reading and convert
      x = 2;
      y = MENU_START_ROW*2.6;
      ReefAngel.LCD.DrawHugeNumbers(COLOR_YELLOW, pHColor, x+65, y+6, text);                            // Put pH on the screen
     
      x += 6;
      y += MENU_START_ROW*3.3;
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,25,y,"Sump Level",Font8x8);      // Draw the Sump Float switch status
  if (ReefAngel.HighATO.IsActive()) {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_RED);
  } else {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_GREEN);
  }
  x += 6;
  y += MENU_START_ROW*2.0;
  ReefAngel.LCD.DrawLargeText(COLOR_INDIGO,DefaultBGColor,25,y,"Skimmer Cup",Font8x8);     // Draw the Skimmer Cup Float switch status
  if (ReefAngel.LowATO.IsActive()) {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_GREEN);
  } else {
    ReefAngel.LCD.FillCircle(15,y+3,7,COLOR_RED);
  }
     
     
      byte TempRelay = ReefAngel.Relay.RelayData;                                          // Code for drawing the relay box
      TempRelay &= ReefAngel.Relay.RelayMaskOff;
      TempRelay |= ReefAngel.Relay.RelayMaskOn;
      ReefAngel.LCD.DrawOutletBox(12, 100, TempRelay);
   }
void DrawCustomGraph()
{
}

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();                                                                        //Initialize controller
    ReefAngel.Use2014Screen();                                                               // Let's use 2014 Screen
    ReefAngel.FeedingModePorts = Port7Bit;                                                   // Ports toggled in Feeding Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port7Bit | Port8Bit;                  // Ports toggled in Water Change Mode
    ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit;                                // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit;   // Ports turned off when Overheat temperature exceeded
    ReefAngel.TempProbe = T1_PROBE;                                                          // Use T1 probe as temperature and overheat functions
    ReefAngel.OverheatProbe = T1_PROBE;
    InternalMemory.OverheatTemp_write( 830 );                                                // Set the Overheat temperature setting

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


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

    ////// Place additional initialization code below here
   
    sl.Init(28.5708, -81.6995);    // Lat/long for Clermont, FL
    sl.SetOffset(-3,0,-3,0);       // rise_hour, rise_seconds, set_hour, set_seconds (set 1 hr later for better viewing time)

    randomSeed(now()%SECS_PER_DAY);
     
      //Custom Variable [0] =  Month/Season
   
    ReefAngel.CustomLabels[0]="Return"; 
    ReefAngel.CustomLabels[1]="Daylights"; 
    ReefAngel.CustomLabels[2]="Actinics"; 
    ReefAngel.CustomLabels[3]="Fuge Light"; 
    ReefAngel.CustomLabels[4]="ATO Kalk"; 
    ReefAngel.CustomLabels[5]="Heater"; 
    ReefAngel.CustomLabels[6]="Skimmer"; 
    ReefAngel.CustomLabels[7]="ATO RoDi"; 
   

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

void loop()
{
 

    // seasonal temperatures
    SeasonalTemps();

    ReefAngel.DayLights( Port2 );             // ATI DayLights (White+Purple)  On 120 min after sunrise, off 120 min before sunset.
    ReefAngel.ActinicLights( Port3 );         // ATI Actinic+ Lights (Blues).   On at sunrise, off at sunset.
    ReefAngel.MoonLights( Port4 );            // Refugium light.  On 120 min before sunset, off 120 min after sunrise.
 
   
    ////// Place your custom code below here
   
if (hour()>=8 && hour()<10)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,60,5,true) ); // Long pulse at 60% with 5s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,60,5,false) ); // Long pulse at 60% with 5s pulse on Anti-sync mode
}
else if (hour()>=10 && hour()<11)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,65,2,true) ); // Long pulse at 65% with 2s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,65,2,false) ); // Long pulse at 65% with 2s pulse on Anti-sync mode
}
else if (hour()>=11 && hour()<12)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,68,408,true) ); // Short pulse at 68% with 408ms pulse on sync mode (3/4" surface wave)
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,68,408,false) ); // Short pulse at 68% with 408ms pulse on Anti-sync mode (3/4" surface wave)
}
else if (hour()>=12 && hour()<14)
{
 ReefAngel.PWM.SetDaylight( GyreMode(35,80,25,true) ); // Gyre 35% ramping up to 80% for 25 minutes on sync mode
 ReefAngel.PWM.SetActinic( GyreMode(35,80,25,false) ); // Gyre 35% ramping up to 80% for 25 minutes on Anti-sync mode
}
else if (hour()>=14 && hour()<15)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,75,408,true) ); // Short pulse at 75% with 408ms pulse on sync mode (1" surface wave)
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,75,408,false) ); // Short pulse at 75% with 408ms pulse on Anti-sync mode (1" surface wave)
}
else if (hour()>=15 && hour()<17)
{
 ReefAngel.PWM.SetDaylight( ShortPulseMode(0,68,408,true) ); // Short pulse at 68% with 408ms pulse on sync mode (3/4" surface wave)
 ReefAngel.PWM.SetActinic( ShortPulseMode(0,68,408,false) ); // Short pulse at 68% with 408ms pulse on Anti-sync mode (3/4" surface wave)
}
else if (hour()>=17 && hour()<18)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(38,75,3,true) ); // Long pulse at 38%/75% with 3s pulse on sync mode (Nutrient transport mode)
 ReefAngel.PWM.SetActinic( LongPulseMode(38,75,3,false) ); // Long pulse at 38%/75% with 3s pulse on Anti-sync mode (Nutrient transport mode)
}
else if (hour()>=18 && hour()<19)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,65,5,true) ); // Long pulse at 65% with 5s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,65,5,false) ); // Long pulse at 65% with 5s pulse on Anti-sync mode
}
else if (hour()>=19 && hour()<20)
{
 ReefAngel.PWM.SetDaylight( LongPulseMode(0,60,10,true) ); // Long pulse at 60% with 10s pulse on sync mode
 ReefAngel.PWM.SetActinic( LongPulseMode(0,60,10,false) ); // Long pulse at 60% with 10s pulse on Anti-sync mode
}
else
{
 ReefAngel.PWM.SetDaylight( ReefCrestMode(46,10,true) ); // reefcrest at 46% +/- 10% on sync mode  (night Mode)
 ReefAngel.PWM.SetActinic( ReefCrestMode(46,10,true) ); // reefcrest at 46% +/- 10% on sync mode  (night mode)
}
 
if( ReefAngel.DisplayedMenu==FEEDING_MODE )
{
 ReefAngel.PWM.SetActinic(0);
 ReefAngel.PWM.SetDaylight(0);
}

if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE )
{
 ReefAngel.PWM.SetActinic(35);
 ReefAngel.PWM.SetDaylight(35);
}
   
   
   
if(ReefAngel.LowATO.IsActive())           //  Float switch in Skimmer Locker
{
 ReefAngel.Relay.On(Port7);
}
 else
{
 ReefAngel.Relay.Off(Port7);               //  Turn off Skimmer when locker full.
}
 
   
if ((hour()>=20 || hour()<=8) && (ReefAngel.Params.PH < 830))
{
 ReefAngel.SingleATO(false,Port5,180,0);   //  Sump switch. Kalk schedule 8pm - 8am if pH < 8.3  If ATO/Kalk runs for 180 seconds, then shut off and send alert.
}
 else   
{
 ReefAngel.SingleATO(false,Port8,180,0);   //  Sump switch.  If ATO/RoDi runs for 180 seconds, then shut off and send alert.
}
 
  {
    sl.CheckAndUpdate();  // handle updating sunrise and sunset values
  }
 
    ////// Place your custom code above here

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

 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( Port6,heatArray[month()][0],heatArray[month()][1]);
 }//end seasonalTemps
Image

Posts: 102
Joined: Wed Nov 18, 2015 9:16 pm
PostPosted: Tue Dec 08, 2015 9:01 pm
how is that ato code with the ph set level working for you? im interested in doing the same thing with a ato pump to kalk stirrer and a straight ato pump.
Next

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 2 guests