Page 1 of 1

ATO Adjustment

Posted: Sun Oct 27, 2013 7:51 pm
by AnthonyK
I've been trying myself to code this but just not having any luck with it.

I have a Standard ATO and need to set a code so that the pump isn't recycling on and off repeatedly when the water splashes in the sump.

How do I code the ATO pump to turn on only when the LowATO is active for at least 5 seconds? Appreciate any help I can get. Thanks

Re: ATO Adjustment

Posted: Mon Oct 28, 2013 6:12 am
by lnevo
The code Roberto gave you in this thread is not working?

http://forum.reefangel.com/viewtopic.php?t=3944#p33300

Re: ATO Adjustment

Posted: Mon Oct 28, 2013 6:13 am
by lnevo
Also... If you are using StandardATO then it should be using two float switches...spread them out a bit more because the standard ato function fills until the high switch is up and does not turn back on until low is back down...

Re: ATO Adjustment

Posted: Mon Oct 28, 2013 2:09 pm
by AnthonyK
No, I couldn't get that code to work.

Re: ATO Adjustment

Posted: Mon Oct 28, 2013 2:10 pm
by lnevo
Did it not compile? Or did it not do what you needed?

Re: ATO Adjustment

Posted: Mon Oct 28, 2013 2:14 pm
by AnthonyK
It was only doing the part that said turn on for xx minutes every yy minutes. It ignored the low ato isactive part.

Re: ATO Adjustment

Posted: Mon Oct 28, 2013 2:46 pm
by lnevo
Impossible... unless you're code was in wrong, or the code needing that needed to be reversed depending on your switch status... can you post the code you used (full INO)

Re: ATO Adjustment

Posted: Mon Oct 28, 2013 6:13 pm
by AnthonyK

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

////// Place global variable code below here
#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Feeding";
prog_char menu1_label[] PROGMEM = "Water Change";
prog_char menu2_label[] PROGMEM = "ATO Clear";
prog_char menu3_label[] PROGMEM = "Clear Overheat";
prog_char menu4_label[] PROGMEM = "Fuge Lights";
prog_char menu5_label[] PROGMEM = "PH Calibration";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label  };

void MenuEntry1()
{
ReefAngel.FeedingModeStart();

}
void MenuEntry2()
{
;ReefAngel.WaterChangeModeStart();


}
void MenuEntry3()
{
ReefAngel.ATOClear();

}
void MenuEntry4()
{
ReefAngel.OverheatClear();

}
void MenuEntry5()
{
ReefAngel.Relay.Override(Port7, ReefAngel.Relay.Status(Port7)+1);
  ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;


}
void MenuEntry6()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;

}

////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port2Bit | Port5Bit | Port6Bit;
    ReefAngel.FeedingModePortsE[0] = Port1Bit | Port2Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;
    ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit | Port3Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port7Bit | Port8Bit;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit | Port4Bit | Port7Bit | Port8Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port2Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 830 );
    
    
    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Box1_Port4 );

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

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

void loop()
{
    ReefAngel.StandardHeater( Port3,775,780 );
    ReefAngel.StandardLights( Port4,9,0,21,0 );
    ReefAngel.StandardLights( Port7,21,0,9,0 );
    ReefAngel.StandardLights( Port8,10,0,20,0 );
    ReefAngel.StandardATO( Box1_Port1,600 );
    ReefAngel.StandardLights( Box1_Port2,1,0,13,0 );
    ReefAngel.StandardFan( Box1_Port3,785,790 );
    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.SetMode( ReefCrest,70,25 );
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    
    ////// Place your custom code below here

if (ReefAngel.LowATO.IsActive())
{
  ReefAngel.DosingPumpRepeat(Box1_Port1,0,10,60);
}  
else
{
  ReefAngel.Relay.Off(Box1_Port1);
}  
    
    ////// Place your custom code above here

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

void DrawCustomMain()
{
    int x,y;
    char text[10];
    
    // "Sammy's Reef"
    ReefAngel.LCD.DrawLargeText (12, 255,18,8,"Sammy's Reef");
    
    // Salinity Display
    ReefAngel.LCD.DrawLargeText(0,255,15,30,"Salt");
    ReefAngel.LCD.DrawLargeText(2,255,15,40,"1.025");  //(Delete this line when sensor is installed)
    //ConvertNumToString(text,ReefAngel.Params.Salinity, 1000); (add this line when sensor is installed)
    //ReefAngel.LCD.DrawLargeText(COLOR_BLUE,255,15,40,text,Num8x8); (add this line when sensor is installed)
    pingSerial();
    
    // Water Level Display
    /// To be added when expansion is purchased
    
    // Left Power Head Display (Actinic)
    ReefAngel.LCD.DrawLargeText (0,255,15,50,"L Wave");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(),COLOR_BLUE,15,60,1);
    pingSerial();
    
    //Right Power Head Display (Daylight)
    ReefAngel.LCD.DrawLargeText (0,255,75,50,"R Wave");
    ReefAngel.LCD.DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(),COLOR_BLUE, 75, 60, 1); //<Color, Pos From Right, Pos From Top, Decimal Placement>
    pingSerial(); 

    // Temperature Display
    ReefAngel.LCD.DrawLargeText(0,255,15,70,"Temp");
    ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
    ReefAngel.LCD.DrawLargeText(COLOR_BLUE, 255, 15, 80, text, Num8x8);
    pingSerial();

    // PH Display
    ReefAngel.LCD.DrawLargeText(0,255,75,70,"pH");
    ConvertNumToString(text, ReefAngel.Params.PH, 100);
    ReefAngel.LCD.DrawLargeText(COLOR_BLUE, 255, 75, 80, text, Num8x8);
    pingSerial();
   
    

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

    // Relay Expansion
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 12, 107, TempRelay );
    pingSerial();

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

void DrawCustomGraph()
{
}

Re: ATO Adjustment

Posted: Mon Oct 28, 2013 6:14 pm
by AnthonyK
It may be working now, I have to wait and see but looks it's been set this way for the afternoon and not gone above the low ato switch yet.

I added the {}brackets to the if and else code...could that have made a difference?