Wave patterns

Related to the development libraries, released by Curt Binder

Posts: 108
Joined: Thu Jun 28, 2012 1:46 pm
PostPosted: Sun Jul 26, 2015 9:45 am
Ok, found the compile error. Case sensitive :) Was using uppercase T instead of lowercase t when calling tide. Not sure if this is the right way to set it up but the tide function has the if statement to set PWM sync or anti sync. Then I let my main run window use full power or reduce after lights out.

Thanks.
-scott

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>
#include <Tide.h>  // testing for tide control

////// Place global variable code below here
Tide tide;  // testing for tide control

////// 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.AddPHExpansion(); // pH Expansion Module
 // Ports toggled in Feeding Mode
 ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
 // Ports toggled in Water Change Mode
 ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
 // Ports toggled when Lights On / Off menu entry selected
 ReefAngel.LightsOnPorts = 0;
 // Ports turned off when Overheat temperature exceeded
 ReefAngel.OverheatShutoffPorts = Port2Bit;
 // Use T1 probe as temperature and overheat functions
 ReefAngel.TempProbe = T1_PROBE;
 ReefAngel.OverheatProbe = T1_PROBE;
 // Set the Overheat temperature setting
 InternalMemory.OverheatTemp_write( 869 );

 // Feeeding and Water Change mode speed
 ReefAngel.DCPump.FeedingSpeed=0;
 ReefAngel.DCPump.WaterChangeSpeed=0;

 // Ports that are always on
 ReefAngel.Relay.On( Port1 );  // skimmer
 // ReefAngel.Relay.On( Port4 );  // LED Fans
 ReefAngel.Relay.On( Port5 );  // RW 4 left side facing tank
 ReefAngel.Relay.On( Port6 );  // RW 4 right side facing tank

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


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

void loop()
{
 ReefAngel.StandardLights( Port2,9,0,21,0 ); // power to LED power supply
 ReefAngel.StandardLights( Port4,9,0,21,0 ); // LED fans
// ReefAngel.WavemakerRandom( Port5,5,90 ); // Not sure what these are for now
// ReefAngel.WavemakerRandom( Port6,5,90 ); // Not sure what these are for now
// ReefAngel.StandardLights( Port7,9,0,21,0 );
// ReefAngel.StandardLights( Port8,9,0,21,0 );

// Channel 0 (1000mA max) - 5 Neutral White
// Channel 1 (1000mA max) - 6 Royal Blue + 5 Blue
// Channel 2 (700mA max) - 12 Lime
// Channel 3 (700mA max) - 5 Violet UV + 4 Deep Red (660nm)
 ReefAngel.PWM.SetChannel( 0, PWMParabola(9,0,21,0,0,65,0) );
 ReefAngel.PWM.SetChannel( 1, PWMParabola(9,0,21,0,0,75,0) );
 ReefAngel.PWM.SetChannel( 2, PWMParabola(9,0,21,0,0,65,0) );
 ReefAngel.PWM.SetChannel( 3, PWMParabola(9,0,21,0,0,65,0) );

 ReefAngel.DCPump.UseMemory = false;

// ReefAngel.DCPump.SetMode( ReefCrest,55,10 );
// ReefAngel.DCPump.DaylightChannel = Sync;
// ReefAngel.DCPump.ActinicChannel = AntiSync;

// Testing tidal function
if (tide.isIncoming()) {
   ReefAngel.DCPump.DaylightChannel = Sync;
   ReefAngel.DCPump.ActinicChannel = AntiSync;
}
else {
 ReefAngel.DCPump.DaylightChannel = AntiSync;
 ReefAngel.DCPump.ActinicChannel = Sync;
}

// ReefAngel.DCPump.ExpansionChannel[0] = None;
// ReefAngel.DCPump.ExpansionChannel[1] = None;
// ReefAngel.DCPump.ExpansionChannel[2] = None;
// ReefAngel.DCPump.ExpansionChannel[3] = None;
// ReefAngel.DCPump.ExpansionChannel[4] = None;
// ReefAngel.DCPump.ExpansionChannel[5] = None;
 
 ////// Place your custom code below here

if (hour()>=21 || hour()<9)
{
 // Sleep mode - slow things down
 ReefAngel.DCPump.SetMode( ReefCrest,25,10 );
}
else
{
// Normal power
 ReefAngel.DCPump.SetMode( ReefCrest,50,10 );
 }

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

 // This should always be the last line
 ReefAngel.Portal( "saf1" );
 ReefAngel.DDNS( "saf1-dns.myreefangel.com" ); // Your DDNS is saf1-saf1-dns.myreefangel.com.myreefangel.com
 ReefAngel.ShowInterface();
}
User avatar
Posts: 5337
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Jul 26, 2015 6:12 pm
Thats perfect! Now if you want to use the tide mode more you can set the parameters for the tide speed to fluctuate through the day and the variation would be based on the MoonPhase() so where you are calling SetMode and giving the ReefCrest speed you could get the speed from the tide class. Also the tide class kind of has a built in night mode at least how I have it set

Posts: 108
Joined: Thu Jun 28, 2012 1:46 pm
PostPosted: Tue Jul 28, 2015 9:15 am
lnevo wrote:Thats perfect! Now if you want to use the tide mode more you can set the parameters for the tide speed to fluctuate through the day and the variation would be based on the MoonPhase() so where you are calling SetMode and giving the ReefCrest speed you could get the speed from the tide class. Also the tide class kind of has a built in night mode at least how I have it set


Cool, thanks for the information because that is what I'm actually looking for. I know I am only going to get "so" much out of the R4's in a 40 gallon breeder but it is more about learning how this works, the corals, and overall look. I like what they are doing with just this basic routine and imagine the rose bubble tips will love one I get some variation in there.

I don't think my Hammers are enjoying it much but then again it seems they don't like their neighbors, Kenya Trees. Thanks again though - I'll take a look at this moon phase and see how the night mode works. I'm not using memory settings so I have to disconnect wife to make any changes. I've not messed with that feature yet.
User avatar
Posts: 5337
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Tue Jul 28, 2015 9:36 am
The tide mode speeds adjust based on moon phase. You dont need to do anything separate
User avatar
Posts: 5337
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Tue Jul 28, 2015 9:37 am
And no explicit nite mode just the way the timing works.

Posts: 108
Joined: Thu Jun 28, 2012 1:46 pm
PostPosted: Tue Jul 28, 2015 1:41 pm
Ok, thanks lnevo.

I'm going pretty slow with this one since the RW-4's can put out a lot of movement in the 40 gallon breeder. The fish for the most part have been around 4 years or so but I recently added a pair of baby clown fish and a blenny which are young / small.

This is a really cool library. I'm really glad I picked up the cables and power heads for the reef angel. It is a lot of fun and educational to boot. I don't remember the last time I was reading up on tidal movement and moon phase.

Posts: 108
Joined: Thu Jun 28, 2012 1:46 pm
PostPosted: Sat Aug 01, 2015 9:29 am
I ran a few different patterns the last couple of days and I have to say I like the tidal swell mode the best so far. Short pulse was interesting and I could actually see a wave on the top of the surface. I think I'll try tidal swell for the whole day and let it go to reef crest mode at night. While it is working not 100% sure I'm calling it correctly - the tide swell that is.

I am using the tide function / routine to set the daylight and actinic channels sync and then just calling tidal swell and passing in 80% power with 20 being the offset between the two. I am assuming that is correct anyway and will let the sides change accordingly. Or do I leave duration to off or 0 and let the tide routine handle which side to ramp up, what time, and its own duration.


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>
#include <Tide.h>  // testing for tide control

////// Place global variable code below here
Tide tide;  // testing for tide control

////// 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.AddPHExpansion(); // pH Expansion Module
 // Ports toggled in Feeding Mode
 ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
 // Ports toggled in Water Change Mode
 ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
 // Ports toggled when Lights On / Off menu entry selected
 ReefAngel.LightsOnPorts = 0;
 // Ports turned off when Overheat temperature exceeded
 ReefAngel.OverheatShutoffPorts = Port2Bit;
 // Use T1 probe as temperature and overheat functions
 ReefAngel.TempProbe = T1_PROBE;
 ReefAngel.OverheatProbe = T1_PROBE;
 // Set the Overheat temperature setting
 InternalMemory.OverheatTemp_write( 869 );

 // Feeeding and Water Change mode speed
 ReefAngel.DCPump.FeedingSpeed=0;
 ReefAngel.DCPump.WaterChangeSpeed=0;

 // Ports that are always on
 ReefAngel.Relay.On( Port1 );  // skimmer
 // ReefAngel.Relay.On( Port4 );  // LED Fans
 ReefAngel.Relay.On( Port5 );  // RW 4 left side facing tank
 ReefAngel.Relay.On( Port6 );  // RW 4 right side facing tank

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


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

void loop()
{
 ReefAngel.StandardLights( Port2,9,0,21,0 ); // power to LED power supply
 ReefAngel.StandardLights( Port4,9,0,21,0 ); // LED fans
// ReefAngel.WavemakerRandom( Port5,5,90 ); // Not sure what these are for now
// ReefAngel.WavemakerRandom( Port6,5,90 ); // Not sure what these are for now
// ReefAngel.StandardLights( Port7,9,0,21,0 );
// ReefAngel.StandardLights( Port8,9,0,21,0 );

// Channel 0 (1000mA max) - 5 Neutral White
// Channel 1 (1000mA max) - 6 Royal Blue + 5 Blue
// Channel 2 (700mA max) - 12 Lime
// Channel 3 (700mA max) - 5 Violet UV + 4 Deep Red (660nm)
 ReefAngel.PWM.SetChannel( 0, PWMParabola(9,0,21,0,0,65,0) );
 ReefAngel.PWM.SetChannel( 1, PWMParabola(9,0,21,0,0,90,0) );
 ReefAngel.PWM.SetChannel( 2, PWMParabola(9,0,21,0,0,55,0) );
 ReefAngel.PWM.SetChannel( 3, PWMParabola(9,0,21,0,0,65,0) );

 ReefAngel.DCPump.UseMemory = false;

// ReefAngel.DCPump.SetMode( ReefCrest,55,10 );
// ReefAngel.DCPump.DaylightChannel = Sync;
// ReefAngel.DCPump.ActinicChannel = AntiSync;

// Testing tidal function
if (tide.isIncoming()) {
   ReefAngel.DCPump.DaylightChannel = Sync;
   ReefAngel.DCPump.ActinicChannel = AntiSync;
}
else {
 ReefAngel.DCPump.DaylightChannel = AntiSync;
 ReefAngel.DCPump.ActinicChannel = Sync;
}

// ReefAngel.DCPump.ExpansionChannel[0] = None;
// ReefAngel.DCPump.ExpansionChannel[1] = None;
// ReefAngel.DCPump.ExpansionChannel[2] = None;
// ReefAngel.DCPump.ExpansionChannel[3] = None;
// ReefAngel.DCPump.ExpansionChannel[4] = None;
// ReefAngel.DCPump.ExpansionChannel[5] = None;
 
 ////// Place your custom code below here

if (hour()>=21 || hour()<9)
{
 // Sleep mode - slow things down
 ReefAngel.DCPump.SetMode( ReefCrest,25,10 );
}
else
{

// Full power to run during the day with lights on
// Start at 9 AM run through 9 PM
ReefAngel.DCPump.SetMode( TidalSwell,80,20 );

}

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

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

Posts: 108
Joined: Thu Jun 28, 2012 1:46 pm
PostPosted: Wed Aug 05, 2015 3:01 pm
Ok, wondering if I could get some more help if possible. I thought I figured it out but I'm starting to think I am misunderstanding something basic. I am trying to use the tide function and have the basic routine as:

// Testing tidal function
if (tide.isIncoming()) {
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
}
else {
ReefAngel.DCPump.DaylightChannel = AntiSync;
ReefAngel.DCPump.ActinicChannel = Sync;
}

Then later in the custom code area I'm checking time to either slow it down or fall into the normal reef crest mode. My question is do I need the night time mode if the lunar/moon slows it down? If so, what is the minimum speed it drops to or do I need to set it somewhere. Same question applies to any settings to tide if I only want one high and low tide through out the day. I think I read somewhere in another post here that it would do both twice?

I am calling the reefcrest mode like:

////// Place your custom code below here
if (hour()>=21 || hour()<9)
{
// Sleep mode - slow things down
ReefAngel.DCPump.SetMode( ReefCrest,25,10 );
}
else
{
// Full power to run during the day with lights on
// Start at 9 AM run through 9 PM
ReefAngel.DCPump.SetMode( ReefCrest,50,30 );
}

What I am trying to avoid is blasting the center of the tank when both power heads are on rather than one doing most of the work most of the day like incoming tide or outgoing. I'm doing something wrong or misunderstand how to have one side run higher power for longer than the other.

Thanks - if this is covered somewhere just direct me. I'm missing something basic :)

Posts: 1
Joined: Thu Jul 28, 2016 8:07 pm
PostPosted: Thu Jul 28, 2016 8:12 pm
dose any one know if you can add a random pattern to this old code

Sine
Contribution of Discocarp
viewtopic.php?f=2&t=2386&p=18240
PulseMinSpeed - % for minimal speed
PulseMaxSpeed - % for maximum speed
PulseDuration - Duration (seconds) in which the entire sine wave will take to complete.
PulseSync - true if you want to sync pumps to same cycle. one false and one true if you want to anti-sync pumps.

CODE: SELECT ALL
byte SineMode(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync) {
double x,y;

x=double(now()%(PulseDuration));
x/=PulseDuration;
x*=2.0*PI;
if (!PulseSync) x+=PI; // shift the sine wave for the right pump

y=sin(x);// y is now between -1 and 1
y+=1.0; // y is now between 0 and 2
y/=2.0; // y is now between 0 and 1

// now compute the tunze speed
y*=double(PulseMaxSpeed-PulseMinSpeed);
y+=double(PulseMinSpeed);

y+=0.5; // for proper rounding

// y is now between PulseMinSpeed and PulseMaxSpeed, constrain for safety
return constrain(byte(y),30,100);
}
Previous

Return to Development Libraries

Who is online

Users browsing this forum: No registered users and 2 guests

cron