Page 3 of 4

Re: DC return pumps

PostPosted: Thu Nov 17, 2016 8:45 pm
by Ismaclst
Hey Lee, Did you ever get a chance to look into this?

Re: DC return pumps

PostPosted: Fri Nov 18, 2016 1:52 am
by lnevo
No :( I haven't even been here on the boards. Been so backed up at work with end of year. I do owe you a solution... will try by this weekend. Feel free to harass me on FB too :)

Re: DC return pumps

PostPosted: Fri Nov 18, 2016 11:09 am
by Ismaclst
Thanks! Appreciate you helping me on this.

Re: DC return pumps

PostPosted: Mon Nov 21, 2016 5:29 am
by lnevo
Ok, I think this should be good to get started. I've reviewed it a few times in my head. Let me know what you think.

Code: Select all
  static unsigned long levelHigh;
  static unsigned long pumpOff;
  static boolean pumpBool;
 
  if (ReefAngel.WaterLevel.GetLevel(3) < 50) levelHigh=now();
  if (now()-levelHigh > 20*SECS_PER_MINUTE && !pumpBool) {
    pumpBool=true; 
    pumpOff=now();
  }

  if (now()-pumpOff() < 5*SECS_PER_MINUTE) {
    ReefAngel.Relay.Off(Port1);
  } else {
    ReefAngel.Relay.On(Port1);
    pumpBool=false;
  }

Re: DC return pumps

PostPosted: Mon Nov 21, 2016 8:31 pm
by Ismaclst
It appears to be what I was wanting. I will upload this later and let you know for sure.

Re: DC return pumps

PostPosted: Mon Nov 21, 2016 8:31 pm
by Ismaclst
Thanks Lee!

Re: DC return pumps

PostPosted: Tue Nov 22, 2016 1:45 am
by Ismaclst
I added this to my code but it did not compile. The first error was I had to change MINUTES to MIN. Now I get a few more.

Re: DC return pumps

PostPosted: Tue Nov 22, 2016 1:59 am
by Ismaclst
Here is my code:

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 <Tide.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>



#define Level         79
#define MinPWM        45
#define OperatingPWM  68
long nummillis=5000;

byte PWMValue=0;
unsigned long lastmillis=millis();
boolean override=false;

static unsigned long levelHigh;
static unsigned long pumpOff;
static boolean pumpBool;

////// Place global variable code below here


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


void setup()
{
  // This must be the first line
  ReefAngel.Init();  //Initialize controller
  ReefAngel.Use2014Screen();  // Let's use 2014 Screen
  ReefAngel.DDNS("Damien");
  ReefAngel.AddMultiChannelWaterLevelExpansion();  // Multi-Channel Water Level Expanion Module
  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port1Bit | Port6Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit | Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port5Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port3Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 800 );
  InternalMemory.WaterLevelMax_write(1800);       


  // Feeeding and Water Change mode speed


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

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


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

void loop()
{
  ReefAngel.StandardHeater( Port3,780,785 );
  ReefAngel.WaterLevelATO(4,Port4,240,28,31);
  ReefAngel.Relay.Set(Port8, (now()%(6*SECS_PER_HOUR))<(30*SECS_PER_MIN));

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

  PWMValue=OperatingPWM;
  if (ReefAngel.WaterLevel.GetLevel(2)<Level-4)
  {
    override=true;
    lastmillis=millis();
    PWMValue+=2;
  }
  if (ReefAngel.WaterLevel.GetLevel(2)>Level+2)
  {
    override=true;
    lastmillis=millis();
    PWMValue-=4;
  }
  if (millis()-lastmillis>nummillis && override)
  {
    override=false;
  }
  if (!override) PWMValue=OperatingPWM;
  if (ReefAngel.WaterLevel.GetLevel(2)>Level+10) PWMValue=MinPWM;
  PWMValue=constrain(PWMValue,MinPWM,100);
  ReefAngel.PWM.SetActinic(PWMValue);
 
  if (ReefAngel.WaterLevel.GetLevel(3) < 50) levelHigh=now();
  if (now()-levelHigh > 20*SECS_PER_MIN && !pumpBool) {
    pumpBool=true; 
    pumpOff=now();
  }

  if (now()-pumpOff() < 5*SECS_PER_MIN) {
    ReefAngel.Relay.Off(Port1);
  } else {
    ReefAngel.Relay.On(Port1);
    pumpBool=false;
  }


  if (ReefAngel.WaterLevel.GetLevel(1)<5) //Disable the port until overriden manually
    ReefAngel.Relay.Override(Port8,0);    //Saltwater Reservoir
  if (ReefAngel.WaterLevel.GetLevel(1)>80)   // Set port back to auto
    ReefAngel.Relay.Override(Port8,2);

  if (ReefAngel.WaterLevel.GetLevel(2)>89) //Overflow
    ReefAngel.Relay.Off(Port1);
  else
    ReefAngel.Relay.On(Port1);

  if (ReefAngel.WaterLevel.GetLevel(3)>87) //ATO Reservoir
    ReefAngel.Relay.Off(Port5);
  if (ReefAngel.WaterLevel.GetLevel(3)<1)
    ReefAngel.Relay.On(Port5);


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

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











Re: DC return pumps

PostPosted: Tue Nov 22, 2016 2:50 am
by lnevo
Sorry, change pumpOff() to pumpOff.

Code: Select all
Sketch uses 60,092 bytes (23%) of program storage space. Maximum is 253,952 bytes.
Global variables use 2,978 bytes (36%) of dynamic memory, leaving 5,214 bytes for local variables. Maximum is 8,192 bytes.

Re: DC return pumps

PostPosted: Wed Nov 23, 2016 2:17 pm
by Ismaclst
So I finally installed the code you did for me today. I submersed the stand pipe for my sump level so it would activate. It shows that the sump level is at 82 and it was suppose to turn the return off when it was 50 or higher. I waited past the 16 minutes but nothing happened. Not sure what is going on. Here is my latest code.

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 <Tide.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>



#define Level         76
#define MinPWM        45
#define OperatingPWM  68
long nummillis=5000;

byte PWMValue=0;
unsigned long lastmillis=millis();
boolean override=false;

static unsigned long levelHigh;
static unsigned long pumpOff;
static boolean pumpBool;

////// Place global variable code below here


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


void setup()
{
  // This must be the first line
  ReefAngel.Init();  //Initialize controller
  ReefAngel.Use2014Screen();  // Let's use 2014 Screen
  ReefAngel.DDNS("Damien");
  ReefAngel.AddMultiChannelWaterLevelExpansion();  // Multi-Channel Water Level Expanion Module
  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port1Bit | Port6Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit | Port8Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port5Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port3Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 800 );
  InternalMemory.WaterLevelMax_write(1800);       


  // Feeeding and Water Change mode speed


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

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


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

void loop()
{
  ReefAngel.StandardHeater( Port3,780,785 );
  ReefAngel.WaterLevelATO(4,Port4,240,28,31);
  ReefAngel.Relay.Set(Port8, (now()%(6*SECS_PER_HOUR))<(30*SECS_PER_MIN));

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

  PWMValue=OperatingPWM;
  if (ReefAngel.WaterLevel.GetLevel(2)<Level-4)
  {
    override=true;
    lastmillis=millis();
    PWMValue+=2;
  }
  if (ReefAngel.WaterLevel.GetLevel(2)>Level+2)
  {
    override=true;
    lastmillis=millis();
    PWMValue-=4;
  }
  if (millis()-lastmillis>nummillis && override)
  {
    override=false;
  }
  if (!override) PWMValue=OperatingPWM;
  if (ReefAngel.WaterLevel.GetLevel(2)>Level+10) PWMValue=MinPWM;
  PWMValue=constrain(PWMValue,MinPWM,100);
  ReefAngel.PWM.SetActinic(PWMValue);
 
  if (ReefAngel.WaterLevel.GetLevel(4) < 50) levelHigh=now();
  if (now()-levelHigh > 16*SECS_PER_MIN && !pumpBool) {
    pumpBool=true; 
    pumpOff=now();
  }

  if (now()-pumpOff < 15*SECS_PER_MIN) {
    ReefAngel.Relay.Off(Port1);
  } else {
    ReefAngel.Relay.On(Port1);
    pumpBool=false;
  }


  if (ReefAngel.WaterLevel.GetLevel(1)<5) //Disable the port until overriden manually
    ReefAngel.Relay.Override(Port8,0);    //Saltwater Reservoir
  if (ReefAngel.WaterLevel.GetLevel(1)>80)   // Set port back to auto
    ReefAngel.Relay.Override(Port8,2);

  if (ReefAngel.WaterLevel.GetLevel(2)>89) //Overflow
    ReefAngel.Relay.Off(Port1);
  else
    ReefAngel.Relay.On(Port1);

  if (ReefAngel.WaterLevel.GetLevel(3)>87) //ATO Reservoir
    ReefAngel.Relay.Off(Port5);
  if (ReefAngel.WaterLevel.GetLevel(3)<1)
    ReefAngel.Relay.On(Port5);


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

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