ATO not turning on.

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

ATO not turning on.

Post by Sacohen »

Can anyone see why my Water Level Expansion is not triggering when it gets below 31%?
I've been monitoring it all morning on the portal and it has read 26% all morning.
Also is there a better place to see a history of Relay Activity then the Portal, like the Reef Angel Client?

These areas where changed last night trying to get my De-nitrification chamber working properly.

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

unsigned long ATOUpdate=0;
////// Place global variable code above here

And

void loop()
{
ReefAngel.StandardLights( Port1,12,0,22,0 );
ReefAngel.StandardLights( Port2,13,0,21,0 );
ReefAngel.Relay.Set( Port3, !ReefAngel.Relay.Status( Port1 ) );
ReefAngel.StandardLights( Port7,13,0,21,0 );
ReefAngel.Relay.Set(Port5,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
ReefAngel.Relay.Set(Port8,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
if (ReefAngel.Relay.Status(Port5) && ATOUpdate==0) // Check to see if port 5 is on and update time is empty
{ ATOUpdate = now(); // If so, set the update time to now
ReefAngel.Relay.Off (Port6); } // and turn off the ATO pump
if (now() - ATOUpdate >= 120 && ATOUpdate != 0) // If it's been 120 sec, and the update time is NOT empty
{ ATOUpdate = 0; // Empty out the update time
ReefAngel.WaterLevelATO(Port6,720,29,31); } // and turn the ATO sensor back on
ReefAngel.PWM.SetActinic(MyCustomWave(50));
if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(0);
if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
////// Place your custom code below here

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 <ReefAngel.h>

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

unsigned long ATOUpdate=0;
////// 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 = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port4Bit | 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;
    // Use T2 probe as temperature and overheat functions
    ReefAngel.TempProbe = T2_PROBE;
    ReefAngel.OverheatProbe = T2_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 825 );
    //Set Standard Menu
    ReefAngel.AddStandardMenu();


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

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

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

void loop()
{
    ReefAngel.StandardLights( Port1,12,0,22,0 );
    ReefAngel.StandardLights( Port2,13,0,21,0 );
    ReefAngel.Relay.Set( Port3, !ReefAngel.Relay.Status( Port1 ) );
    ReefAngel.StandardLights( Port7,13,0,21,0 );
    ReefAngel.Relay.Set(Port5,(now()-3600)%21600<1200); // Runs for 1200s every 21600 seconds
    ReefAngel.Relay.Set(Port8,((now()-3600)-1200)%21600<1200); // Runs for 1200s every 21600 seconds with 1200s offset
if (ReefAngel.Relay.Status(Port5) && ATOUpdate==0) // Check to see if port 5 is on and update time is empty
  { ATOUpdate = now();                             // If so, set the update time to now
    ReefAngel.Relay.Off (Port6); }                 // and turn off the ATO pump
if (now() - ATOUpdate >= 120 && ATOUpdate != 0)    // If it's been 120 sec, and the update time is NOT empty
  { ATOUpdate = 0;                                 // Empty out the update time
    ReefAngel.WaterLevelATO(Port6,720,29,31); }    // and turn the ATO sensor back on
    ReefAngel.PWM.SetActinic(MyCustomWave(50));
    if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(0);
    if( ReefAngel.DisplayedMenu==WATERCHANGE_MODE ) ReefAngel.PWM.SetActinic(0);
    if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
    ////// Place your custom code below here
    

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

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

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 20, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // Water Level
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,75,66, "WL:" );
    ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,99,66, ReefAngel.WaterLevel.GetLevel() );
    pingSerial();

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 92, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
}
byte MyCustomWave(byte maxspeed)
{
  static byte randomspeed=0;
  if (now()%11<5)
  {
    return randomspeed;
  }
  else if (now()%11>=5 && now()%11<10)
  {
    return maxspeed;
  }
  else
  {
    randomspeed=random(35,maxspeed);
    return 0;
  }
}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: ATO not turning on.

Post by rimai »

I think it is related to the delay you have in there.
Roberto.
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: ATO not turning on.

Post by cosmith71 »

I'm not familiar with the water level sensor. Where it it initially called? The only reference I see to port 6 is in out delay code.

--Colin
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: ATO not turning on.

Post by Sacohen »

The Water Level Sensor is call in the libraries I think by the following code...

Code: Select all

ReefAngel.WaterLevelATO(Port6,720,29,31;
It means start the pump plugged into Port6 when then percentage of water in the sensor goes below 29% and stop it when it reaches 31%. The time out is 720 in this case because I'm using a Tom's Aqua lifter to feed the water and they are very slow pumps (3g/h if I remember correctly).
Post Reply