Trouble setting up RF Addon

Expansion modules and attachments
Post Reply
windsweptfarm
Posts: 13
Joined: Mon Jul 01, 2013 10:53 am

Trouble setting up RF Addon

Post by windsweptfarm »

I recently got the RF module. Haven't had time to really work on custom coding for it yet, but I wanted to get it up and running using RA wizard. Decided to have it default on to Nutrient Transport mode. (code set up by wizard). I reset the memory on my two vortechs, then uploaded my code. The RF module's LED is purple so it is in Nutrient Transport mode. Can't set my vortechs to slave mode. The pump controllers and RF module are literally next to each other. Pumps keep flashing red and blue after trying to set them as slaves (not communicating). I must be missing a setup step to formally set the RF module to master and the pumps to slave. Need some help. Thanks, Casey
#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>

// Custom menus
#include <avr/pgmspace.h>
prog_char menu1_label[] PROGMEM = "Reset Skimmer";
prog_char menu2_label[] PROGMEM = "Reset Return Pump";
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 = "PHE Calibration";
prog_char menu7_label[] PROGMEM = "Salinity Calibration";
prog_char menu8_label[] PROGMEM = "WL Calibration";
prog_char menu9_label[] PROGMEM = "Date / Time";

// 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
};

////// Place global variable code below here
boolean overflow_plugged = false;
boolean skimmate_full = false;
boolean calcium_low = false;
boolean alkalinity_low = false;

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


void setup()
{
    // This must be the first line
    ReefAngel.Init(); //Initialize controller
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
    ReefAngel.Use2014Screen(); // Let's use 2014 Screen
    ReefAngel.AddSalinityExpansion(); // Salinity Expansion Module
    ReefAngel.AddPHExpansion(); // pH Expansion Module
    ReefAngel.AddWaterLevelExpansion(); // Water Level Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port4Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port4Bit;
    ReefAngel.WaterChangePortsE[0] = Port2Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port5Bit | Port6Bit;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit | Port5Bit | Port6Bit;
    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( 869 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 ); //VorTech MP40
    ReefAngel.Relay.On( Port2 ); //VorTech MP10
    ReefAngel.Relay.On( Port4 ); //Return Pump
    ReefAngel.Relay.On( Port8 ); //Skimmer
    ReefAngel.Relay.On( Box1_Port3 ); // Unused
    ReefAngel.Relay.On( Box1_Port4 ); // Unused
    ReefAngel.Relay.On( Box1_Port5 ); //4 Channel Dosing Pump
    ReefAngel.Relay.On( Box1_Port6 ); //Sump Light
    ReefAngel.Relay.On( Box1_Port7 ); //pH Expansion
    ReefAngel.Relay.On( Box1_Port8 ); //Salinity Expansion

    ////// Place additional initialization code below here
ReefAngel.CustomLabels[0]="VorTech MP40";
ReefAngel.CustomLabels[1]="VorTech MP10";
ReefAngel.CustomLabels[2]="Heater";
ReefAngel.CustomLabels[3]="Return Pump";
ReefAngel.CustomLabels[4]="Actinics";
ReefAngel.CustomLabels[5]="Daylight";
ReefAngel.CustomLabels[6]="Blue Moon";
ReefAngel.CustomLabels[7]="Skimmer";
ReefAngel.CustomLabels[8]="Swabbie";
ReefAngel.CustomLabels[9]="ATO";
ReefAngel.CustomLabels[10]="Unused";
ReefAngel.CustomLabels[11]="Unused";
ReefAngel.CustomLabels[12]="Dosing Pump";
ReefAngel.CustomLabels[13]="Sump Light";
ReefAngel.CustomLabels[14]="pH Exp";
ReefAngel.CustomLabels[15]="Salinity Exp";

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

void loop()
{
    ReefAngel.StandardHeater( Port3,780,800 );
    ReefAngel.StandardLights( Port5,7,0,19,0 ); // Actinics
    ReefAngel.StandardLights( Port6,8,0,18,0 ); // Daylight
    ReefAngel.StandardLights( Port7,19,0,0,0 ); // Blue Moon
    ReefAngel.DosingPumpRepeat( Box1_Port1,0,240,30 ); // Actually controlling swabbie.
    ReefAngel.StandardATO( Box1_Port2,120 );
    ReefAngel.PWM.SetDaylight( PWMSlope(8,0,18,0,10,100,60,10) );
    ReefAngel.PWM.SetActinic( PWMSlope(7,0,19,0,10,100,60,10) );
    ReefAngel.RF.UseMemory = false;
    ReefAngel.RF.SetMode( NutrientTransport,45,40 );
    ////// Place your custom code below here
    
    
    /// set custom variables for portal
    {
      ReefAngel.CustomVar[0] = overflow_plugged;
      ReefAngel.CustomVar[1] = skimmate_full;
      ReefAngel.CustomVar[2] = calcium_low;
      ReefAngel.CustomVar[3] = alkalinity_low;
    }
    
    
    {
      static byte sump_level=0;
      static byte overflow_level=0;
      
      sump_level= ReefAngel.WaterLevel.GetLevel (0);
      overflow_level= ReefAngel.WaterLevel.GetLevel (3);
        
        if (((sump_level < 50) or (overflow_level > 75)) && (millis()>1000)) { // Turn off sump if overflow begins to crest and
          overflow_plugged = true; // sump level drops when overflow is obstructed.
          bitClear(ReefAngel.Relay.RelayMaskOff,3);
          ReefAngel.LED.On();}
          
          if (((sump_level >= 80) or (sump_level < 40)) && (millis()>1000)) { // Toggles skimmer on and off if sump depth too great.
            ReefAngel.Relay.Off (Box0_Port8);} // Avoids skimmer overflow. Used this code instead of delayed start for skimmer.
            
          if ((sump_level <= 76) && (sump_level > 45)) { // Otherwise skimmer is on unless sump level too low.
              ReefAngel.Relay.On (Box0_Port8);}
              
    }
    
    
    {
      static byte skimmate_level=0;
      
      skimmate_level = ReefAngel.WaterLevel.GetLevel (1);
      
        if (skimmate_level > 75) {
          skimmate_full = true;}
          
            if (skimmate_level < 70) {
            skimmate_full = false;}
        
            if (skimmate_level > 80) { // Turn off skimmer when skimmate container is full.
            bitClear(ReefAngel.Relay.RelayMaskOff,7);
            ReefAngel.LED.On();}
    }
    
    {
      static byte calcium_level=0;
      
      calcium_level = ReefAngel.WaterLevel.GetLevel (4); // Alert when calcium tank is low.
      
        if (calcium_level < 10) {
          calcium_low = true;}
          
          if (calcium_level > 20) {
            calcium_low = false;}
    }
    
    {
      static byte alkalinity_level=0;
      
      alkalinity_level = ReefAngel.WaterLevel.GetLevel (2); // Alert when alkalinity tank is low.
      
        if (alkalinity_level < 10) {
          alkalinity_low = true;}
          
          if (alkalinity_level > 20) {
            alkalinity_low = false;}
        }
          
      

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

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


  void MenuEntry1()
  {
    bitSet (ReefAngel.Relay.RelayMaskOff,7);
    ReefAngel.LED.Off();
    ReefAngel.DisplayMenuEntry ("Reset Skimmer");
  }
  void MenuEntry2()
  {
    bitSet (ReefAngel.Relay.RelayMaskOff,3);
    ReefAngel.LED.Off();
    overflow_plugged = false;
    ReefAngel.DisplayMenuEntry ("Reset Return Pump");
  }
  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.SetupCalibratePHExp();
    ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
  }
  void MenuEntry7()
  {
    ReefAngel. SetupCalibrateSalinity();
    ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
  }
  void MenuEntry8()
  {
    ReefAngel.SetupCalibrateWaterLevel();
    ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
  }
  void MenuEntry9()
  {
    ReefAngel.SetupDateTime();
    ReefAngel.DisplayedMenu = ALT_SCREEN_MODE;
  }
    
   
    


User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Trouble setting up RF Addon

Post by lnevo »

You have to load the RF setup code to pair them up. Then you can go back to your code.
windsweptfarm
Posts: 13
Joined: Mon Jul 01, 2013 10:53 am

Re: Trouble setting up RF Addon

Post by windsweptfarm »

thanks Lee
windsweptfarm
Posts: 13
Joined: Mon Jul 01, 2013 10:53 am

Re: Trouble setting up RF Addon

Post by windsweptfarm »

All linked up. Do I have to remove the setup code or just leave it. My vortechs went into nutrient transport mode after the slaves were set up and the setup screen on RA is no longer present. I had just added the setup code to my working sketch. Thanks again for the help. Casey
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Trouble setting up RF Addon

Post by lnevo »

No no..just go back to your previous code. Setup is only needed once.
Post Reply