RF Expansion Module

Expansion modules and attachments
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

I used the first vortechsetup.pde that rimai posted and just declared random2,155,0 in setup. other then that i have the code posted above and a code to set vortech in ntm for 30 min after feed mode and all worked fine....if its breathing white its in night mode...wait til morning see what it does.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

Sorry no wifi, I connect via USB. I didn't set an internal memory value manually, I just added ReefAngel.RF.SetMode(Smart_NTM,120,6); to my setup() like Deckoz2302 suggested. I looked in the Reef Angel Client a couple days ago to see if I could set it in there before I got the module, but didn't see anywhere I could set the internal memory settings outside of what's in the Memory tab.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

Deckoz2302 wrote:I used the first vortechsetup.pde that rimai posted and just declared random2,155,0 in setup. other then that i have the code posted above and a code to set vortech in ntm for 30 min after feed mode and all worked fine....if its breathing white its in night mode...wait til morning see what it does.
I think it's all good now. I'll be feeding my Poseidon complex during my lunch break tomorrow for sure :) Thanks for the help!
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

Ok, so here is what I'd like you to do.
Shut the Client Listener service if you have it running.
On Arduino IDE, open Serial Monitor and make sure it is set to 57600 baud.
Type: GET /mb855
After you type this, make sure you hit at least one time the space in your keyboard, then hit enter.
It should give you something on the screen.
Paste it her, please :)
Roberto.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

It says:

HTTP/1.1 200 OK
Server: ReefAngel
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Connection: close
Content-Type: text/xml
Content-Length: 118

<M855>255</M855>

Which is the same thing InternalMemory.RFMode_read() is returning. I was going to bug you later about if it should return a number or a string, like Storm, Night, etc
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

Just as I was thinking.
I'll change the setup code to initialize the memory.
Thank you so much for finding the bug.
Now, to fix your memory, you can simply type: GET /mb855,0
Same thing. Make sure you get space before hitting enter.
This will place 0 on the internal memory, which is constant. If you want to use a different value, just use the equivalent number of the mode you wish to be the default mode.
Roberto.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

Oh, make sure to place values on 856 and 857 too.
855- mode
856- speed
857- duration
Roberto.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

All 3 internal memory areas set. Thanks again.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

Hmmm, I noticed the same thing as stu except my mode value is 4 whether or not the other modes are switched due to if statements. I believe each time we reference the mode value in our code we could write something like this in our custom main
If (InternalMemory.RFmode_read() == 4) ReefAngel.LCD.DrawText(COLOR_YELLOW,DefaultBGColor,8,y+13,"Reef Crest:");
Else (InternalMemory.RFmode_read() == 8)ReefAngel.LCD.DrawText(COLOR_VIOLET,DefaultBGColor,8,y+13,"Nutrient Transport");// not sure of actual numbers for each mode gotta look at global.h
But the problem is when we say use memory false in our code the setmode doesn't rewrite internal memory value so it probably won't work. if we made a global value though. Like byte vtechmode; above setup and then in our if statement for moonphase or feeding or what have you. Add this line
if ( hour() <= 6 || hour () >= 20 )
{
ReefAngel.PWM.SetActinic(MoonPhase());
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,10,0);
vtechmode = 11//not sure of night number
}
else { ReefAngel.PWM.SetActinic(0);
Vtechmode = InternalMemory.RFmode_read();
}
If (vtechmode == 11) reefangel draw text ect ect we would have to have this if statement in custom main otherwise if it is in loop it will show up on every screen - which is why we should create a global byte and set change the value in loop() and intialize its value in setup() with vtechmode = internalmem.....

Then in our custom write it like
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

When I get home today rimai I may add to your vortechsetup pde and upload it for you, so that once slaves are set menu pops up to select default mode, speed % and pulse duration.

Gotta look at the code to figure out how you do a scroll select like tempuratures on the preloaded pde(like how you select water/lights/room)
Mode would have to be simple string array? And use the number of the position to set value
Speed would be internalmemory rfspeed write = abs((percent * 0.01) * 255)
Duration would just be 0-255 selection
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

StuGotz wrote:All 3 internal memory areas set. Thanks again.
I wanted to tweak my internal memory settings this morning when my lights came on. I changed the values for 856 and 857, but nothing happened. I uploaded my PDE to reset the software, but nothing happened. That's when I went looking for a software reset function and posted this http://forum.reefangel.com/viewtopic.php?f=12&t=526. I didn't want to have to unplug the controller while I was testing.

I unplugged the relay box for 10 secs and when it came back up the vortech changed to the new settings. I changed the memory values again, but this time the Vortech changed immediately without a hard reset.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

Did you understand my code idea for displaying the mode on main stu?
Put this above setup

Code: Select all

byte vtechmode;
void vtechstr(byte);
Place this in setup

Code: Select all

vtechmode = InternalMemory.RFmode_Read();
In your loop for moonlight or feeding or where your if/else statement is put this in if

Code: Select all

vtechmode = 5; //replace 5 with the numerical value of the mode
Place this in else

Code: Select all

vtechmode = InternamMemory.RFmode_read();
Creatr a function

Code: Select all

void vtechstr(byte modenum) { 
char modestr;  
 if (modenum=  0) modestr = "Constant"; // do this for each number of modes
Last edited by Deckoz2302 on Fri Dec 30, 2011 8:42 am, edited 1 time in total.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

then at the end of the function return modestr;

Then call it in custom main with
ReefAngel.LCD.DrawText(#,#,#,#,vtechstr(vtechmode));

Let me know if it works, ii will try when I get home

Also last post in if statement it has to be double ==....post is to long to edit on phone...bleh android

And I think we need to use str not char
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

There is no need to reboot the controller for the memory settings to take effect.
It will always use memory settings to pick up the mode.
If you add no SetMode() on your loop, it will use memory settings.
I think the confusion is when you use SetMode() without UseMemory=false.
You must use UseMemory=false to be able to use SetMode() properly or the controller may get confused and won't know which mode to use.
By looking at th previous code, you had this:

Code: Select all

// ReefAngel.RF.UseMemory=false;
  ReefAngel.RF.SetMode(Smart_NTM,120,6);
You need to have this:

Code: Select all

  ReefAngel.RF.UseMemory=false;
  ReefAngel.RF.SetMode(Smart_NTM,120,6);
If you don't add anything to your code, you should still be able to change modes by changing the internal memory.
Changing internal memory is slightly harder now, because we are in the process of revamping all apps (Client, Status, iPhone and Android), but they will all eventually offer that capability in the near future and it should be just open your prefered application and change modes.
Give this a shot and see if it works.
Roberto.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

rimai wrote:There is no need to reboot the controller for the memory settings to take effect.
I had to unplug the unit yesterday for it to sync up for the 1st time, and again this morning for the changes I made to 2 memory location for speed and duration. After I unplugged the unit this morning I was able to update the memory locations one more time and the change occured immediately without any reboots, soft or hard. I'm not sure what is causing it to lock up like that, requiring a hard reset.

rimai wrote:It will always use memory settings to pick up the mode.
If you add no SetMode() on your loop, it will use memory settings.
I think the confusion is when you use SetMode() without UseMemory=false.
You must use UseMemory=false to be able to use SetMode() properly or the controller may get confused and won't know which mode to use.
By looking at th previous code, you had this:

Code: Select all

// ReefAngel.RF.UseMemory=false;
  ReefAngel.RF.SetMode(Smart_NTM,120,6);
You need to have this:

Code: Select all

  ReefAngel.RF.UseMemory=false;
  ReefAngel.RF.SetMode(Smart_NTM,120,6);
If you don't add anything to your code, you should still be able to change modes by changing the internal memory.
Changing internal memory is slightly harder now, because we are in the process of revamping all apps (Client, Status, iPhone and Android), but they will all eventually offer that capability in the near future and it should be just open your prefered application and change modes.
Give this a shot and see if it works.
The PDE I posted earlier was updated after I posted it. I commented everything out except this.

Code: Select all

 if (hour()>=19 || hour()<7)
    {
      ReefAngel.PWM.SetActinic(MoonPhase());  //Moon phase schedule between 7:00pm - 7:00am
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(Night,15,0);
     }
  else
    {
      ActinicPWMValue=PWMSlope(7,00,19,0,0,35,60,ActinicPWMValue); //Actinic turn on at 7am, off at 10am, and ramp up 0% to 50% PWM in 60 minutes
      //ActinicPWMValue=PWMSlope(16,00,19,0,0,50,60,ActinicPWMValue); //Actinic turn on at 4pm, off at 7pm, and ramp up 0% to 50% PWM in 60 minutes
      ReefAngel.PWM.SetActinic(ActinicPWMValue);
      ReefAngel.RF.UseMemory=true;
    }
So there isn't anything else in the setup() or loop() stepping on it.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

Deckoz2302 wrote:then at the end of the function return modestr;

Then call it in custom main with
ReefAngel.LCD.DrawText(#,#,#,#,vtechstr(vtechmode));

Let me know if it works, ii will try when I get home

Also last post in if statement it has to be double ==....post is to long to edit on phone...bleh android

And I think we need to use str not char
Don't knock android ;) I plan on testing this all out over the weekend, I had a similar idea before going to bed last night. I was just going to read the internal memory area and have if set a variable for the string and display that on the custom main.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

StuGotz wrote: I was just going to read the internal memory area and have if set a variable for the string and display that on the custom main.
I just realized the issue with doing it like that, the internal memory would always be the same...
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

StuGotz wrote:I just realized the issue with doing it like that, the internal memory would always be the same...
The upcoming library will offer you a way to pull the current mode. No date to be released yet though :(
But a work around is to follow what Deckoz posted earlier.
Create a variable to hold the current mode and display it on custom main.
Are you able to change modes by changing internal memory values without reboot now?
Roberto.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

Which is why I said create a global bye such as vtechmode and whenever you change the mode you have a line following stating mode number like above, I realized the same thing typing the code earlier
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

rimai wrote:Are you able to change modes by changing internal memory values without reboot now?
I think I may have just figured out what might be locking it up.


I tested by changing 857, and duration changed just fine. I change 857 back to my original value, still no problem. I changed 855 to 0, no problem, then to 5, still no problem. I change it to 9, no problem. But change 855 back to 5 and it locked up.

I think it has something to do with Night mode. It would explain why it was locked up again this morning. It didn't come out of night mode correctly then either.

Hard reset and the Vortech immediately went into mode 5.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

Wow, nice troubleshooting!!!
I think I know exactly what went wrong now.
Thanks for finding it again :)
Yes, indeed it is not coming from night mode correctly.
To come out of either feeding mode or night mode, the controller needs to send a specific messages to the ecotech drivers.
I handled the feeding mode messages properly when the controller goes into or exits feeding mode, but I didn't create the handling of night mode exit message.
Let me look into it tonight.
Roberto.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

I dunno - mine has gone in and out of night mode two nights in a row and also a test run changing time on the controller to see if it worked

hmm I dunno

ps. thats really weird that roberto and I posted at the same minute...reading this almost 3 hours later

if I remember right you can set the length of night on the vortech..and they will auto pop out of night mode on they're own
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

rimai wrote:Wow, nice troubleshooting!!!
I think I know exactly what went wrong now.
Thanks for finding it again :)
Yes, indeed it is not coming from night mode correctly.
To come out of either feeding mode or night mode, the controller needs to send a specific messages to the ecotech drivers.
I handled the feeding mode messages properly when the controller goes into or exits feeding mode, but I didn't create the handling of night mode exit message.
Let me look into it tonight.
Glad to help!

I haven't tried feeding mode yet. My 10 year old oscellaris is in a QT since Tues :( I didn't think he was going to make it, but he's swimming, breathing and eating normally after daily 100% water changes and Formalin. I'm guessing it's Brooklynella from him being added into my new tank. I should have waited longer after the cycle to move him!
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

Deckoz2302 wrote:I dunno - mine has gone in and out of night mode two nights in a row and also a test run changing time on the controller to see if it worked

hmm I dunno

ps. thats really weird that roberto and I posted at the same minute...reading this almost 3 hours later

if I remember right you can set the length of night on the vortech..and they will auto pop out of night mode on they're own
Murphy's law tends to kick in whenever I work on new projects. My manual doesn't mention night mode, I thought it was a new custom mode, like storm.
Deckoz2302
Posts: 149
Joined: Tue Nov 01, 2011 11:05 am

Re: RF Expansion Module

Post by Deckoz2302 »

This is from the manual for the mp10ESw

"Configuration Mode is used to define settings for the following: Battery Backup speed, Night Mode
speed and time, Feed Mode speed and time and Auto-Dim time. These modes operate automatically depending on the settings that you define.
The Configuration Menu is entered by pressing and holding all three buttons during any normal
operational mode. At this point the control dial led will blink orange and white and the first two blue
LED lights will illuminate brightly. You are now in the configuration menu and can navigate between
the following six different configuration settings:
From left to right
Battery Backup Speed
Night Mode Speed
Night Mode Time
Feed Mode Speed
Feed Mode Time
Auto-Dim Time
In the configuration mode main menu, each of the six different settings will be indicated by a corresponding pair of illuminated blue LED lights. Use the mode button to cycle through the different
configurable settings. Illustration above shows the driver in the configuration mode main menu sitting on Night Mode Speed (3rd and 4th Blue LEDs Illuminated).
Once the mode you want to modify is signaled by the LED bar, you can press the set button to access that modes values, at this point the control dial will blink a set of colors specific for each mode
you are modifying. These colors are:
• Battery Backup Speed: Orange and Blue
• Night Mode Speed: Orange and Green
• Night Mode Time: Orange and Purple
• Feed Mode Speed: Orange and Pink
• Feed Mode Time: Orange and Yellow
• Auto-dim functionality: Orange and Turquoise
Illustration above shows the driver in the Night Mode Speed configuration setting. It also is showing, by the illuminated LEDs, what setting it is currently set to. The driver will also indicate, by
the dim LEDs, what setting is the default. Note: If there is only two brightly illuminated LEDs, that
means that you are currently set to the defualt setting

Night Time Speed:
Setting 1: Lowest Speed of pump
Setting 2: 25% speed of pump
Setting 3: 50% speed of pump **Default Setting
Setting 4: 75% speed of pump


Night Mode Time:
Setting 1: 6 hour night
Setting 2: 8 hour night
Setting 3: 10 hour night **Default Setting
Setting 4: 12 hour night
Setting 5: 14 hour nigh
Night mode"
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

Here is a little sample code I made:

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_RF.h>
#include <ReefAngel.h>

void setup()
{
  ReefAngel.Init();  
  ReefAngel.RF.UseMemory=false;
  ReefAngel.RF.SetMode(Night,0,0);
  ReefAngel.Timer[1].SetInterval(5);
  ReefAngel.Timer[1].Start();
}

void loop()
{
  ReefAngel.ShowInterface();
  if (ReefAngel.Timer[1].IsTriggered())
  {
    ReefAngel.RF.SetMode(Feeding_Stop,0,0);
    ReefAngel.RF.UseMemory=true;
  }
}
This code will put pumps into night mode on start-up then, after 5 seconds, it should return back to memory settings.
If you save 9 (Night mode) in the intenal memory 855, you will need to save 8 (Feeding_Stop) to get out of night mode and then save your default mode to return back to running mode.
See if this works for you.
Roberto.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

I was able to change internal memory 855 from 5 to 9 to 8 and back to 5 with no problems.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: RF Expansion Module

Post by rimai »

Yay :)
Roberto.
StuGotz
Posts: 95
Joined: Sat Oct 15, 2011 9:17 am

Re: RF Expansion Module

Post by StuGotz »

Came out of Night mode just fine this morning switching to night before back to memory settings.

Code: Select all

  if (hour()>=19 || hour()<7)
    {
      ReefAngel.PWM.SetActinic(MoonPhase());  //Moon phase schedule between 7:00pm - 7:00am
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(Night,15,0);
    }
  else
    {
      ActinicPWMValue=PWMSlope(7,00,19,0,0,35,60,ActinicPWMValue); //Actinic turn on at 7am, off at 10am, and ramp up 0% to 50% PWM in 60 minutes
      //ActinicPWMValue=PWMSlope(16,00,19,0,0,50,60,ActinicPWMValue); //Actinic turn on at 4pm, off at 7pm, and ramp up 0% to 50% PWM in 60 minutes
      ReefAngel.PWM.SetActinic(ActinicPWMValue);
      ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
      ReefAngel.RF.UseMemory=true;
    }
SuperDodge
Posts: 52
Joined: Sun Feb 12, 2012 11:16 am

Re: RF Expansion Module

Post by SuperDodge »

I am trying to install my RF module today and I see the instructions include changing jumpers. Can you clarify for me if I'm moving the existing jumper, installing one new jumper or installing two new jumpers? I don't see any jumpers with the stuff I received but I may just be missing them so I want to know what I'm looking for.


EDIT: I have looked everywhere and don't see any jumpers, but they appear to be the same size as the ones that ship on most hard drives, so I have plenty of spares laying around as long as I know how many I am supposed to install where...

SECOND EDIT: I have the RA+ and these pins don't even seem to exist?
Image
Post Reply