Outlet cycling

Share you PDE file with our community
Post Reply
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Outlet cycling

Post by grafspee1217 »

Hi Roberto,
I was acclimating some corals today and noticed that one of the outlets on the #1 box cycles off every ten minutes or so. It stays off for a few minutes then turns back on. It's outlet #7 on box-1. Can you take a look at the file and see if you notice what is causing it?
#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 <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 | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port7Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // The T3 probe is tank temperature and overheat functions
    ReefAngel.TempProbe = T3_PROBE;
    ReefAngel.OverheatProbe = T3_PROBE;
    // Overheat temperature setting
    InternalMemory.OverheatTemp_write( 840 );


    // Ports that are always on Pump-8 Wavemakers-5&6
      ReefAngel.Relay.On( Port8 );
      ReefAngel.Relay.On( Port5 );
      ReefAngel.Relay.On( Port6 );

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

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

void loop()
{
    ReefAngel.StandardHeater( Port1,751,761 );
    ReefAngel.StandardATO( Port2,390 );
    ReefAngel.StandardLights( Port3,21,0,9,0 );
    //ReefAngel.Wavemaker( Port5,60 );
    //ReefAngel.Wavemaker( Port6,60 );
    ReefAngel.Relay.DelayedOn( Port7,3 );
    //Actinic Lights
    ReefAngel.StandardLights( Box1_Port1,11,0,22,0 );
    //Moon Light Driver
    ReefAngel.StandardLights( Box1_Port2,22,0,8,0 );
    //Morning Lights
    ReefAngel.StandardLights( Box1_Port3,11,30,21,30 );
    //High Noon Lights
    ReefAngel.StandardLights( Box1_Port4,12,0,21,0 );
    // This next line will run cooling fans for the tank
    ReefAngel.StandardFan( Box1_Port5,790,805 );
    //Moon Light 9V
    ReefAngel.StandardLights( Box1_Port8,21,59,8,1 );
    ReefAngel.PWM.SetDaylight( PWMSlope(12,0,21,0,10,100,240,10) );
    ReefAngel.PWM.SetActinic( PWMSlope(11,0,22,0,10,100,60,10) );
    ////// Place your custom code below here
          if (ReefAngel.Params.Temp[T1_PROBE]>0)
      {
        if (ReefAngel.Params.Temp[T1_PROBE] >= 860) ReefAngel.Relay.On(Box1_Port7);
        if (ReefAngel.Params.Temp[T1_PROBE] <= 820) ReefAngel.Relay.Off(Box1_Port7);
      }

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

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

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
    pingSerial();

    // Relay Expansion
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 12, 106, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
    ReefAngel.LCD.DrawGraph( 5, 5 );
}
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

You have that port set to heater.
Roberto.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

ok, got my boxes mixed up. Box_1 is the second box I added. The main box port 7 which is delayed on for my protein skimmer.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

BTW I don't see where I have box_1 port 7 set up as a heater. My heater is on port 1.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

It's in your custom code:

Code: Select all

       if (ReefAngel.Params.Temp[T1_PROBE]>0)
      {
        if (ReefAngel.Params.Temp[T1_PROBE] >= 860) ReefAngel.Relay.On(Box1_Port7);
        if (ReefAngel.Params.Temp[T1_PROBE] <= 820) ReefAngel.Relay.Off(Box1_Port7);
      }
Roberto.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

That's for my cooling fan on the lights.
My concern is port 7 for my protein skimmer. I've been wondering why my protein skimmer has been pulling anything out lately.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

sorry, I meant to say hasnt been pulling out any skimate
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

Got confused here.
Are you talking about port7 or box1_port7 that is presenting that behavior?
Roberto.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

I'm talking about port 7. I have it set for a delayed on. I notice that the port just shuts off and then waits for the delay before it restarts. Question is why is it shutting down?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

It does that on feeding or water change mode too
Roberto.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

Yes but it was not in either mode when it happened. It happened quite a few times while I was acclimating some corals
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

Does this happen all the time?
Roberto.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

I know but it was not in either feeding or water change mode. The only port that cycled off was port 7.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

I've been watching it now and it happens all the time.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

If you look in the screen, does it show port7 off?
Roberto.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

I would have to watch it and see. If the screen shows it's off then it's in the code?
SuperDodge
Posts: 52
Joined: Sun Feb 12, 2012 11:16 am

Re: Outlet cycling

Post by SuperDodge »

Roberto,

I'm experiencing this behavior on my Box1_Port5 which is also my skimmer. I have it set to DelayedOn but it turns on and off all day long. I am not entering water change mode or feed mode. See Code Below:

Code: Select all

// This file is designed for v1.0.2

/* The following features are enabled for this File: 
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define RelayExp
#define InstalledRelayExpansionModules 1
#define WDT
#define SIMPLE_MENU
#define CUSTOM_MAIN
#define SALINITYEXPANSION
#define RFEXPANSION
#define ORPEXPANSION
#define IOEXPANSION
#define FONT_8X8
#define NUMBERS_12x16

The Relay Devices Are:
Salt Mix Pump          1
Return Pump            2
Media Reactor          3
Tank Light             4
UV Sterilizer          5
Not In Use             6
Refugium Light         7
LiterMeter             8

The Expansion Relay Devices Are:
Right VorTech          1
Left Vortech           2
Right Heater           3
Left Heater            4
Protein Skimmer        5
Not In Use             6
Alkalinity Doser       7
Calcium Doser          8

The Vortech Pump Modes Are:
Constant               0
Lagoon                 1
Reef Crest             2
Short Pulse            3
Longe Pulse            4
Nutrient Transport     5
Tidal Swell            6
Feeding Start          7
Feeding Stop           8
Night                  9
Storm                  10
*/

//*******************************************************************************************************************
// Define Libraries Used Here:
#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>
// End Define Libraries
//*******************************************************************************************************************

//*******************************************************************************************************************
// Define Global Variables Here:
byte TempRelay1; // Variable for Right Relay Box Statuses
byte TempRelay2; // Variable for Left Relay Box Statuses
byte MoonLight; // Variable that represents Blue LED % for Moonlight

// Variables for Custom Main Screen Layout
byte x;
byte y1;
byte y2;
byte y3;
byte y4;
byte y5;
byte y6;
// End Variable Declarations
//*******************************************************************************************************************

//*******************************************************************************************************************
// Draw Custom Main Screen:
void DrawCustomMain()
{
  char phtext[10];
  ConvertNumToString(phtext, ReefAngel.Params.PH, 100);
  strcat(phtext,"  ");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,5,"pH:");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,75,5,phtext);
  char saltext[10];
  ConvertNumToString(saltext, ReefAngel.Params.Salinity, 10);
  strcat(saltext,"  ");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,15,"Salinity:");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,75,15,saltext);
  char orptext[10];
  ConvertNumToString(orptext, ReefAngel.Params.ORP, 1);
  strcat(orptext,"  ");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,25,"ORP:");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,75,25,orptext);
  //ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,93,"RF Mode:");
  //ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,75,93,ReefAngel.RF.Mode);
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T1_PROBE], COLOR_BLACK, 80, 90, 10); // Display Tank Filter Area Temp
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], COLOR_BLACK, 80, 100, 10); //Display Tank Temp
  ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], COLOR_BLACK, 80, 110, 10); //Display Room Temp
  
  pingSerial();
  
  TempRelay1 = ReefAngel.Relay.RelayData;
  TempRelay1 &= ReefAngel.Relay.RelayMaskOff;
  TempRelay1 |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawCircleOutletBox(30, 93, TempRelay1, true);
  
  TempRelay2 = ReefAngel.Relay.RelayDataE[0];
  TempRelay2 &= ReefAngel.Relay.RelayMaskOffE[0];
  TempRelay2 |= ReefAngel.Relay.RelayMaskOnE[0];
  ReefAngel.LCD.DrawCircleOutletBox(7, 93, TempRelay2, true);
}

void DrawCustomGraph()
{
  // Write Text on Home Screen Temp
  ReefAngel.LCD.DrawText(0,255,48,90,"Tank:");
  ReefAngel.LCD.DrawText(0,255,111,90,"F");
  ReefAngel.LCD.DrawText(0,255,48,100,"Sump:");
  ReefAngel.LCD.DrawText(0,255,111,100,"F");
  ReefAngel.LCD.DrawText(0,255,48,110,"Room:");
  ReefAngel.LCD.DrawText(0,255,115,110,"F");
  ReefAngel.LCD.DrawText(0,255,48,120,"pH:");
  ReefAngel.LCD.DrawText(0,255,77,120,"ORP:");
}
// End Custom Main Screen
//*******************************************************************************************************************


//*******************************************************************************************************************
// One Time Startup Functions:
void setup()
{
    InternalMemory.ORPMin_write(2050);
    InternalMemory.ORPMax_write(450);
    // This must be the first line
    ReefAngel.Init();  //Initialize controller

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port3Bit | Port5Bit;
    ReefAngel.FeedingModePortsE[0] = Port5Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;

    // Define Ports That Are Always On
    ReefAngel.Relay.On(Box1_Port1); // Right VorTech Always On
    ReefAngel.Relay.On(Box1_Port2); // Left VorTech Always On
    ReefAngel.Relay.On(Port1); // Salt Mix Pump Always On
    ReefAngel.Relay.On(Port2); // Return Pump Always On
    ReefAngel.Relay.On(Port4); // Tank Light Always On
    ReefAngel.Relay.On(Port5); // UV Sterilizer Always On
    ReefAngel.Relay.On(Port7); // Refugium Light Always On
    ReefAngel.Relay.On(Port8); // LiterMeter Always On
}
// End Startup Functions
//*******************************************************************************************************************

//*******************************************************************************************************************
// Main Program:
void loop()
{
    // Specific functions that use Internal Memory values
    ReefAngel.StandardHeater(Box1_Port3,778,782); // Control Heater Between 77.8F and 78.2F
    ReefAngel.StandardHeater(Box1_Port4,778,782); // Control Heater Between 77.8F and 78.2F
    ReefAngel.Relay.DelayedOn(Port3,3); // Turn Media Reactor on 3 Minutes After Startup
    ReefAngel.Relay.DelayedOn(Box1_Port5,5); // Turn Skimmer on 5 Minutes After Startup
    ReefAngel.DosingPumpRepeat(Box1_Port7,0,60,30); //Run Alk Pump 30 Seconds, Every 60 Minutes
    ReefAngel.DosingPumpRepeat(Box1_Port8,30,60,30); //Run Calc Pump 30 Seconds, Every 60 Minutes, 30 Min Phase Shift
    
    ////// Place your custom code below here
 
    // Control Radion Lights
    ReefAngel.RF.RadionChannels[Radion_Intensity]=100;
    ReefAngel.RF.RadionChannels[Radion_White]=PWMParabola(8,30,22,0,0,100,0);
    ReefAngel.RF.RadionChannels[Radion_RoyalBlue]=PWMParabola(8,0,22,30,4,100,4);
    ReefAngel.RF.RadionChannels[Radion_Red]=PWMParabola(9,0,21,30,0,5,0);
    ReefAngel.RF.RadionChannels[Radion_Green]=PWMParabola(9,0,21,30,0,15,0);
    ReefAngel.RF.RadionChannels[Radion_Blue]=PWMParabola(8,15,22,15,0,80,0);
    if (second()==0) ReefAngel.RF.RadionWrite();

    // This sends all the data to the portal
    // Do not add any custom code that changes any relay status after this line
    // The only code after this line should be the ShowInterface function
    ReefAngel.Portal("SuperDodge", "xxxxx");

    // This should always be the last line
    ReefAngel.ShowInterface();
}
// End Main Program Loop
//*******************************************************************************************************************
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

Does Port3 also do the same thing?
Roberto.
SuperDodge
Posts: 52
Joined: Sun Feb 12, 2012 11:16 am

Re: Outlet cycling

Post by SuperDodge »

I don't believe it does that Roberto, but to be honest I wouldn't swear to it because there is no noise associated with my media reactor so it wouldn't be as obvious.

I'll check it out tonight and see if it's cycling or not.
Image
SuperDodge
Posts: 52
Joined: Sun Feb 12, 2012 11:16 am

Re: Outlet cycling

Post by SuperDodge »

OK. I was out of town for a couple of days. I watched the controller closely and what's happening is the RA+ is restarting sporadically.

Any ideas?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

Yes, that's what I thought.
If the controller reboots, it would cause the delayedon ports to stay off for that period of time.
Something is causing the controller to reboot. It is usually interference in the system or loose cable.
Roberto.
TanksNStuff
Posts: 188
Joined: Fri Dec 30, 2011 6:57 am

Re: Outlet cycling

Post by TanksNStuff »

Not sure if this is your issue, but I was having a similar problem before and it turned out to be the USB connection to my RF Module (the connector right at the module, not the expansion hub). It wasn't in all the way, and must have been causing an error because it kept timing out my controller (red status light on).

I thought it was maybe the VGA cable or temp probe wires because every time I closed my cabinet door, it would beep and blink. Turns out the temp probe wires were actually tugging on the RF module's cable and jostling it just a tiny bit.

Anyway, I'd check to make sure all of your USB connections are secure to rule out that as a problem.
SuperDodge
Posts: 52
Joined: Sun Feb 12, 2012 11:16 am

Re: Outlet cycling

Post by SuperDodge »

I haven't figured out what's causing the RA+ to restart yet, I'm methodically removing one cable at a time.

My question is, am I overdosing Cal/Alk during all this? I have them set on DosingPumpRepeat. Does the timer on that restart every time the RA reboots or does it work based off the clock which doesn't care about the reboots?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

Code: Select all

void ReefAngelClass::DosingPumpRepeat(byte DPRelay, int OffsetMinute, int RepeatMinute, int RunTime)
{
  signed long t=(elapsedSecsToday(now())-((long)OffsetMinute*60));
  Relay.Set(DPRelay,(t%((long)RepeatMinute*60))<RunTime && t>=0);
}
It is based on number of seconds from midnight, so no matter if it reboots or not, it will always use the clock.
Roberto.
SuperDodge
Posts: 52
Joined: Sun Feb 12, 2012 11:16 am

Re: Outlet cycling

Post by SuperDodge »

rimai wrote:

Code: Select all

void ReefAngelClass::DosingPumpRepeat(byte DPRelay, int OffsetMinute, int RepeatMinute, int RunTime)
{
  signed long t=(elapsedSecsToday(now())-((long)OffsetMinute*60));
  Relay.Set(DPRelay,(t%((long)RepeatMinute*60))<RunTime && t>=0);
}
It is based on number of seconds from midnight, so no matter if it reboots or not, it will always use the clock.
Thanks, that makes it easier not to worry while I'm trying to sort out what the problem is.
Image
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

I never did figure out why some of my outlets would occasionally cycle off then back on. It was most noticeable at night when the moonlights were on, kinda hard to miss the lights coming on full bright for a second then off again. I noticed it happened with the skimmer when I was acclimating some corals as well. Since I never got a good answer as to what was causing it I resigned myself to having to live with it. A week ago I noticed the blue light on the wifi blinking. I didnt have time to hook up my laptop and reconfigure the wifi at the time. The next day was my normally scheduled water change day. I set the RA for water change mode and everything shut down as it was supposed to... for about 4 seconds. Then everything started back up again. I tried it again with the same result. No matter what I did it would not stay in water change mode. I tried unplugging the RA with the same result. I noticed that when it happened the screen would blank out for a second then the status light would come on then everything would start up. It seemed as if the RA would simply reboot. Since the wifi was blinking blue I unplugged it from the RA. The problem stopped. I've noticed that since the wifi has not been plugged in (over a week now) I have not had the cycling outlets anymore. any ideas?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

That's a good finding.
I don't know what would cause that though.
Would you be able to post the "get e" dump from the wifi module?
Roberto.
grafspee1217
Posts: 84
Joined: Sun Mar 11, 2012 10:38 am

Re: Outlet cycling

Post by grafspee1217 »

sure, how do I do that? Does it matter that the wifi module has been off?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Outlet cycling

Post by rimai »

Look at the manual for instructions on how to use Tera Term.
Roberto.
treetopflyn
Posts: 89
Joined: Fri Oct 05, 2012 1:58 am

Outlet cycling

Post by treetopflyn »

Hmmm I am having the same issue with cycling on and off. Ill try some of things mentioned and see if anything helps.
Post Reply