Icecap Module

Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Icecap Module

Post by Ismaclst »

I have the maxspect gyre and was thinking about purchasing the Icecap module to go with it. Has anyone else bought this? Does it come with the cable you need to connect to the RA? I'm assuming you can use any of the DC pump modes?
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Icecap Module

Post by lnevo »

It might come with the cable to connect to apex. You'd have to cut off the ethernet jack and connect the wires to the dimming module or splice it to the dimming connector cable. You're alternative is to take an ethernet jack outlet and connect the wires from that to your dimming module / dimming leads.

It should be able to use the DC Pump modes, the issue is how will it react. Also keep in mind that one of the connections controls speed, the other direction, so you'll need some manual code to control the direction and keep in mind that it's not a usual powerhead so the behavior may be different with our modes.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

Ok, thanks. I don't use the reverse flow so I don't need to buy the special cable. Roberto, what code are you using for your gyre?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Icecap Module

Post by rimai »

Sorry, I was actually never able to set it up yet.
I moved and I'm kind of remodeling the house, so I took my tank to the office and I'm waiting to finish my house to setup a new tank and install the Gyre pump.
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Icecap Module

Post by rimai »

Ismaclst wrote:I have the maxspect gyre and was thinking about purchasing the Icecap module to go with it. Has anyone else bought this? Does it come with the cable you need to connect to the RA? I'm assuming you can use any of the DC pump modes?
You should be able to use the DCPump modes.
The Kessil cable in the webstore should be able to be used with the Icecap module too :)
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

Ok, thanks. What mode are you guys running at night after the lights go out? I wanted something that is more gentle at night and during the day I was planning on using else mode.
Image
oftheangels
Posts: 43
Joined: Sat Nov 21, 2015 10:34 am
Location: Dallas

Re: Icecap Module

Post by oftheangels »

I'm using the Tide function to manage flow with the Maxspect/Icecap. Here is my code to make this happen:

In your init:

Code: Select all

    tide.Init(40,10,30);
    tide.SetWaveLength(12+SECS_PER_HOUR);
 
Then call this function from your loop:

Code: Select all

void setMaxspect()
{
  int reverse_speed=0;
  int forward_speed=45;
  
 if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
   forward_speed = NutrientTransportMode(25,50,1500,false);
   reverse_speed = 0;
 } else {
    forward_speed = tide.CalcTide();
 }
#if debug_flow == 1
  Serial.print("Forward Speed: ");
  Serial.print(forward_speed);
  Serial.print(" Reverse Speed: ");
  Serial.print(reverse_speed);
  Serial.println();
#endif

  ReefAngel.PWM.SetChannel(2,reverse_speed);  // set the pump direction
  ReefAngel.PWM.SetChannel(1,forward_speed);    // set the pump speed
}
Hope this helps.

-LeoD
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

oftheangels wrote:I'm using the Tide function to manage flow with the Maxspect/Icecap. Here is my code to make this happen:

In your init:

Code: Select all

    tide.Init(40,10,30);
    tide.SetWaveLength(12+SECS_PER_HOUR);
 
Then call this function from your loop:

Code: Select all

void setMaxspect()
{
  int reverse_speed=0;
  int forward_speed=45;
  
 if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
   forward_speed = NutrientTransportMode(25,50,1500,false);
   reverse_speed = 0;
 } else {
    forward_speed = tide.CalcTide();
 }
#if debug_flow == 1
  Serial.print("Forward Speed: ");
  Serial.print(forward_speed);
  Serial.print(" Reverse Speed: ");
  Serial.print(reverse_speed);
  Serial.println();
#endif

  ReefAngel.PWM.SetChannel(2,reverse_speed);  // set the pump direction
  ReefAngel.PWM.SetChannel(1,forward_speed);    // set the pump speed
}
Hope this helps.

-LeoD
How well does the tide function work with the gyre? Is it as random as the else mode? Would you say there is a big difference from the stock controller to the RA?
Image
oftheangels
Posts: 43
Joined: Sat Nov 21, 2015 10:34 am
Location: Dallas

Re: Icecap Module

Post by oftheangels »

The tide function works pretty well actually. The transitions are much gentler than say pulse mode. Really the only two modes I used with the standard controller were gyre and pulse...

For a while I was using this:

forward_speed = ShortPulseMode(tide.CalcTide() -10, tide.CalcTide(), 5000, false);

This adds a pulse on the tide... I may switch back to this at some point. I've only been running with straight tide for a few days but my corals seem to love it and the sand in my tank is staying put ;^). Also, I did use the gyre effect like this:

Code: Select all

   reverse_speed = ShortPulseMode(0,100,10000,false); 
   if (reverse_speed == 100)
     //
     // while we are going in reverse increase the speed to 45-60
     forward_speed = ShortPulseMode(30,60,5000,false);
   else
     //
     // while we are going forward set speed to 25-40 to keep
     // from blowing corals off the rocks
     forward_speed = ShortPulseMode(25,40,5000, false);
What this does is switch directions (forward/reverse) every 10 seconds and runs a pulse on top of that (every 5 seconds)... There are so many possibilities (which is why I love the RA).

-LeoD
oftheangels
Posts: 43
Joined: Sat Nov 21, 2015 10:34 am
Location: Dallas

Re: Icecap Module

Post by oftheangels »

I should also add that I am working on a generic function that uses all of the above tricks but uses memory locations for:

mode: pulse, gyre
usetide: true/false
minspeed
maxspeed
pulsecycle
gyrecycle

I will post it the source once I get it all working satisfactory. It will be nice to switch modes and speeds like the builtin maxspect controller does.

-LeoD
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

Great, thanks. Could you post your whole code?
Image
oftheangels
Posts: 43
Joined: Sat Nov 21, 2015 10:34 am
Location: Dallas

Re: Icecap Module

Post by oftheangels »

Here you go. Keep in mind I'm a RA newbie:

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 <Tide.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 <SunLocation.h>

#define debug_flow 1
#define debug_lights 1

////// Place global variable code below here
#define Return 1
#define Skimmer 2
#define Heater 3
#define SumpLight 4
#define Unused 6
#define Scrubber 5
#define PowerStrip 7
#define ATO 8

#define SumpTemp T1_PROBE
#define DisplayTemp T2_PROBE

////// Place global variable code above here
Tide tide;
SunLocation sunLocation;

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 | Port2Bit;

    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit;

    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;

    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit;

    // 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( Port6 );


    ////// Place additional initialization code below here
    ReefAngel.CustomLabels[0]="Return";
    ReefAngel.CustomLabels[1]="Skimmer";
    ReefAngel.CustomLabels[2]="Heater";
    ReefAngel.CustomLabels[3]="Fuge Light";
    ReefAngel.CustomLabels[4]="Unused";
    ReefAngel.CustomLabels[5]="Scrubber";
    ReefAngel.CustomLabels[6]="Power Strip";
    ReefAngel.CustomLabels[7]="ATO";

    tide.Init(40,10,30);
    tide.SetWaveLength(12+SECS_PER_HOUR);
    sunLocation.Init(25.7753,80.2089);
    sunLocation.SetOffset(8,0,8,0);
    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.Relay.DelayedOn( Port2 );
    ReefAngel.StandardHeater( Port3, 785, 805 );
    ReefAngel.StandardLights( Port4, 20,0,9,0);

    ////// Place your custom code below here
    //setVortech();
    //
    // turn the scrubber led on at 5pm and off at 5am 
    ReefAngel.StandardLights(Port5,17,0,5,0);
    sunLocation.CheckAndUpdate();
    
    setLED();
    setMoon();
    setMaxspect();
    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "oftheangels" );

    ReefAngel.ShowInterface();
}

void setLED()
{

#if debug_flow == 1
  Serial.print("Rise Hour: ");
  Serial.print(sunLocation.GetRiseHour());
  Serial.print(" Rise Minute: ");
  Serial.print(sunLocation.GetRiseMinute());
  Serial.print(" Set Hour: ");
  Serial.print(sunLocation.GetSetHour());
  Serial.print(" Set Minute: ");
  Serial.print(sunLocation.GetSetMinute());
  Serial.println();
#endif

    ReefAngel.PWM.SetActinic(PWMParabola(sunLocation.GetRiseHour(),sunLocation.GetRiseMinute(),sunLocation.GetSetHour() ,sunLocation.GetSetMinute(),0,50,0));

    ReefAngel.PWM.SetDaylight(PWMParabola(sunLocation.GetRiseHour(),sunLocation.GetRiseMinute(),sunLocation.GetSetHour(),sunLocation.GetSetMinute(),10,60,0));
}

void setMoon()
{
#ifdef debug_lights == 1
  Serial.print("Daylight: ");
  Serial.print(sunLocation.IsDaytime());
  Serial.print(" MoonPhase: ");
  Serial.print(MoonPhase());
  Serial.println();
#endif

  if (sunLocation.IsDaytime())
    ReefAngel.PWM.SetChannel(0, 0);
  else
    ReefAngel.PWM.SetChannel( 0, MoonPhase() );
}


void setVortech()
{
    // Pumps for night mode, start with lagoon, short pulse most of the day
  if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
  {
    if (hour() > 9 || hour() < 17)
      ReefAngel.RF.SetMode(ReefCrest,40,0);
    else
      ReefAngel.RF.SetMode(LongWave, 40, 0);
  }
}


void setMaxspect()
{
  int reverse_speed=0;
  int forward_speed=45;
  
 if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
   forward_speed = NutrientTransportMode(25,50,1500,false);
   reverse_speed = 0;
 } else if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
   //
   // shut off maxspect during water changes.
   forward_speed = 0;
   reverse_speed = 0;
 } else {
   //
   // swap between forward and reverse every 10 seconds
#if 0
   reverse_speed = ShortPulseMode(0,100,10000,false); 
   if (reverse_speed == 100)
     //
     // while we are going in reverse increase the speed to 45-60
     forward_speed = ShortPulseMode(30,60,5000,false);
   else
     //
     // while we are going forward set speed to 25-40 to keep
     // from blowing corals off the rocks
     forward_speed = ShortPulseMode(25,40,5000, false);
#endif
    forward_speed = tide.CalcTide();
  }
#if debug_flow == 1
  Serial.print("Forward Speed: ");
  Serial.print(forward_speed);
  Serial.print(" Reverse Speed: ");
  Serial.print(reverse_speed);
  Serial.println();
#endif

  ReefAngel.PWM.SetChannel(2,reverse_speed);  // set the pump direction
  ReefAngel.PWM.SetChannel(1,forward_speed);    // set the pump speed
}

Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

rimai wrote:
Ismaclst wrote:I have the maxspect gyre and was thinking about purchasing the Icecap module to go with it. Has anyone else bought this? Does it come with the cable you need to connect to the RA? I'm assuming you can use any of the DC pump modes?
You should be able to use the DCPump modes.
The Kessil cable in the webstore should be able to be used with the Icecap module too :)
Will this cable allow forward and reverse?
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

oftheangels wrote:Here you go. Keep in mind I'm a RA newbie:

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 <Tide.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 <SunLocation.h>

#define debug_flow 1
#define debug_lights 1

////// Place global variable code below here
#define Return 1
#define Skimmer 2
#define Heater 3
#define SumpLight 4
#define Unused 6
#define Scrubber 5
#define PowerStrip 7
#define ATO 8

#define SumpTemp T1_PROBE
#define DisplayTemp T2_PROBE

////// Place global variable code above here
Tide tide;
SunLocation sunLocation;

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 | Port2Bit;

    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit;

    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;

    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit;

    // 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( Port6 );


    ////// Place additional initialization code below here
    ReefAngel.CustomLabels[0]="Return";
    ReefAngel.CustomLabels[1]="Skimmer";
    ReefAngel.CustomLabels[2]="Heater";
    ReefAngel.CustomLabels[3]="Fuge Light";
    ReefAngel.CustomLabels[4]="Unused";
    ReefAngel.CustomLabels[5]="Scrubber";
    ReefAngel.CustomLabels[6]="Power Strip";
    ReefAngel.CustomLabels[7]="ATO";

    tide.Init(40,10,30);
    tide.SetWaveLength(12+SECS_PER_HOUR);
    sunLocation.Init(25.7753,80.2089);
    sunLocation.SetOffset(8,0,8,0);
    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.Relay.DelayedOn( Port2 );
    ReefAngel.StandardHeater( Port3, 785, 805 );
    ReefAngel.StandardLights( Port4, 20,0,9,0);

    ////// Place your custom code below here
    //setVortech();
    //
    // turn the scrubber led on at 5pm and off at 5am 
    ReefAngel.StandardLights(Port5,17,0,5,0);
    sunLocation.CheckAndUpdate();
    
    setLED();
    setMoon();
    setMaxspect();
    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "oftheangels" );

    ReefAngel.ShowInterface();
}

void setLED()
{

#if debug_flow == 1
  Serial.print("Rise Hour: ");
  Serial.print(sunLocation.GetRiseHour());
  Serial.print(" Rise Minute: ");
  Serial.print(sunLocation.GetRiseMinute());
  Serial.print(" Set Hour: ");
  Serial.print(sunLocation.GetSetHour());
  Serial.print(" Set Minute: ");
  Serial.print(sunLocation.GetSetMinute());
  Serial.println();
#endif

    ReefAngel.PWM.SetActinic(PWMParabola(sunLocation.GetRiseHour(),sunLocation.GetRiseMinute(),sunLocation.GetSetHour() ,sunLocation.GetSetMinute(),0,50,0));

    ReefAngel.PWM.SetDaylight(PWMParabola(sunLocation.GetRiseHour(),sunLocation.GetRiseMinute(),sunLocation.GetSetHour(),sunLocation.GetSetMinute(),10,60,0));
}

void setMoon()
{
#ifdef debug_lights == 1
  Serial.print("Daylight: ");
  Serial.print(sunLocation.IsDaytime());
  Serial.print(" MoonPhase: ");
  Serial.print(MoonPhase());
  Serial.println();
#endif

  if (sunLocation.IsDaytime())
    ReefAngel.PWM.SetChannel(0, 0);
  else
    ReefAngel.PWM.SetChannel( 0, MoonPhase() );
}


void setVortech()
{
    // Pumps for night mode, start with lagoon, short pulse most of the day
  if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
  {
    if (hour() > 9 || hour() < 17)
      ReefAngel.RF.SetMode(ReefCrest,40,0);
    else
      ReefAngel.RF.SetMode(LongWave, 40, 0);
  }
}


void setMaxspect()
{
  int reverse_speed=0;
  int forward_speed=45;
  
 if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
   forward_speed = NutrientTransportMode(25,50,1500,false);
   reverse_speed = 0;
 } else if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
   //
   // shut off maxspect during water changes.
   forward_speed = 0;
   reverse_speed = 0;
 } else {
   //
   // swap between forward and reverse every 10 seconds
#if 0
   reverse_speed = ShortPulseMode(0,100,10000,false); 
   if (reverse_speed == 100)
     //
     // while we are going in reverse increase the speed to 45-60
     forward_speed = ShortPulseMode(30,60,5000,false);
   else
     //
     // while we are going forward set speed to 25-40 to keep
     // from blowing corals off the rocks
     forward_speed = ShortPulseMode(25,40,5000, false);
#endif
    forward_speed = tide.CalcTide();
  }
#if debug_flow == 1
  Serial.print("Forward Speed: ");
  Serial.print(forward_speed);
  Serial.print(" Reverse Speed: ");
  Serial.print(reverse_speed);
  Serial.println();
#endif

  ReefAngel.PWM.SetChannel(2,reverse_speed);  // set the pump direction
  ReefAngel.PWM.SetChannel(1,forward_speed);    // set the pump speed
}

Thanks for your help. I was getting some errors when I added what you told me to. I figured out that I needed to add these, too.

Code: Select all

Tide tide;

Code: Select all

#include <Tide.h>
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Icecap Module

Post by rimai »

Ismaclst wrote:
rimai wrote:
Ismaclst wrote:I have the maxspect gyre and was thinking about purchasing the Icecap module to go with it. Has anyone else bought this? Does it come with the cable you need to connect to the RA? I'm assuming you can use any of the DC pump modes?
You should be able to use the DCPump modes.
The Kessil cable in the webstore should be able to be used with the Icecap module too :)
Will this cable allow forward and reverse?
Yes
Roberto.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

Great, thanks.
Image
oftheangels
Posts: 43
Joined: Sat Nov 21, 2015 10:34 am
Location: Dallas

Re: Icecap Module

Post by oftheangels »

Ismaclst wrote:
oftheangels wrote:Here you go. Keep in mind I'm a RA newbie:

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 <Tide.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 <SunLocation.h>

#define debug_flow 1
#define debug_lights 1

////// Place global variable code below here
#define Return 1
#define Skimmer 2
#define Heater 3
#define SumpLight 4
#define Unused 6
#define Scrubber 5
#define PowerStrip 7
#define ATO 8

#define SumpTemp T1_PROBE
#define DisplayTemp T2_PROBE

////// Place global variable code above here
Tide tide;
SunLocation sunLocation;

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 | Port2Bit;

    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit;

    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;

    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit;

    // 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( Port6 );


    ////// Place additional initialization code below here
    ReefAngel.CustomLabels[0]="Return";
    ReefAngel.CustomLabels[1]="Skimmer";
    ReefAngel.CustomLabels[2]="Heater";
    ReefAngel.CustomLabels[3]="Fuge Light";
    ReefAngel.CustomLabels[4]="Unused";
    ReefAngel.CustomLabels[5]="Scrubber";
    ReefAngel.CustomLabels[6]="Power Strip";
    ReefAngel.CustomLabels[7]="ATO";

    tide.Init(40,10,30);
    tide.SetWaveLength(12+SECS_PER_HOUR);
    sunLocation.Init(25.7753,80.2089);
    sunLocation.SetOffset(8,0,8,0);
    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.Relay.DelayedOn( Port2 );
    ReefAngel.StandardHeater( Port3, 785, 805 );
    ReefAngel.StandardLights( Port4, 20,0,9,0);

    ////// Place your custom code below here
    //setVortech();
    //
    // turn the scrubber led on at 5pm and off at 5am 
    ReefAngel.StandardLights(Port5,17,0,5,0);
    sunLocation.CheckAndUpdate();
    
    setLED();
    setMoon();
    setMaxspect();
    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "oftheangels" );

    ReefAngel.ShowInterface();
}

void setLED()
{

#if debug_flow == 1
  Serial.print("Rise Hour: ");
  Serial.print(sunLocation.GetRiseHour());
  Serial.print(" Rise Minute: ");
  Serial.print(sunLocation.GetRiseMinute());
  Serial.print(" Set Hour: ");
  Serial.print(sunLocation.GetSetHour());
  Serial.print(" Set Minute: ");
  Serial.print(sunLocation.GetSetMinute());
  Serial.println();
#endif

    ReefAngel.PWM.SetActinic(PWMParabola(sunLocation.GetRiseHour(),sunLocation.GetRiseMinute(),sunLocation.GetSetHour() ,sunLocation.GetSetMinute(),0,50,0));

    ReefAngel.PWM.SetDaylight(PWMParabola(sunLocation.GetRiseHour(),sunLocation.GetRiseMinute(),sunLocation.GetSetHour(),sunLocation.GetSetMinute(),10,60,0));
}

void setMoon()
{
#ifdef debug_lights == 1
  Serial.print("Daylight: ");
  Serial.print(sunLocation.IsDaytime());
  Serial.print(" MoonPhase: ");
  Serial.print(MoonPhase());
  Serial.println();
#endif

  if (sunLocation.IsDaytime())
    ReefAngel.PWM.SetChannel(0, 0);
  else
    ReefAngel.PWM.SetChannel( 0, MoonPhase() );
}


void setVortech()
{
    // Pumps for night mode, start with lagoon, short pulse most of the day
  if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
  {
    if (hour() > 9 || hour() < 17)
      ReefAngel.RF.SetMode(ReefCrest,40,0);
    else
      ReefAngel.RF.SetMode(LongWave, 40, 0);
  }
}


void setMaxspect()
{
  int reverse_speed=0;
  int forward_speed=45;
  
 if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
   forward_speed = NutrientTransportMode(25,50,1500,false);
   reverse_speed = 0;
 } else if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) {
   //
   // shut off maxspect during water changes.
   forward_speed = 0;
   reverse_speed = 0;
 } else {
   //
   // swap between forward and reverse every 10 seconds
#if 0
   reverse_speed = ShortPulseMode(0,100,10000,false); 
   if (reverse_speed == 100)
     //
     // while we are going in reverse increase the speed to 45-60
     forward_speed = ShortPulseMode(30,60,5000,false);
   else
     //
     // while we are going forward set speed to 25-40 to keep
     // from blowing corals off the rocks
     forward_speed = ShortPulseMode(25,40,5000, false);
#endif
    forward_speed = tide.CalcTide();
  }
#if debug_flow == 1
  Serial.print("Forward Speed: ");
  Serial.print(forward_speed);
  Serial.print(" Reverse Speed: ");
  Serial.print(reverse_speed);
  Serial.println();
#endif

  ReefAngel.PWM.SetChannel(2,reverse_speed);  // set the pump direction
  ReefAngel.PWM.SetChannel(1,forward_speed);    // set the pump speed
}

Thanks for your help. I was getting some errors when I added what you told me to. I figured out that I needed to add these, too.

Code: Select all

Tide tide;

Code: Select all

#include <Tide.h>
Happy to help! That's what's great about this community and open source in general... RA ROCKS!

-LeoD
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Icecap Module

Post by lnevo »

I didnt look at your full code yet. But it would be nice to wrap this into a function and have it be used like a standard mode function. Then you could use the anti-sync speed as an output to control the direction.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Icecap Module

Post by lnevo »

Here, this should do nicely. The only thing I learned from here is that we need to add in the libraries either to let each function decide its speeds under different modes like feeding and waterchange OR we add a FeedingAntiSyncSpeed and WaterChangeAntiSyncSpeed variables. For now I took that part out of the function. You could always implement it manually if you like by not using those variables, or maybe we can just manage it in the libraries too, I'd have to look closer how that works.

The libraries do this:

Code: Select all

ReefAngel.cpp:          if (DCPump.FeedingSpeed < 100) 
ReefAngel.cpp:                  SyncSpeed=DCPump.FeedingSpeed;
ReefAngel.cpp:                  AntiSyncSpeed=DCPump.FeedingSpeed;
Anyway, here's the function a little more simplified

Code: Select all

byte setMaxspect(byte minSpeed, byte maxSpeed, boolean PulseSync)
{
  int reverse_speed=0;
  int forward_speed=minSpeed;
  
   // swap between forward and reverse every X seconds 
   reverse_speed = ShortPulseMode(0,100,ReefAngel.DCPump.Duration*2,true); 
   if (reverse_speed == 100) {
     //
     // while we are going in reverse increase the speed by 10 
     forward_speed = ShortPulseMode(minSpeed+10, maxSpeed+10,ReefAngel.DCPump.Duration,true);
   } else {
     //
     // while we are going forward set speed to 25-40 to keep
     // from blowing corals off the rocks
     forward_speed = ShortPulseMode(minSpeed,maxSpeed, ReefAngel.DCPump.Duration, true);
  }

  if (PulseSync) {
    return forward_speed;
  } else {
    return reverse_speed;
  }
}
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

lnevo wrote:Here, this should do nicely. The only thing I learned from here is that we need to add in the libraries either to let each function decide its speeds under different modes like feeding and waterchange OR we add a FeedingAntiSyncSpeed and WaterChangeAntiSyncSpeed variables. For now I took that part out of the function. You could always implement it manually if you like by not using those variables, or maybe we can just manage it in the libraries too, I'd have to look closer how that works.

The libraries do this:

Code: Select all

ReefAngel.cpp:          if (DCPump.FeedingSpeed < 100) 
ReefAngel.cpp:                  SyncSpeed=DCPump.FeedingSpeed;
ReefAngel.cpp:                  AntiSyncSpeed=DCPump.FeedingSpeed;
Anyway, here's the function a little more simplified

I like how you simplified it. This may be a stupid and obvious question, but how do you set the max and min speed for forward and reverse?

Code: Select all

byte setMaxspect(byte minSpeed, byte maxSpeed, boolean PulseSync)
{
  int reverse_speed=0;
  int forward_speed=minSpeed;
  
   // swap between forward and reverse every X seconds 
   reverse_speed = ShortPulseMode(0,100,ReefAngel.DCPump.Duration*2,true); 
   if (reverse_speed == 100) {
     //
     // while we are going in reverse increase the speed by 10 
     forward_speed = ShortPulseMode(minSpeed+10, maxSpeed+10,ReefAngel.DCPump.Duration,true);
   } else {
     //
     // while we are going forward set speed to 25-40 to keep
     // from blowing corals off the rocks
     forward_speed = ShortPulseMode(minSpeed,maxSpeed, ReefAngel.DCPump.Duration, true);
  }

  if (PulseSync) {
    return forward_speed;
  } else {
    return reverse_speed;
  }
}
Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

rimai wrote:
Ismaclst wrote:I have the maxspect gyre and was thinking about purchasing the Icecap module to go with it. Has anyone else bought this? Does it come with the cable you need to connect to the RA? I'm assuming you can use any of the DC pump modes?
You should be able to use the DCPump modes.
The Kessil cable in the webstore should be able to be used with the Icecap module too :)

How long is the Kessil cable? My RA is in the basement so it needs to be a decent length.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Icecap Module

Post by rimai »

Won't reach.
It's about 6ft.
You better off just splicing your own cable. You can build one from scratch or get an stereo audio cable at the local store than is long enough.
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Icecap Module

Post by lnevo »

He way I wrote the function I added 10 to the speed for reverse and forward uses the values you provide.
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

What do all three of these numbers mean?

Code: Select all

    tide.Init(40,10,30);
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Icecap Module

Post by lnevo »

40 speed, 35-45 during 1/4 moons and 25-55 during new and full moon. It might be
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

Sorry for all the questions, but I'm still confused on how you got 35-45 and 25-55? I can't seem to find the correlation between those numbers and the 40, 10 and 30 ones.
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Icecap Module

Post by lnevo »

40 is the speed for the tide. As it goes from high tide to low tide its going to start at a range of 10 so 35-45 between the high tide and low tide speed. As the month progresses the range will increase to 3 which is 25-55.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Icecap Module

Post by lnevo »

Image
Ismaclst
Posts: 248
Joined: Wed Jan 28, 2015 5:17 pm

Re: Icecap Module

Post by Ismaclst »

Ok, I understand now. I don't have the icecap module yet but I wanted to upload the code so it was ready when I did get it. I noticed that both the daylight and actnitic values didn't change when I uploaded the new code. Should they? I did notice that where it says dc pump in the portal, that it shows that the mode is constant, speed is 50% and duration is 50.
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Icecap Module

Post by lnevo »

Can you post your new code?
Post Reply