internal memory and wierd relay issues

New members questions
Post Reply
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

internal memory and wierd relay issues

Post by sabo »

Hi. Ive just uploaded code to my controller using internal memory, and its not making much sense. ports 1-4 are always on, with port 4 off on overheat. However, port 2 seems to be always stuck off, and port 4 turns on when I clear the ato on the android app. Ive taken a look at the sketch the wizard generated and looked at the initial memory code and I cant seem to make much sense of it.
Ive also tried to find some info on internal memory without much luck getting something that makes sense in how the internal memory works on RA. If someone can point me to even a README in the libraries that sheds some light on it all would be much appreciated.
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: internal memory and wierd relay issues

Post by sabo »

OK, this gets weirder :) I have a powerhead plugged into port 2, and toggling both port 2 and 4 with the android app makes relay 2 switch.
Another question, is the overheat temp is in celcius, but the heater on/off appears to be in F. I changed it to C, is that wrong?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: internal memory and wierd relay issues

Post by rimai »

Can you try using hard coded settings first to make sure everything is working as intended and we move to internal memory later?
You can also use the ControllerTester code in the examples folder to check each port of the relay box.
Roberto.
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: internal memory and wierd relay issues

Post by sabo »

Yeah, the relay box works fine when its all in the code, its only when I use internal memory that this issue appears. If I cant work it out i'll go back to using it all in the code.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: internal memory and wierd relay issues

Post by lnevo »

Did you run the pde to initialize memory? Did you go into the portal and update the relevant parameters to what you want under internal memory?
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: internal memory and wierd relay issues

Post by sabo »

I had a little play in the portal and with the android app. Its not so much about changing setting as to why port 2 and 4 seem to be tied together somehow when I switch them with the android app. When I ran the wizard, ports 1-4 were set to always on, with port 4 set to switch off with overheat, but for some reason port 4 is tied to the ato clear and port 2 sometimes switches when I use the app, and sometimes doesnt. I cant work out what its tied to. Which file defines the various ports to the labels in the portal and app?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: internal memory and wierd relay issues

Post by rimai »

Can you post your code?
Roberto.
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: internal memory and wierd relay issues

Post by sabo »

Here you go.

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 <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.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port6Bit;
    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 = Port4Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port1Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;

    // 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( Port2 );
    ReefAngel.Relay.On( Port3 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );
    ReefAngel.Relay.On( Box1_Port3 );
    ReefAngel.Relay.On( Box1_Port4 );
    ReefAngel.Relay.On( Box1_Port5 );

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

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

void loop()
{
    ReefAngel.WaterLevelATO( Port6 );
    ReefAngel.Relay.DelayedOn( Box1_Port6 );
    ReefAngel.MoonLights( Box1_Port7 );
    ReefAngel.DCPump.UseMemory = true;
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    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
    

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

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

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

Re: internal memory and wierd relay issues

Post by rimai »

I doesn't look like code related.
If the port is set to always on, it wouldn't be tied to ATO function.
Can you switch the svga cables between your relay expansion and your main box?
Roberto.
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: internal memory and wierd relay issues

Post by sabo »

Swapped and same thing. But the ato clear is actually on port six, not 4. I must have gotten mixed up when playing with it last night, so the ato timeout and clear is working as expected, its just that ports 2 and 4 dont switch with the app. They do sometimes (i did get them switching last night, i'm just not sure what it is that makes them work sometimes and not others) i'll continue playing with it and try and see if I can work out what the relationship is.

Just managed to get them to switch with the portal about 4 times, then it stopped working. Its odd, every other relay works with the app and portal, its just 2 and 4 seem to be misbehaving, and I dont think its the relay box, as those ports worked fine when I didnt use internal memory,
sabo
Posts: 129
Joined: Tue Sep 24, 2013 3:18 am

Re: internal memory and wierd relay issues

Post by sabo »

And I just discovered my programming cable has the green wire come loose.. I'll see if the local electronics shop has a plug for it tomorrow.. Cant seem to catch a break with this thing :(
Post Reply