Page 1 of 1

Wavemaker Help

Posted: Sun Jul 17, 2011 12:33 pm
by manoverboard
Hello, I am new to the Reef Angel and am still trying to grasp the entire concept of the coding. I currently have my wavemakers set up for one to come on for 15 seconds, and the other for 30 (the best option I could get it to do for me) on ports 5 and 6. What I was trying to do was to make one come on for 30 seconds, then when it goes off have the other turn on for 30 seconds while the first is toggled off. I am lost as to how to make this happen, and exactly what the code would look like to get these results. Also I am unclear as to where to put this code in when i start the controller up. Thanks in advance for any possible help.

Re: Wavemaker Help

Posted: Sun Jul 17, 2011 12:36 pm
by rimai

Re: Wavemaker Help

Posted: Sun Jul 17, 2011 12:37 pm
by binder
so you want the wavemakers to alternate every 30 seconds? when one turns off the other turns on, right?

curt

Re: Wavemaker Help

Posted: Fri Sep 16, 2011 5:16 pm
by chase
binder wrote:so you want the wavemakers to alternate every 30 seconds? when one turns off the other turns on, right?

curt
I would also be interested in this wavemaker option, thanks in advance!

Re: Wavemaker Help

Posted: Fri Sep 16, 2011 8:43 pm
by psyrob
I was baffled with this too...what I finally did was set one for 46 seconds and one for 37, thinking the difference in the odd/even numbers would stagger the pumps some and lead to random flow...

Re: Wavemaker Help

Posted: Sun Sep 18, 2011 1:10 am
by chase
psyrob wrote:I was baffled with this too...what I finally did was set one for 46 seconds and one for 37, thinking the difference in the odd/even numbers would stagger the pumps some and lead to random flow...
Hey rob,
After reading through several posts and spending some time messing around this is what I pieced together and it's working well:

Code: Select all

void setup()
{
   randomSeed(analogRead(0));
    ReefAngel.Init();  //Initialize controller   
    ReefAngel.Timer[1].SetInterval(random(15,35));
    ReefAngel.Timer[1].Start();  
    ReefAngel.Relay.On(Port5);
}

void loop()
{
    ReefAngel.ShowInterface();

if ( ReefAngel.Timer[1].IsTriggered() )
      {
        ReefAngel.Timer[1].SetInterval(random(15,35));
        ReefAngel.Timer[1].Start();
        ReefAngel.Relay.Toggle(Port5);
        ReefAngel.Relay.Toggle(Port6);
       }
}
Basically this uses random times between 15 and 35 to turn port 5 on, while port 6 is toggled off. Once the time elapses port 6 is toggled on for a random time while port 5 is toggled off. I like this because you kind of get 2 timer functions (via the random toggle) while only using 1 timing resource on the controller.

I commented out my ReefAngel.Wavemaker1(Port5); & ReefAngel.Wavemaker2(Port6); functions as well because I think this messes with the random wavemaker code above.

I also read somewhere that port 5 and 6 have special relays designed for toggling back and forth between quick intervals, so that's why I'm using them...if anyone knows this to be true or not feel free to comment.

Re: Wavemaker Help

Posted: Sun Sep 18, 2011 5:28 am
by binder

I commented out my ReefAngel.Wavemaker1(Port5); & ReefAngel.Wavemaker2(Port6); functions as well because I think this messes with the random wavemaker code above.

I also read somewhere that port 5 and 6 have special relays designed for toggling back and forth between quick intervals, so that's why I'm using them...if anyone knows this to be true or not feel free to comment.
you are correct with the wavemaker functions interfering with you random functionality. So you should not use the wavemaker functions and the random functions together. You are doing the right thing.

curt

Re: Wavemaker Help

Posted: Tue Oct 30, 2012 8:33 am
by Spotted
I am trying to get this random code into my code. What would I need to copy and paste into my code to get this to work?
I was also wondering if there was a way to add like a nutrient transport function that would turn on all the power heads for X amount of time then revert back to the random pattern maker?
I have 4 power heads. 2 on port 5 and 2 on port 6.
Here is my code

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (06/11/2012 09:50)
// RA_061112_0950.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define wifi
 #define WDT
 #define CUSTOM_MENU
 #define CUSTOM_MENU_ENTRIES 5
 #define ENABLE_ATO_LOGGING
 #define IOEXPANSION
 */


#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 <IO.h>
#include <ReefAngel.h>

////// Place global variable code below here
unsigned long clearsiphon=now();

////// Place global variable code above 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 = "Lights On";
prog_char menu4_label[] PROGMEM = "Lights Off";
prog_char menu5_label[] PROGMEM = "Clear Siphon";
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();
  ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
  ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights On");

}
void MenuEntry5()
{
  ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = 0;
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights Off");

}

void MenuEntry6()
{
  clearsiphon=now();
  ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}


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

  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  //Light On/Off Ports
  ReefAngel.LightsOnPorts = Port2Bit | Port4Bit;

  // Ports that are always on

  ReefAngel.Relay.On(Port8);  //Return Pump

  //Adds Wifi function
  ReefAngel.AddWifi();
  ////// Place additional initialization code below here
  ReefAngel.Relay.On(Port8);


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

void loop()
{
  // Specific functions that use Internal Memory values
  ReefAngel.SingleATO(true,Port1,120,1);  //ATO time out 2 minutes once every hour
  ReefAngel.StandardLights(Port2,19,0,7,0);  //Refugium Light on at 7PM off at 6AM
  ReefAngel.StandardLights(Port3,6,0,7,0);  //Overflow pump on at 6AM off at 7PM
  ReefAngel.StandardLights(Port4,7,0,19,0);  // Tank light on at 7AM off at 7PM
  ReefAngel.StandardLights(Port5,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  ReefAngel.StandardLights(Port6,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  ReefAngel.Relay.DelayedOn(Port7, 5);  //Skimmer
  ////// Place your custom code below here
  if (now()%clearsiphon<120)
    ReefAngel.Relay.On(Port3);  
  else
   BackSiphon(Port8,Port3);
 

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

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

void BackSiphon(byte MonitorPort, byte BackSiphonPort)
{
  static byte laststatus=0;
  static unsigned long lastnow=now();
  byte currentstatus=ReefAngel.Relay.Status(MonitorPort);

  if (laststatus!=currentstatus)
  {
    laststatus=currentstatus;
    if (currentstatus) lastnow=now();
  }
  ReefAngel.Relay.Set(BackSiphonPort,now()%lastnow<300);
}
Off topic, I have also lost ability to calibrate my PH probe with this code. If I reload the original code, calibrate, then reload custom code will that work for calibration?

Re: Wavemaker Help

Posted: Tue Oct 30, 2012 9:12 am
by rimai
Try this:

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (06/11/2012 09:50)
// RA_061112_0950.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define wifi
 #define WDT
 #define CUSTOM_MENU
 #define CUSTOM_MENU_ENTRIES 5
 #define ENABLE_ATO_LOGGING
 #define IOEXPANSION
 */


#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 <IO.h>
#include <ReefAngel.h>

////// Place global variable code below here
unsigned long clearsiphon=now();
boolean NTM=false;
////// Place global variable code above 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 = "Lights On";
prog_char menu4_label[] PROGMEM = "Lights Off";
prog_char menu5_label[] PROGMEM = "Clear Siphon";
prog_char menu6_label[] PROGMEM = "Nutri Transp";

PROGMEM const char *menu_items[] = {
  menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label  };

void MenuEntry1()
{
  ReefAngel.FeedingModeStart();

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

}
void MenuEntry3()
{
  ReefAngel.ATOClear();
  ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
  ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights On");

}
void MenuEntry5()
{
  ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = 0;
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights Off");

}

void MenuEntry6()
{
  clearsiphon=now();
  ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}

void MenuEntry7()
{
   NTM=true; // Enable NTM mode
   ReefAngel.Timer[1].Start(); // Start timer for NTM mode
}

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

  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  //Light On/Off Ports
  ReefAngel.LightsOnPorts = Port2Bit | Port4Bit;

  // Ports that are always on

  ReefAngel.Relay.On(Port8);  //Return Pump

  //Adds Wifi function
  ReefAngel.AddWifi();
  ////// Place additional initialization code below here
  ReefAngel.Relay.On(Port8);

  ReefAngel.Timer[1].SetInterval(900); // Timer for Nutrient Transport mode

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

void loop()
{
  // Specific functions that use Internal Memory values
  ReefAngel.SingleATO(true,Port1,120,1);  //ATO time out 2 minutes once every hour
  ReefAngel.StandardLights(Port2,19,0,7,0);  //Refugium Light on at 7PM off at 6AM
  ReefAngel.StandardLights(Port3,6,0,7,0);  //Overflow pump on at 6AM off at 7PM
  ReefAngel.StandardLights(Port4,7,0,19,0);  // Tank light on at 7AM off at 7PM
//  ReefAngel.StandardLights(Port5,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
//  ReefAngel.StandardLights(Port6,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  ReefAngel.Relay.DelayedOn(Port7, 5);  //Skimmer
  ////// Place your custom code below here
  if (now()%clearsiphon<120)
    ReefAngel.Relay.On(Port3);  
  else
   BackSiphon(Port8,Port3);
 
 ReefAngel.WavemakerRandom(Port5,60,90); // Port 5 on random wavemaker
 ReefAngel.Relay.Set(!ReefAngel.Relay.Status(Port5)); // Port 6 is opposite of Port5

  if (ReefAngel.Timer[1].Istriggered) // if timer for NTM mode is expired
    NTM=false; // disable NTM mode
  
  if (NTM) // if we are on NTM mode, turn ports on
  {
    ReefAngel.Relay.On(Port5);
    ReefAngel.Relay.On(Port6);
  }
  ////// Place your custom code above here

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

void BackSiphon(byte MonitorPort, byte BackSiphonPort)
{
  static byte laststatus=0;
  static unsigned long lastnow=now();
  byte currentstatus=ReefAngel.Relay.Status(MonitorPort);

  if (laststatus!=currentstatus)
  {
    laststatus=currentstatus;
    if (currentstatus) lastnow=now();
  }
  ReefAngel.Relay.Set(BackSiphonPort,now()%lastnow<300);
}
Yes, the ph calibration can be done that way.

Re: Wavemaker Help

Posted: Wed Oct 31, 2012 7:42 pm
by Spotted
Ok, getting an error on this line:

ReefAngel.Relay.Set(!ReefAngel.Relay.Status(Port5)); // Port 6 is opposite of Port5

error is:

no matching function for call to 'RelayClass::Set(bool)'

Here's the rest of the result window:

The following feature was automatically added:
Watchdog Timer
Version Menu

The following features were detected:
Wifi
Custom Menu
Number of Menu Options: 7
Latest_9_19.cpp: In function 'void loop()':
Latest_9_19:151: error: no matching function for call to 'RelayClass::Set(bool)'
C:\Users\Lisy\Documents\Arduino\libraries\Relay/Relay.h:44: note: candidates are: void RelayClass::Set(byte, boolean)
Latest_9_19:153: error: 'class TimerClass' has no member named 'Istriggered'

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (06/11/2012 09:50)
// RA_061112_0950.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define wifi
 #define WDT
 #define CUSTOM_MENU
 #define CUSTOM_MENU_ENTRIES 5
 #define ENABLE_ATO_LOGGING
 #define IOEXPANSION
 */


#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 <IO.h>
#include <ReefAngel.h>

////// Place global variable code below here
unsigned long clearsiphon=now();
boolean NTM=false;
////// Place global variable code above 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 = "Lights On";
prog_char menu4_label[] PROGMEM = "Lights Off";
prog_char menu5_label[] PROGMEM = "Clear Siphon";
prog_char menu6_label[] PROGMEM = "Nutri Transp";

PROGMEM const char *menu_items[] = {
  menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label  };

void MenuEntry1()
{
  ReefAngel.FeedingModeStart();

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

}
void MenuEntry3()
{
  ReefAngel.ATOClear();
  ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
  ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights On");

}
void MenuEntry5()
{
  ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = 0;
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights Off");

}

void MenuEntry6()
{
  clearsiphon=now();
  ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}

void MenuEntry7()
{
   NTM=true; // Enable NTM mode
   ReefAngel.Timer[1].Start(); // Start timer for NTM mode
}

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

  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  //Light On/Off Ports
  ReefAngel.LightsOnPorts = Port2Bit | Port4Bit;

  // Ports that are always on

  ReefAngel.Relay.On(Port8);  //Return Pump

  //Adds Wifi function
  ReefAngel.AddWifi();
  ////// Place additional initialization code below here
  ReefAngel.Relay.On(Port8);

  ReefAngel.Timer[1].SetInterval(900); // Timer for Nutrient Transport mode

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

void loop()
{
  // Specific functions that use Internal Memory values
  ReefAngel.SingleATO(true,Port1,120,1);  //ATO time out 2 minutes once every hour
  ReefAngel.StandardLights(Port2,19,0,7,0);  //Refugium Light on at 7PM off at 6AM
  ReefAngel.StandardLights(Port3,7,0,19,0);  //Blue LED on at 7AM off at 7PM
  ReefAngel.StandardLights(Port4,8,0,18,0);  // Daylight on at 8AM off at 6PM
//  ReefAngel.StandardLights(Port5,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
//  ReefAngel.StandardLights(Port6,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  ReefAngel.Relay.DelayedOn(Port7, 5);  //Skimmer
  ////// Place your custom code below here
  if (now()%clearsiphon<120)
    ReefAngel.Relay.On(Port3);  
  else
   BackSiphon(Port8,Port3);
 
ReefAngel.WavemakerRandom(Port5,60,90); // Port 5 on random wavemaker
 ReefAngel.Relay.Set(!ReefAngel.Relay.Status(Port5)); // Port 6 is opposite of Port5

  if (ReefAngel.Timer[1].Istriggered) // if timer for NTM mode is expired
    NTM=false; // disable NTM mode
  
  if (NTM) // if we are on NTM mode, turn ports on
  {
    ReefAngel.Relay.On(Port5);
    ReefAngel.Relay.On(Port6);
  }
  ////// Place your custom code above here

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

void BackSiphon(byte MonitorPort, byte BackSiphonPort)
{
  static byte laststatus=0;
  static unsigned long lastnow=now();
  byte currentstatus=ReefAngel.Relay.Status(MonitorPort);

  if (laststatus!=currentstatus)
  {
    laststatus=currentstatus;
    if (currentstatus) lastnow=now();
  }
  ReefAngel.Relay.Set(BackSiphonPort,now()%lastnow<300);
}
Also I no longer need the clear siphon function. I got it on constant power now.

Re: Wavemaker Help

Posted: Wed Oct 31, 2012 8:12 pm
by rimai
Try this:

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (06/11/2012 09:50)
// RA_061112_0950.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define wifi
 #define WDT
 #define CUSTOM_MENU
 #define CUSTOM_MENU_ENTRIES 5
 #define ENABLE_ATO_LOGGING
 #define IOEXPANSION
 */


#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 <AI.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <Salinity.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

////// Place global variable code below here
unsigned long clearsiphon=now();
boolean NTM=false;
////// Place global variable code above 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 = "Lights On";
prog_char menu4_label[] PROGMEM = "Lights Off";
prog_char menu5_label[] PROGMEM = "Clear Siphon";
prog_char menu6_label[] PROGMEM = "Nutri Transp";

PROGMEM const char *menu_items[] = {
  menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label  };

void MenuEntry1()
{
  ReefAngel.FeedingModeStart();

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

}
void MenuEntry3()
{
  ReefAngel.ATOClear();
  ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
  ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights On");

}
void MenuEntry5()
{
  ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = 0;
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights Off");

}

void MenuEntry6()
{
  clearsiphon=now();
  ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}

void MenuEntry7()
{
   NTM=true; // Enable NTM mode
   ReefAngel.Timer[1].Start(); // Start timer for NTM mode
}

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

  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  //Light On/Off Ports
  ReefAngel.LightsOnPorts = Port2Bit | Port4Bit;

  // Ports that are always on

  ReefAngel.Relay.On(Port8);  //Return Pump

  //Adds Wifi function
  ReefAngel.AddWifi();
  ////// Place additional initialization code below here
  ReefAngel.Relay.On(Port8);

  ReefAngel.Timer[1].SetInterval(900); // Timer for Nutrient Transport mode

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

void loop()
{
  // Specific functions that use Internal Memory values
  ReefAngel.SingleATO(true,Port1,120,1);  //ATO time out 2 minutes once every hour
  ReefAngel.StandardLights(Port2,19,0,7,0);  //Refugium Light on at 7PM off at 6AM
  ReefAngel.StandardLights(Port3,7,0,19,0);  //Blue LED on at 7AM off at 7PM
  ReefAngel.StandardLights(Port4,8,0,18,0);  // Daylight on at 8AM off at 6PM
//  ReefAngel.StandardLights(Port5,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
//  ReefAngel.StandardLights(Port6,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  ReefAngel.Relay.DelayedOn(Port7, 5);  //Skimmer
  ////// Place your custom code below here
  if (now()%clearsiphon<120)
    ReefAngel.Relay.On(Port3);  
  else
   BackSiphon(Port8,Port3);
 
ReefAngel.WavemakerRandom(Port5,60,90); // Port 5 on random wavemaker
 ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5)); // Port 6 is opposite of Port5

  if (ReefAngel.Timer[1].IsTriggered()) // if timer for NTM mode is expired
    NTM=false; // disable NTM mode
  
  if (NTM) // if we are on NTM mode, turn ports on
  {
    ReefAngel.Relay.On(Port5);
    ReefAngel.Relay.On(Port6);
  }
  ////// Place your custom code above here

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

void BackSiphon(byte MonitorPort, byte BackSiphonPort)
{
  static byte laststatus=0;
  static unsigned long lastnow=now();
  byte currentstatus=ReefAngel.Relay.Status(MonitorPort);

  if (laststatus!=currentstatus)
  {
    laststatus=currentstatus;
    if (currentstatus) lastnow=now();
  }
  ReefAngel.Relay.Set(BackSiphonPort,now()%lastnow<300);
}

Re: Wavemaker Help

Posted: Wed Oct 31, 2012 8:52 pm
by Spotted
Almost working just right, I appreciate all the help.
When Nutri Trans is stopped, random wave function does not resume. All PH remain on. Also, I don't know if it's possible to still shut off all PH after 10 PM?
Also, the clear siphon function is no longer needed as I have put ports 3&4 on to lights. I think the clear siphon is interfering with the light function.
Actually I have run out of space on my bar and until I can save enough for an expansion, I gotta run the siphon manually..
Thanks again!!

Re: Wavemaker Help

Posted: Wed Oct 31, 2012 8:55 pm
by Spotted
Wait, I just found time value for the nutri transport mode. I wil continue testing tomorrow. The lights still don't work right though, port 3 where the aqualifter was for the siphon on the overflow.
Thanks

Re: Wavemaker Help

Posted: Wed Oct 31, 2012 9:40 pm
by rimai
Yeah, the mode will last 15minutes (900seconds).
You can change it as you wish.
Try this one. I removed the siphon:

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (06/11/2012 09:50)
// RA_061112_0950.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
 #define wifi
 #define WDT
 #define CUSTOM_MENU
 #define CUSTOM_MENU_ENTRIES 5
 #define ENABLE_ATO_LOGGING
 #define IOEXPANSION
 */


#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 <AI.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <Salinity.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

////// Place global variable code below here
unsigned long clearsiphon=now();
boolean NTM=false;
////// Place global variable code above 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 = "Lights On";
prog_char menu4_label[] PROGMEM = "Lights Off";
prog_char menu5_label[] PROGMEM = "Clear Siphon";
prog_char menu6_label[] PROGMEM = "Nutri Transp";

PROGMEM const char *menu_items[] = {
  menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label  };

void MenuEntry1()
{
  ReefAngel.FeedingModeStart();

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

}
void MenuEntry3()
{
  ReefAngel.ATOClear();
  ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
  ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights On");

}
void MenuEntry5()
{
  ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = 0;
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights Off");

}

void MenuEntry6()
{
  clearsiphon=now();
  ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}

void MenuEntry7()
{
  NTM=true; // Enable NTM mode
  ReefAngel.Timer[1].Start(); // Start timer for NTM mode
}

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

  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  //Light On/Off Ports
  ReefAngel.LightsOnPorts = Port2Bit | Port4Bit;

  // Ports that are always on

  ReefAngel.Relay.On(Port8);  //Return Pump

  //Adds Wifi function
  ReefAngel.AddWifi();
  ////// Place additional initialization code below here
  ReefAngel.Relay.On(Port8);

  ReefAngel.Timer[1].SetInterval(900); // Timer for Nutrient Transport mode

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

void loop()
{
  // Specific functions that use Internal Memory values
  ReefAngel.SingleATO(true,Port1,120,1);  //ATO time out 2 minutes once every hour
  ReefAngel.StandardLights(Port2,19,0,7,0);  //Refugium Light on at 7PM off at 6AM
  ReefAngel.StandardLights(Port3,7,0,19,0);  //Blue LED on at 7AM off at 7PM
  ReefAngel.StandardLights(Port4,8,0,18,0);  // Daylight on at 8AM off at 6PM
  //  ReefAngel.StandardLights(Port5,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  //  ReefAngel.StandardLights(Port6,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  ReefAngel.Relay.DelayedOn(Port7, 5);  //Skimmer
  ////// Place your custom code below here


  ReefAngel.WavemakerRandom(Port5,60,90); // Port 5 on random wavemaker
  ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5)); // Port 6 is opposite of Port5

    if (ReefAngel.Timer[1].IsTriggered()) // if timer for NTM mode is expired
      NTM=false; // disable NTM mode

    if (NTM) // if we are on NTM mode, turn ports on
  {
    ReefAngel.Relay.On(Port5);
    ReefAngel.Relay.On(Port6);
  }
  ////// Place your custom code above here

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




Re: Wavemaker Help

Posted: Fri Nov 02, 2012 6:44 am
by Spotted
Ok, so this line

Code: Select all

 ReefAngel.WavemakerRandom(Port5,60,90); // Port 5 on random wavemaker
Is the line that says how long the PHs are on yes? Is it between 60 to 90 seconds? Just making sure so I can play with the timing. Thanks.

Awesome work.

Re: Wavemaker Help

Posted: Fri Nov 02, 2012 7:46 am
by rimai
yes :) between 60 and 90s

Re: Wavemaker Help

Posted: Fri Nov 02, 2012 7:39 pm
by Spotted
Is it not possible to get the PHs to shut off at 10PM? I wasn't able to test until tonight and they don't shut off.
Otherwise everything looks awesome.

Re: Wavemaker Help

Posted: Fri Nov 02, 2012 8:12 pm
by rimai
Yes, we can shut them off.
What time period do you want them off?

Re: Wavemaker Help

Posted: Sat Nov 03, 2012 4:17 am
by Spotted
10pm to 6 am

Re: Wavemaker Help

Posted: Sat Nov 03, 2012 8:46 am
by rimai
Try this:

Code: Select all

// Autogenerated file by RAGen (v1.2.2.171), (06/11/2012 09:50)
// RA_061112_0950.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
 #define wifi
 #define WDT
 #define CUSTOM_MENU
 #define CUSTOM_MENU_ENTRIES 5
 #define ENABLE_ATO_LOGGING
 #define IOEXPANSION
 */


#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 <AI.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <Salinity.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

////// Place global variable code below here
unsigned long clearsiphon=now();
boolean NTM=false;
////// Place global variable code above 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 = "Lights On";
prog_char menu4_label[] PROGMEM = "Lights Off";
prog_char menu5_label[] PROGMEM = "Clear Siphon";
prog_char menu6_label[] PROGMEM = "Nutri Transp";

PROGMEM const char *menu_items[] = {
  menu0_label, menu1_label, menu2_label, menu3_label, menu4_label, menu5_label, menu6_label  };

void MenuEntry1()
{
  ReefAngel.FeedingModeStart();

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

}
void MenuEntry3()
{
  ReefAngel.ATOClear();
  ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
  ReefAngel.Relay.RelayMaskOn = ReefAngel.LightsOnPorts;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = ReefAngel.LightsOnPortsE[i];
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights On");

}
void MenuEntry5()
{
  ReefAngel.Relay.RelayMaskOn = 0;
#ifdef RelayExp
  for ( byte i = 0; i < MAX_RELAY_EXPANSION_MODULES; i++ )
  {
    ReefAngel.Relay.RelayMaskOnE[i] = 0;
  }
#endif  // RelayExp
  ReefAngel.Relay.Write();
  ReefAngel.DisplayMenuEntry("Lights Off");

}

void MenuEntry6()
{
  clearsiphon=now();
  ReefAngel.DisplayedMenu=RETURN_MAIN_MODE;
}

void MenuEntry7()
{
  NTM=true; // Enable NTM mode
  ReefAngel.Timer[1].Start(); // Start timer for NTM mode
}

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

  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
  //Light On/Off Ports
  ReefAngel.LightsOnPorts = Port2Bit | Port4Bit;

  // Ports that are always on

  ReefAngel.Relay.On(Port8);  //Return Pump

  //Adds Wifi function
  ReefAngel.AddWifi();
  ////// Place additional initialization code below here
  ReefAngel.Relay.On(Port8);

  ReefAngel.Timer[1].SetInterval(900); // Timer for Nutrient Transport mode

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

void loop()
{
  // Specific functions that use Internal Memory values
  ReefAngel.SingleATO(true,Port1,120,1);  //ATO time out 2 minutes once every hour
  ReefAngel.StandardLights(Port2,19,0,7,0);  //Refugium Light on at 7PM off at 6AM
  ReefAngel.StandardLights(Port3,7,0,19,0);  //Blue LED on at 7AM off at 7PM
  ReefAngel.StandardLights(Port4,8,0,18,0);  // Daylight on at 8AM off at 6PM
  //  ReefAngel.StandardLights(Port5,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  //  ReefAngel.StandardLights(Port6,6,0,22,0);  //Turn off powerheads from 10PM to 6AM
  ReefAngel.Relay.DelayedOn(Port7, 5);  //Skimmer
  ////// Place your custom code below here


  if (hour()>=22 || hour()<6)
  {
    ReefAngel.Relay.Off(Port5);
    ReefAngel.Relay.Off(Port6);
  }
  else
  {
    ReefAngel.WavemakerRandom(Port5,60,90); // Port 5 on random wavemaker
    ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5)); // Port 6 is opposite of Port5

      if (ReefAngel.Timer[1].IsTriggered()) // if timer for NTM mode is expired
        NTM=false; // disable NTM mode

      if (NTM) // if we are on NTM mode, turn ports on
    {
      ReefAngel.Relay.On(Port5);
      ReefAngel.Relay.On(Port6);
    }

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

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

Re: Wavemaker Help

Posted: Tue Nov 06, 2012 7:08 pm
by Spotted
Awesome work, everything is working perfectly!!
Now on to another problem. I think I may have a bad PH probe. I tried to calibrate it like we discussed earlier, with the original RA code and I am not getting correct readings, I think.
First I rinsed in RO, then into 7.0 which read 469. Then rinsed again and into the 10 which read 474. I didn't think these numbers were any good, but I put the probe back in my sump and it jumped between 7 and 10. Nothing in between , just 7 or 10.
I then repeated the calibration and nothing really changed. Now it's in my sump and is reading 14!!

Any suggestions?

Re: Wavemaker Help

Posted: Tue Nov 06, 2012 9:45 pm
by rimai
Cool. PM for an RMA number.

Re: Wavemaker Help

Posted: Wed Nov 07, 2012 6:11 am
by Spotted
So, as of this morning, I got a message on the screen says

No Internal Memory Found

Only the return pump was running. I tried reflashing and it looks like it uploads, lights on the unit blink and flash just like it was uploading and the programmer runs through the normal flash routine, but same message on the screen.
I tried power cycling and now nothing is running and I tried reflashing and same thing.

What to do now?

Re: Wavemaker Help

Posted: Wed Nov 07, 2012 9:20 am
by rimai
Upload InitialInternalMemory code
File->Sketchbook->Example Codes->InitialInternalMemory

Re: Wavemaker Help

Posted: Wed Nov 07, 2012 12:40 pm
by Spotted
Thanks, I'll give it a shot when I get home. Any idea why that happened?

Re: Wavemaker Help

Posted: Wed Nov 07, 2012 4:48 pm
by Spotted
Ok, got it back up and running. Any idea what might have happened, so I don't do it again?

Re: Wavemaker Help

Posted: Wed Nov 07, 2012 4:50 pm
by rimai
Humm.. not sure...
Did you upload anything or changed internal memory ?

Re: Wavemaker Help

Posted: Wed Nov 07, 2012 5:06 pm
by Spotted
I restored the original code to calibrate the PH probe, but then reloaded my code. I then got caught up in the election and left the usb connected, but I had shut the PC down.
Came back in the AM and it was not working. To be honest, I'm not certain it was working right last night. It was after 10 when everything shuts off..
Anyhow, it's all working again, thanks!!