Wave patterns

Related to the development libraries, released by Curt Binder
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Wave patterns

Post by Sacohen »

No problem.
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

Picked up two RW-4's for the 40 gallon breeder which is made up mostly of soft corals and 3 rose bubble tip anemones. My order for two cables came in so I just finished connecting everything and adding some basic code from a few pages back that cycled through reef crest and nutrient export modes. Uploaded the code and saw a blast of water movement then nothing.

Probably have my code in the wrong place I'm guessing because they shot on for a second then nothing. I'll need to clean this up and label the ports on the relay box since it is getting messy. Side note - I just added the wireless adapter and it works great. Question - do I have to disconnect the wireless adapter every time I want to upload new code?


Code:
#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.AddWifi();
ReefAngel.AddStandardMenu(); // Add Standard Menu

ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// 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 );


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

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


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

void loop()
{

ReefAngel.StandardLights( Port2,9,0,21,0 );
ReefAngel.StandardLights( Port4,9,0,21,0 ); // LED fans

ReefAngel.WavemakerRandom(Port5,60,300);

// ReefAngel.WavemakerRandom(Port5,120,600);
// ReefAngel.WavemakerRandom(Port6,120,600);

////// Place your custom code below here

// Turn Port5 on/off random cycles that lasts from 25 to 60 secs
// ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
// ReefAngel.Relay.Set(Port8,!ReefAngel.Relay.Status(Port7));

// This will turn off both relays at a set time

if (hour()>=20 || hour()<10)
{
ReefAngel.Relay.Off(Port5); // large power head
ReefAngel.Relay.Off(Port6); // large power head
ReefAngel.Relay.Off(Port4); // LED fans
ReefAngel.Relay.On(Port7); // Small power head for night
ReefAngel.Relay.On(Port8); // Small power head for night
}
else
{

// Turn Port5 on/off random cycles that lasts from 25 to 60 secs
ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
ReefAngel.Relay.Off(Port7);
ReefAngel.Relay.Off(Port8);
}

// 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(10,0,20,0,0,65,0) );
ReefAngel.PWM.SetChannel( 1, PWMParabola(10,0,20,0,0,75,0) );
ReefAngel.PWM.SetChannel( 2, PWMParabola(10,0,20,0,0,65,0) );
ReefAngel.PWM.SetChannel( 3, PWMParabola(10,0,20,0,0,65,0) );

// Testing wave pumps
if (hour()>=16 && hour()<18)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); // Nutrient Transport on sync mode
ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,false) ); // Nutrient Transport on anti-sync mode
}
else if (hour()>=18 && hour()<16)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true) ); // ReefCrest at 50% + - 20 on sync mode
ReefAngel.PWM.SetActinic( ReefCrestMode(50,20,false) ); // ReefCrest at 50% + - 20 on anti-sync mode
}
////// 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-dns.myreefangel.com
ReefAngel.ShowInterface();
}
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Wave patterns

Post by Sacohen »

I'm not sure about the code, but a quick look it seems right, except it looks like you have the wave mode on ports 5 & 6 and are also using the DC Pump code.

If you don't have the Bluetooth module you will need to unplug the WiFi module every time you want to update your code.
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

Yeah, that is odd. Not really sure at this point since I have cruddy notes and they don't look that great in the sketch either :( I just re-ran the wizard and it produced something that has at least one side working but not sure if this is right either so I'll need to continue to try. Also those little things can put out some water movement. I accidently had 90 percent I guess and everything was moving around way too much. Caught it and reset to 50 and everything seems pretty happy.

Originally on my power / relay box it was like this. Daylight and Actinic channels not used.

Plug 1 - skimmer (always on, off for feeding)
Plug 2 - Power supply for LED's - set time on/off
Plug 3 - NA
Plug 4 - LED heat sink fans - come on once LED's start up
Plug 5 - large power head powers on at 10 am until 8 pm
Plug 6 - large power head powers on at 10 am until 8 pm
Plug 7 - small power heads only coming on at 10 PM
Plug 8 - small power heads only coming on at 10 PM

The goal is to remove the koralia power heads and just use the RW-4's if I can get them to work together or educated is how I think they work :) I am reading it as reef crest daylight is set to sync with actinic set to antisync. So at some time - not sure when, one side shuts down and the other kicks in. Sort of simulating high/low tide. I just don't see that time window or cut off.

New code:
#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.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 );
ReefAngel.Relay.On( Port4 );
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port6 );

////// 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(10,0,20,0,0,65,0) );
ReefAngel.PWM.SetChannel( 1, PWMParabola(10,0,20,0,0,75,0) );
ReefAngel.PWM.SetChannel( 2, PWMParabola(10,0,20,0,0,65,0) );
ReefAngel.PWM.SetChannel( 3, PWMParabola(10,0,20,0,0,65,0) );

ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( ReefCrest,50,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
// 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


////// 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
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Wave patterns

Post by cosmith71 »

That's not how ReefCrest works. ReefCrest slowly meanders between the midline (50 in your case) by +/- the offset (10 here). When the sync goes up, the antisync goes down. So they both should be on constantly, going between 40 and 60.

--Colin
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

cosmith71 wrote:That's not how ReefCrest works. ReefCrest slowly meanders between the midline (50 in your case) by +/- the offset (10 here). When the sync goes up, the antisync goes down. So they both should be on constantly, going between 40 and 60.

--Colin
Ok, that makes sense and also what I see although I thought I saw higher than 60 on one side. I'll add a if statement to get them to swap who is anti then.

Thanks, appreciate you taking time to explain it.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

You can use tide.IsIncoming() it might be isIncoming as your condition for swapping the channels
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

Ok, thanks. I'll see if I can find an example of that. Right now I have the standard reef crest to go to 25 when the lights go off (9 PM). Then standard power when them come on again at 9 AM. I don't know what mode actually does what so I'm just using reef crest for now but would like to get the sides to alternate.

Does it make more sense to change flow patterns or just use one?

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 );
}
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

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
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

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
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

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
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

The tide mode speeds adjust based on moon phase. You dont need to do anything separate
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wave patterns

Post by lnevo »

And no explicit nite mode just the way the timing works.
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

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.
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

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();
}
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: Wave patterns

Post by saf1 »

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 :)
rlr86
Posts: 1
Joined: Thu Jul 28, 2016 8:07 pm

Re: Wave patterns

Post by rlr86 »

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);
}
Post Reply