Setting up the Expansion Hub

Basic / Standard Reef Angel hardware
Post Reply
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Setting up the Expansion Hub

Post by chase »

I couldn't find any specific manual for the Expansion Hub in the Downloads section. Do I need to do anything other than follow the instructions (seems to be just plugging in) other than what's provided in the Expansion Module manual? I just upgraded to a RA+ running the 9.9 libraries. I created my ino file using the wizard and plan on connecting my extra relay box and salinity module to the hub.
Here's the code I currently have loaded:

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 <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
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port4Bit;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port2Bit | Port3Bit;
    ReefAngel.WaterChangePortsE[0] = Port7Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 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( 830 );


    // Ports that are always on
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Box1_Port5 );
    ReefAngel.Relay.On( Box1_Port6 );
    ReefAngel.Relay.On( Box1_Port8 );

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

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

void loop()
{
    ReefAngel.StandardLights( Port1,9,0,21,0 );
    ReefAngel.SingleATO( true,Port2,300,0 );
    ReefAngel.StandardHeater( Port3,785,789 );
    ReefAngel.WavemakerRandom( Port5,10,15 );
    ReefAngel.WavemakerRandom( Port6,10,15 );
    ReefAngel.StandardLights( Port7,21,0,23,0 );
    ReefAngel.StandardLights( Port8,21,0,9,0 );
    ReefAngel.DosingPumpRepeat( Box1_Port3,0,120,2 );
    ReefAngel.DosingPumpRepeat( Box1_Port4,5,120,3 );
    ReefAngel.StandardHeater( Box1_Port7,777,781 );
    ////// Place your custom code below here
    

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

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

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

    // Salinity
    ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,15,54, "SAL:" );
    ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,39,54, ReefAngel.Params.Salinity );
    pingSerial();

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

    // Relay Expansion
    TempRelay = ReefAngel.Relay.RelayDataE[0];
    TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
    TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
    ReefAngel.LCD.DrawOutletBox( 12, 98, TempRelay );
    pingSerial();

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

void DrawCustomGraph()
{
}
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Setting up the Expansion Hub

Post by rimai »

Just plug into the main relay box. That's it :)
Roberto.
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Re: Setting up the Expansion Hub

Post by chase »

Awesome, thanks! On another note I've noticed the wavemaker on port 6 has not been turning on, but 5 toggles as expected using the random interval. I am able to turn it on via the RA Client I/F.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Setting up the Expansion Hub

Post by rimai »

That is the way the libraries are set to work. Only one random function.
You can set port 6 to be opposite of 5.
If you still want port 6 to be totally random too, just like 5, we can create a special function for you.
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Setting up the Expansion Hub

Post by rimai »

Roberto.
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Re: Setting up the Expansion Hub

Post by chase »

Great, that's working now. Just used the opposite function in the reply to my old thread like you suggested ;) I just tried to calibrate my salinity probe via the menu, but the number in red reads 0. I know the controller sees the probe because on the main screen it said 60, and when I put it in the 35 sol it says 59.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Setting up the Expansion Hub

Post by rimai »

If you go to the calibration menu and it shows 0, it means that it is either not reading the probe or not finding the module.
The red number has to change.
Roberto.
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Re: Setting up the Expansion Hub

Post by chase »

Alright, well I've been messing around for a while and I'm not having much luck. So far here's what I can verify:
1) The #include <Salinity.h> is in my sketch
2) My features file contains #define SALINITYEXPANSION
3) The Salinity exp module is plugged in to my expansion hub, which is plugged into my main relay box.
4) A sal value of 59 shows up on the main controller screen
5) The value still reads 0 in the sal calibration menu
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Setting up the Expansion Hub

Post by rimai »

What happens if you connect the salinity module directly into your main relay box?
Roberto.
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Re: Setting up the Expansion Hub

Post by chase »

No change- the power supply light is green, the Salinity Exp Module Light is green too. I also power cycled the controller after plugging directly into the main relay box.

I've also noticed since upgrading to .9.9 my expansion relay box works through the RA Client by turning ports off/on, but doesn't appear to update, all ports show off. Everything shows up fine, including the ports being off/on via the controller screen though. Not trying to confuse the issue, since the expansion ports seem to be working fine, just thought I'd mention it. I suppose that would rule out the Expansion Hub being faulty (there is a green light on it when plugged into the main relay box).
Image
chase
Posts: 101
Joined: Fri Sep 16, 2011 8:26 am

Re: Setting up the Expansion Hub

Post by chase »

Okay, I assumed that since the SDA/SCL jumpers were on the RA+ board it was already configured. Apparently they are offset. So I went ahead and fully connected the jumpers and the numbers show up in the cal window. Only other question is the jumper offset on RST. Should that be fully connected or just offset too?
Edit: I assume the offset is for storage, so the jumpers aren't easily lost.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Setting up the Expansion Hub

Post by rimai »

Good :)
All three should be inserted and not offset for your case.
Roberto.
Post Reply