Relay Expansion Module

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

Relay Expansion Module

Post by chase »

Got my extra relay box w/ expansion module in recently and I can't seem to get any of the ports turned on.
1. Jumpers are in the head unit
2. Switch settings are all in the off position (ID#1)
3. Green power light is on
4. Loaded code to turn all the ports on
5. Ran I2C Scanner as well
PDE Code:

Code: Select all

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>


#define Daylight            1
#define AutoTopOff          2
//#define Chiller             2
#define Heater              3
#define Return              4
#define WavemakerL          5
#define WavemakerR          6
#define LEDs                7
#define Refugium            8

void setup()
{
   randomSeed(analogRead(0)); //wm stuff 
    ReefAngel.Init();  //Initialize controller   
    ReefAngel.FeedingModePorts = B00001000;
    ReefAngel.WaterChangePorts = B00000000;
    ReefAngel.OverheatShutoffPorts = B00000101;
    ReefAngel.LightsOnPorts = B00000001;
    // Ports that are always on
    ReefAngel.Relay.On(Return); //port 4
        //relay expansion testing
        ReefAngel.Relay.On(11); //testing ID1 
        ReefAngel.Relay.On(12);
        ReefAngel.Relay.On(13);
        ReefAngel.Relay.On(14);
        ReefAngel.Relay.On(15);
        ReefAngel.Relay.On(16);
        ReefAngel.Relay.On(17);
        ReefAngel.Relay.On(18);
        /*ReefAngel.Relay.On(21); //testing ID2
        ReefAngel.Relay.On(22);
        ReefAngel.Relay.On(23);
        ReefAngel.Relay.On(25);
        ReefAngel.Relay.On(26);
        ReefAngel.Relay.On(27);
        ReefAngel.Relay.On(28);*/
   //wm stuff
    ReefAngel.Timer[1].SetInterval(random(15,35));
    ReefAngel.Timer[1].Start(); 
    ReefAngel.Relay.On(WavemakerL);
}

void loop()
{
    ReefAngel.ShowInterface();
//    ReefAngel.StandardFan(Chiller,775,783); Removed for ATO function
    ReefAngel.StandardHeater(Heater,768,771);
    ReefAngel.StandardLights(Daylight,9,0,20,30);  //Daylight schedule 9:00am - 8:30pm
    ReefAngel.StandardLights(Refugium,21,0,9,0);  //Refugium schedule 9:00pm - 9:00am
    ReefAngel.StandardLights(LEDs,8,30,22,0);  //LED schedule 8:30am - 10:00pm   
    ATOFailSafe(AutoTopOff); //ATO Stuff  
    //Wavemaker stuff
    if ( ReefAngel.Timer[1].IsTriggered() )
      {
        ReefAngel.Timer[1].SetInterval(random(15,30));
        ReefAngel.Timer[1].Start();
        ReefAngel.Relay.Toggle(WavemakerL); //port 5
        ReefAngel.Relay.Toggle(WavemakerR); //port 6
       }
}

void ATOFailSafe(byte ATO) //changed port to ATO
{
   // Check for the low switch
   /*
   If the Low switch is active, meaning the float is opposite the end with the two wires,
        we are empty so we should turn on the pump.  Otherwise, we are full, so turn off the port.
   */
   if ( ReefAngel.LowATO.IsActive() )
   {
      ReefAngel.LowATO.StartTopping();
      ReefAngel.Relay.On(ATO);
   }
   else
   {
      ReefAngel.LowATO.StopTopping();
      ReefAngel.Relay.Off(ATO);
   }

   if ( ReefAngel.LowATO.IsTopping() && ! ReefAngel.HighATO.IsActive() )
   {
      // We have a problem
      /*
      The pump is running and topping but the low switch isn't shutting off the port.
      We must shutoff the port ourself.
      */
      ReefAngel.Relay.Off(ATO);
      // Trigger some sort of alert, maybe an email or text message

      /*
      We did not indicate that the port is not topping anymore, we could do that manually
      OR we could not do it and replace the switch and have the controller do it for us.
      It's completely up to the user.
      At this point, it shouldn't matter because there is a problem with the switch and that
      needs to be addressed.
      */
  }
}
I2C Results:

Code: Select all

I2CScanner ready!
starting scanning of I2C bus from 1 to 128...
addr: 1       	addr: 2       	addr: 3       	addr: 4       
addr: 5       	addr: 6       	addr: 7       	addr: 8       
addr: 9       	addr: 10       	addr: 11       	addr: 12       
addr: 13       	addr: 14       	addr: 15       	addr: 16       
addr: 17       	addr: 18       	addr: 19       	addr: 20       
addr: 21       	addr: 22       	addr: 23       	addr: 24       
addr: 25       	addr: 26       	addr: 27       	addr: 28       
addr: 29       	addr: 30       	addr: 31       	addr: 32 found!
addr: 33       	addr: 34       	addr: 35       	addr: 36       
addr: 37       	addr: 38       	addr: 39       	addr: 40       
addr: 41       	addr: 42       	addr: 43       	addr: 44       
addr: 45       	addr: 46       	addr: 47       	addr: 48       
addr: 49       	addr: 50       	addr: 51       	addr: 52       
addr: 53       	addr: 54       	addr: 55       	addr: 56 found!
addr: 57       	addr: 58       	addr: 59       	addr: 60       
addr: 61       	addr: 62       	addr: 63       	addr: 64       
addr: 65       	addr: 66       	addr: 67       	addr: 68       
addr: 69       	addr: 70       	addr: 71       	addr: 72       
addr: 73       	addr: 74       	addr: 75       	addr: 76       
addr: 77       	addr: 78       	addr: 79       	addr: 80 found!
addr: 81       	addr: 82       	addr: 83       	addr: 84 found!
addr: 85       	addr: 86       	addr: 87       	addr: 88       
addr: 89       	addr: 90       	addr: 91       	addr: 92       
addr: 93       	addr: 94       	addr: 95       	addr: 96       
addr: 97       	addr: 98       	addr: 99       	addr: 100       
addr: 101       	addr: 102       	addr: 103       	addr: 104 found!
addr: 105       	addr: 106       	addr: 107       	addr: 108       
addr: 109       	addr: 110       	addr: 111       	addr: 112       
addr: 113       	addr: 114       	addr: 115       	addr: 116       
addr: 117       	addr: 118       	addr: 119       	addr: 120       
addr: 121       	addr: 122       	addr: 123       	addr: 124       
addr: 125       	addr: 126       	addr: 127       	addr: 128       

done
Thanks in advance!
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Relay Expansion Module

Post by binder »

Did you enable RelayExp in your Features file? It's gotta be enabled in order for the controller to compile in the extra code to work with the relays.

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

Re: Relay Expansion Module

Post by chase »

binder wrote:Did you enable RelayExp in your Features file? It's gotta be enabled in order for the controller to compile in the extra code to work with the relays.

curt
That was exactly it- thanks! I missed it because it wasn't mentioned in the relay expansion module doc. ;)
Image
poolman
Posts: 17
Joined: Mon Jan 30, 2012 1:36 am

Re: Relay Expansion Module

Post by poolman »

Hi

Have the same problem, where and how do I "enable relayExp in the features file?

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

Re: Relay Expansion Module

Post by rimai »

Make sure to check the Expansion module on the features tab of RAGen.
Also, make sure to place the jumpers as instructed on the manual.
Roberto.
poolman
Posts: 17
Joined: Mon Jan 30, 2012 1:36 am

Re: Relay Expansion Module

Post by poolman »

Hi Roberto, found the problem with the Arduino folder not pointing to the correct location in RA Gen.

Thanks
Post Reply