How to cycle power to 4 wave pumps?

Do you have a question on how to do something.
Ask in here.

Posts: 52
Joined: Mon Oct 01, 2018 5:55 pm
PostPosted: Thu Feb 28, 2019 9:29 pm
I have the reef angel plus controller with 2 relay expansions. Currently i am using internal memory.
I have the wave maker setup to cycle every 180 seconds. I am using standard wave pumps plugged into ports 5-6 on both relay expansions.

Right now they all turn on/off at the same time. Is there any way for me to have them cycle randomly? If not randomly then at least cycle on a set time, as long as they do not all go on/off at the same time. That kind of defeats the purpose.

Can this be done at all with internal memory?

Posts: 12459
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Mar 01, 2019 12:32 am
Can you post your code?
Roberto.

Posts: 52
Joined: Mon Oct 01, 2018 5:55 pm
PostPosted: Fri Mar 01, 2019 9:11 am
#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
ReefAngel.AddWaterLevelExpansion(); // Water Level Expansion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit | Port7Bit;
ReefAngel.FeedingModePortsE[0] = Port3Bit | Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
ReefAngel.LightsOnPortsE[0] = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port7Bit;
ReefAngel.OverheatShutoffPortsE[0] = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;


// Ports that are always on
ReefAngel.Relay.On( Port8 );
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port3 );
ReefAngel.Relay.On( Box1_Port8 );

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


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

void loop()
{
ReefAngel.DayLights( Port1 );
ReefAngel.DayLights( Port2 );
ReefAngel.MoonLights( Port3 );
ReefAngel.MoonLights( Port4 );
ReefAngel.WavemakerRandom1(Port5,60,180); // Turn Port5 on/off random cycles that lasts from 15 to 60 secs
ReefAngel.WavemakerRandom2(Port6,60,180); // Turn Port6 on/off random cycles that lasts from 15 to 60 secs
// Port 5 and 6 are not synchronized.
// They work independent of each other at random times.
ReefAngel.WaterLevelATO( Port7 );
ReefAngel.Relay.DelayedOn( Box1_Port2 );
ReefAngel.StandardHeater( Box1_Port4 );
ReefAngel.WavemakerRandom1(Box1_Port5,60,180); // Turn Port5 on/off random cycles that lasts from 15 to 60 secs
ReefAngel.WavemakerRandom2(Box1_Port6,60,180); // Turn Port6 on/off random cycles that lasts from 15 to 60 secs
// Port 5 and 6 are not synchronized.
// They work independent of each other at random times.
ReefAngel.MoonLights( Box1_Port7 );
////// Place your custom code below here


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

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

Posts: 12459
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Mar 01, 2019 11:06 am
I see 4 pumps.
Do you want just 1 on and 3 off at a time?
So, each stays on for 45 seconds with a total of 180 seconds?
Roberto.

Posts: 52
Joined: Mon Oct 01, 2018 5:55 pm
PostPosted: Fri Mar 01, 2019 12:54 pm
I would really like for them to cycle. Not all turn off/on at the same time like its been doing.

Based on the comments in the code
// Port 5 and 6 are not synchronized.
// They work independent of each other at random times.

It sounds like they should cycle at random times, or maybe i am misunderstanding it.

Right now all 4 pumps turn off/on at at exactly the same time.
Last edited by alexr54 on Fri Mar 01, 2019 12:57 pm, edited 1 time in total.

Posts: 12459
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Mar 01, 2019 12:57 pm
Elaborate please. What is cycle for you?
Give me exactly what you want the ports to do.
Roberto.

Posts: 52
Joined: Mon Oct 01, 2018 5:55 pm
PostPosted: Fri Mar 01, 2019 1:00 pm
rimai wrote:Elaborate please. What is cycle for you?
Give me exactly what you want the ports to do.


Is it possible to randomize each wave maker ports 'on' and 'off' duration? Like between 60-180 seconds?
So they will each turn on and off independently at a random time between 60-180 seconds.

I hope i am making sense. And thank you for responding.

Posts: 52
Joined: Mon Oct 01, 2018 5:55 pm
PostPosted: Fri Mar 01, 2019 1:09 pm
I suppose i can modify these settings?

ReefAngel.WavemakerRandom1(Port5,60,180); // Turn Port5 on/off random cycles that lasts from 15 to 60 secs
ReefAngel.WavemakerRandom2(Port6,60,180); // Turn Port6 on/off random cycles that lasts from 15 to 60 secs
// Port 5 and 6 are not synchronized.
// They work independent of each other at random times.


To different times and load it into the unit. It will use the times i set for each but will not turn on/off randomly within the times set?
Also will i be able to still use internal memory?

What confuses me is this:
// Port 5 and 6 are not synchronized.
// They work independent of each other at random times.
Last edited by alexr54 on Fri Mar 01, 2019 1:10 pm, edited 1 time in total.

Posts: 12459
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Mar 01, 2019 1:09 pm
Try this:
Code: Select all
ReefAngel.Relay.Set(Port5,now()%180<random(60,120));
ReefAngel.Relay.Set(Port6,now()%180<random(60,120));
ReefAngel.Relay.Set(Box1_Port5,now()%180<random(60,120));
ReefAngel.Relay.Set(Box1_Port6,now()%180<random(60,120));
Roberto.

Posts: 52
Joined: Mon Oct 01, 2018 5:55 pm
PostPosted: Fri Mar 01, 2019 1:11 pm
Thanks Roberto,
Will i need to disable internal memory?
Next

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 3 guests