ATO Reservoir refill every few days

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

Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida
PostPosted: Mon Feb 15, 2016 8:47 pm
Is there a way to run an ATO reservoir fill cycle every few days instead of based on float switches? How can I run it like every 3 days? Is there a way to do that?
I currently run it manually with a 12V solenoid, but I want to automate it. I mean that is the purpose of my tank computer, right?
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Feb 15, 2016 9:08 pm
Yes I just shared my function with someone else in this thread.

viewtopic.php?t=5896#p51479

It relies on the water level sensor to know when to fill and when to stop. Without float switches how will you know? You could rely on a float valve to stop your RO/DI and just go for a specific time. Let me know, we can modify that code pretty easily.

Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida
PostPosted: Thu Feb 18, 2016 4:51 pm
Yes that's my current set up. I have a float valve on the feed line to my reservoir. Right now I turn on the RO/DI port ,it fills and after a few hours, or days, whenever I remember to shut it off,I shut it off.
I was just thinking fill the tank every 3 days. Just run the RO/DI for X hours then wait another 3 days and refill again.
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Thu Feb 18, 2016 6:08 pm
Yeah that works. What time do you want it to kick in? You gonna manually turn it off still or do you want it to turn off after a set time?

Edit: nvm you said x hours.

Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida
PostPosted: Fri Feb 19, 2016 6:55 pm
11PM would be a good time
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Feb 21, 2016 8:46 am
This should do it.

Code: Select all
// Set this to the port your solenoid is on.
#define ROSolenoid Port5

void RefillATO() {
  static boolean refillActive=false; // Flag to determine if we've initiated the refill.
  static time_t startedAt=0;
 
  byte startAt=23;
  byte runFor=6;
  byte runEvery=3;
 
  if ( now()+(startAt*SECS_PER_HOUR) % (runEvery*SECS_PER_DAY)==0 ) {
    ReefAngel.Relay.Override(ROSolenoid,1); // We turn on the solenoid port.
    startedAt=now();
    refillActive=true;
  }
 
  if ( now()-startedAt == runFor*SECS_PER_HOUR && refillActive) {
    ReefAngel.Relay.Override(ROSolenoid,0); // Back to automatic mode
    refillActive=true;
    startedAt=0;
  }
}


Let us know how it goes.

Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida
PostPosted: Tue Feb 23, 2016 8:04 pm
Ok, I really appreciate the help, but I need a little bit more. I'm not sure where to put the code into my code. :oops:
So, here's my code.
Thanks in advance.

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
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = Port3Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = Port3Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = Port1Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // 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( Port3 ); //Sump Powerhead. Main Relay Port 3
    ReefAngel.Relay.On( Port4 );//Display Lights
    ReefAngel.Relay.On( Port5 ); //Display Tank Power Heads MaiRelay Port 5
    ReefAngel.Relay.On( Port8 ); //Return Pump Relay 1 Port 8
    ReefAngel.Relay.On( Box1_Port1 ); //ATS Air Pump. Relay 2 Port 1
    ReefAngel.Relay.On( Box1_Port2 ); //Media Reactor. Relay 2 Port 2
    ReefAngel.Relay.On( Box1_Port3 ); //Aqualifter. Relay 2 Port 3
    ReefAngel.Relay.Off( Box2_Port8 );//Referencing Relay 3
    ////// Place additional initialization code below here
   

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

void loop()
{
    ReefAngel.SingleATOLow( Port1 );
    ReefAngel.Relay.DelayedOn( Port7 ); //Skimmer Relay 1 Port 7
    ReefAngel.MHLights( Box1_Port4 ); //ATS Light Relay 2 Port 4
    ReefAngel.DCPump.UseMemory = true; //ignore programming and use memory locations
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    ////// Place your custom code below here
   
    if ((now()%SECS_PER_DAY==31320)) //if it is 8:42 AM
    {ReefAngel.FeedingModeStart();} //START FEEDING MODE
    if ((now()%SECS_PER_DAY==67320)) //if it is 6:42 PM
    {ReefAngel.FeedingModeStart();} //START FEEDING MODE
   
   
    if (hour()>=22 || hour()<9)
    { // Sleep mode - slow things down
    ReefAngel.DCPump.SetMode( ReefCrest,25,10 );
    }
    else
    {
    // Normal power
    ReefAngel.DCPump.SetMode( ReefCrest,50,10 );
    }
   
    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "spotted" );
    ReefAngel.DDNS( "7730.homeip.net:2000" ); // Your DDNS is spotted-7730.homeip.net:2000.myreefangel.com
    ReefAngel.ShowInterface();
}

Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Tue Feb 23, 2016 8:14 pm
Put all of it after the last } in your code. Then in the part at the current bottom where it says place your custom code below here put the following line to activate the function

RefillATO();

Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida
PostPosted: Wed Feb 24, 2016 7:34 am
Is this correct?
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
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = Port3Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = Port3Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = Port1Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // 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( Port3 ); //Sump Powerhead. Main Relay Port 3
    ReefAngel.Relay.On( Port4 );//Display Lights
    ReefAngel.Relay.On( Port5 ); //Display Tank Power Heads MaiRelay Port 5
    ReefAngel.Relay.On( Port8 ); //Return Pump Relay 1 Port 8
    ReefAngel.Relay.On( Box1_Port1 ); //ATS Air Pump. Relay 2 Port 1
    ReefAngel.Relay.On( Box1_Port2 ); //Media Reactor. Relay 2 Port 2
    ReefAngel.Relay.On( Box1_Port3 ); //Aqualifter. Relay 2 Port 3
    ReefAngel.Relay.Off( Box2_Port8 );//Referencing Relay 3
    ////// Place additional initialization code below here
   

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

void loop()
{
    ReefAngel.SingleATOLow( Port1 );
    ReefAngel.Relay.DelayedOn( Port7 ); //Skimmer Relay 1 Port 7
    ReefAngel.MHLights( Box1_Port4 ); //ATS Light Relay 2 Port 4
    ReefAngel.DCPump.UseMemory = true; //ignore programming and use memory locations
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    ////// Place your custom code below here
   
    if ((now()%SECS_PER_DAY==31320)) //if it is 8:42 AM
    {ReefAngel.FeedingModeStart();} //START FEEDING MODE
    if ((now()%SECS_PER_DAY==67320)) //if it is 6:42 PM
    {ReefAngel.FeedingModeStart();} //START FEEDING MODE
   
   
    if (hour()>=22 || hour()<9)
    { // Sleep mode - slow things down
    ReefAngel.DCPump.SetMode( ReefCrest,25,10 );
    }
    else
    {
    // Normal power
    ReefAngel.DCPump.SetMode( ReefCrest,50,10 );
    }
    RefillATO();
    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "spotted" );
    ReefAngel.DDNS( "7730.homeip.net:2000" ); // Your DDNS is spotted-7730.homeip.net:2000.myreefangel.com
    ReefAngel.ShowInterface();
}
// Set this to the port your solenoid is on.
#define ROSolenoid Port5

void RefillATO() {
  static boolean refillActive=false; // Flag to determine if we've initiated the refill.
  static time_t startedAt=0;
 
  byte startAt=23;
  byte runFor=6;
  byte runEvery=3;
 
  if ( now()+(startAt*SECS_PER_HOUR) % (runEvery*SECS_PER_DAY)==0 ) {
    ReefAngel.Relay.Override(ROSolenoid,1); // We turn on the solenoid port.
    startedAt=now();
    refillActive=true;
  }
 
  if ( now()-startedAt == runFor*SECS_PER_HOUR && refillActive) {
    ReefAngel.Relay.Override(ROSolenoid,0); // Back to automatic mode
    refillActive=true;
    startedAt=0;
  }
}
Image
User avatar
Posts: 5350
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Feb 24, 2016 8:13 am
Yes should work
Next

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 3 guests