Water Level ATO programming issue

Expansion modules and attachments
Post Reply
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Water Level ATO programming issue

Post by jcjrogers »

Maybe I don't understand the parameters set with the Water Level sensor using as an ATO. It appears that at least sometimes, the only way I'm able to engage the low level is to clear ATO Timeout (no "timeout has occurred). I'm assuming low level should engage (start filling) when my low level percentage is reached and when my high level percentage is reaached, it should shut-off the relay. I watch the Uapp screen for the levels, and it doesn't engage/disengage when my numbers are reached. However, I've let it go for a few hours, and it must have run as my level has remained pretty constant. I've now connected to my kalk stirrer so I need a way to set a very short interval I can depend on and follow visually so I started with 97 high and 94 low. My level got down to 92-93, I cleared the ATO, and the pump came right on. This has occurred other times as well, though like I said, it must not always be occurring or the controller isn't really using the high/low values I've entered into Uapp. This is my code:

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.AddStandardMenu();  // Add Standard Menu
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    ReefAngel.AddMultiChannelWaterLevelExpansion();  // Multi-Channel Water Level Expanion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port7Bit;
    ReefAngel.FeedingModePortsE[0] = Port3Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port4Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = Port3Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit | Port3Bit | Port5Bit | Port7Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port1Bit | Port2Bit | Port3Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
    ReefAngel.LightsOnPortsE[0] = Port1Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T2_PROBE;
    ReefAngel.OverheatProbe = T2_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 840 );

    // Ports that are always on
    //*ReefAngel.Relay.On( Port1 ); - place holder for Webwizard.  Using ActinicLights code for Port 1
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port3 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Box1_Port5 );
   
    ////// Place additional initialization code below here
   

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

void loop()
{
    ReefAngel.StandardLights( Port2 );
    ReefAngel.StandardHeater1( Box1_Port2 );
    ReefAngel.Relay.Set( Port3, !ReefAngel.Relay.Status( Port2 ) );
    ReefAngel.StandardHeater1( Port5 );
    ReefAngel.WaterLevelATO( 1,Port8 );
    ///if ( ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port8); - Not yet installed
    ReefAngel.Relay.DelayedOn( Port7 );
    ReefAngel.StandardFan1( Port6 );
    if ( ReefAngel.Params.PH > 840 ) ReefAngel.Relay.Off( Port8 );
    ///if ( ReefAngel.LowATO.IsActive()) ReefAngel.Relay.On(Port8); - Not yet installed

    ////// Place your custom code below here
    ReefAngel.WaterLevelATO( 2,Box1_Port4,5,95,14400 ); // hard codes ATO reservoir settings since only one available in Uapp.
    MyOwnStandardLights(Port1,-InternalMemory.ActinicOffset_read());  // Calls my new offset to allow negative offset.
    
    
    ////// Place your custom code above here

    ReefAngel.CloudPortal();
    // This should always be the last line
    ReefAngel.ShowInterface();
}

    void MyOwnStandardLights(byte Relay, int MinuteOffset)
{
   int onTime=NumMins(InternalMemory.StdLightsOnHour_read(),InternalMemory.StdLightsOnMinute_read())-MinuteOffset;
   int offTime=NumMins(InternalMemory.StdLightsOffHour_read(),InternalMemory.StdLightsOffMinute_read())+MinuteOffset;
   ReefAngel.StandardLights(Relay,
         onTime/60,
         onTime%60,
         offTime/60,
         offTime%60
   );
}

// RA_STRING1=U2FsdGVkX1/MRai+5HT5Qq9ZfbEK1mzFXKwT07B7oyM=
// RA_STRING2=U2FsdGVkX1+PuVSO4WlfFCjqa//mhJqdV9c4vId+V1I=
// RA_STRING3=Chloe's House-2.4
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water Level ATO programming issue

Post by rimai »

I think it is because you are using ATO function on two ports and one is affecting the other because one is causing the ATO timeout and the other can't activate because it has the flag on.
I would suggest using only one ATO function.
Roberto.
jcjrogers
Posts: 66
Joined: Fri May 05, 2017 11:27 am

Re: Water Level ATO programming issue

Post by jcjrogers »

rimai wrote:I think it is because you are using ATO function on two ports and one is affecting the other because one is causing the ATO timeout and the other can't activate because it has the flag on.
I would suggest using only one ATO function.
I changed that and reloaded, and all is well. What I originally planned with my reservoir wasn't going to work anyway.
Post Reply