New Setup, Need Help w/RF

Do you have a question on how to do something.
Ask in here.
Post Reply
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

New Setup, Need Help w/RF

Post by robmwpropane »

I've got the RA+, wifi, RF

I have the RA setup and running, and the wifi up and running. I have all ports forwarded and can see it weather on my local network or not. It works great in that aspect. I'd like to get the RF setup, I have 2 mp40wes. I've read the manual, but I can't figure out what to do? (as of right now, I really only have the RA controlling the heater, nothing else is plugged in yet, but all ports work great via app, portal, etc.)

My current code;

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


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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit;
    // 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( Port2 );
    ReefAngel.Relay.On( Port3 );

    ////// Place additional initialization code below here
    
   
    ReefAngel.Init();  //Initialize controller
    ReefAngel.LCD.DrawText(0,255,20,50,"Assigning Slaves");
    ReefAngel.RF.SendData(Slave_Start,0,0);
    ReefAngel.RF.UseMemory=true;
    InternalMemory.RFMode_write(0);
    InternalMemory.RFSpeed_write(128);
    InternalMemory.RFDuration_write(10);

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

void loop()
{
    ReefAngel.StandardHeater( Port1,790,800 );
    ReefAngel.RF.UseMemory = false;
    ReefAngel.RF.SetMode( ReefCrest,80,10 );
    
    ////// Place your custom code below here
    
    ReefAngel.Refresh();
    if (ReefAngel.Joystick.IsButtonPressed())
    {
      ReefAngel.RF.UseMemory=true;
      ReefAngel.RF.SendData(Slave_Stop,0,0);
      ReefAngel.LCD.DrawText(0,255,50,60,"Done");
    }
    ////// Place your custom code above here

}





The RF manual says to pull it from the examples and upload, but will that not "over write" my current code when I upload? Here's what the GUI spits out for the RF code;

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 <ReefAngel.h>

//#define Constant      0
//#define Random1       1 // Lagoonal
//#define Random2       2 // Reef Crest
//#define ShortWave     3
//#define LongWave      4
//#define Smart_NTM     5 // Nutrient Transport Mode
//#define Smart_TSM     6 // Tidal Swell Mode
//#define Feeding_Start 7
//#define Feeding_Stop  8
//#define Night         9
//#define Slave_Start   97
//#define Slave_Stop    98
//#define None          99

void setup()
{
  ReefAngel.Init();  //Initialize controller
  ReefAngel.LCD.DrawText(0,255,20,50,"Assigning Slaves");
  ReefAngel.RF.SendData(Slave_Start,0,0);
  ReefAngel.RF.UseMemory=true;
  InternalMemory.RFMode_write(0);
  InternalMemory.RFSpeed_write(128);
  InternalMemory.RFDuration_write(10);
}

void loop()
{
  ReefAngel.Refresh();
  if (ReefAngel.Joystick.IsButtonPressed())
  {
    ReefAngel.RF.UseMemory=true;
    ReefAngel.RF.SendData(Slave_Stop,0,0);
    ReefAngel.LCD.DrawText(0,255,50,60,"Done");
  }
}





My thought is to add these together, and then upload at once? I don't understand how to do that, or I'm not understanding all together, lol. How would I set it up to change the vortechs from the app? Do I add the code to memory when the wizard asks to do so?

Sorry for being such a noob, thanks for any help, and Happy Thanksgiving!!!
Last edited by robmwpropane on Fri Nov 25, 2016 1:24 pm, edited 3 times in total.
Image
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

Re: New Setup, Need Help w/RF

Post by robmwpropane »

So, here's what I came up with. When someone gets a chance, could they take a look and tell me if I'm on the right track?

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


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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit;
    // 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( Port2 );
    ReefAngel.Relay.On( Port3 );

    ////// Place additional initialization code below here
    
   
    ReefAngel.Init();  //Initialize controller
    ReefAngel.LCD.DrawText(0,255,20,50,"Assigning Slaves");
    ReefAngel.RF.SendData(Slave_Start,0,0);
    ReefAngel.RF.UseMemory=true;
    InternalMemory.RFMode_write(0);
    InternalMemory.RFSpeed_write(128);
    InternalMemory.RFDuration_write(10);

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

void loop()
{
    ReefAngel.StandardHeater( Port1,790,800 );
    ReefAngel.RF.UseMemory = false;
    ReefAngel.RF.SetMode( ReefCrest,80,10 );
    
    ////// Place your custom code below here
    
    ReefAngel.Refresh();
    if (ReefAngel.Joystick.IsButtonPressed())
    {
      ReefAngel.RF.UseMemory=true;
      ReefAngel.RF.SendData(Slave_Stop,0,0);
      ReefAngel.LCD.DrawText(0,255,50,60,"Done");
    }
    ////// Place your custom code above here


}





Last edited by robmwpropane on Fri Nov 25, 2016 1:25 pm, edited 1 time in total.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Setup, Need Help w/RF

Post by rimai »

No. you need to load the RF code only once to sync the pumps with the RF module. Once they are synced, you don't need that code anymore.
It's a code dedicated to syncing the pumps only. It can't do anything else.
Then you can generate a code with the wizard and upload and everything should start working.
Roberto.
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

Re: New Setup, Need Help w/RF

Post by robmwpropane »

rimai wrote:No. you need to load the RF code only once to sync the pumps with the RF module. Once they are synced, you don't need that code anymore.
It's a code dedicated to syncing the pumps only. It can't do anything else.
Then you can generate a code with the wizard and upload and everything should start working.
Thanksgiving got in the way! Jk, so I upload the code for Rf to the RA, hook everything up, let it sync. After that, unplug, reload the other code that I have running now, and that's it?

Should I be setting storage to internal memory if I want to control them from the app when I re-upload code?

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

Re: New Setup, Need Help w/RF

Post by rimai »

if it got synced, it should work.
Post the code and we can confirm.
Roberto.
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

Re: New Setup, Need Help w/RF

Post by robmwpropane »

So I did as you said, everything is working. Some things to note,

I can not change vortech modes from the android app? It only displays mode and speed, NO duration? And again, I can't make changes?

I can change from the portal, however, when I uploaded the code, my portal went bonkers? It was if though I had every attachment there was. It took a good 5 minutes to go back to being accurate.

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


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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


    // Ports that are always on
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port3 );

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

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

void loop()
{
    ReefAngel.StandardHeater( Port1 );
    ReefAngel.RF.UseMemory = true;
    ////// Place your custom code below here
    

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


}

Last edited by robmwpropane on Fri Nov 25, 2016 1:25 pm, edited 1 time in total.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Setup, Need Help w/RF

Post by rimai »

Yes, you can.
Tap and hold the mode.
It should pop up a box to allow you to change the modes.
Roberto.
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

Re: New Setup, Need Help w/RF

Post by robmwpropane »

rimai wrote:Yes, you can.
Tap and hold the mode.
It should pop up a box to allow you to change the modes.
It works!! Thanks! Not as intuitive as the relay ports that are grayed out boxes. I did tap mode, just never thought to hold.

I've looked through countless threads on here. Is there a easy way to set up the vortechs for waves, nutrient export, etc? The way I did it before was to play with the dials and then save the mode? Right now I have 2 mp40wes, one is sync, the other anti sync.

I borrowed some of your code I found in a thread to change modes throughout the day, I just don't understand? Can you add some explanation for what the numbers mean and how I can change it for my needs? I added comments to what I don't understand.

Just when you get time, thank you very much!

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


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


void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port1Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


    // Ports that are always on
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port3 );

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

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

void loop()
{
    ReefAngel.StandardHeater( Port1 );
    ReefAngel.RF.UseMemory = true;
    
    ////// Place your custom code below here
    
    if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
  {
    if (hour()>=15 && hour()<=17) ////WHAT DO #'s MEAN?
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(LongWave,100,3);  ////Can I change this to any mode?
    }
    else if (hour()>=22 || hour()<7) ////WHAT DO #'s MEAN?
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(ReefCrest,40,0); ////WHAT DO #'s MEAN?
    }
    else
    {
      ReefAngel.RF.UseMemory=true; ////Does this need to be here at the end?
    }

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


}

Last edited by robmwpropane on Fri Nov 25, 2016 1:25 pm, edited 1 time in total.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Setup, Need Help w/RF

Post by rimai »

Whe you use ReefAngel.RF.UseMemory=true; it will use settings store in your internal memory that you set with the phone app.
If you want the controller to use a different one, you need to set it to false.
if (hour()>=15 && hour()<=17) means is hour of the day is greater than or equal to 15 and hour of the day is less than or equal to 17 do something
ReefAngel.RF.SetMode(LongWave,100,3); means longwave mode with 100% speed and pulse duration of 3 seconds.
Roberto.
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

Re: New Setup, Need Help w/RF

Post by robmwpropane »

rimai wrote:Whe you use ReefAngel.RF.UseMemory=true; it will use settings store in your internal memory that you set with the phone app.
If you want the controller to use a different one, you need to set it to false.
if (hour()>=15 && hour()<=17) means is hour of the day is greater than or equal to 15 and hour of the day is less than or equal to 17 do something
ReefAngel.RF.SetMode(LongWave,100,3); means longwave mode with 100% speed and pulse duration of 3 seconds.
Will I still be able to control the modes through the app if set to false?

In the app, what is the difference between "home" and "away", what is it's purpose?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Setup, Need Help w/RF

Post by rimai »

When set to false, you won't be able to control with app.
That's why the code is set to true on other times than the ones you want to override through code.
Roberto.
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

Re: New Setup, Need Help w/RF

Post by robmwpropane »

Just so I'm on the right track, the code below is;
Memory set to true, use app (or memory) settings
Set to false between the hours of 3pm and 5pm; mode set to longwave 100%, 3 seconds
Set to false between the hours of 10pm and 7pm; mode set to reefcrest 40%, 0 seconds

3 questions;
1.) am I on the right track
2.) what does setting the duration to "0" do
3.) why in the app is there "home" and "away"; ie, what's the difference?


Code: Select all


void loop()
{
    ReefAngel.StandardHeater( Port1 );
    ReefAngel.RF.UseMemory = true;
    
    ////// Place your custom code below here
    
    if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
  {
    if (hour()>=15 && hour()<=17) ////WHAT DO #'s MEAN?
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(LongWave,100,3);  ////Can I change this to any mode?
    }
    else if (hour()>=22 || hour()<7) ////WHAT DO #'s MEAN?
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(ReefCrest,40,0); ////WHAT DO #'s MEAN?
    }
    else
    {
      ReefAngel.RF.UseMemory=true; ////Does this need to be here at the end?
    }

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


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

Re: New Setup, Need Help w/RF

Post by rimai »

I think you are good.
Duration is how long between changes.
Home and away is for different profiles.
You may have internet that blocks incoming from inside you own network. I do. So I have to setup a home with internal ip and away with external IP.
Roberto.
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

Re: New Setup, Need Help w/RF

Post by robmwpropane »

rimai wrote:I think you are good.
Duration is how long between changes.
Home and away is for different profiles.
You may have internet that blocks incoming from inside you own network. I do. So I have to setup a home with internal ip and away with external IP.
I see. Both home and away that I have set work weather I'm on my network or not. I have my external ip set for both.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Setup, Need Help w/RF

Post by rimai »

lucky u :)
Roberto.
robmwpropane
Posts: 78
Joined: Mon Oct 31, 2016 12:33 pm

Re: New Setup, Need Help w/RF

Post by robmwpropane »

I'm still haveing a bit of trouble understanding. What does this line do?

Code: Select all

if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
and especially in conjunction with this;

Code: Select all

if (hour()>=15 && hour()<=17) //----------Between 3pm and 5 pm
Original code (the only thing I've changed is the comments);

Code: Select all

void loop()
{
    ReefAngel.StandardHeater( Port1 );
    ReefAngel.RF.UseMemory = true;
    
    ////// Place your custom code below here
    
    if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
    {
    if (hour()>=15 && hour()<=17) //----------Between 3pm and 5 pm
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(LongWave,100,3); //----------LongWave, 100%, 3 seconds
    }
    else if (hour()>=22 || hour()<7) //----------Between 10pm and 7am
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(ReefCrest,40,0); //----------ReefCrest, 40%, 0ms
    }
    else
    {
      ReefAngel.RF.UseMemory=true; //----------Return to default settings
    }
Edit: I think I get it. If in Feeding Mode OR Water Change Mode switch to these settings if between 3pm-5pm, 10pm-7am

What I don't understand is the && or ||. I know what they mean(&& is for both be true, || is for either be true) but I don't understand the logic here. Couldn't the "||" in this line be a "&&" or vice versa?

Code: Select all

else if (hour()>=22 || hour()<7)
Edit 2: I think it's because everything starts over at 12am. So it would be only true if after 10pm OR before 7am because the code starts over at 12am and both instances can not be true.

Funny, I'm not going to use this code, I just wanted to dissect it to understand it. If someone could confirm all my ramblings, I'd appreciate it. Thanks!! :D
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: New Setup, Need Help w/RF

Post by rimai »

You got it.
!= means NOT
&& means AND
|| means OR
Roberto.
Post Reply