Icecap battery backup feeding mode code

Do you have a question on how to do something.
Ask in here.

Posts: 164
Joined: Mon Apr 29, 2013 6:50 am
PostPosted: Mon Mar 13, 2017 5:00 pm
I just picked up an icecap bsttery backup for a jebao pump and when i enter feeding or water change mode this signals the battery to kick on.

Is the fix just as simple as changing the code to speed 0 instead of turning the relay off? Does the PH need to be connected to the controller via the jebao cable for this to work? I have the cable but im currently running it via the jebao control unit.

Thx
Image

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Mon Mar 13, 2017 5:06 pm
Could you post your code?

Posts: 164
Joined: Mon Apr 29, 2013 6:50 am
PostPosted: Tue Mar 14, 2017 5:48 am
It is just the standard Relay off type code for feeding mode and waterr change mode.
Image

Posts: 164
Joined: Mon Apr 29, 2013 6:50 am
PostPosted: Tue Mar 14, 2017 12:01 pm
#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 <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
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port6Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );


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

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


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

void loop()
{
ReefAngel.DosingPumpRepeat( Port3,0,120,224 ); // dose ALK 224 seconds 12x/day
ReefAngel.DosingPumpRepeat( Port4,60,120,300 ); // dose CAL 300 seconds 12x/day
ReefAngel.StandardHeater( Port6,770,773 );
ReefAngel.StandardATO( Port7,900 );
////// Place your custom code below here

//Start Feeding Mode at 20:30 - NONE
if ( (now()%86400==73800) ) {
ReefAngel.FeedingModeStart();
}

//Track ALK, CAL, and ATO dosing pumps
const byte numPumps=3;
byte pump[numPumps] = { Port3, Port4, Port7 };
byte portalMinutes[numPumps] = { 0, 2, 4 };
byte portalSeconds[numPumps] = { 1, 3, 5 };

static time_t pumpTimer[numPumps];
static boolean pumpStatus[numPumps];
static boolean atoDisabled;

for (int i=0;i< numPumps;i++) {
if (ReefAngel.Relay.Status(pump[i])) {
if (!pumpStatus[i]) {
pumpTimer[i]=now()-pumpTimer[i]; // Pump was off, timer is now a time
pumpStatus[i]=true;
}
} else {
if (pumpStatus[i]) {
pumpTimer[i]=now()-pumpTimer[i]; // Pump was on, timer is now a timer
pumpStatus[i]=false;

// Normalize and assign to CustomVar for reporting on the portal
ReefAngel.CustomVar[portalMinutes[i]]=pumpTimer[i]/60; // Number of Minutes
// ReefAngel.CustomVar[portalSeconds[i]]=pumpTimer[i]%60; // Number of Seconds
}
}
}

static boolean clearTimer;
if (now()%SECS_PER_DAY!=SECS_PER_DAY-1) clearTimer=true;
if ( (now()%SECS_PER_DAY==SECS_PER_DAY-1) && clearTimer==true) {
// Backup timers to portal variable
ReefAngel.CustomVar[portalSeconds[0]] = pumpTimer[0]/60;
ReefAngel.CustomVar[portalSeconds[1]] = pumpTimer[1]/60;
ReefAngel.CustomVar[portalSeconds[2]] = pumpTimer[2]/60;
pumpTimer[0]=0; // Clear timer for Port3
pumpTimer[1]=0; // Clear timer for Port4
clearTimer=false;
}
if (bitRead(ReefAngel.Relay.RelayMaskOn, 6)==1) { // ATO relay was forced on
atoDisabled=true; // don't want to change the variable names yet.. but you may want to to make it clearer..
}
if (atoDisabled && (bitRead(ReefAngel.Relay.RelayMaskOn, 6)==0)) { // ATO override has been cleared
pumpTimer[2]=0; // Clear timer for ATOPort
atoDisabled=false;
}
ReefAngel.Relay.Set(Port5,now()%19800!=0);

if (hour()>=7 && hour()<8)
{
ReefAngel.PWM.SetDaylight( LongPulseMode(40,55,10,true) ); // Long pulse hi/low 60%40% 10s pulse on sync mode
ReefAngel.PWM.SetActinic( LongPulseMode(40,55,10,false) ); // Long pulse hi/low 60%40% 10s pulse on anti-sync mode
}
else if (hour()>=8 && hour()<11)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(0,75,700,true) ); // NTM low/high 30%90% on sync mode
ReefAngel.PWM.SetActinic( NutrientTransportMode(0,75,700,false) ); // NTM low/high 30%90% on anti-sync mode
}
else if (hour()>=11 && hour()<14)
{
ReefAngel.PWM.SetDaylight( ShortPulseMode(0,50,230,true) ); // Short pulse at 60% with 200ms pulse on sync mode
ReefAngel.PWM.SetActinic( ShortPulseMode(0,50,230,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
}
else if (hour()>=14 && hour()<16)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(60,25,true) ); // ReefCrest on 50% with +/-10% on sync mode
ReefAngel.PWM.SetActinic( ReefCrestMode(60,25,false) ); // ReefCrest on 50% with +/-10% on sync mode
}
else if (hour()>=16 && hour()<18)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(0,65,700,true) ); // NTM low/high 30%90% on sync mode
ReefAngel.PWM.SetActinic( NutrientTransportMode(0,65,700,false) ); // NTM low/high 30%90% on anti-sync mode
}
else if (hour()>=18 && hour()<20)
{
ReefAngel.PWM.SetDaylight( TidalSwellMode(70,true) ); // TidalSwell at 70% on sync mode
ReefAngel.PWM.SetActinic( TidalSwellMode(70,false) ); // TidalSwell at 70% on anti-sync mode
}
else if (hour()>=20 && hour()<23)
{
ReefAngel.PWM.SetDaylight( ShortPulseMode(0,65,900,true) ); // Short pulse at 60% with 200ms pulse on sync mode
ReefAngel.PWM.SetActinic( ShortPulseMode(0,65,900,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
}
else
{
ReefAngel.PWM.SetDaylight( ShortPulseMode(0,50,230,true) ); // Short pulse at 60% with 200ms pulse on sync mode
ReefAngel.PWM.SetActinic( ShortPulseMode(0,50,230,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
}

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

// This should always be the last line
ReefAngel.Portal( "kirkwood" );
ReefAngel.ShowInterface();
}
Image

Posts: 164
Joined: Mon Apr 29, 2013 6:50 am
PostPosted: Tue Mar 14, 2017 12:24 pm
I tried tweaking my code from other users posts but still need help. I went ahead and removed the Jebao port (Port 5) from turning off on water change or feeding mode. Now I just need an "if" statement that puts the Port 5 speed at 0 whenever feeding mode or water change mode are activated.

Thanks.

my attempt and fail..

// This must be the first line
ReefAngel.Init(); //Initialize controller
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port6Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 825 );

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

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Tue Mar 14, 2017 3:23 pm
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;

Posts: 164
Joined: Mon Apr 29, 2013 6:50 am
PostPosted: Tue Mar 14, 2017 5:05 pm
GugsJr wrote:// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;


Doesn't work. There is nothing specified as "DCPump" anywhere in my code.
Image

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Tue Mar 14, 2017 6:42 pm
how do you have your Jebaos hooked up? On the original switch?

Posts: 164
Joined: Mon Apr 29, 2013 6:50 am
PostPosted: Tue Mar 14, 2017 7:40 pm
GugsJr wrote:how do you have your Jebaos hooked up? On the original switch?


I dont know how to answer that question. I dont write code and honestly havent touched my RA code in almost 2 years. My full code is posted above.
Image

Posts: 164
Joined: Mon Apr 29, 2013 6:50 am
PostPosted: Tue Mar 14, 2017 7:43 pm
Anyone else know the code to make port 5 run at speed 0 when i activate feeding or waterchange mode? I need to make this change because i just added an icecap batterybackup and currently when port 5 turns off in feeding mode it triggers the icecap to turn on thinking there has been a poeer outage.
Image
Next

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 7 guests