Page 1 of 1

Continuos Water Change

Posted: Sat Jan 17, 2015 10:09 pm
by Rodasphoto
I am thinking about implementing a continuos water change and have two Spectapure dosing pumps that are up to the task.
I am switching to internal memory and was wondering if there is a way to turn my stand alone Avastmarine ATO off when the pumps are set to withdraw water/replace water? (I plan to replace the water every 9 min.)

Is there also a way to reduce the offset off when one pump turns off and the other turns on using internal memory as well?

Can you mix hard coding and coding to internal memory in the sketch?

Many thanks for your help. ;)

Re: Continuos Water Change

Posted: Sun Jan 18, 2015 6:06 am
by lnevo
I would just put a statement if either spectrapure pump is on then turn off the ato relay. However the offset you mentioned would prob leave a window where neither is running? Can you elaborate with the on/off timeline of what you want?

Yes you can mix hard coded and memory

Re: Continuos Water Change

Posted: Sun Jan 18, 2015 8:35 am
by Rodasphoto
lnevo wrote:I would just put a statement if either spectrapure pump is on then turn off the ato relay. However the offset you mentioned would prob leave a window where neither is running? Can you elaborate with the on/off timeline of what you want?

Yes you can mix hard coded and memory
I plan to have the pumps change 18 mL every 9 minutes, 24 hours a day, 7 days a week. This comes out to 150x a day.

I would like Pump 1 to remove 18 mL of water from the tank which would take 6.17 seconds (it pumps 175 ml/min). Then as soon as Pump 1 is finished Pump 2 would add 18 mL of fresh saltwater to the tank which would take 5.4 seconds (it pumps 200 mL/min). I would like to minimize the offset if possible. I do not know how to code and copy and paste bits and pieces as I need them. Could you please tell me how to code the if statement. My ATO is currently on an expansion relay box 1 Relay 14. The pumps will be on 5 and 6 of relay box 1.

Re: Continuos Water Change

Posted: Sun Jan 18, 2015 8:37 am
by lnevo
Are you dosing 2 part? Meaning are you using the dosing pumps in the portal configuration?

Re: Continuos Water Change

Posted: Sun Jan 18, 2015 8:49 am
by Rodasphoto
I am not dosing 2 part. I was going to use the dosing pump function in the wizard to get the pumps to turn on/off to change my water. I was going to have it coded to the memory so if I need to change it later I can through the portal or RA app on my phone.

Re: Continuos Water Change

Posted: Sun Jan 18, 2015 1:38 pm
by lnevo
Ok. cool. That will certainly be the easiest way, but it will have a built in offset between dosing pump 1 and dosing pump 2. We can do it one of two ways. I can work on some code to know when the first pump is triggered and keep the ATO off, or we can manually setup the two dosing pumps to use the internal memory but not have an offset in between. While either pump is off the ATO won't trigger. Let me know you're preference with that, the main thing would be how customizable do you want the offset between the pumps... or if you want to drain, then add, then ato pump back on.

Just for shits and giggles...another option you could do is to add some water first, then remove some water. Since the amount of water changed is the same it won't kick on your ATO and we won't have to do anything custom. Since you're changing so little water, it really won't make that much of a difference. What do you think of that? It's certainly the easiest and most flexible code-wise...

Re: Continuos Water Change

Posted: Mon Jan 19, 2015 6:23 am
by Rodasphoto
lnevo wrote:Ok. cool. That will certainly be the easiest way, but it will have a built in offset between dosing pump 1 and dosing pump 2. We can do it one of two ways. I can work on some code to know when the first pump is triggered and keep the ATO off, or we can manually setup the two dosing pumps to use the internal memory but not have an offset in between. While either pump is off the ATO won't trigger. Let me know you're preference with that, the main thing would be how customizable do you want the offset between the pumps... or if you want to drain, then add, then ato pump back on.

Just for shits and giggles...another option you could do is to add some water first, then remove some water. Since the amount of water changed is the same it won't kick on your ATO and we won't have to do anything custom. Since you're changing so little water, it really won't make that much of a difference. What do you think of that? It's certainly the easiest and most flexible code-wise...
I was thinking to drain then fill with ATO off. But more importantly I would like to be able to adjust the amount of water being pumped in/out using internal memory if changes need to be made with minimum hassle. I am a new parent and my priority is my daughter. As a result I have not been able to do water changes as often as I like. If it works out better to fill then remove then I game for that.

I appreciate your help.

Re: Continuos Water Change

Posted: Mon Jan 19, 2015 6:25 am
by lnevo
Cool. I think especially with the frequency you are doing, it doesn't really matter which way you go :)

I'll write up the code for you. Can you post your current INO and which ports you need for the spectrapure and ato

Re: Continuos Water Change

Posted: Mon Jan 19, 2015 6:26 am
by lnevo
Oh and congratulations on your new daughter! Thats one area where RA definitely helps with having things automated!

Re: Continuos Water Change

Posted: Mon Jan 19, 2015 8:37 am
by Rodasphoto
Thanks. Its an amazing feeling when you become a parent. I find having a child is like having a reef tank, a lot of work but one of the greatest things you can do in life.
  • Main Relay
    1. Skimmer
    2. LED fan
    3. LED power supply 1
    4. LED power supply 2
    5. RW8
    6. MJ1200 water mixing station
    7. Heater
    8. DC3000

    Expansion Relay 1
    1. ATO
    2. Not Used
    3. Not Used
    4. Not Used
    5. Autowater change 1
    6. Autowater change 2

    7. Not Used
    8. Not Used
In the INO below I set the relays for the autowater change 1 & 2 pumps to not used because I was not sure what to choose from in the wizard.

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>

////// 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 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = Port1Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port4Bit | Port5Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = Port1Bit | Port4Bit | Port7Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | Port8Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


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

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

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

void loop()
{
    ReefAngel.DayLights( Port2 );
    ReefAngel.DayLights( Port3 );
    ReefAngel.DayLights( Port4 );
    ReefAngel.DayLights( Port5 );
    ReefAngel.DosingPumpRepeat1( Port6 );
    ReefAngel.StandardHeater( Port7 );
    ReefAngel.DayLights( Box1_Port1 );
    ReefAngel.PWM.Channel0PWMParabola();
    ReefAngel.PWM.Channel1PWMParabola();
    ReefAngel.PWM.Channel2PWMParabola();
    ReefAngel.PWM.Channel3PWMParabola();
    ReefAngel.PWM.Channel4PWMParabola();
    ReefAngel.PWM.Channel5PWMParabola();
    ////// Place your custom code below here
    

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

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

Re: Continuos Water Change

Posted: Mon Jan 19, 2015 12:10 pm
by lnevo
Put this in the custom code section. Btw, you had Box1_Port1 on/off with your lights... you can change it back if that's your preference.

If you need to switch around the ports below, go ahead. But this is pretty much the easiest. You'll add a few ml of water, and then take a few ml of water out. It really won't be a big difference considering your frequency and this way it won't mess with the ATO and you won't have to disable during the operation.

Code: Select all

    ReefAngel.Relay.On( Box1_Port1 ); // ATO port is always on
    ReefAngel.DosingPumpRepeat1(Box1_Port6); // AWC change 2 (add)
    ReefAngel.DosingPumpRepeat2(Box1_Port5); // AWC change 1 (drain)

Re: Continuos Water Change

Posted: Mon Jan 19, 2015 7:22 pm
by Rodasphoto
lnevo wrote:Put this in the custom code section. Btw, you had Box1_Port1 on/off with your lights... you can change it back if that's your preference.

If you need to switch around the ports below, go ahead. But this is pretty much the easiest. You'll add a few ml of water, and then take a few ml of water out. It really won't be a big difference considering your frequency and this way it won't mess with the ATO and you won't have to disable during the operation.

Code: Select all

    ReefAngel.Relay.On( Box1_Port1 ); // ATO port is always on
    ReefAngel.DosingPumpRepeat1(Box1_Port6); // AWC change 2 (add)
    ReefAngel.DosingPumpRepeat2(Box1_Port5); // AWC change 1 (drain)
Sorry for this dumb question but how would I change the values of how long they run? I have always hard coded by settings. I have my ATO on a timer because it is so loud that it has woken me up at night so I set to turn on with the lights since I am usually up by then. Should I take the first line off so that way it follows the time schedule?

Re: Continuos Water Change

Posted: Mon Jan 19, 2015 7:24 pm
by lnevo
Yeah you can go back to the daylights code you had for it before if that works for you. As far as the changes I'm assuming you have wifi? You can set the values through the portal or universal app

Re: Continuos Water Change

Posted: Tue Jan 20, 2015 5:34 pm
by Rodasphoto
lnevo wrote:Yeah you can go back to the daylights code you had for it before if that works for you. As far as the changes I'm assuming you have wifi? You can set the values through the portal or universal app
I am sorry to bother you again. I was looking through the reef angel app and did not see dosingpump repeat1 or dosingpumprepeat2. I am not sure not sure which memory location I should input a value. Also is the value in seconds? can I do tenths of seconds?

Code: Select all

[quote]
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <[color=#CC6600]Wire[/color].h>
#include <[color=#CC6600]OneWire[/color].h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <[color=#006699]LED[/color].h>
#include <RA_TempSensor.h>
#include <[color=#006699]Relay[/color].h>
#include <RA_PWM.h>
#include <[color=#006699]Timer[/color].h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <[color=#006699]Salinity[/color].h>
#include <[color=#006699]RF[/color].h>
#include <[color=#006699]IO[/color].h>
#include <[color=#006699]ORP[/color].h>
#include <[color=#006699]AI[/color].h>
#include <[color=#006699]PH[/color].h>
#include <[color=#006699]WaterLevel[/color].h>
#include <[color=#006699]Humidity[/color].h>
#include <[color=#006699]DCPump[/color].h>
#include <[color=#006699]PAR[/color].h>
#include <[color=#CC6600]ReefAngel[/color].h>

[color=#7E7E7E]////// Place global variable code below here[/color]


[color=#7E7E7E]////// Place global variable code above here[/color]


[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]()
{
    [color=#7E7E7E]// This must be the first line[/color]
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]Init[/color]();  [color=#7E7E7E]//Initialize controller[/color]
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]Use2014Screen[/color]();  [color=#7E7E7E]// Let's use 2014 Screen [/color]
    [color=#7E7E7E]// Ports toggled in Feeding Mode[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]FeedingModePorts[/color] = [color=#006699]Port1Bit[/color] | [color=#006699]Port5Bit[/color] | [color=#006699]Port8Bit[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]FeedingModePortsE[/color][0] = [color=#006699]Port1Bit[/color];
    [color=#7E7E7E]// Ports toggled in Water Change Mode[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]WaterChangePorts[/color] = [color=#006699]Port1Bit[/color] | [color=#006699]Port3Bit[/color] | [color=#006699]Port4Bit[/color] | [color=#006699]Port5Bit[/color] | [color=#006699]Port8Bit[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]WaterChangePortsE[/color][0] = [color=#006699]Port1Bit[/color] | [color=#006699]Port4Bit[/color] | [color=#006699]Port7Bit[/color];
    [color=#7E7E7E]// Ports toggled when Lights On / Off menu entry selected[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]LightsOnPorts[/color] = 0;
    [color=#CC6600]ReefAngel[/color].[color=#006699]LightsOnPortsE[/color][0] = 0;
    [color=#7E7E7E]// Ports turned off when Overheat temperature exceeded[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]OverheatShutoffPorts[/color] = [color=#006699]Port2Bit[/color] | [color=#006699]Port3Bit[/color] | [color=#006699]Port4Bit[/color] | [color=#006699]Port8Bit[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]OverheatShutoffPortsE[/color][0] = [color=#006699]Port7Bit[/color];
    [color=#7E7E7E]// Use T1 probe as temperature and overheat functions[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]TempProbe[/color] = [color=#006699]T1_PROBE[/color];
    [color=#CC6600]ReefAngel[/color].[color=#006699]OverheatProbe[/color] = [color=#006699]T1_PROBE[/color];


    [color=#7E7E7E]// Ports that are always on[/color]
    [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port1[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port8[/color] );

    [color=#7E7E7E]////// Place additional initialization code below here[/color]
    

    [color=#7E7E7E]////// Place additional initialization code above here[/color]
}

[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]()
{
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DayLights[/color]( [color=#006699]Port2[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DayLights[/color]( [color=#006699]Port3[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DayLights[/color]( [color=#006699]Port4[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DayLights[/color]( [color=#006699]Port5[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DosingPumpRepeat1[/color]( [color=#006699]Port6[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardHeater[/color]( [color=#006699]Port7[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DayLights[/color]( [color=#006699]Box1_Port1[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]Channel0PWMParabola[/color]();
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]Channel1PWMParabola[/color]();
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]Channel2PWMParabola[/color]();
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]Channel3PWMParabola[/color]();
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]Channel4PWMParabola[/color]();
    [color=#CC6600]ReefAngel[/color].[color=#006699]PWM[/color].[color=#CC6600]Channel5PWMParabola[/color]();

    [color=#7E7E7E]////// Place your custom code below here[/color]
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DosingPumpRepeat1[/color]([color=#006699]Box1_Port6[/color]); [color=#7E7E7E]// AWC change 2 (add)[/color]
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]DosingPumpRepeat2[/color]([color=#006699]Box1_Port5[/color]); [color=#7E7E7E]// AWC change 1 (drain)[/color]

    [color=#7E7E7E]////// Place your custom code above here[/color]

    [color=#7E7E7E]// This should always be the last line[/color]
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]Portal[/color]( [color=#006699]"Rodasphoto"[/color] );
    [color=#CC6600]ReefAngel[/color].[color=#CC6600]ShowInterface[/color]();
}


[/quote]

Re: Continuos Water Change

Posted: Tue Jan 20, 2015 6:31 pm
by rimai
Use the dosing pump repeat timer and interval memory locations

Re: Continuos Water Change

Posted: Thu Jan 22, 2015 3:17 pm
by Rodasphoto
rimai wrote:Use the dosing pump repeat timer and interval memory locations
Found that the Dosing Pump Timer is the length of time the dosing pump is on but is this in seconds or is it like our lighting that has a max of 225ish.

Also found that the DosingPump Repeat Interval sets the time between each time the pumps will run. Is this in seconds, minutes, or what? I would like to run my dosing pumps every 9 minutes, so would I just write a 9 for that location?

Re: Continuos Water Change

Posted: Thu Jan 22, 2015 4:22 pm
by lnevo
Yeah repeat is in minutes and the time is in seconds. I believe its an int so you should be able to do more than 255 seconds. Roberto can you confirm?

Re: Continuos Water Change

Posted: Thu Jan 22, 2015 4:29 pm
by rimai

Code: Select all

void DosingPumpRepeat(byte DPRelay, int OffsetMinute, int RepeatMinute, int RunTime);
Yes, they are all int, so you can go up to 32000

Re: Continuos Water Change

Posted: Fri Jan 23, 2015 4:33 pm
by Rodasphoto
Many thanks.