Code for DC return pump

Do you have a question on how to do something.
Ask in here.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Code for DC return pump

Post 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?
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Code for DC return pump

Post by lnevo »

Show us your code and the errors
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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();
}
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post 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.
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

I'm getting 'class ReefAngelClass' has no member named 'WaterLevel'
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post by rimai »

Maybe you have a problem with your libraries.
Try installing the Reef Angel Installer again.
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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?
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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;
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post 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%.
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Ok, thank you.
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post 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.
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post 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.
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post by rimai »

I think I have a 1" up and 1.5" down
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Anybody else have any thoughts what could be the issue?
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Code for DC return pump

Post 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.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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?
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post by rimai »

Yes, That's how I have it too, because my drain is larger pipe size than my return.
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Code for DC return pump

Post 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.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post by Ismaclst »

Ok, thanks for the replies. I will give it a try.
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Code for DC return pump

Post 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.
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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?
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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?
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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?
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Code for DC return pump

Post 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.
Image
Post Reply