Help - RA has started to randomly turn off skimmer!

Basic / Standard Reef Angel hardware
Post Reply
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

As above, my skimmer is on port 3, and the only code I have affecting the skimmer is a float switch in the skimmer lid to turn of the skimmer if fills - have checked the switch and is all working fine?

I am at a loss as to what is happening. Luckily, it has happened 2 times whilst I have been nearby and managed to catch it.

If I use the portal or iphone app, I am able to turn the skimmer back on.

Any advise please, as its a bit concerning if Im out and my skimmer turns off.

I look forward to your advise!!
#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
unsigned long lastLowSal=now();//salinity >35.1 timer
boolean SALduration=true;//salinity >35.1 for 2 minutes flag
boolean ATOEnabled=false;//enable ATO function for 5 seconds
boolean ATOPumping=true;//disable ATO function for 5 minutes
unsigned long ATOStart=now();//ATO 5 sec run timer
double Salinitytest;
////// Place global variable code above here


void setup()
{
    // This must be the first line
    ReefAngel.Init(); //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
    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 = Port6Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 260 );
    InternalMemory.SalTempComp_write( 255); // Change this to compensation temperature


    // Ports that are always on
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port8 );
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );
    ReefAngel.Relay.On( Box1_Port4 );
    ReefAngel.Relay.On( Box1_Port6 );
    ReefAngel.Relay.On( Box1_Port7 );
    ReefAngel.Relay.On( Box1_Port8 );
    
    ////// Place additional initialization code below here
    
    ReefAngel.Timer[1].SetInterval(1800); // 30 mins before reactivation of ATO
    
    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.Relay.DelayedOn( Port3,5 );//skimmer delay on switching on
    ReefAngel.StandardHeater( Port6,252,255 );
    ReefAngel.StandardFan( Port7,255,258 );
    ////// Place your custom code below here
    ReefAngel.WaterLevelATO(Port2,180,35,40);// Salinty top up to keep water level correct
    
    // Apply Salinity temp Compensation & salinity calibration
    double SalCompensation;
    if (ReefAngel.TempSensor.unit)
    SalCompensation=ReefAngel.Params.Salinity/(1+((ReefAngel.Params.Temp[T3_PROBE]-InternalMemory.SalTempComp_read())*0.0022));
    else
    SalCompensation=ReefAngel.Params.Salinity/(1+((ReefAngel.Params.Temp[T3_PROBE]-InternalMemory.SalTempComp_read())*0.001165));
    SalCompensation=round(SalCompensation);
    
   // For displaying salinity without temp compensation
   Salinitytest=SalCompensation;
   
    ///// If salinity >35.1 for 120 sec set SALduration flag
    if (SalCompensation<351) lastLowSal=now();
    
    if (now()-lastLowSal>120) SALduration=false;
  
    if (SALduration && ATOPumping)//if salinity>35.1 for 2 minutes enable ATO
  
    {ATOStart=now();
  }
  else
  {
    ATOEnabled=true;
    ATOPumping=false;
  }

  if (now()-ATOStart<5)//ATO pump on time 5 seconds
  {
    if (ATOEnabled) ReefAngel.Relay.On(Port1);
    ReefAngel.Timer[1].Start();//start 5 minute disable of ATO
  }
  else
  {
    ReefAngel.Relay.Off(Port1);
    ATOEnabled=false;
  }
  if (ReefAngel.Timer[1].IsTriggered())//after 30 minute disable, enable ATO
  {
    ATOPumping=true;
    ATOStart=now();
    SALduration=true;
  }


    ///// if skimmer cup full, turn off skimmer
    if (ReefAngel.HighATO.IsActive()) {
    bitClear(ReefAngel.Relay.RelayMaskOff,2);
    }
    else {
    bitSet(ReefAngel.Relay.RelayMaskOff,2);
    }
    
    ////// Place your custom code above here

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

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

    // Salinity
    ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,15,46, "SAL:" );
    ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,39,46, ReefAngel.Params.Salinity );
    pingSerial();
    
    //map of adc temp comp salinity
    ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,15,63, "SAT:" );
    ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,39,63, (int)Salinitytest );

    // ORP
    ReefAngel.LCD.DrawText( COLOR_PALEVIOLETRED,DefaultBGColor,75,46, "ORP:" );
    ReefAngel.LCD.DrawText( COLOR_PALEVIOLETRED,DefaultBGColor,99,46, ReefAngel.Params.ORP );
    pingSerial();

    // Water Level
    ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,75,63, "WL:" );
    ReefAngel.LCD.DrawText( COLOR_BLACK,DefaultBGColor,99,63, ReefAngel.WaterLevel.GetLevel() );
    pingSerial();

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

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

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

void DrawCustomGraph()
{
}

rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help - RA has started to randomly turn off skimmer!

Post by rimai »

Is the high ATO showing active or not active in the portal/android app when this happened?
I have the same float idea on my skimmer and I use similar thing, but mine doesn't clear the override by itself.
I never had problems with it, though.
I need to go and manually clear it after I dump the yuk out in the drain :)
Roberto.
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

Hi Roberto,

Panic over - think it was a salt bridge on the float switch connector - gave it a real good clean up and all seems OK now!!

cheers..
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

Hi Roberto - hoping you can help!!

Thought this was resolved, but definitely not.

My skimmer is being turned off what seems randomly throughout the day.

I have managed to observe the head unit and what seems to be happening, is it is resetting itself - the status light flashes red and then "reboots". As I have the skimmer disabled for several minutes after power loss or reset, this is why the skimmer is stopping.

I am at a loss to explain why this is happening. I have been running the same code for quite a while, and the only change I have made is to my salinity TO to keep salinity at 33ppt rather than my previous 35ppt.

I have just updated libraries, and uploaded my code again.

What can cause the head unit to reset itself??

Please help!!
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help - RA has started to randomly turn off skimmer!

Post by rimai »

The head unit reboots because of the watchdog.
It is preventing a lock up. Usually from external noise from a source around the RA equipment.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Help - RA has started to randomly turn off skimmer!

Post by lnevo »

One thing you can look at to preventing the skimmer from getting delayed on a restart is look at the code we implemented here

http://forum.reefangel.com/viewtopic.php?f=12&t=3585

This would allow your skimmer to still delay after feeding and waterchange mode, but not on restart. You could also do as I did and use the ATO High float switch to prevent the skimmer from coming on if it was an extended delay from a power outage or similar.
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

rimai wrote:The head unit reboots because of the watchdog.
It is preventing a lock up. Usually from external noise from a source around the RA equipment.
Hi Roberto, is this a common thing? I haven't added anything near the RA head of relay boxes at all recently?

Also, how do I go about resolving it so it doesn't happen - will a ferrite core on the VGA cable help?
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

lnevo wrote:One thing you can look at to preventing the skimmer from getting delayed on a restart is look at the code we implemented here

http://forum.reefangel.com/viewtopic.php?f=12&t=3585

This would allow your skimmer to still delay after feeding and waterchange mode, but not on restart. You could also do as I did and use the ATO High float switch to prevent the skimmer from coming on if it was an extended delay from a power outage or similar.

Thanks Lee.

It is a possibility, but ideally I would prefer to stop the resetting rather than work around it if you know what I mean!

I could do as you say, but currently using ATO high float in skimmer to knock out skimmer when full.

I guess could leave it like this and just accept if have a delayed power outage, skimmer will overflow, but get knocked off by float switch, but would prefer the safeguard. I also use ATO low for an ATO water low warning, so no spare float switches.

Thinking out loud now, from memory, I think the 2 default dimming ports can be reconfigured as switch inputs, so maybe a possibility of using one of them?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help - RA has started to randomly turn off skimmer!

Post by rimai »

Well, you do want the controller to reboot itself to prevent lock-up.
Not common, but I've seen happening.
You may not have added anything, but something may have changed during this time.
It's like a pump leaking stray voltage. It works fine for several months and one day, it starts doing all by itself.
So, something may be introducing noise to the RA system, which would cause this.
Try moving the expansion bus cables away from ballasts or drivers and make sure they are seated properly.
The new twi.c file may help. If the issue is in the expansion bus, it flags the bus as locked while keeping the controller still working instead of rebooting.
You can ask the Portal to alert you if FLAG is not zero, which would indicate something is wrong.
http://forum.reefangel.com/viewtopic.php?f=2&t=3068
Roberto.
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

rimai wrote:Well, you do want the controller to reboot itself to prevent lock-up.
Not common, but I've seen happening.
You may not have added anything, but something may have changed during this time.
It's like a pump leaking stray voltage. It works fine for several months and one day, it starts doing all by itself.
So, something may be introducing noise to the RA system, which would cause this.
Try moving the expansion bus cables away from ballasts or drivers and make sure they are seated properly.
The new twi.c file may help. If the issue is in the expansion bus, it flags the bus as locked while keeping the controller still working instead of rebooting.
You can ask the Portal to alert you if FLAG is not zero, which would indicate something is wrong.
http://forum.reefangel.com/viewtopic.php?f=2&t=3068
Hi Roberto, agreed dont want lock up!

I have tried to locate the twi.c file on my mac (I have updated to the latest libraries), but dont have a contents folder in arduino folder?

I have set the flag in the portal to email if flag > 0 - I take it the flag is activated when the watchdog is triggered, so I will get to see how often this is occurring?

cheers..
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help - RA has started to randomly turn off skimmer!

Post by rimai »

You should have a contents folder. Make sure you are looking at the Arduino app and not the libraries folder.
Roberto.
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

rimai wrote:You should have a contents folder. Make sure you are looking at the Arduino app and not the libraries folder.
In my arduino folder, I have the following folders:
example codes
libraries
RA preloaded
tools
update

and thats it!!
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help - RA has started to randomly turn off skimmer!

Post by rimai »

No...
You must look in the Arduino app... It should be in your applications folder. Then right-click it and choose Show Contents.
Roberto.
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

Got it - sorry for being thick!!

Now that that is updated, do I need to reload my code?

Also the FLAG in portal, is it set when watchdog is activated?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Help - RA has started to randomly turn off skimmer!

Post by rimai »

Yes, you must upload again.
No, the watchdog's purpose is to reboot the controller. Once it reboots, it's job is done.
The FLAG tag is to indicate several alert options... Each bit in the FLAG variable means something.

Code: Select all

#define ATOTimeOutFlag	0
#define OverheatFlag   	1
#define BusLockFlag   	2
#define LightsOnFlag   	3
#define LeakFlag		4
In this case we are interested in bit #2.
Bit #2 gets flagged when the controller can't use the expansion bus, indicating the bus is locked for some reason.
With the old twi.c, we couldn't check for lock on the bus, so the controller would just reboot itself and not even give time to retry again. It was a one strike deal. If it failed on the first try, it would just reboot.
The new twi.c, doesn't reboot the controller, so it keeps retying to use the bus indefinitely. It sets the FLAG when it senses something wrong in the bus, but resets the FLAG when it can use the bus again. So, if the problem is just momentarily, it will just fail once or a few times and resume again when the problem is not there anymore. It's a much more relaxed communication now.
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Help - RA has started to randomly turn off skimmer!

Post by lnevo »

I understand about the float switches and obviously about resolving the root cause.

What you can do instead if you have an extra switch around or can get one...is wire it in parallel to the ato low port. This is what i do but both of mine are on high :) and my low monitors my skimmer too.

I take the same action if sump is overflowing or if water level drops to low...both shut off the return.

Something to think about. Obviously not a fix. Would be good to monitor a rising sump level though in addition. No need for more inputs...yet :)
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

lnevo wrote:I understand about the float switches and obviously about resolving the root cause.

What you can do instead if you have an extra switch around or can get one...is wire it in parallel to the ato low port. This is what i do but both of mine are on high :) and my low monitors my skimmer too.

I take the same action if sump is overflowing or if water level drops to low...both shut off the return.

Something to think about. Obviously not a fix. Would be good to monitor a rising sump level though in addition. No need for more inputs...yet :)
Yes, good simple idea - can easily place a float switch for sump level in parallel with my skimmer cup full float switch - as you say, same action for both! Thanks!!
dazza1304
Posts: 154
Joined: Sat Aug 04, 2012 4:22 am

Re: Help - RA has started to randomly turn off skimmer!

Post by dazza1304 »

rimai wrote:Yes, you must upload again.
No, the watchdog's purpose is to reboot the controller. Once it reboots, it's job is done.
The FLAG tag is to indicate several alert options... Each bit in the FLAG variable means something.

Code: Select all

#define ATOTimeOutFlag	0
#define OverheatFlag   	1
#define BusLockFlag   	2
#define LightsOnFlag   	3
#define LeakFlag		4
In this case we are interested in bit #2.
Bit #2 gets flagged when the controller can't use the expansion bus, indicating the bus is locked for some reason.
With the old twi.c, we couldn't check for lock on the bus, so the controller would just reboot itself and not even give time to retry again. It was a one strike deal. If it failed on the first try, it would just reboot.
The new twi.c, doesn't reboot the controller, so it keeps retying to use the bus indefinitely. It sets the FLAG when it senses something wrong in the bus, but resets the FLAG when it can use the bus again. So, if the problem is just momentarily, it will just fail once or a few times and resume again when the problem is not there anymore. It's a much more relaxed communication now.
Thanks Roberto,

I would like to get this clear - with the new twi.c, the controller wont reboot - it will always retry to access bus - so if this is the case, it is possible that the bus could be locked up, which is not ideal?
Post Reply