DC return pumps


Posts: 12306
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Nov 23, 2016 3:04 pm
There are something not correct in your code.
You are using channel 2 for the pump control:
Code: Select all
  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;
  }


And then the same channel for overfow control:
Code: Select all
  if (ReefAngel.WaterLevel.GetLevel(2)>89) //Overflow
    ReefAngel.Relay.Off(Port1);
  else
    ReefAngel.Relay.On(Port1);


So effectively, your first code does nothing.
The second code supersedes and then you will only get port1 off when level is greater than 89.
Roberto.

Posts: 250
Joined: Wed Jan 28, 2015 5:17 pm
PostPosted: Wed Nov 23, 2016 4:01 pm
OK, I see now. That code shuts the return off if my overflow is greater than 89 so it won't overflow if my drain is plugged. What can I do if I want to keep that and still toggle port one when my sump level is too high for too long? Do I need to use a float switch in the sump instead of using the standpipe or is there something that can be changed in the code to allow me to use both codes simultaneously?
Image

Posts: 12306
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Thu Nov 24, 2016 1:21 am
If the sump level is at 82 and your code is set to 89, it will never turn off.
Change 89 to something smaller.
Roberto.

Posts: 250
Joined: Wed Jan 28, 2015 5:17 pm
PostPosted: Thu Nov 24, 2016 2:08 am
I guess I'm still confused. The sump level was only at 82 because I submerged the standpipe to test the code. It's supposed to turn off the return when the level is 50 or higher for at least 16 minutes. Normal levels for the sump are around 30. The 89 is the max level of my overflow so it shuts off the return to keep it from overflowing the tank if there is blockage. Channel 2 is for my overflow and channel 4 is my sump.
Image

Posts: 12306
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Thu Nov 24, 2016 9:59 am
Your code doesn't even use channel 4.
Roberto.

Posts: 250
Joined: Wed Jan 28, 2015 5:17 pm
PostPosted: Thu Nov 24, 2016 9:02 pm
Code: Select all
  if (ReefAngel.WaterLevel.GetLevel(4) < 50) levelHigh=now();
  if (now()-levelHigh > 16*SECS_PER_MIN && !pumpBool) {
    pumpBool=true; 
    pumpOff=now();
  }
Image

Posts: 12306
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Nov 25, 2016 9:40 am
Sorry, I was looking at the code you posted before.
Try this:
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 {
    if (ReefAngel.WaterLevel.GetLevel(2)>89) //Overflow
      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(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();
}
Roberto.

Posts: 250
Joined: Wed Jan 28, 2015 5:17 pm
PostPosted: Fri Nov 25, 2016 11:20 am
Thanks, Roberto. It works but just need to change 15 minutes to 15 seconds. How do you code this?
Image

Posts: 12306
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Nov 25, 2016 12:52 pm
16*SECS_PER_MIN is equal to 16 * 60 seconds, which means 16 minutes.
If you want 16 seconds, just remove the SECS_PER_MIN, which will be just 16 seconds.
Roberto.
Previous

Return to Ask anything here

Who is online

Users browsing this forum: No registered users and 4 guests

cron