How to cycle power to 4 wave pumps?

Do you have a question on how to do something.
Ask in here.
Post Reply
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

How to cycle power to 4 wave pumps?

Post by alexr54 »

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

Re: How to cycle power to 4 wave pumps?

Post by rimai »

Can you post your code?
Roberto.
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

#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();
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to cycle power to 4 wave pumps?

Post by rimai »

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.
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

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

Re: How to cycle power to 4 wave pumps?

Post by rimai »

Elaborate please. What is cycle for you?
Give me exactly what you want the ports to do.
Roberto.
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

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.
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

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

Re: How to cycle power to 4 wave pumps?

Post by rimai »

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.
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

Thanks Roberto,
Will i need to disable internal memory?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: How to cycle power to 4 wave pumps?

Post by rimai »

no. Just erase any code that uses those ports or they will have conflicts.
Roberto.
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

Awesome, will try this out soon as i get home.

I'm well versed in scripting with powershell and some PHP coding.
But this is new to me. I kind of get it, but need practice.
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

The code you suggested kind of made the ports go crazy. It was power cycling every half second. I had to unplug and revert.

I simply changed each port to different times and this works fine for me. I do appreciate the help!
The wizard does not allow this.
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

rimai wrote:no. Just erase any code that uses those ports or they will have conflicts.
It looks like one of my wave pump ports now does not work. It must have somehow burnt out whren attempting the code you suggested. Now 3 work fine...
Is there a way to fix/replace one port?
alexr54
Posts: 59
Joined: Mon Oct 01, 2018 5:55 pm

Re: How to cycle power to 4 wave pumps?

Post by alexr54 »

Scratch that. Looks like all ports are working, although they do have quite a loud click.

I managed to get it just right. The first 2 ports for the wave maker are working randomly, the next 2 ports in the other box are synced on/off with random timing.
Looks like it’s working good! Thanks again.
Post Reply