Page 1 of 1

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!!