ATO Reservoir refill every few days

Do you have a question on how to do something.
Ask in here.
Post Reply
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: ATO Reservoir refill every few days

Post by Spotted »

Ok, so after a really long trip out of town, I have returned!
It would appear that the code for the ATO reservoir refill does not function as hoped. Actually it does nothing. Can someone please take a look at it and tell me what needs to be done to fix it?
I really appreciate all your help on this.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO Reservoir refill every few days

Post by rimai »

I think it would be easier to just do this:

Code: Select all

ReefAngel.Relay.Set(Port1,(now%129600)<10800));
I have not tested, but it may be worth a try.
129600=number of seconds in 3 days
10800=number of seconds in 3 hours
It will turn on for 10800 seconds every 129600 seconds.
It will always turn on starting at midnight.
Roberto.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: ATO Reservoir refill every few days

Post by Spotted »

Ok, so remove this

Code: Select all

// Set this to the port your solenoid is on.
#define ROSolenoid Box2_Port6

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;
  }
And make it look like this

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
    ReefAngel.Relay.Set(Box1_Port6,(now%129600)<10800));
    ////// 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 = false; //ignore programming and use memory locations if true
    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( Lagoon,40,66 );
    }
    else
    {
    // Normal power
    ReefAngel.DCPump.SetMode( Constant,70,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();
}
// Set this to the port your solenoid is on.
and is that new code in the right place? The line right above

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

Or should it go above this line:

////// Place your custom code above here
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO Reservoir refill every few days

Post by rimai »

It has to be on loop section or it will only work at boot and never again.
setup() section only happens on boot and loop() section happens all the time.
Roberto.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: ATO Reservoir refill every few days

Post by Spotted »

Ok I tried this and got an error mesage. Here's the code and I hope it's in the correct place.

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 = false; //ignore programming and use memory locations if true
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    ReefAngel.Relay.Set(Box2_Port6,(now%129600)<10800));

    ////// 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( Lagoon,40,66 );
    }
    else
    {
    // Normal power
    ReefAngel.DCPump.SetMode( Constant,70,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();
}
Here's my error:

The following features were automatically added:
Watchdog Timer
Version Menu

The following features were detected:
Wifi Attachment
Relay Expansion Module
DC Pump Control (Jebao/Tunze)
Dimming Signal
2014 Main Screen
Extra Font - Medium Size (8x8 pixels)
Metal Halide Setup
Number of Relay Expansion Modules: 2
Simple Menu
sketch_jun26.cpp: In function 'void loop()':
sketch_jun26:87: error: invalid operands of types 'time_t ()()' and 'long int' to binary 'operator%'
sketch_jun26:87: error: expected `;' before ')' token




Help please!
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO Reservoir refill every few days

Post by rimai »

Sorry, I forgot the parenthesis.
Try this:

Code: Select all

ReefAngel.Relay.Set(Box2_Port6,((now()%129600)<10800));
Roberto.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: ATO Reservoir refill every few days

Post by Spotted »

Hi Roberto, I'm trying to check if this change is working, but I get no info on the relay activity in the portal. It says that there is no data.
The portal itself shows current data, but nothing in relay activity or in web chart.
Can you point me in the right direction?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO Reservoir refill every few days

Post by rimai »

You may need to update the firmware of wifi attachment:
http://forum.reefangel.com/viewtopic.php?f=3&t=4601
Roberto.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: ATO Reservoir refill every few days

Post by Spotted »

Ok, I ran the ttl file to make sure all was good, but I still cant get any data on the web portal for relay activity or for web chart.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO Reservoir refill every few days

Post by rimai »

Can you post the tera term result?
Roberto.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: ATO Reservoir refill every few days

Post by Spotted »

Here they are:
CMD
get w
SSID=Fish
Chan=0
ExtAnt=0
Join=1
Auth=WPA2
Mask=0x1fff
Rate=12, 24 Mb
Linkmon-Infra=30
Linkmon-AP=3600
Passphrase=FishfisH
EAP_Id=userid
EAP_User=peap-user
<4.00>

get i
IF=UP
DHCP=ON
IP=192.168.1.200:2000
NM=255.255.255.0
GW=192.168.1.1
HOST=104.36.18.155:80
PROTO=TCP,
MTU=1524
FLAGS=0x6
TCPMODE=0x0
BACKUP=0.0.0.0
<4.00>
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO Reservoir refill every few days

Post by rimai »

Looks correct.
Are you sure your code has the correct forum username?
Roberto.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: ATO Reservoir refill every few days

Post by Spotted »

It is. Does the forum name matter for the rest of the web portal? I am able to see all the items. I can control the relays and get updates on my parameters. The only 2 things I can't get are the relay activity and the web chart.
The Relay Activity says no data and the web chart is just blank..
Here's the code, is there a problem with it somewhere maybe?

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 = false; //ignore programming and use memory locations if true
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    ReefAngel.Relay.Set(Box1_Port6,((now()%259200)<3600));

    ////// 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( Lagoon,40,66 );
    }
    else
    {
    // Normal power
    ReefAngel.DCPump.SetMode( Constant,70,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
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO Reservoir refill every few days

Post by rimai »

It is probably the DDNS line.
Remove it and see if it works.
Roberto.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: ATO Reservoir refill every few days

Post by Spotted »

Ok, that did it.
Thanks!
Another question. I am running both my Jebao pumps on one side of my tank now, kind of like a gyre configuration. They are of course run by my RA. There are a couple lines in the code that looks like they define Sync and AntiSync. I assume that on is for on channel ,the other is the opposite channel. Is it possible to change one line so both say Sync or AntiSync and they both act as one pump even though they are on different dimming channels?
Thanks again.
Image
Post Reply