Page 1 of 1

Relay Expansion Working But Not Showing

Posted: Fri Jan 04, 2019 3:19 pm
by sbidny
I have a Reef Angel Plus controller with three relay expansions, so I have a total of four relay boxes.

I have successfully hooked up two of the relay expansions, so I am seeing three relay boxes on the controller UI, the portal, and the UApp.

When I hook up the third expansion, set its dip switch appropriately, and reference it in the code, it is not showing up on any of these interfaces.

However, it appears that the outlet states on this relay box are set correctly according to the code, so it seems that the relay expansion is actually working.

I have tried multiple combinations of swapping the cables, relay box, relay expansion module, and expansion hub port, and everything seems to work for showing relay expansions 1 and 2. It just that expansion 3 doesn't appear on any of the interfaces.

Thoughts? What can I try next?

Re: Relay Expansion Working But Not Showing

Posted: Fri Jan 04, 2019 3:39 pm
by rimai
Can you post your code?
Because the log only shows 2 expansion boxes.
Did you upload the code with the Arduino IDE or webwizard?

Re: Relay Expansion Working But Not Showing

Posted: Fri Jan 04, 2019 4:42 pm
by sbidny
Uploaded using the Arduino IDE via Bluetooth, but I'm using Arduino 1.8.6 with the dev libs. This is because the Web Wizard doesn't support Bluetooth, but I still use it as my IDE. The Web Wizard uses the dev libs, which in turn require the later Arduino version. Will post my code in a bit. It's nothing too fancy right now. Still just trying to get basic things to work.

Re: Relay Expansion Working But Not Showing

Posted: Fri Jan 04, 2019 4:45 pm
by sbidny

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

void setGyres()
{
    ReefAngel.PWM.SetDaylight(SineMode(TideMode(InternalMemory.PWMSlopeStartD_read(), 2, 10), TideMode(InternalMemory.PWMSlopeEndD_read(), 4, 20), InternalMemory.PWMSlopeDurationD_read() * 60, true));
    ReefAngel.PWM.SetActinic(SineMode(TideMode(InternalMemory.PWMSlopeStartD_read(), 2, 10), TideMode(InternalMemory.PWMSlopeEndA_read(), 4, 20), InternalMemory.PWMSlopeDurationA_read() * 60, false));
}

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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.AddStandardMenu();  // Add Standard Menu
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddMultiChannelWaterLevelExpansion();  // Multi-Channel Water Level Expanion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    ReefAngel.FeedingModePortsE[1] = Port1Bit | Port2Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port4Bit;
    ReefAngel.WaterChangePortsE[0] = 0;
    ReefAngel.WaterChangePortsE[1] = Port3Bit | Port8Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    ReefAngel.OverheatShutoffPortsE[1] = Port6Bit | Port7Bit | Port8Bit;
    // Ports turned off when Leak is detected
    ReefAngel.LeakShutoffPorts = Port1Bit | Port2Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.LeakShutoffPortsE[0] = 0;
    ReefAngel.LeakShutoffPortsE[1] = Port3Bit | Port4Bit | Port5Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    ReefAngel.LightsOnPortsE[1] = 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( 820 );

    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Box1_Port3 );
    ReefAngel.Relay.On( Box1_Port4 );
    ReefAngel.Relay.On( Box1_Port5 );
    ReefAngel.Relay.On( Box2_Port2 );
    ReefAngel.Relay.On( Box2_Port4 );
    ReefAngel.Relay.On( Box2_Port5 );
    ReefAngel.Relay.On( Box2_Port6 );
    ReefAngel.Relay.On( Box3_Port5 );
    ReefAngel.Relay.On( Box3_Port6 );
    ReefAngel.Relay.On( Box3_Port7 );

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

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

void loop()
{
    ReefAngel.Relay.DelayedOn( Box2_Port8 );
    ReefAngel.RF.UseMemory = false;
    ReefAngel.RF.SetMode( Constant,20,10 );
    if (!ReefAngel.HighATO.IsActive()) ReefAngel.WaterLevelATO(1, Box2_Port3, InternalMemory.ATOTimeout_read(), InternalMemory.WaterLevelLow_read(), InternalMemory.WaterLevelHigh_read());
    if (!ReefAngel.LowATO.IsActive()) ReefAngel.WaterLevelATO(2, Port4, InternalMemory.ATOTimeout_read(), InternalMemory.WaterLevelLow_read(), InternalMemory.WaterLevelHigh_read());

    ////// Place your custom code below here

    ReefAngel.StandardHeater1(Port7);
    setGyres();

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

    ReefAngel.Portal( "sbidny", "xxx" );
    ReefAngel.CloudPortal();
    ReefAngel.DDNS( "reef" ); // Your DDNS is sbidny-reef.myreefangel.com
    // This should always be the last line
    ReefAngel.ShowInterface();
}

Re: Relay Expansion Working But Not Showing

Posted: Fri Jan 04, 2019 5:30 pm
by rimai
This is not the code loaded on the controller.
Can you try uploading it again?

Re: Relay Expansion Working But Not Showing

Posted: Sat Jan 05, 2019 3:15 pm
by sbidny
You're right. I had made a small change. I uploaded above, but it's still not working.

Re: Relay Expansion Working But Not Showing

Posted: Sat Jan 05, 2019 7:23 pm
by rimai
That still doesn't seem to be the code uploaded to the controller.
The data in the portal shows a different thing.
https://forum.reefangel.com/status/para ... ?id=sbidny
The REM tag is the one for the enabled relay boxes.
REM=3 means Box1 and Box2 are enabled. It should be REM=7 if you were using the code above.
Try this:
Open Arduino and just compile the code.
Then after successful compilation, upload it one more time.
Does it work now?
I have a feeling there may be a bug on the upload button that doesn't apply the correct features.

Re: Relay Expansion Working But Not Showing

Posted: Sun Jan 06, 2019 12:24 am
by sbidny
Yup, that did it. Good trick to know. Thanks.