Page 6 of 6

Re: RF Expansion Module

Posted: Mon Jan 21, 2013 10:26 am
by smoothdog
That time the light just turned blue and stays blue. Even after clicking the knob and re-uploading the code generated by running the wizard it stays blue.

Re: RF Expansion Module

Posted: Mon Jan 21, 2013 10:32 am
by rimai
What about this one:

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.SetMode(Slave_Start,0,0);

  InternalMemory.RFMode_write(97);
  InternalMemory.RFSpeed_write(50);
  InternalMemory.RFDuration_write(10);
}

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

Re: RF Expansion Module

Posted: Mon Jan 21, 2013 10:39 am
by smoothdog
Now the light is off altogether.

Re: RF Expansion Module

Posted: Mon Jan 21, 2013 10:47 am
by rimai
Give me a few hours.
I don't have a RF module on me right now.

Re: RF Expansion Module

Posted: Mon Jan 21, 2013 11:10 am
by smoothdog
OK, thanks.

Re: RF Expansion Module

Posted: Mon Jan 21, 2013 3:47 pm
by rimai
Try this:

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=false;
  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");
  }
}


Re: RF Expansion Module

Posted: Mon Jan 21, 2013 7:17 pm
by smoothdog
We have sycronization! Thanks Roberto!

Re: RF Expansion Module

Posted: Mon Jan 21, 2013 7:19 pm
by rimai
Great!!!
Thanks for informing me about this issue.
Libs 1.0.3 had a slight change on how the modes were handled.
I need to update the VortechSetup code to this one now.

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 2:06 pm
by DrewPalmer04
Stupid question...

If the night mode issue fixed on the RF module?

I want to define different modes based on time...but the logic is backwards....I want to define modes based on get.actinic values throughout the day...

not sure how to pull this off....

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 2:26 pm
by rimai
You can do that.
All you need is make sure set UseMemory to false.

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 2:28 pm
by DrewPalmer04
coming out of night mode has been fixed?

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 2:33 pm
by rimai
To come out of night mode, you must send a command.
You need to send Night_Stop or Feeding_Stop. They are the same thing... lol
lnevo is controlling his pumps according to the tidal info on top of parabola to go into night mode :)

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 2:54 pm
by DrewPalmer04
I like his tidal code. I just like to be in control of my tanks time. Lol. Not based on lat/long. I guess I'll just do if else if else. The else would be the feed_stop correct?

RF Expansion Module

Posted: Wed Mar 13, 2013 2:57 pm
by lnevo
You can take a look at my code. I track previous modes. If previous mode is Night, i flip feeding stop and then set the mode. I only do this if I'm not in reefcrest mode since that mode I'm overriding with mu custom.

But yeah, you can scratch the night mode and just set speed with the slope or parabola. I'm using slope to transition to my night speed.

Roberto, any chance we can get Custom added to the drop down on the portal?

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 3:05 pm
by DrewPalmer04
What kind of flow do you experience with your tide.h set up? Random? Variable bc of the moon? Is it more constant from the MPs and the speed increases? I enjoy more of an alternating current instead of full blast on.

RF Expansion Module

Posted: Wed Mar 13, 2013 4:05 pm
by lnevo
I'm waiting till I have some more long term graphing to post some charts and my night mode speed is taking away from the view...need to find a better way to show it..I may declare a Tide class just to use for the charting :)

Actual results of RFS
http://forum.reefangel.com/status/chart ... filter=rfs

Result of tide.CalcSpeed() you can see the shift that happens for night mode. Try and shift it back up and you'll see how high and low tide get formed.
http://forum.reefangel.com/status/chart ... &filter=c4

Ebb/Flood result of isIncoming()
http://forum.reefangel.com/status/chart ... &filter=c6

The way the tide class works is this...

a cosine wave represents the lunar pull in the ocean. So the difference between high tide and low tide is greater at new moon and full moon and less during quarter moons. So a cosine curve represents this nicely,

The tide class gets set to a speed. The arguments to unit represent the minimum gap and maximum gap between high and low tide. This gap gets adjusted based on the moon phase curve and applied to the speed that you set the tide class to.

I also track (now working properly) the direction of the current and you can get that as a true false from isIncoming() and I set which pump to set faster, the other gets multiplied by a percentage.

The CalcTide() function returns the speed based on the parameters discussed above. You could also adjust the wavelength (default is 12 hours) if you want more or less high and low tides. If you used this output directly you would get a smooth transition.

I pass the output to Roberto's ReefCrestMode function and it adds a bunch of randomness to the output. The randomness though is still shaped by the tides and of course the flow direction based on the shifting current.

You could just as easily do more complex functions or pass them to the tunze functions or your own pwm slope / parabola. The main point for me is that base speed is set in memory and everything is variable based on what is entered.

Here's my relevant code to give you a better idea how I'm doing everything...

Code: Select all

Tide tide;
Tide.Init(vtSpeed, 10, 30);

// Night Mode
tideSpeed=PWMSlope(sl.GetRiseHour()-1,sl.GetRiseMinute(),sl.GetSetHour()+1,sl.GetSetMinute(),vtNightSpeed,vtSpeed,60,vtNightSpeed);
  
// Set tide classes to desired speed
tide.SetSpeed(tideSpeed);

Int rcSpeed=ReefCrestMode(tide.CalcTide());

ReefAngel.RF.SetMode(Custom,rcSpeed*tideDiff,1-tide.isIncoming());
ReefAngel.RF.SetMode(Custom,rcSpeed,tide.isIncoming());

RF Expansion Module

Posted: Wed Mar 13, 2013 4:08 pm
by lnevo
This chart shows the effect of MoonPhase over the course of the month.

http://forum.reefangel.com/download/file.php?id=632

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 4:48 pm
by DrewPalmer04
Graphs look good! Maybe a short video of how it looks in your tank. :)

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 5:13 pm
by DrewPalmer04
Also if we could contain a max speed value that would be nice. My two MP10s could and might rip my tank apart lol. IF unregulated.

RF Expansion Module

Posted: Wed Mar 13, 2013 5:21 pm
by lnevo
Max speed for the tide class would be speed+(maxOffset/2)

For roberto's ReefCrestMode its speed +/- 20. I changed it to 10 for my needs.

I set my day speed to 45 and night at 25.

Pump 2 offset is .6 i think.

I hear the ripping apart...2 mp40 on a 65 :)

Re: RF Expansion Module

Posted: Wed Mar 13, 2013 6:02 pm
by DrewPalmer04
Make that a 45 lol. Hence why I'd need minimal output overall.

Re: RF Expansion Module

Posted: Mon Apr 01, 2013 2:42 pm
by bencollinz
rimai wrote:Try this:

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=false;
  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");
  }
}

I had to use this to get my RF to sync as welll. thank you!

but I reupped my normal code and now the rf is just blinking green/blue. 2 drivers are white. is this correct?
nevermind, unplugged rf usb, replugged works now.

Re: RF Expansion Module

Posted: Mon Feb 12, 2018 11:07 am
by tngo
Was there a Vortech setup for the RA*? I ended up just using the setup() portion written for the RA+ to get the RF module to blink green/blue. Then once paired with the vortechs I just uploaded the normal running code. Not very elegant but I think it's paired?

Tim

Re: RF Expansion Module

Posted: Mon Feb 12, 2018 4:29 pm
by rimai
You did it right. I never generated a code for RA*