Relay Not Responding

Expansion modules and attachments
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I pulled the power on the main relay, plugged it back in, then pulled power on the expansion relay and plugged that back in.

Here is /r99 output after that reboot:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>800</T1>
<T2>802</T2>
<T3>753</T3>
<PH>811</PH>
<R>132</R>
<RON>0</RON>
<ROFF>255</ROFF>
<R1>204</R1>
<RON1>0</RON1>
<ROFF1>255</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
I then waited for the metalhalides to turn back on. Here is the /r99 output when the metal halides turned on:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>800</T1>
<T2>800</T2>
<T3>748</T3>
<PH>810</PH>
<R>140</R>
<RON>0</RON>
<ROFF>255</ROFF>
<R1>205</R1>
<RON1>0</RON1>
<ROFF1>255</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
Then I entered feeding mode, and ports 4 and 7 on the expansion relay properly turned off:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>800</T1>
<T2>800</T2>
<T3>748</T3>
<PH>809</PH>
<R>140</R>
<RON>0</RON>
<ROFF>79</ROFF>
<R1>205</R1>
<RON1>0</RON1>
<ROFF1>183</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
Feeding mode then timed out, and expansion relay port 7 properly came back on, expansion relay port 4 did not:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>798</T1>
<T2>798</T2>
<T3>744</T3>
<PH>810</PH>
<R>140</R>
<RON>0</RON>
<ROFF>255</ROFF>
<R1>205</R1>
<RON1>0</RON1>
<ROFF1>255</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Everything looks good in there.
What happens if you mode port4 and port 7 to another port and change the code accordingly?
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Ok, I swapped expansion ports 3 with 4, and swapped expansion ports 7 with 8, so that now feeding mode should turn off/on expansion ports 3 and 8:

Code: Select all

/* The following features are enabled for this File: 

#define DisplayImages
#define SetupExtras
#define OverheatSetup
#define DateTimeSetup
#define VersionMenu
#define wifi
#define SaveRelayState
#define RelayExp
#define InstalledRelayExpansionModules 1
#define DosingPumpIntervalSetup
#define WDT
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 9
#define CUSTOM_MAIN
#define COLORS_PDE
#define ENABLE_ATO_LOGGING
#define ENABLE_EXCEED_FLAGS
#define IOEXPANSION
#define FONT_8x8
#define FONT_8x16
#define FONT_12x16
#define NUMBERS_8x8
#define NUMBERS_8x16
#define NUMBERS_12x16
#define NUMBERS_16x16
#define CUSTOM_VARIABLES

*/


#include <ReefAngel_Features.h>
#include <RA_Colors.h>
#include <RA_CustomColors.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 <Timer.h>
#include <Memory.h>
#include <IO.h>
#include <ReefAngel.h>
#include <RA_PWM.h>
#include <avr/pgmspace.h>

////// Place global variable code below here
// Initialize Buzzer variables
// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long buzzerinterval = 1000;           // interval at which to sound buzzer (milliseconds)
long previousMillis = 0;

////// Place global variable code above here


prog_char menu1_label[] PROGMEM = "Feeding";
prog_char menu2_label[] PROGMEM = "Water Change";
prog_char menu3_label[] PROGMEM = "ATO Clear";
prog_char menu4_label[] PROGMEM = "Overheat Clear";
prog_char menu5_label[] PROGMEM = "PH Calibration";
prog_char menu6_label[] PROGMEM = "Date / Time";
prog_char menu7_label[] PROGMEM = "Version";
prog_char menu8_label[] PROGMEM = "Turn ON/OFF Skimmer";
prog_char menu9_label[] PROGMEM = "Turn Off Skimmer";
// Group the menu entries together
PROGMEM const char *menu_items[] = {
menu1_label, menu2_label, menu3_label,
menu4_label, menu5_label, menu6_label,
menu7_label, menu8_label, menu9_label
};
    
void MenuEntry1()
{
ReefAngel.FeedingModeStart();
}
void MenuEntry2()
{
ReefAngel.WaterChangeModeStart();
}
void MenuEntry3()
{
ReefAngel.ATOClear();
ReefAngel.DisplayMenuEntry("Clear ATO Timeout");
}
void MenuEntry4()
{
ReefAngel.OverheatClear();
ReefAngel.DisplayMenuEntry("Clear Overheat");
}
void MenuEntry5()
{
ReefAngel.SetupCalibratePH();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry6()
{
ReefAngel.SetupDateTime();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry7()
{
ReefAngel.DisplayVersion();
}
void MenuEntry8()
{
ReefAngel.Relay.Toggle(Box1_Port8);
ReefAngel.Relay.Write();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}
void MenuEntry9()
{
ReefAngel.Relay.Off(Box1_Port8);
ReefAngel.Relay.Write();
ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
}

void DrawCustomMain()
{
  ReefAngel.LCD.DrawDate(6, 119);
  pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  pingSerial();
  // draw main relay
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay |= ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
#ifdef RelayExp
  pingSerial();
  // draw 1st expansion relay
  TempRelay = ReefAngel.Relay.RelayDataE[0];
  TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
  TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
  ReefAngel.LCD.DrawOutletBox(12, 105, TempRelay);
#endif  // RelayExp
}
void DrawCustomGraph()
{
  // Change the 45 to adjust the horizontal position of the text 
  ReefAngel.LCD.DrawGraph(5, 5);
}


void CheckReservoirStatus(byte channel, byte pump)
{
    if ( ReefAngel.IO.GetChannel(channel) )
    {
        // If empty, shutoff the port, trigger alert
        ReefAngel.CustomVar[channel] = 1;
        ReefAngel.Relay.Off(pump);
    }
    else
    {
        // If not empty, turn on the port, clear alert
        ReefAngel.CustomVar[channel] = 0;
        ReefAngel.Relay.On(pump);
    }
}


void MyCustomATO(int ATOTimeout)
{
    /*
    This function works as follows:

    When it's time to topoff the system, we check the levels of each
    of the three reservoirs.  If a reservoir is empty, we set a custom
    flag to indicate it's empty on the portal and we do not start that
    pump.  Otherwise, we clear the custom flag for the reservoir and
    start the pump.
    The function monitors the switch levels like normal.
    Monitor the status of the reservoirs while topping off.
    When the high switch is triggered (aka, finished topping off), 
    ALL ports are turned off regardless of status (doesn't hurt to do this).
    If the timeout occurs, the LED light comes on and all ports are 
    turned off just like when we finish topping off.
    
    */
    unsigned long TempTimeout = ATOTimeout;
    TempTimeout *= 1000;

    if ( ReefAngel.LowATO.IsActive() && ( !ReefAngel.LowATO.IsTopping()) )
    {
        ReefAngel.LowATO.Timer = millis();
        ReefAngel.LowATO.StartTopping();

        // Check the level of each reservoir
        // If empty, set the alert and don't start topping off
        // otherwise if not empty, clear the alert and start topping
        CheckReservoirStatus(0, Port5);
        CheckReservoirStatus(1, Port6);
        CheckReservoirStatus(2, Box1_Port5);
    }

    // Monitor levels while topping off, to prevent a reservoir from running dry
    // Might need to remove this check here -- Nope, this seems to work fine.
    
    if ( ReefAngel.LowATO.IsTopping() )
    {
        CheckReservoirStatus(0, Port5);
        CheckReservoirStatus(1, Port6);
        CheckReservoirStatus(2, Box1_Port5);
    }

    if ( ReefAngel.HighATO.IsActive() )
    {
        ReefAngel.LowATO.StopTopping();  // stop the low ato timer
        ReefAngel.Relay.Off(Port5);
        ReefAngel.Relay.Off(Port6);
        ReefAngel.Relay.Off(Box1_Port5);
    }

    if ( (millis()-ReefAngel.LowATO.Timer > TempTimeout) && ReefAngel.LowATO.IsTopping() )
    {
        ReefAngel.LED.On();
#ifdef ENABLE_EXCEED_FLAGS
        InternalMemory.write(ATO_Exceed_Flag, 1);
#endif  // ENABLE_EXCEED_FLAGS
        ReefAngel.Relay.Off(Port5);
        ReefAngel.Relay.Off(Port6);
        ReefAngel.Relay.Off(Box1_Port5);
#ifdef ENABLE_ATO_LOGGING
        // bump the counter if a timeout occurs
        AtoEventCount++;
        if ( AtoEventCount >= MAX_ATO_LOG_EVENTS ) { AtoEventCount = 0; }
#endif  // ENABLE_ATO_LOGGING
    }
}

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    // Initialize the custom menu
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePortsE[0] = Port3Bit | Port8Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port4Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port1Bit | Port2Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port4Bit;
    ReefAngel.LightsOnPortsE[0] = Port1Bit | Port3Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port2Bit | Port5Bit | Port6Bit;
    ReefAngel.WaterChangePortsE[0] = Port2Bit | Port4Bit | Port5Bit | Port6Bit | Port8Bit;

    // Ports that are always on
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.On(Box1_Port3);
    ReefAngel.Relay.On(Box1_Port7);
    ReefAngel.Relay.On(Box1_Port8);
    ////// Place additional initialization code below here
    ReefAngel.OverheatProbe = T1_PROBE; // Use Temperature probe 1 to check for overheat




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

void loop()
{
    // Specific functions that use Internal Memory values
    ReefAngel.StandardLights(Port1,23,0,2,0); // Moon lights on 23:00-02:00
    ReefAngel.StandardHeater(Port2,780,790); // 800w heater on at 78.0, off at 79.0
    ReefAngel.MHLights(Port4); // MH on 14:00-22:00, delay 15m if power fails
    ReefAngel.StandardLights(Port7,21,0,13,0); // Sump lights on 21:00-13:00
    ReefAngel.StandardLights(Port8,8,0,21,0);  //Plant lights on 08:00-21:00
    ReefAngel.MHLights(Box1_Port1); // MH on 14:00-22:00, delay 15m if power fails
    ReefAngel.StandardHeater(Box1_Port2); // 250w heater on at 78.5, off at 79.0
    ReefAngel.StandardLights(Box1_Port4); // Actinics on 13:00-23:00
    ////// Place your custom code below here
    //ATO function
    MyCustomATO(InternalMemory.ATOTimeout_read());
    
    //Notify when sump level is low
    if ( ReefAngel.IO.GetChannel(4) )
    {
      ReefAngel.CustomVar[4]=1;
        // If the sump level is about to cavitate the pumps, then sound the alarm
        unsigned long currentMillis = millis();
        if(currentMillis - previousMillis > buzzerinterval) {
    // save the last time the buzzer turned on 
    previousMillis = currentMillis;   
    // if the buzzer is off turn it on and vice-versa:
    if (ReefAngel.PWM.GetDaylightValue() == 0)
      ReefAngel.PWM.SetDaylight(25);
    else
      ReefAngel.PWM.SetDaylight(0);
  }
    }
    else
    {
        // Turn the buzzer off when the sump level is above cavitation levels
        ReefAngel.PWM.SetDaylight(0);
        ReefAngel.CustomVar[4]=0;
    }

//If the ATO float switch is stuck, and the topoff pump timeout flag is set, then set C5=1
ReefAngel.CustomVar[5]=InternalMemory.read(ATO_Exceed_Flag);  //Note that this value should be either 0 or 1, but for some reason is 254 or 255.
    
//Vodka dosing 
      if ( ReefAngel.IO.GetChannel(3) )  //Check there is vodka in the reservoir
  {
    ReefAngel.Relay.Off(Box1_Port6);  //If no vodka, then set a variable and turn off the port
    ReefAngel.CustomVar[3]=1;
  }
  else  //If there is vodka, then dose
  {
    ReefAngel.CustomVar[3]=0;
    ReefAngel.DosingPumpRepeat1(Box1_Port6);
  }

//Monitor the water level in the display
ReefAngel.CustomVar[6]=ReefAngel.IO.GetChannel(5);
  
    ////// Place your custom code above here
    // 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("btorrenga");

    // This should always be the last line
    ReefAngel.ShowInterface();
}
Here is /r99 after pulling power on each relay:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>800</T1>
<T2>800</T2>
<T3>743</T3>
<PH>811</PH>
<R>68</R>
<RON>0</RON>
<ROFF>79</ROFF>
<R1>204</R1>
<RON1>0</RON1>
<ROFF1>123</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
Entering feeding mode did not work properly, since expansion port 8 turned off but expansion port 3 did not:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>798</T1>
<T2>798</T2>
<T3>743</T3>
<PH>811</PH>
<R>68</R>
<RON>0</RON>
<ROFF>79</ROFF>
<R1>204</R1>
<RON1>0</RON1>
<ROFF1>123</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
Upon feeding mode timeout both expansion ports 3 and 8 properly turned on:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>798</T1>
<T2>800</T2>
<T3>741</T3>
<PH>810</PH>
<R>68</R>
<RON>0</RON>
<ROFF>255</ROFF>
<R1>204</R1>
<RON1>0</RON1>
<ROFF1>255</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I have two ports on the main relay and one on the expansion relay that run topoff pumps. The display properly indicates that all three ports turn on, but the port on the expansion relay does not actually energize.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

What happens if you swap your boxes?
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I swapped boxes (what a pain). Here is r99 before entering feeding mode:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>782</T1>
<T2>784</T2>
<T3>750</T3>
<PH>800</PH>
<R>142</R>
<RON>0</RON>
<ROFF>255</ROFF>
<R1>207</R1>
<RON1>0</RON1>
<ROFF1>255</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
During feeding mode, both expansion relays 3 and 8 properly turned off:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>784</T1>
<T2>782</T2>
<T3>750</T3>
<PH>799</PH>
<R>142</R>
<RON>0</RON>
<ROFF>79</ROFF>
<R1>207</R1>
<RON1>0</RON1>
<ROFF1>123</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
After feeding mode timed out, and the ports properly turned on. Dammit:

Code: Select all

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<RA>
<T1>784</T1>
<T2>784</T2>
<T3>752</T3>
<PH>799</PH>
<R>142</R>
<RON>0</RON>
<ROFF>255</ROFF>
<R1>207</R1>
<RON1>0</RON1>
<ROFF1>255</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>1</ATOLOW>
<ATOHIGH>1</ATOHIGH>
<EM>32</EM>
<REM>1</REM>
<PWMA>0</PWMA>
<PWMD>0</PWMD>
<IO>0</IO>
<C0>0</C0>
<C1>0</C1>
<C2>0</C2>
<C3>0</C3>
<C4>0</C4>
<C5>190</C5>
<C6>0</C6>
<C7>0</C7>
</RA>
I entered and exited feeding mode a few more times, worked flawlessly each time. So, what the heck is going on?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Strange huh?
I dunno either. I'm going along with what you are finding out.
What about the main box? Is it work fine too?
There was one case in the past where stuff wasn't working either, but even swapping boxes didn't fix the issue.
The only thing that made it work without a hickup was to swap out all the equipment from the expansion box to main box and the equipment from main box to the expansion box.
I never couldn't figure that one out... :( But it worked.
I think it was something to do with load like you suspected on a previous post.
I just can't wrap my head around it because load "shouldn't" have anything to do with it.
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I manually toggled each port.

Main relay:
1 ok
2 ok
3 Turned off ok, will not come back on. Is set to always be on as a pump.
4 ok
5 ok
6 ok
7 ok
8 ok

Expansion relay:
1 ok
2 ok
3 ok
4 Completely unresponsive, is stuck on as my actinic lights.
5 ok
6 ok
7 ok
8 ok
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Does it still present the same problem on the same ports if you swap the svga cables?
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I swapped the svga cables and then manually toggled each port.

Main relay:
1 ok
2 ok
3 always stuck on. Is set to always be on as a pump.
4 ok
5 ok
6 ok
7 ok
8 ok

Expansion relay:
1 ok
2 ok
3 ok
4 Completely unresponsive, is stuck on as my actinic lights.
5 ok
6 ok
7 ok
8 ok

Same ports are troubled, but this time main port three would not turn off, instead is stuck on.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Man, I think it can only be bad equipment.
We went through all my ideas.
The last thing I can think of is actually testing every port with the ControllerTester code to make sure it is indeed defective.
File->Sketchbook->Example Codes->ControllerTester
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Ugh, ok, I did the controller tester on each relay twice, one time with each VGA cable. Port 4 on my original main relay box (before swapped, with the swapped results being shown in the recent test results) being stuck always on. All other ports went ok.

Considering that, does it sound like there is one bad port causing all the errors? Or, does it sound like there is one bad port and some code errors/bugs?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

How about the expansion box?
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

You can add this line to test:

Code: Select all

  ReefAngel.Relay.RelayDataE[0]=1<<port;
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Compile error:

ControllerTester.cpp: In function 'void loop()':
ControllerTester:82: error: 'class RelayClass' has no member named 'RelayDataE'
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I added that line like this:

Code: Select all

#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 <ReefAngel.h>

int port=0;

void setup()
{
  ReefAngel.Init();  
}

void loop()
{
  
  /*
  This code will display:
  
  Temperature probes
  pH probe
  Daylight PWM % (if the feature is enabled)
  Actinic PWM % (if the feature is enabled)
  Relay box
  Time/Date
  ATO port status
  
  It will blink the red status LED and increment the PWM % every second.
  
  Moving or pressing the joystick will activate another port in the relay box.
  
  */
  if (ReefAngel.Joystick.IsUp() || ReefAngel.Joystick.IsRight()) port++;
  if (ReefAngel.Joystick.IsButtonPressed()) port++;
  if (ReefAngel.Joystick.IsDown() || ReefAngel.Joystick.IsLeft()) port--;
  if (port>7) port=0;
  if (port<0) port=7;
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,10,"Port   On");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,45,10,port+1); 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,20,"Low ATO");
  if (ReefAngel.LowATO.IsActive())
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,65,20,"Closed");
  else
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,65,20,"Open  ");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,30,"High ATO");
  if (ReefAngel.HighATO.IsActive())
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,70,30,"Closed");
  else
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,70,30,"Open  ");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,40,"Status LED ");
  if (now()%2==0)
  {
    ReefAngel.LED.On();
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,80,40,"On ");
  }
  else
  {
    ReefAngel.LED.Off();
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,80,40,"Off");
  }
  ReefAngel.Relay.RelayData=1<<port;
  ReefAngel.Relay.RelayDataE[0]=1<<port;
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.PWM.SetActinic(now()%100);
  ReefAngel.PWM.SetDaylight(now()%100);
  ReefAngel.LCD.DrawMonitor(15, 70, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor(15, 70, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawOutletBox(12, 103, ReefAngel.Relay.RelayData);
  ReefAngel.LCD.DrawDate(6, 122);
  ReefAngel.Relay.Write();
  ReefAngel.Refresh();
}



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

Re: Relay Not Responding

Post by rimai »

Sorry, the auto-feature is not able to recognize that keyword.
Just add this anywhere in the code:

Code: Select all

  //Box1_Port1
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Having trouble getting both relays to work with the test code. This compiles ok, but still only shows one relay on the display, cannot control the expansion:

Code: Select all

#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 <ReefAngel.h>

int port=0;

void setup()
{
  ReefAngel.Init();  
}

void loop()
{
  
  /*
  This code will display:
  
  Temperature probes
  pH probe
  Daylight PWM % (if the feature is enabled)
  Actinic PWM % (if the feature is enabled)
  Relay box
  Time/Date
  ATO port status
  
  It will blink the red status LED and increment the PWM % every second.
  
  Moving or pressing the joystick will activate another port in the relay box.
  
  */
  if (ReefAngel.Joystick.IsUp() || ReefAngel.Joystick.IsRight()) port++;
  if (ReefAngel.Joystick.IsButtonPressed()) port++;
  if (ReefAngel.Joystick.IsDown() || ReefAngel.Joystick.IsLeft()) port--;
  if (port>7) port=0;
  if (port<0) port=7;
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,10,"Port   On");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,45,10,port+1); 
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,20,"Low ATO");
  if (ReefAngel.LowATO.IsActive())
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,65,20,"Closed");
  else
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,65,20,"Open  ");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,30,"High ATO");
  if (ReefAngel.HighATO.IsActive())
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,70,30,"Closed");
  else
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,70,30,"Open  ");
  ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,15,40,"Status LED ");
  if (now()%2==0)
  {
    ReefAngel.LED.On();
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,80,40,"On ");
  }
  else
  {
    ReefAngel.LED.Off();
    ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,80,40,"Off");
  }
  ReefAngel.Relay.RelayData=1<<port;
  ReefAngel.Relay.RelayDataE[0]=1<<port;
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.PWM.SetActinic(now()%100);
  ReefAngel.PWM.SetDaylight(now()%100);
  ReefAngel.LCD.DrawMonitor(15, 70, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor(15, 70, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawOutletBox(12, 103, ReefAngel.Relay.RelayData);
  ReefAngel.LCD.DrawDate(6, 122);
  ReefAngel.Relay.Write();
  ReefAngel.Refresh();
}

 //Box1_Port1

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

Re: Relay Not Responding

Post by rimai »

The expansion box should follow the same as displayed for the main box.
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I see. Tested both relays while both are hooked up, same result. One port is stuck on. I still have the first expansion box I bought that has two bad ports in it. Can I open the boxes up and salvage something? Or is that asking for trouble?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Are you saying that the expansion box is working ok for all relays?
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Yes, under the test code one relay box is perfect, the other has port 4 stuck on. I have a third box, the original one I purchased, which has I believe two bad ports. Can I disassemble that one and make one working box from the parts?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Yes, you can pop it open to scavenge the relay.
What did you have connected on that port?
You mentioned they were working before you put all together with a night lamp.
And this still doesn't explain how the expansion box works with the test code and not with your code... :?
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Right, that I tested everything with a lamp previously is troubling. I may have missed that port somehow though. The bad port has always had two korellia powerheads plugged into it. My understanding is that heavy loads, if anything, would be a problem, such as a bunch of metal halide ballasts. In this instance, however, it has either been a small incandescent lamp or two powerheads.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Four screws on the top come out fine, but the rest seems to be pretty tight to pull apart. Are there any tricks I need to know about when disassembling the relay?

--Nevermind, I got it. Brute force through some glue. The relays are not soldered, right? It looks like they plug in, which I believe is the part to replace. So I popped out the bad relay #4, and took one of the working relays from my original box that was replaced. Unfortunately I get the same result - relay #4 is still stuck in the on position! The relay I scavenged should be one of the working ones, so I am not worried that I replaced a broken part with a different broken part.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Yes, the relays are soldered.
The part you replaced is probably just the socket.
The relay is a square piece that is soldered on the board.
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Ok, I understand now. I replaced the socket.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I replaced the relay. The replaced relay is stuck in the off position. What does that indicate is broken?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

You got pm.
Roberto.
Post Reply