Wavemaker Help

Requests for new functions or software apps

Posts: 2
Joined: Thu Jul 14, 2011 2:43 am
PostPosted: Sun Jul 17, 2011 12:33 pm
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.

Posts: 12242
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Jul 17, 2011 12:36 pm
Did you try using RAGen?
viewtopic.php?f=15&t=60
Roberto.
User avatar
Posts: 2739
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Sun Jul 17, 2011 12:37 pm
so you want the wavemakers to alternate every 30 seconds? when one turns off the other turns on, right?

curt

Posts: 101
Joined: Fri Sep 16, 2011 8:26 am
PostPosted: Fri Sep 16, 2011 5:16 pm
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!
Image

Posts: 243
Joined: Thu Sep 01, 2011 8:44 pm
PostPosted: Fri Sep 16, 2011 8:43 pm
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...
Image

Posts: 101
Joined: Fri Sep 16, 2011 8:26 am
PostPosted: Sun Sep 18, 2011 1:10 am
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.
Image
User avatar
Posts: 2739
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Sun Sep 18, 2011 5:28 am

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

Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida
PostPosted: Tue Oct 30, 2012 8:33 am
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?
Image

Posts: 12242
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Tue Oct 30, 2012 9:12 am
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.
Roberto.

Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida
PostPosted: Wed Oct 31, 2012 7:42 pm
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.
Image
Next

Return to Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron