Auto Water change conections!!

New members questions
Post Reply
baroutas
Posts: 116
Joined: Sat Oct 13, 2012 11:21 pm
Location: GREECE-HELLAS
Contact:

Auto Water change conections!!

Post by baroutas »

Hi again!!! I would like to know what kind of ecuipment i need for auto water change and what are the conections??
Please if sameone have the schematic, send to me (thanosmparoytas@hotmail.com).
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Auto Water change conections!!

Post by rimai »

There are several ways of doing this....
I think the easiest is to use 2 pumps. One to pump water out and one to pump water in.
Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: Auto Water change conections!!

Post by DrewPalmer04 »

Yep that's what I do with the ATO floats.
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
baroutas
Posts: 116
Joined: Sat Oct 13, 2012 11:21 pm
Location: GREECE-HELLAS
Contact:

Re: Auto Water change conections!!

Post by baroutas »

ΟΚ I understand!! I thought of something different! If someone has the plumbing (water pipes - sewage next to the aquarium) at home, will put 2 solenoid (one for input and one for output of water from the aquarium) that is controlled by two opposing relay? If you know the exact time it needs to empty and fill (x) llitre then plan and the corresponding relay! Also could be automatically filled when would lower the level of the aquarium, and how? :?:
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Auto Water change conections!!

Post by 00Warpig00 »

I have my Auto Water Change set to pick my water source SW or RO water based on salinity at start of water change. I have my WC mode set to do all critical water functions based on float switches in my sump and in my topoff containers nothing is based on how long it should take for water to drain/fill etc. It seems the water level expansion would be a great way to drive water changes but I dont have a water level expansion since I bought all my RA equipment before it was even announced much less available. It is probably easier to use the waterlevel expansion to do ATO and water changes then float switches as I have had problems with both my IO module and some float switches attached to it. One switch i still have not resolved it's flakiness even after replacement. So yes there are a bunch of ways to do auto water change. I think most involve pumping water out of the system with one pump (mine is in my sump) and pumping water in to my sump with another pump (in my ATO RO\SW tank).

Nick
180G FOWLR
20GH QT#1
29G QT#2

Image
baroutas
Posts: 116
Joined: Sat Oct 13, 2012 11:21 pm
Location: GREECE-HELLAS
Contact:

Re: Auto Water change conections!!

Post by baroutas »

Thanks alot for your time to answer me and sare with me your way for Ayto water change!!!

Thanos!
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Auto Water change conections!!

Post by 00Warpig00 »

If you are interested in the details I can post my RA code for you to look at that is based off water levels measured by 6 float switches in my system hooked to an IO module.

the process is something like this.

1. Enter waterchange mode via menu or android
2. shut stuff off
3. let water settle into sump
4. turn sump drain pump on until sump empty float is activated
5. turn off sump drain pump
6. turn on appropriate pump in water change bins to start refill of sump.
7. pump until sump full float is activated
8. turn stuff and accessories back on.
9. return to normal mode.

Nick
180G FOWLR
20GH QT#1
29G QT#2

Image
baroutas
Posts: 116
Joined: Sat Oct 13, 2012 11:21 pm
Location: GREECE-HELLAS
Contact:

Re: Auto Water change conections!!

Post by baroutas »

Yes i 'm interested to learn the details!!!Thats very kind from you and thanks!!
00Warpig00
Posts: 289
Joined: Wed May 16, 2012 9:52 pm

Re: Auto Water change conections!!

Post by 00Warpig00 »

It appears as my code is not exactly how I described above. Thought I made those changes, it appears I didn't but the bulk of it is accurate. the bulk of the Water Change stuff is in the (void AutoWaterChange()) function near the middle of the code.

Nick

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

// Initialize Alert variables
byte AlertNonCritical=0;
byte AlertCritical=0;
byte overheatflag=0;
byte atoflag=0;
byte iochannel0flag=0;
byte iochannel1flag=0;
byte iochannel2flag=0;
byte iochannel3flag=0;
byte iochannel4flag=0;
byte iochannel5flag=0;


//*****Begin WaterChange Additions

// skimmer port
byte SkimmerPort = Port4;
// return port
byte ReturnPort = Port3;
// sump drain port
byte SumpDrainPort = Port8;
// SaltWater brute pump
byte SWBrutePort = Port7;
// Timer for countdowns
TimerClass tm;

//*****End WaterChange Additions


//*****Begin ATO By Salinity Additions

byte ATOBrutePort = Port2;

//*****End ATO By Salinity Additions


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


//*****Begin Custom Menu Additions

#include <avr/pgmspace.h>
prog_char menu1_label[] PROGMEM = "Mask LED's On";
prog_char menu2_label[] PROGMEM = "Mask LED's Off";
prog_char menu3_label[] PROGMEM = "Mask LED's Clear";
prog_char menu4_label[] PROGMEM = "Water Change";
prog_char menu5_label[] PROGMEM = "Clear ATO Timeout";
prog_char menu6_label[] PROGMEM = "Overheat Clear";
prog_char menu7_label[] PROGMEM = "PH Calibration";
prog_char menu8_label[] PROGMEM = "Date / Time";

// Group the menu entries together
PROGMEM const char *menu_items[] = 
  {
    menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label, menu7_label, menu8_label,
  };

//*****End Custom Menu Additions


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller


    //*****Begin Custom Menu Additions... Initialize Custom Menu

    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));    
    InternalMemory.write(199, 0); //sets the controller to non masked LED mode upon boot.    

    //*****End Custom Menu Additions


    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port4Bit | Port5Bit | Port6Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 850 );


    // Ports that are always on
    ReefAngel.Relay.On( Port3 );
    ReefAngel.Relay.On( Box1_Port5 );
    ReefAngel.Relay.On( Box1_Port6 );
    ReefAngel.Relay.On( Box1_Port7 );


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

    ReefAngel.CustomVar[0]=0;
    ReefAngel.CustomVar[1]=0;
    ReefAngel.CustomVar[2]=0;
    ReefAngel.CustomVar[3]=0;
    ReefAngel.CustomVar[4]=0;
    ReefAngel.CustomVar[5]=0;
    ReefAngel.CustomVar[6]=0;   
    ReefAngel.CustomVar[7]=0;   


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

void loop()
{
    ReefAngel.StandardFan( Port1,790,820 );
    ReefAngel.Relay.DelayedOn( Port4,1 );
    ReefAngel.WavemakerRandom( Port5,30,100 );
    ReefAngel.StandardHeater( Port6,750,760 );
    ReefAngel.StandardLights( Box1_Port1,13,0,23,0 );
    ReefAngel.StandardLights( Box1_Port2,13,0,23,0 );
    ReefAngel.StandardHeater( Box1_Port3,750,760 );
    ReefAngel.StandardHeater( Box1_Port4,750,760 );


//*****Begin Custom Menu Additions

  // Removes LED's from a "MASKED" State
  if ( InternalMemory.read(199) == 0 ) 
    {
      ReefAngel.PWM.SetChannel( 0, PWMParabola(14,0,23,59,1,100,1) ); //Sets LED Drivers on Ch0 to Parabola math
      ReefAngel.PWM.SetChannel( 1, PWMParabola(14,0,23,59,1,100,1) ); //Sets LED Drivers on Ch1 to Parabola math
      ReefAngel.PWM.SetChannel( 3, PWMSlope(2,0,7,30,0,50,0,0) ); //Opens/closes 5V relay on Ch3 that shorts\opens dimmer leads on Ch0 LED driver to turn Driver on/off 
      ReefAngel.PWM.SetChannel( 4, PWMSlope(0,0,14,0,0,50,0,0) ); //Opens/closes 5V relay on Ch4 that shorts\opens dimmer leads on Ch1 LED driver to turn Driver on/off
    }

  // MASKS LED's Off
  if ( InternalMemory.read(199) == 1 )
    {
      ReefAngel.PWM.SetChannel( 0, 0 ); //Sets LED Drivers on Ch0 to 0%
      ReefAngel.PWM.SetChannel( 1, 0 ); //Sets LED Drivers on Ch1 to 0%
      ReefAngel.PWM.SetChannel( 3, 50 ); //closes 5V relay on Ch3 that shorts dimmer leads on Ch0 LED driver to turn Driver off
      ReefAngel.PWM.SetChannel( 4, 50 ); //closes 5V relay on Ch4 that shorts dimmer leads on Ch1 LED driver to turn Driver off
    }

  if ( InternalMemory.read(199) == 2 )
    {
      ReefAngel.PWM.SetChannel( 0, 100 ); //Sets LED Drivers on Ch0 to 100%
      ReefAngel.PWM.SetChannel( 1, 100 ); //Sets LED Drivers on Ch1 to 100%
      ReefAngel.PWM.SetChannel( 3, 0 ); //Opens 5V relay on Ch3 that removes short on dimmer leads on Ch0 LED driver to turn Driver on
      ReefAngel.PWM.SetChannel( 4, 0 ); //Opens 5V relay on Ch4 that removes short on dimmer leads on Ch1 LED driver to turn Driver on
    }

  else
    {
    }
        
//*****End Custom Menu Additions

      
    overheatflag = InternalMemory.read( Overheat_Exceed_Flag );
    atoflag = InternalMemory.read( ATO_Exceed_Flag );
    iochannel0flag = ! ReefAngel.IO.GetChannel( 0 );
    iochannel1flag = ! ReefAngel.IO.GetChannel( 1 );
    iochannel2flag = ! ReefAngel.IO.GetChannel( 2 );
    iochannel3flag = ! ReefAngel.IO.GetChannel( 3 );
    iochannel4flag = ! ReefAngel.IO.GetChannel( 4 );
    iochannel5flag = ! ReefAngel.IO.GetChannel( 5 );
    AlertNonCritical = atoflag + iochannel2flag + iochannel3flag + iochannel4flag + iochannel5flag;
    AlertCritical = overheatflag + iochannel0flag + iochannel1flag;    
    if ( AlertNonCritical >= 1 ) AlertNonCritical = 5;
    if ( AlertCritical >= 1 ) AlertCritical = 5;    
    ReefAngel.PWM.SetActinic(millis()%60000<100?AlertNonCritical:0);
    ReefAngel.PWM.SetDaylight(millis()%60000<100?AlertNonCritical:0);
    if ( AlertCritical >= 1 ) ReefAngel.PWM.SetActinic(millis()%300<100?AlertCritical:0);
    if ( AlertCritical >= 1 ) ReefAngel.PWM.SetDaylight(millis()%300<100?AlertCritical:0);    

    
    ////// Place your custom code below here

    ReefAngel.CustomVar[0]=InternalMemory.read(ATO_Exceed_Flag);
    ReefAngel.CustomVar[1]=InternalMemory.read(Overheat_Exceed_Flag);
    ReefAngel.CustomVar[2]=0;
    ReefAngel.CustomVar[3]=0;
    ReefAngel.CustomVar[4]=InternalMemory.read(199);
    ReefAngel.CustomVar[5]=AlertNonCritical;
    ReefAngel.CustomVar[6]=AlertCritical;   
    ReefAngel.CustomVar[7]=ATOBrutePort;
    
    if ( ReefAngel.CustomVar[0]== 1 )
      {
        ReefAngel.Relay.RelayMaskOff=~(Port4Bit);
      }

    //*****Begin WC Additions

    // If menu equals waterchange mode
    // then we start the automatic water change
    // Otherwise we ignore and proceed
    if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE)
      {
        AutoWaterChange();
      }
    
    //*****End WC Additions
    
    
    //*****Begin ATO By Salinity Additions
    
    if (ReefAngel.Params.Salinity<300)
      {
        ATOBrutePort=Port7;
      }
    else
      {
        ATOBrutePort=Port2;
      }
    ReefAngel.StandardATO(ATOBrutePort,40 );
    if (iochannel2flag == 1)
      {
        ReefAngel.Relay.RelayMaskOff=~(Port7Bit);
      }
    if (iochannel4flag == 1)
      {
        ReefAngel.Relay.RelayMaskOff=~(Port2Bit);
      }
      
    //*****End ATO By Salinity Additions


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

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


//*****Begin Custom Menu Additions

//Mask LED's On. Forces LED's On Full Blast
void MenuEntry1()
  {
    InternalMemory.write(199, 2);
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Mask Lights On"); waitForTime(2);
    ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
  }

//Mask LED's Off. Forces LED's Off
void MenuEntry2()
  {
    InternalMemory.write(199, 1);
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Mask Lights Off"); waitForTime(2);
    ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
  }

//Mask LED's Clear. Remove LED Masking Returns LED's To Normal Schedule
void MenuEntry3()
  {
    InternalMemory.write(199, 0);
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Mask Lights Clear"); waitForTime(2);
    ReefAngel.DisplayedMenu = RETURN_MAIN_MODE;
  }
  
//Start Waterchange Mode
void MenuEntry4()
  {
    ReefAngel.WaterChangeModeStart();
  }

//Clear ATO Timeout Flag 
void MenuEntry5()
  {
    ReefAngel.ATOClear();
    ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
  }

//Clear Overheat Flag
void MenuEntry6()
  {
    ReefAngel.OverheatClear();
    ReefAngel.DisplayMenuEntry("Clear Overheat");
  }

//Calibrate PH Probe
void MenuEntry7()
  {
    ReefAngel.SetupCalibratePH();
    ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
  }

//Set clock Date & Time
void MenuEntry8()
  {
    ReefAngel.SetupDateTime();
    ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
  }
  
//*****End Custom Menu Additions


//*****Begin WC Additions

void AutoWaterChange()
{
    // auto water change mode
    // Display Starting Water Change"
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Starting Water Change"); waitForTime(3);

    // Check Saltwater BRUTE for sufficient saltwater on IO Module Port2
    if ( isSWBruteEmpty() )
      {
        ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
        ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Not Enough Saltwater"); waitForTime(3);

        //Abort Water Change if insufficient saltwater
        // Handles the cleanup to return to the main screen
        ReefAngel.ClearScreen(DefaultBGColor);
        ReefAngel.DisplayedMenu = DEFAULT_MENU;
        DrawCustomGraph();
        return;
      }
   
    //Display Disabling ATO Pump
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");    
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Disabling ATO Pump"); waitForTime(3);

    // turn off ATO pump port to prevent ATO from trying to fill a sump being drained intentionally
    ReefAngel.Relay.RelayMaskOff=~(Port2Bit);
   
    //Display Stopping Skimmer
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Stopping Skimmer"); waitForTime(3);

    // turn off the skimmer port
    ReefAngel.Relay.Off(SkimmerPort);
    ReefAngel.Relay.Write();
    
    //Display Skimmer Draining
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Skimmer Draining"); waitForTime(3);    

    // wait for 1 minute
    waitForTime(60);

    //Display Skimmer Done Draining
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Skimmer Done Draining"); waitForTime(3);
    
    //display Stopping Return Pump
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Stopping Return Pump"); waitForTime(3);

    //Stop Return Pump
    ReefAngel.Relay.Off(ReturnPort);
    ReefAngel.Relay.Write();
   
    //Display Draining To Sump
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Draining To Sump"); waitForTime(3);

    //display Sump Filling
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Filling"); waitForTime(3);

    // wait for IO Mod Port 1 to be active
    waitForIOChannel(1);

    //display Sump Is Full
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Is Full"); waitForTime(3);

    //Display Sump Settling
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Settling"); waitForTime(3);

    // wait for sump to settle
    waitForTime(30);
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Settled"); waitForTime(3);

    // display Draining Sump
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Start Draining Sump"); waitForTime(3);

    //turn on sump drain pump
    ReefAngel.Relay.On(SumpDrainPort);
    ReefAngel.Relay.Write();

    //display Sump Draining
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Draining"); waitForTime(3);

    // wait for sump empty port active, IO Mod Port 0
    waitForIOChannel(0);
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Is Empty"); waitForTime(3);

    //display Stopping Sump Draining
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Stopping Sump Drain"); waitForTime(3);

    // turn off sump drain
    ReefAngel.Relay.Off(SumpDrainPort);
    ReefAngel.Relay.Write();

    //Display Sump Settling
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Settling"); waitForTime(3);

    // wait for sump to settle
    waitForTime(30);

    //display Sump Settled
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Settled"); waitForTime(3);

    //display Starting Saltwater Pump
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Start Saltwater Pump"); waitForTime(3);
 
    //turn on Saltwater Pump
    ReefAngel.Relay.On(SWBrutePort);
    ReefAngel.Relay.Write();

    //display Saltwater Pumping
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Saltwater Pumping"); waitForTime(3);

    // wait for sump full float switch active, IO Mod Port 1
    waitForIOChannel(1);

    //display Stop Saltwater Pump
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Stop Saltwater Pump"); waitForTime(3);

    // turn off sw brute pump
    ReefAngel.Relay.Off(SWBrutePort);
    ReefAngel.Relay.Write();    

    //diasplay Sump is Full
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Is Full"); waitForTime(3);

    //Display Sump Settling
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Settling"); waitForTime(3);

    // wait for sump to settle
    waitForTime(30);

    //display Sump Settled
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Sump Settled"); waitForTime(3);
   
    //display Starting Return Pump
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Starting Return Pump"); waitForTime(3);

    // turn on return pump
    ReefAngel.Relay.On(ReturnPort);
    ReefAngel.Relay.Write();

    //display Return Pump Started
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Return Pump Started"); waitForTime(3);
 
    //display Normalizing Waterlevel
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Normalizing Waterlevel"); waitForTime(3);

    //waiting 2 minutes for waterlevel to normalize
    waitForTime(120);
   
    //display Starting Skimer
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Starting Skimmer"); waitForTime(3);

    //turn on skimmer
    ReefAngel.Relay.On(SkimmerPort);
    ReefAngel.Relay.Write();

    //display Normalizing Skimmer
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Normalizing Skimmer"); waitForTime(3);

    //wait for 2 minutes for skimmer to normalize
    waitForTime(120);

    //display Skimmer Normalized
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Skimmer Normalized"); waitForTime(3);

    //display Enabling ATO Pump
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Enabling ATO Pump"); waitForTime(3);

    //Enable ATO pump
    ReefAngel.Relay.RelayMaskOff = B11111111;
    ReefAngel.Relay.Write();

    //display Water Change Complete
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "                      ");
    ReefAngel.LCD.DrawText(ModeScreenColor, DefaultBGColor, 2, 30, "Water Change Complete"); waitForTime(3);

    // Handles the cleanup to return to the main screen
    ReefAngel.ClearScreen(DefaultBGColor);
    ReefAngel.DisplayedMenu = DEFAULT_MENU;
    DrawCustomGraph();
}

bool isSWBruteEmpty()
{
  // check status of IO Mod Port 2
  if ( ! ReefAngel.IO.GetChannel(2) )
      return true;
  return false;
}

void waitForTime(int seconds)
{
    bool done = false;
    tm.SetInterval(seconds);
    tm.Start();
    int t = tm.Trigger - now();
    do
    {
      // check the wifi interface
      pingSerial();
      // wait for specified seconds
      if ( (t >= 0) && ! tm.IsTriggered() )
        {
          // TODO finish countdown on screen
          // show countdown on screen
          //LCD.Clear(DefaultBGColor,60+(intlength(t)*5),100,100,108);
          //LCD.DrawText(DefaultFGColor,DefaultBGColor,60,100,t);
          wdt_reset();
          delay(200);
        }
        else
        {
          done = true;
        }
    } while ( !done );
    return;
}

void waitForIOChannel(byte channel)
{
    // TODO complete this function
    do
    {
      wdt_reset();
      // display something on screen
      // check the wifi interface
      pingSerial();
      delay(200);
      // TODO check the IO channel logic
    } while ( ReefAngel.IO.GetChannel(channel) );
}

//*****End WC Additions


void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Dimming Expansion
    x = 15;
    y = 2;
    for ( int a=0;a<6;a++ )
    {
      if ( a>2 ) x = 75;
      if ( a==3 ) y = 2;
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :   " );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
      y += 10;
    }
    pingSerial();

    // I/O Expansion
    byte bkcolor;
    x = 14;
    y = 34;
    for ( int a=0;a<6;a++ )
    {
      ReefAngel.LCD.DrawCircleOutline( x+(a*20),y,4,COLOR_MEDIUMORCHID );
      if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE; else bkcolor=COLOR_GRAY;
      ReefAngel.LCD.FillCircle( x+(a*20),y,2,bkcolor );
    }
    pingSerial();

    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 44, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 44, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // Salinity
    ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,15,76, "SAL:" );
    ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,39,76, ReefAngel.Params.Salinity );
    pingSerial();

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

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

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

void DrawCustomGraph()
{
}

180G FOWLR
20GH QT#1
29G QT#2

Image
baroutas
Posts: 116
Joined: Sat Oct 13, 2012 11:21 pm
Location: GREECE-HELLAS
Contact:

Re: Auto Water change conections!!

Post by baroutas »

ΟΚ thanks for reply!!!!!Now i start to understand a few thinks!! You see i am newbe!!!!ha ha ha!! :D
Post Reply