Page 1 of 4

Code for DC return pump

Posted: Sun Feb 01, 2015 4:48 am
by Ismaclst
Is anyone using Roberto's DC return pump code? I tried to just copy and paste, but I get a lot of errors. If you are using it could you show me your code?

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 6:12 am
by lnevo
Show us your code and the errors

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 6:15 am
by Ismaclst

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 <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         50
#define MinPWM        50
#define OperatingPWM  66
long nummillis=5000;

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

////// 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.AddMultiChannelWaterLevelExpansion();  // Multi-Channel Water Level Expanion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // 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 );
    ReefAngel.Relay.On( Port7 );
    ReefAngel.Relay.On( Port8 );

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

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

void loop()
{
    ReefAngel.StandardHeater( Port3,780,785 );
    ReefAngel.StandardATO( Port4,180 );
    ReefAngel.StandardLights( Port5,21,30,9,30 );

    ////// Place your custom code below here
    PWMValue=OperatingPWM;
  if (ReefAngel.WaterLevel.GetLevel()<Level-2)
  {
    override=true;
    lastmillis=millis();
    PWMValue+=2;
  }
  if (ReefAngel.WaterLevel.GetLevel()>Level+2)
  {
    override=true;
    lastmillis=millis();
    PWMValue-=2;
  }
  if (millis()-lastmillis>nummillis && override)
  {
    override=false;
  }
  if (!override) PWMValue=OperatingPWM;
  if (ReefAngel.WaterLevel.GetLevel()>Level+10) PWMValue=MinPWM;
  PWMValue=constrain(PWMValue,MinPWM,100);
  ReefAngel.PWM.SetActinic(PWMValue);
    

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

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

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 6:21 am
by Ismaclst
Also, I bought the multi channel water level expansion and I need to incorporate it into my code. The first channel will be for my ATO and the second will be for the DC return pump. The other two I'm not using at this time. How would I go about doing this? Thanks in advance.

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 8:55 am
by rimai
Compiles fine for me.
To change the channel of the WL module, simply add the channel inside the (), so it looks like this:

Code: Select all

ReefAngel.WaterLevel.GetLevel(2)
Make sure to change all the ones related to the return pump code.

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 9:18 am
by Ismaclst
I'm getting 'class ReefAngelClass' has no member named 'WaterLevel'

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 9:32 am
by rimai
Maybe you have a problem with your libraries.
Try installing the Reef Angel Installer again.

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 9:56 am
by Ismaclst
That worked, thank you. What do I need to add to this, ReefAngel.WaterLevelATO(Port3,180,54,56);, to use channel 1 of the multi channel water module?

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 11:25 am
by Ismaclst
Also, I'm assuming I change these three values to fit my needs? What do the 50 and 66 exactly mean? Is 50 what you want your water level to be at and the 66 is for the speed of the pump? What is the MinPWN?

Code: Select all

#define Level         50
#define MinPWM        50
#define OperatingPWM  66
long nummillis=5000;

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 12:27 pm
by rimai
Simply add the channel in front of the port:

Code: Select all

ReefAngel.WaterLevelATO(1,Port3,180,54,56);, 
50 is minimum you want the pump to run and 66 is the what the pump should be running to match the drain.
The code will go +/- 2% according to the water level measured.
But this is very dependent on what type of tank and drain pipe you are using.
You will need to play around with the settings to see what works best for you.
You may even need more than +/- 2%.

Re: Code for DC return pump

Posted: Sun Feb 01, 2015 12:52 pm
by Ismaclst
Ok, thank you.

Re: Code for DC return pump

Posted: Thu Feb 05, 2015 2:28 pm
by Ismaclst
rimai wrote:Simply add the channel in front of the port:

Code: Select all

ReefAngel.WaterLevelATO(1,Port3,180,54,56);, 
50 is minimum you want the pump to run and 66 is the what the pump should be running to match the drain.
The code will go +/- 2% according to the water level measured.
But this is very dependent on what type of tank and drain pipe you are using.
You will need to play around with the settings to see what works best for you.
You may even need more than +/- 2%.
Roberto, would there be any ill effects if I changed the 2% to like 10%? I thought maybe it would make tuning the drain a little quicker if I gave the pump a larger range to work with.

Re: Code for DC return pump

Posted: Thu Feb 05, 2015 3:04 pm
by rimai
You would have to try it to see what response you get.
I have a 60g tank, so the +/-2% worked well for me.

Re: Code for DC return pump

Posted: Mon Feb 16, 2015 7:26 pm
by Ismaclst
Ok, so I'm trying to figure out my return pump and overflow. I bought the new Jebao DCT 6000 pump. I have a 50 gallon tank with a 1 inch drain and a 1/2 inch return. I was using the stock controller to see about where I would have to set the pump to overcome the drain. Even at the max speed it won't. Roberto, what size pump are you running? Is your setup different? I thought for sure that 1580 gallons of flow would for sure be enough? There shouldn't be much head loss cause it goes through two 45's and about 3 foot of pipe. Any ideas?

Re: Code for DC return pump

Posted: Mon Feb 16, 2015 8:34 pm
by rimai
I use it at about 64% on a 9000 model.
If I run it at 100%, I get way too much flow.
I do have a 5000 that I use at the office for water changes and it can pump about 5 feet with no problems.
There must be something in your pump that is not right.

Re: Code for DC return pump

Posted: Tue Feb 17, 2015 1:41 am
by Ismaclst
I don't think its the pump. I tested it before installing it and it seemed to work fine. What is the size of your return? Could it be that mine, only being a 1/2 inch, is causing too much back pressure?

Re: Code for DC return pump

Posted: Tue Feb 17, 2015 8:33 am
by rimai
I think I have a 1" up and 1.5" down

Re: Code for DC return pump

Posted: Tue Feb 17, 2015 2:02 pm
by Ismaclst
Anybody else have any thoughts what could be the issue?

Re: Code for DC return pump

Posted: Tue Feb 17, 2015 5:43 pm
by lnevo
I think before you get it variably adjusting your overflow, make sure that it's working with the RA at the speeds you set it for and is able to adjust properly with the RA.

Re: Code for DC return pump

Posted: Tue Feb 17, 2015 6:23 pm
by Ismaclst
I never had it hooked up to my RA. I was just using the stock controller so I would have an rough idea where to set my pump at. I guess I could hook it up to the RA to see if it works with it. Would the 1/2 inch return have anything to do with it? Or maybe my overflow box won't let enough water in to overcome the standpipe?

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 1:53 pm
by Ismaclst
I know this is frowned upon but if I were to use a valve on the end of my drain to slow the water going through, would this solve my issues? I figured I could put a couple of failsafes in.

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 2:23 pm
by rimai
Yes, That's how I have it too, because my drain is larger pipe size than my return.

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 2:35 pm
by lnevo
This is essentially a bean animal / herbie type overflow (i.e. Full Siphon) A valve is required in this to set the speed of the siphon to match the return pump or you will never get a siphon going and being maintained. In the "robertoflow" you have the water level sensor as your backup drain rather than a backup standpipe.

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 2:52 pm
by Ismaclst
Ok, thanks for the replies. I will give it a try.

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 3:16 pm
by Ismaclst
Can I use the water sensor as a failsafe? Let's say that my normal operating range is 50 and if something plugs the drain and it raises too high, the reef angel will turn off the return pump port.

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 4:54 pm
by rimai
The code already does that.
I would on top of that use a float switch in your overflow.
I have one on mine :)
The float switch is in series with the PWM signal that controls the DC pump.

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 5:08 pm
by Ismaclst
Oh, ok. So do you just take the red wire from the PWM signal ,cut it, and place the float in between that?

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 5:40 pm
by Ismaclst
One more thing. I seem to be having a little issue with my water sensor for my ato. I marked a line on my sump where I wanted my level to be at. I based my code off of that reading. Now after a day or so It shows that my level is at the correct level but its actually about 1/4" lower than my line. Does this mean I have a leak somewhere? I put silicone around the orange piece and the coupling hoping this would cure it. I did see some very small micro bubbles from my skimmer entering the return section. Could they be building up inside the tube? If so is there something I could use to prevent this?

Re: Code for DC return pump

Posted: Wed Feb 18, 2015 5:49 pm
by Ismaclst
I forgot to mention something. When I was calibrating the tube I noticed that when I kept the tube out of the water it stayed at the given number but when I placed it into the water to figure what the 100% would be, it would fluctuate up down about two numbers. Is this normal or does that number have to be like the first number you calibrate?

Re: Code for DC return pump

Posted: Thu Feb 19, 2015 1:00 pm
by Ismaclst
Anybody? I came home today and it was about a half inch below the line. When I pulled it out and put it back in, it showed that it was low. Hoping to get this fixed soon otherwise I will have to use the float switches.