Relay Not Responding

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

Relay Not Responding

Post by btorrenga »

Over the weekend I installed my controller, two relays, IO module, and so on, up to the tank for production. Prior to then I was testing with a simple lamp to verify functionality. All of the relays on the main relay module work fine. The expansion relay would not turn my powerheads back on when the feeding mode ended. Nothing except unplugging the power to the expansion relay box and plugging it back in would wake up the powerhead relays on the expansion box. At first I thought the issue was with my code, such as a misconfigured feeding mode function. However, the powerheads (and some other relays on the expansion box) do not turn back on via the portal or android app, and the display on the controller properly indicates which ports SHOULD be on/off. Is there a limitation as to what kind of loads can be plugged into the relays? I suspect I have something plugged in to the expansion box that is preventing its relays from operating properly, though I doubt the powerheads draw many amps. Testing with a simple incandescent lamp prior to installation verified that my code functions, and that the hardware works.

What is plugged in to expansion relay, and results of toggling power via android app/water change mode/portal:
Port 1: 2x 150w metal halides, analogue ballasts <--- did not test extensively, but power toggled on/off properly about three times
Port 2: 1x 250w heater <--- did not test
Port 3: Actinics, 384w <--- power toggles properly each time
Port 4: Two powerheads, probably 10w each<--- power will not turn on after toggling off. Must reset via power to box
Port 5: Topoff pump, 3w <--- power will toggle sometimes, not every time
Port 6: Topoff pump, 3w <--- power will toggle sometimes, not every time
Port 7: Two powerheads, probably 10w each <--- power will not turn on after toggling off. Must reset via power to box
Port 8: Skimmer, 50w <--- power toggles properly each time
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

You should be fine with that equipment.
So, what you are saying is that you tested the hardware and code before installing and everything was working, but when you connected your equipment, this behavior started happening?
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Yes, exactly. Have you seen this happen before?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Caspar just told me he is experiencing the same thing.
Roberto.
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Relay Not Responding

Post by CASPAR »

Yeah same here just tested and ports 1,4,6,7 on expansion relay does same, will turn off through phone app and portal, but when turned back on says its on but is not.......
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

When you do that with one port, can you still turn off a second port and so on for all ports?
If you go through all ports, do you end up with all ports off that you can't turn on?
Do they work fine if they are left on auto mode?
Roberto.
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Relay Not Responding

Post by CASPAR »

All of mine on the expansion relay are set to always on, and if you turn them off manually via portal or phone app then turn them back on and they show on in both phone and portal app they are not. also while testing mentioned ports that went off and stay off will not power back up until relay power is cycled. Like i said all mine on expansion are set to always on and they do stay on always its just until you manually cycle them, then they wont come back on.
Image
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Relay Not Responding

Post by CASPAR »

I also tested each port with a simple led night lite as Btorrenga did almost the same but I definately dont think it is a load issue because an led nitelite doesnt draw hardly anything, so I think it is something else. Hopefully Roberto can figure this out...
Image
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

CASPAR wrote:I also tested each port with a simple led night lite as Btorrenga did almost the same but I definately dont think it is a load issue because an led nitelite doesnt draw hardly anything, so I think it is something else. Hopefully Roberto can figure this out...
Perhaps the most recent library update? I did my extensive testing under 0.9.7 or 0.9.8.
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Relay Not Responding

Post by CASPAR »

Mine is 0.9.6
Image
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

Interesting, 0.9.6 was the version with the portal XML issue, I think. I did my testing under the library version that had the XML problem preventing the portal from working.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I just ran through the feeding mode which is configured to turn off two relays on the expansion relay. I did not manually exit the feeding mode. Both relays turned on perfectly when feeding mode timed out. Then I entered feeding mode again and manually cancelled it. Only one of the two relays turned on after manually exiting feeding mode.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I then entered feeding mode again while one of the relays was improperly off and allowed feeding mode to timeout. Both relays properly turned back on after feeding mode timed out.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Humm, that's very interesting information.
This sounds definitely a bug in the libraries.
I'll look into it.
Thanks a lot for the troubleshooting and information to narrow down the possible causes :)
Roberto.
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Relay Not Responding

Post by CASPAR »

Any ideas yet roberto? I am using 0.9.6 lib file do i need to change it, really need to get this working
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

I'll try to tackle that today.
Roberto.
CASPAR
Posts: 49
Joined: Wed May 09, 2012 12:24 pm

Re: Relay Not Responding

Post by CASPAR »

Thanks Roberto your are tha man!!!!
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

I can't seem to be able to replicate the problem.
Can you try updating the libraries to 0.9.9?
Roberto.
btorrenga
Posts: 100
Joined: Mon Apr 16, 2012 10:22 pm

Re: Relay Not Responding

Post by btorrenga »

I just ran feeding mode two more times... First time one of the two relays came back on after timeout, second time neither relay came back on after timeout. That kills my theory that timeout restore relays fine.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay Not Responding

Post by rimai »

Browse the controller with http://ipaddress:2000/r99
It should give you some XML data.
Can you get this XML data before you go into feed mode, during and after?
Other than feed mode, does it work as expected? As in, for your Box1_Port 2 (heater), does it turn on/off according to the temperature settings you chose?
Roberto.
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.
Post Reply