Icecap Module
Re: Icecap Module
Great, thanks. Could you post your whole code?
-
- Posts: 43
- Joined: Sat Nov 21, 2015 10:34 am
- Location: Dallas
Re: Icecap Module
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
}
Re: Icecap Module
Will this cable allow forward and reverse?rimai wrote:You should be able to use the DCPump modes.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?
The Kessil cable in the webstore should be able to be used with the Icecap module too
Re: Icecap Module
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.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 }
Code: Select all
Tide tide;
Code: Select all
#include <Tide.h>
Re: Icecap Module
YesIsmaclst wrote:Will this cable allow forward and reverse?rimai wrote:You should be able to use the DCPump modes.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?
The Kessil cable in the webstore should be able to be used with the Icecap module too
Roberto.
-
- Posts: 43
- Joined: Sat Nov 21, 2015 10:34 am
- Location: Dallas
Re: Icecap Module
Happy to help! That's what's great about this community and open source in general... RA ROCKS!Ismaclst wrote: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.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 }
Code: Select all
Tide tide;
Code: Select all
#include <Tide.h>
-LeoD
Re: Icecap Module
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.
Re: Icecap Module
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:
Anyway, here's the function a little more simplified
The libraries do this:
Code: Select all
ReefAngel.cpp: if (DCPump.FeedingSpeed < 100)
ReefAngel.cpp: SyncSpeed=DCPump.FeedingSpeed;
ReefAngel.cpp: AntiSyncSpeed=DCPump.FeedingSpeed;
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;
}
}
Re: Icecap Module
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:Anyway, here's the function a little more simplifiedCode: Select all
ReefAngel.cpp: if (DCPump.FeedingSpeed < 100) ReefAngel.cpp: SyncSpeed=DCPump.FeedingSpeed; ReefAngel.cpp: AntiSyncSpeed=DCPump.FeedingSpeed;
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; } }
Re: Icecap Module
rimai wrote:You should be able to use the DCPump modes.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?
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.
Re: Icecap Module
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.
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.
Re: Icecap Module
He way I wrote the function I added 10 to the speed for reverse and forward uses the values you provide.
Re: Icecap Module
What do all three of these numbers mean?
Code: Select all
tide.Init(40,10,30);
Re: Icecap Module
40 speed, 35-45 during 1/4 moons and 25-55 during new and full moon. It might be
Re: Icecap Module
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.
Re: Icecap Module
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.
Re: Icecap Module
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.
Re: Icecap Module
Here is my latest code:
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>
////// Place global variable code below here
////// Place global variable code above here
Tide tide;
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
ReefAngel.DDNS("Damien");
ReefAngel.AddMultiChannelWaterLevelExpansion(); // Multi-Channel Water Level Expanion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port5Bit;
// 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;
ReefAngel.Relay.Set(Port8, now()%6*SECS_PER_HOUR<30*SECS_PER_MIN);
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 800 );
InternalMemory.WaterLevelMax_write(1800);
// Feeeding and Water Change mode speed
// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port6 );
tide.Init(55,10,30);
tide.SetWaveLength(12+SECS_PER_HOUR);
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Port3,780,785 );
ReefAngel.WaterLevelATO(4,Port4,240,28,31);
////// Place your custom code below here
if (ReefAngel.WaterLevel.GetLevel(1)<5) //Disable the port until overriden manually
ReefAngel.Relay.Override(Port8,0); //Saltwater Reservoir
if (ReefAngel.WaterLevel.GetLevel(1)>80) // Set port back to auto
ReefAngel.Relay.Override(Port8,2);
if (ReefAngel.WaterLevel.GetLevel(2)>80) //Overflow
ReefAngel.Relay.Off(Port1);
else
ReefAngel.Relay.On(Port1);
if (ReefAngel.WaterLevel.GetLevel(3)>87) //ATO Reservoir
ReefAngel.Relay.Off(Port5);
if (ReefAngel.WaterLevel.GetLevel(3)<1)
ReefAngel.Relay.On(Port5);
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Ismaclst" );
ReefAngel.ShowInterface();
}
byte setMaxspect(byte minSpeed, byte maxSpeed, boolean PulseSync)
{
int reverse_speed=0;
int forward_speed=45;
// 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(35+10, 60+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(35,70, ReefAngel.DCPump.Duration, true);
}
if (PulseSync) {
return forward_speed;
} else {
return reverse_speed;
}
}
Re: Icecap Module
You added the function but you have to call it. Same with the tide you set. We have to tie them together now.
You need to add the following now to set your dimming channels.
I need to be on the computer to give you the right code. I also made some mistakes that I need to fix in the setMaspect function.
You need to add the following now to set your dimming channels.
I need to be on the computer to give you the right code. I also made some mistakes that I need to fix in the setMaspect function.
Re: Icecap Module
I bought a stereo audio cable for forward and reverse. How many wires should be in it? I cut the end off and there are three, a red, blue and white.
Re: Icecap Module
One should be ground and the other two would be for your two signals. If you are wiring to the dimming leads you'll share the ground.
Re: Icecap Module
Did you ever get a chance to look into this more?lnevo wrote:You added the function but you have to call it. Same with the tide you set. We have to tie them together now.
You need to add the following now to set your dimming channels.
I need to be on the computer to give you the right code. I also made some mistakes that I need to fix in the setMaspect function.
Re: Icecap Module
No, i got swamped this weeken. I'll probably have a chance friday if you can hang in...
Re: Icecap Module
Ok, this should do it. I've set the min speed to 1/2 the Tidal speed and used the Tidal speed as the max speed. As discussed the tidal speed will vary +/- depending on the range you gave which means 55 (+/-5 during quarter moons and half moon, versus +/-15 during newmoon and full moon) It will also vary throughout the day based on the wavelength you have set.. which is currently 72 minutes... tide.SetWaveLength(12+SECS_PER_HOUR); The default is 12 hours which would be 12*SECS_PER_HOUR. Anyway below is the code that will set the Actinic/Daylight to the value of the the setMaxspect function using the tide class as an input. I also included the change I made in your RO/Valve post
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>
////// Place global variable code below here
////// Place global variable code above here
Tide tide;
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
ReefAngel.DDNS("Damien");
ReefAngel.AddMultiChannelWaterLevelExpansion(); // Multi-Channel Water Level Expanion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port5Bit;
// 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;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 800 );
InternalMemory.WaterLevelMax_write(1800);
// Feeeding and Water Change mode speed
// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port6 );
tide.Init(55,10,30);
tide.SetWaveLength(12+SECS_PER_HOUR);
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Port3,780,785 );
ReefAngel.WaterLevelATO(4,Port4,240,28,31);
ReefAngel.Relay.Set(Port8, (now()%(6*SECS_PER_HOUR))<(30*SECS_PER_MIN));
////// Place your custom code below here
if (ReefAngel.WaterLevel.GetLevel(1)<5) //Disable the port until overriden manually
ReefAngel.Relay.Override(Port8,0); //Saltwater Reservoir
if (ReefAngel.WaterLevel.GetLevel(1)>80) // Set port back to auto
ReefAngel.Relay.Override(Port8,2);
if (ReefAngel.WaterLevel.GetLevel(2)>80) //Overflow
ReefAngel.Relay.Off(Port1);
else
ReefAngel.Relay.On(Port1);
ReefAngel.Relay.Off(Port5); // Set Default to off
if (ReefAngel.WaterLevel.GetLevel(3)>87) //ATO Reservoir
ReefAngel.Relay.Off(Port5);
if (ReefAngel.WaterLevel.GetLevel(3)<1)
ReefAngel.Relay.On(Port5);
////// Place your custom code above here
ReefAngel.PWM.SetDaylight(setMaxspect(tide.GetSpeed(),tide.GetSpeed()/2,true)); // Set the Speed
ReefAngel.PWM.SetActinic(setMaxspect(tide.GetSpeed(),tide.GetSpeed()/2,false)); // Set the direction - speeds here are irrelevant actually.
// This should always be the last line
ReefAngel.Portal( "Ismaclst" );
ReefAngel.ShowInterface();
}
byte setMaxspect(byte minSpeed, byte maxSpeed, boolean PulseSync)
{
int reverse_speed=0;
int forward_speed=45;
// 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;
}
}
Re: Icecap Module
Thanks for taking the time and correcting my code. I appreciate it.
Re: Icecap Module
I know this is an old thread. But I wanted to check before moving forward. Icecap just came out with their gyre pump as a license off maxspect. If i get their gyre pump and the ice cap module will this work with the DC pump codes? i current have two jeabo but would like to swap out to two opposing gyres. I have the jebaos set up to randomly select the wave pattern for the day. would this still be relevant for the gyre control? along with feed mode?