Relay Going Bad?

Basic / Standard Reef Angel hardware
Post Reply
hnnhflns
Posts: 22
Joined: Tue Jul 09, 2013 7:09 pm

Relay Going Bad?

Post by hnnhflns »

One of my relays just started clicking like crazy. We have 2 relays on only one of them is clicking, and it is the relay that controls all our lighting. The second relay is fine. I have reuploaded the code on the controller, reset the controller, and reset the relay box. The problem is still happening. I went to the online portal to check the individual plugs, and I have everything set to on or off, and now the lights aren't flashing, but the relay box is still clicking.

I have a second angel that is going to be for a second system, I tried putting the code on it, but it is a standard while the controller I am having an issue with is a plus.

I am going to try to write a new code in the morning and upload it to the angel. This has happened once before and we fixed it by simply re-uploading the code, but it isn't working this time.

Any ideas as to what is going on? Is the controller starting to fail? Is the relay going bad?

Even though some of the ports are set to be off, some of the lights just started flashing again. It goes for long periods of time without making a click, then goes through 5-10 minute periods where it clicks several times a second
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Going Bad?

Post by rimai »

Can you swap the relay boxes and see if the problem follows the box or it is always in the box that is connected as main box or expansion box?
Roberto.
hnnhflns
Posts: 22
Joined: Tue Jul 09, 2013 7:09 pm

Re: Relay Going Bad?

Post by hnnhflns »

With the current configuration, I can't get to the second relay box for a couple of days.

I put all the ports on the relay back to "auto" and it isn't clicking anymore. It started around 9:30 last night which is when the main DT lights are set to be turned off. I am going to see if it happens again tonight.
hnnhflns
Posts: 22
Joined: Tue Jul 09, 2013 7:09 pm

Re: Relay Going Bad?

Post by hnnhflns »

I changed the relay boxes around. The problem is still persisting. The relays are continuously turning themselves on and off. We reprogrammed and changed some of the plugs around to try to fix the problem, and now when a specific relay is turned on in one box it turns off another in the same box.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Going Bad?

Post by rimai »

Did it follow the box or it happens always in the same port regardless of which physical box you use?
Which port is it?
Roberto.
hnnhflns
Posts: 22
Joined: Tue Jul 09, 2013 7:09 pm

Re: Relay Going Bad?

Post by hnnhflns »

It's all the ports. There isnt an order to when they flicker, or even a timing they follow. It is completely random. It can not happen for a few minutes, then all the sudden all the lights are flashing on and off.

We even tried changing the code, but it didn't help. It didn't happen last night right after we uploaded the new code, but it happened again tonight.

And after a while (sometimes a 30 minutes, sometimes a couple hours) the ports stop turning on and off and everything runs normally.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Going Bad?

Post by rimai »

Do you mean all ports on both relay boxes?
Roberto.
hnnhflns
Posts: 22
Joined: Tue Jul 09, 2013 7:09 pm

Re: Relay Going Bad?

Post by hnnhflns »

I can't tell if it is all of them, but it is most of the ports on both relay boxes.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: Relay Going Bad?

Post by lnevo »

It might be worthwhile to post your code and maybe also try the controller test code.
hnnhflns
Posts: 22
Joined: Tue Jul 09, 2013 7:09 pm

Re: Relay Going Bad?

Post by hnnhflns »

I haven't heard of the controller test code. It used to just happen around 9:30 pm, but now it is happening all the time.

Here is the current code that we are running. It's nothing fancy, just the basics

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    ReefAngel.AddORPExpansion();  // ORP Expansion Module
    ReefAngel.AddPHExpansion();  // pH Expansion Module
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    ReefAngel.AddMultiChannelWaterLevelExpansion();  // Multi-Channel Water Level Expanion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port8Bit;
    ReefAngel.LightsOnPortsE[0] = Port3Bit | Port4Bit | Port6Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port5Bit | Port6Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port3Bit | Port4Bit | Port6Bit | Port7Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 835 );

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


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );
    ReefAngel.Relay.On( Box1_Port5 );

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

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

void loop()
{
    ReefAngel.StandardHeater( Port2,765,768 );
    ReefAngel.Relay.DelayedOn( Port3,10 );
    ReefAngel.DosingPumpRepeat( Port4,0,480,60 );
    ReefAngel.StandardLights( Port5,9,0,14,0 );
    ReefAngel.Relay.DelayedOn( Port6,10 );
    ReefAngel.StandardFan( Port7,808,810 );
    ReefAngel.StandardLights( Port8,0,0,8,0 );
    ReefAngel.StandardLights( Box1_Port3,14,0,22,0 );
    ReefAngel.StandardLights( Box1_Port4,11,0,23,59 );
    ReefAngel.StandardLights( Box1_Port6,23,0,12,0 );
    ReefAngel.StandardLights( Box1_Port7,23,0,1,0 );
    ReefAngel.WaterLevelATO( Box1_Port8,300,50,80 );
    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.SetMode( Constant,50,10 );
    ReefAngel.DCPump.DaylightChannel = None;
    ReefAngel.DCPump.ActinicChannel = None;
    ReefAngel.DCPump.ExpansionChannel[0] = None;
    ReefAngel.DCPump.ExpansionChannel[1] = None;
    ReefAngel.DCPump.ExpansionChannel[2] = None;
    ReefAngel.DCPump.ExpansionChannel[3] = None;
    ReefAngel.DCPump.ExpansionChannel[4] = None;
    ReefAngel.DCPump.ExpansionChannel[5] = None;
    ////// Place your custom code below here

  //Beginning of Jebao Control through Actinic and Daylight ports.
    if (hour()<1 || hour()>=8) 
    {
        ReefAngel.PWM.SetActinic(20);
        ReefAngel.PWM.SetDaylight(20);
    }
    else if (hour()>=8 && hour()<15)
    {
      ReefAngel.PWM.SetDaylight( TidalSwellMode(30,true) ); // Tidal Swell at 40% on sync mode
      ReefAngel.PWM.SetActinic( TidalSwellMode(30,false) ); // Tidal Swell at 40% on anti-sync mode
    }
    else if (hour()>=15 && hour()<17)
    {
      ReefAngel.PWM.SetDaylight( ReefCrestMode(100,85,true) ); // ReefCrest at 100% + - 85 on sync mode
      ReefAngel.PWM.SetActinic( ReefCrestMode(100,85,false) ); // ReefCrest at 100% + - 85 on anti-sync mode
    }
    else if (hour()>=17 && hour()<19)
    {
      ReefAngel.PWM.SetDaylight( NutrientTransportMode(90,100,2000,true) ); // Nutrient Transport on sync mode
      ReefAngel.PWM.SetActinic( NutrientTransportMode(90,100,2000,false) ); // Nutrient Transport on anti-sync mode
    }
    else if (hour()>=19 && hour()<21)
    {
      ReefAngel.PWM.SetDaylight( ReefCrestMode(100,85,true) ); // ReefCrest at 100% + - 85 on sync mode
      ReefAngel.PWM.SetActinic( ReefCrestMode(100,85,false) ); // ReefCrest at 100% + - 85 on anti-sync mode
    }
    else if (hour()>=21 && hour()<22)
    {
      ReefAngel.PWM.SetDaylight( ElseMode(100,85,true )); // ElseMode on sync mode, 100 +/- 85%
      ReefAngel.PWM.SetActinic( ElseMode(100,85,false )); // ElseMode on sync mode, 100 +/- 85%
    }
    else if (hour()>=22 && hour()<23)
    {
      ReefAngel.PWM.SetDaylight( TidalSwellMode(80,true) ); // Tidal Swell at 40% on sync mode
      ReefAngel.PWM.SetActinic( TidalSwellMode(80,false) ); // Tidal Swell at 40% on anti-sync mode
    }
    else if (hour()>=23 && hour()<1)
    { 
      ReefAngel.PWM.SetDaylight( LongPulseMode(0,20,10,true) ); // Long pulse at 20% with 10s pulse on sync mode
      ReefAngel.PWM.SetActinic( LongPulseMode(0,20,10,false) ); // Long pulse at 20% with 10s pulse on anti sync mode
    }
    //End of Jebao Control
        

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

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

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

    // pH Expansion
    ReefAngel.LCD.DrawText( COLOR_MEDIUMSEAGREEN,DefaultBGColor,15,66, "PHE:" );
    ReefAngel.LCD.DrawSingleMonitor( ReefAngel.Params.PHExp,COLOR_MEDIUMSEAGREEN,39,66, 100 );    
    pingSerial();

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

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

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

void DrawCustomGraph()
{
}


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

Re: Relay Going Bad?

Post by rimai »

Is it doing on both or just one box?
Your original post days one and then you said both.
If just one, which box is it?
Roberto.
hnnhflns
Posts: 22
Joined: Tue Jul 09, 2013 7:09 pm

Re: Relay Going Bad?

Post by hnnhflns »

It's both boxes now. It started out as just the expansion, but it is now both the expansion and the original box.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Going Bad?

Post by rimai »

Try moved the USB cables and any expansion module away from mains power cords, especially if you have MH ballasts.
Unplug and plug all usb connectors back in to make sure all cables are seated properly.
Do you have an expansion hub or the relay expansion is connected directly to the main relay box?
Roberto.
hnnhflns
Posts: 22
Joined: Tue Jul 09, 2013 7:09 pm

Re: Relay Going Bad?

Post by hnnhflns »

For the most part, at least lately, it has been working properly. We don't have MH ballasts.

It appears that the Water Level Sensor has been causing one of the relays to trip. Unplugged all the expansions and it stopped as well.
Post Reply