SingleATOLow not working properly

Basic / Standard Reef Angel hardware
Post Reply
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

SingleATOLow not working properly

Post by alexwbush »

I am not sure what I am doing wrong here. I have a set of float switches wired in series (for redundancy) plugged into ATOLow that controls my ATO (port 8). Thoughts?

It works when I hard code ATOLow to turn on/off port 8, but I don't get the 60 second timeout:

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 <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
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port4Bit | Port5Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port6Bit | Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


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

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

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

void loop()
{
    ReefAngel.DayLights( Port1 );
    ReefAngel.ActinicLights( Port2 );
    ReefAngel.ActinicLights( Port3 );
    ReefAngel.StandardHeater( Port6 );
    ReefAngel.StandardHeater( Port7 );
//    ReefAngel.SingleATOLow( Port8 );
    ReefAngel.PWM.DaylightPWMParabola();
    ReefAngel.PWM.ActinicPWMParabola();
    ////// Place your custom code below here
    
    if ( ReefAngel.LowATO.IsActive() )
    {
       ReefAngel.Relay.On(Port8);
    }
    else
    {
       ReefAngel.Relay.Off(Port8);
    }

    ////// Place your custom code above here

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

But this won't work (using SingleATOLow). It'll work the first time but then never comes back on when the water level is too low:

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 <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
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port4Bit | Port5Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port6Bit | Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


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

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

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

void loop()
{
    ReefAngel.DayLights( Port1 );
    ReefAngel.ActinicLights( Port2 );
    ReefAngel.ActinicLights( Port3 );
    ReefAngel.StandardHeater( Port6 );
    ReefAngel.StandardHeater( Port7 );
    ReefAngel.SingleATOLow( Port8 );
    ReefAngel.PWM.DaylightPWMParabola();
    ReefAngel.PWM.ActinicPWMParabola();
    ////// Place your custom code below here
    
    ////// Place your custom code above here

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

alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: SingleATOLow not working properly

Post by alexwbush »

And it really doesn't make sense because the portal is showing my ATOLow as active (green), so why isn't it triggering?
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: SingleATOLow not working properly

Post by alexwbush »

Is there an easy code I can add to see the up to the minute status of the ATOs on the display? Maybe to replace the graphs. I think my 2 wire plug in port may be malfunctioning or loose.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: SingleATOLow not working properly

Post by rimai »

Both are working for me here.
Add this to your code inside the loop() section:

Code: Select all

    if (ReefAngel.LowATO.IsActive())
      ReefAngel.LCD.Clear(0,10,120,18,128);
    else
      ReefAngel.LCD.Clear(255,10,120,18,128);
This will draw a square below the time to indicate when the ATO port is active or not.
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: SingleATOLow not working properly

Post by alexwbush »

thanks for the code Roberto. The ATO switches are working great and accurate. For some reason it's not triggering the relay to turn on. Could it be there is something wrong with the timer being reset? It seems that it only does it once, then never again right after I load the code.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: SingleATOLow not working properly

Post by rimai »

You just found a bug on the Wizard.
The Wizard is missing the setting for hour interval.
That's why it only runs once. It's waiting for X hours before it can run again.
Since it is not setting the X in your memory, it is using whatever you've got in the memory right now.
You can use Java Status app or Android app to change it or you may load the InitialInternalMemory code or add this to your setup():

Code: Select all

InternalMemory.ATOHourInterval_write(0);
I need to add this memory location to both Wizard and Portal.
This will save 0 into your memory settings.
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: SingleATOLow not working properly

Post by alexwbush »

awesome! I updated the memory using the Android app... THANKS!
Post Reply