Page 1 of 1

Relay Expansion in Webbanner and Portal

Posted: Fri Mar 02, 2012 10:46 pm
by javisaman
Hmm, I don't know why I'm having so much trouble with this. But I was wondering how to get either the web banner or reef angel portal to display the statuses of all the relays (not just the main ones). I'm not using RAGen, but a custom INC.

Thanks

Re: Relay Expansion in Webbanner and Portal

Posted: Fri Mar 02, 2012 11:11 pm
by rimai
Can I see your code?

Re: Relay Expansion in Webbanner and Portal

Posted: Sat Mar 03, 2012 6:32 am
by javisaman

Code: Select all

//@author Javed Aman
//Custom Reef Angel Code




//dev libs

#include <ReefAngel_Features.h>
//#include <ReefAngel_Globals.h>
#include <Globals.h>
//#include <ReefAngel_Wifi.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
//#include <ReefAngel_EEPROM.h>
#include <InternalEEPROM.h>
//#include <ReefAngel_NokiaLCD.h>
#include <RA_NokiaLCD.h>
//#include <ReefAngel_ATO.h>
#include <RA_ATO.h>
//#include <ReefAngel_Joystick.h>
#include <RA_Joystick.h>
//#include <ReefAngel_LED.h>
#include <LED.h>
//#include <ReefAngel_TempSensor.h>
#include <RA_TempSensor.h>
//#include <ReefAngel_Relay.h>
#include <Relay.h>
//#include <ReefAngel_PWM.h>
#include <RA_PWM.h>
//#include <ReefAngel_Timer.h>
#include <Timer.h>
//#include <ReefAngel_Memory.h>
#include <Memory.h>
#include <ReefAngel.h>


#define WhiteLED       1
#define BlueLED        2
#define FugeLight      3
#define Vortech        4

#ifdef RelayExp
#define ATO            5
#else
#define KoraliaTank    5
#endif

#define Return         6
#define Heater         7
#define Chiller        8

#ifdef RelayExp

#define KoraliaTank    11
#define KoraliaFuge    12
#define Skimmer        14
#define LiterMeter     13
#define FluvalReturn   15
#define FluvalLights   16
#define SkimmerFlush   17
//#define Feeder         15
//#define WaterChangePump 16
//#define WaterChangeHeat 17

#endif

//ReefAngel_TimerClass ParamTimer;


void setup(){
  ReefAngel.Init();
  
  
  ReefAngel.Relay.On(Return);
  ReefAngel.Relay.On(Vortech);
  //ReefAngel.Relay.On(FugeLight);
  //ReefAngel.Relay.On(WhiteLED);
  //ReefAngel.Relay.On(BlueLED);
  

#ifdef RelayExp  
  ReefAngel.Relay.On(LiterMeter);
  ReefAngel.Relay.On(Skimmer);
  //ReefAngel.Relay.On(ATO);
  ReefAngel.Relay.On(KoraliaFuge);
  ReefAngel.Relay.On(FluvalReturn);
  //ReefAngel.Relay.On(SkimmerFlush);
#endif
  //ReefAngel.StandardATO(ATO, 5);

  //ReefAngel.Relay.Off(ATO);
  ReefAngel.Relay.On(KoraliaTank);
  
  ReefAngel.FeedingModePorts = B00110000;
  ReefAngel.WaterChangePorts = B11111000;
  ReefAngel.OverheatShutoffPorts = B01000011;
#ifdef RelayExp
  ReefAngel.FeedingModePortsE[0] = B00000001;
  ReefAngel.WaterChangePortsE[0] = B00000111;
#endif  

  
  // Initialize and start the Parameter timer
//  ParamTimer.SetInterval(15);  // set interval to 15 seconds
//  ParamTimer.Start();
  
}

void loop() {
  ReefAngel.ShowInterface();
  ReefAngel.SingleATO(true, ATO, 10, 0);

  ReefAngel.StandardLights(WhiteLED, 14, 25, 20, 35);
  ReefAngel.PWM.SetDaylight(PWMSlope(14,30, 20,30, 0, 50, 80, ReefAngel.PWM.GetDaylightValue()));
  //ReefAngel.PWM.SetDaylight(25);
  ReefAngel.StandardLights(BlueLED, 10, 25, 21, 35);
  ReefAngel.PWM.SetActinic(PWMSlope(10, 30, 21, 30, 0, 100, 120, ReefAngel.PWM.GetActinicValue())); 
  //ReefAngel.PWM.SetActinic(90);
  
  ReefAngel.StandardLights(FluvalLights, 8, 25, 21, 35);
  ReefAngel.StandardLights(SkimmerFlush, 21, 50, 21, 52);

  

  ReefAngel.StandardLights(FugeLight, 19, 30, 11, 30);
  
  ReefAngel.StandardHeater(Heater, 790, 800);
  ReefAngel.StandardFan(Chiller, 800, 805);
  
  
   ReefAngel.Relay.DelayedOn(Vortech, 2);
   ReefAngel.Relay.DelayedOn(KoraliaTank, 2);
   ReefAngel.Relay.DelayedOn(Skimmer, 10);
   ReefAngel.Portal("javisaman"); 
   
}

void DrawCustomMain(){

  ReefAngel.LCD.DrawDate(6, 119);
  pingSerial();
  
  
  ReefAngel.LCD.DrawMonitor(15, 63, ReefAngel.Params, 
  //  ReefAngel.PWM.DaylightPWMValue, ReefAngel.PWM.ActinicPWMValue); //standard
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue()); //development
  pingSerial();
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay != ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
#ifdef RelayExp
  TempRelay = ReefAngel.Relay.RelayDataE[0];
  TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
  TempRelay != ReefAngel.Relay.RelayMaskOnE[0];
  ReefAngel.LCD.DrawOutletBox(12, 105, TempRelay);
#endif RelayExp
}

void DrawCustomGraph(){
}

Re: Relay Expansion in Webbanner and Portal

Posted: Sat Mar 03, 2012 9:20 am
by rimai
Are you sure your features file has this:

Code: Select all

#define RelayExp
What happens if you try to compile this:

Code: Select all

//@author Javed Aman
//Custom Reef Angel Code




//dev libs

#include <ReefAngel_Features.h>
//#include <ReefAngel_Globals.h>
#include <Globals.h>
//#include <ReefAngel_Wifi.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
//#include <ReefAngel_EEPROM.h>
#include <InternalEEPROM.h>
//#include <ReefAngel_NokiaLCD.h>
#include <RA_NokiaLCD.h>
//#include <ReefAngel_ATO.h>
#include <RA_ATO.h>
//#include <ReefAngel_Joystick.h>
#include <RA_Joystick.h>
//#include <ReefAngel_LED.h>
#include <LED.h>
//#include <ReefAngel_TempSensor.h>
#include <RA_TempSensor.h>
//#include <ReefAngel_Relay.h>
#include <Relay.h>
//#include <ReefAngel_PWM.h>
#include <RA_PWM.h>
//#include <ReefAngel_Timer.h>
#include <Timer.h>
//#include <ReefAngel_Memory.h>
#include <Memory.h>
#include <ReefAngel.h>


#define WhiteLED       1
#define BlueLED        2
#define FugeLight      3
#define Vortech        4

#ifdef RelayExp
#define ATO            5
#else
#define KoraliaTank    5
#endif

#define Return         6
#define Heater         7
#define Chiller        8


#define KoraliaTank    11
#define KoraliaFuge    12
#define Skimmer        14
#define LiterMeter     13
#define FluvalReturn   15
#define FluvalLights   16
#define SkimmerFlush   17
//#define Feeder         15
//#define WaterChangePump 16
//#define WaterChangeHeat 17


//ReefAngel_TimerClass ParamTimer;


void setup(){
  ReefAngel.Init();
  
  
  ReefAngel.Relay.On(Return);
  ReefAngel.Relay.On(Vortech);
  //ReefAngel.Relay.On(FugeLight);
  //ReefAngel.Relay.On(WhiteLED);
  //ReefAngel.Relay.On(BlueLED);
  

  ReefAngel.Relay.On(LiterMeter);
  ReefAngel.Relay.On(Skimmer);
  //ReefAngel.Relay.On(ATO);
  ReefAngel.Relay.On(KoraliaFuge);
  ReefAngel.Relay.On(FluvalReturn);
  //ReefAngel.Relay.On(SkimmerFlush);
  //ReefAngel.StandardATO(ATO, 5);

  //ReefAngel.Relay.Off(ATO);
  ReefAngel.Relay.On(KoraliaTank);
  
  ReefAngel.FeedingModePorts = B00110000;
  ReefAngel.WaterChangePorts = B11111000;
  ReefAngel.OverheatShutoffPorts = B01000011;
  ReefAngel.FeedingModePortsE[0] = B00000001;
  ReefAngel.WaterChangePortsE[0] = B00000111;

  
  // Initialize and start the Parameter timer
//  ParamTimer.SetInterval(15);  // set interval to 15 seconds
//  ParamTimer.Start();
  
}

void loop() {
  ReefAngel.ShowInterface();
  ReefAngel.SingleATO(true, ATO, 10, 0);

  ReefAngel.StandardLights(WhiteLED, 14, 25, 20, 35);
  ReefAngel.PWM.SetDaylight(PWMSlope(14,30, 20,30, 0, 50, 80, ReefAngel.PWM.GetDaylightValue()));
  //ReefAngel.PWM.SetDaylight(25);
  ReefAngel.StandardLights(BlueLED, 10, 25, 21, 35);
  ReefAngel.PWM.SetActinic(PWMSlope(10, 30, 21, 30, 0, 100, 120, ReefAngel.PWM.GetActinicValue())); 
  //ReefAngel.PWM.SetActinic(90);
  
  ReefAngel.StandardLights(FluvalLights, 8, 25, 21, 35);
  ReefAngel.StandardLights(SkimmerFlush, 21, 50, 21, 52);

  

  ReefAngel.StandardLights(FugeLight, 19, 30, 11, 30);
  
  ReefAngel.StandardHeater(Heater, 790, 800);
  ReefAngel.StandardFan(Chiller, 800, 805);
  
  
   ReefAngel.Relay.DelayedOn(Vortech, 2);
   ReefAngel.Relay.DelayedOn(KoraliaTank, 2);
   ReefAngel.Relay.DelayedOn(Skimmer, 10);
   ReefAngel.Portal("javisaman"); 
   
}

void DrawCustomMain(){

  ReefAngel.LCD.DrawDate(6, 119);
  pingSerial();
  
  
  ReefAngel.LCD.DrawMonitor(15, 63, ReefAngel.Params, 
  //  ReefAngel.PWM.DaylightPWMValue, ReefAngel.PWM.ActinicPWMValue); //standard
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue()); //development
  pingSerial();
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay != ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
  TempRelay = ReefAngel.Relay.RelayDataE[0];
  TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
  TempRelay != ReefAngel.Relay.RelayMaskOnE[0];
  ReefAngel.LCD.DrawOutletBox(12, 105, TempRelay);
}

void DrawCustomGraph(){
}

Re: Relay Expansion in Webbanner and Portal

Posted: Sat Mar 03, 2012 10:40 pm
by javisaman
Yes. And my custom main shows all of the relays.

Re: Relay Expansion in Webbanner and Portal

Posted: Sat Mar 03, 2012 10:43 pm
by rimai
Did it work?

Re: Relay Expansion in Webbanner and Portal

Posted: Sun Mar 11, 2012 3:13 pm
by rossbryant1956
I am working to get all my relays showing in the portal. What is the difference between this:

Code: Select all

#define WhiteLED       1
#define BlueLED        2
#define FugeLight      3
#define Vortech        4

#ifdef RelayExp
#define ATO            5
#else
#define KoraliaTank    5
#endif

#define Return         6
#define Heater         7
#define Chiller        8

#ifdef RelayExp

#define KoraliaTank    11
#define KoraliaFuge    12
#define Skimmer        14
#define LiterMeter     13
#define FluvalReturn   15
#define FluvalLights   16
#define SkimmerFlush   17
//#define Feeder         15
//#define WaterChangePump 16
//#define WaterChangeHeat 17

#endif
which I found in this thread, or this:

Code: Select all

/*
Ports assignment:

Port1 - Reservoir Heater
Port2 - Standard Lights
Port3 - Moon Lights
Port4 - Refugium Pumps
Port5 - WaveMaker One
Port6 - WaveMaker Two 
Port7 - Heater
Port8 - Return Pump
*/
which is the way I do it. I would like these labels to carry forward to all the apps that can read them. Thx

Re: Relay Expansion in Webbanner and Portal

Posted: Sun Mar 11, 2012 3:23 pm
by rimai
They both won't update the Portal.
Simply go to the tab "Labels" on the Portal and you will be able to change them.
But, just FYI:
The 1st piece of code just makes it easier to code when you are manually coding. So, instead of using for example ReefAngel.Relay.On(Port1), you can used ReefAngel.Relay.On(WhiteLED), because you define that WhiteLED is the same as 1.
The 2nd piece of code does nothing. It's considered comments. Anything in between /* and */ is a comment block and gets stripped off.

Re: Relay Expansion in Webbanner and Portal

Posted: Sun Mar 11, 2012 3:50 pm
by rossbryant1956
Cool. Thx

How do I get my portal to show my second expansion block? It is currently not there. Thx

Re: Relay Expansion in Webbanner and Portal

Posted: Sun Mar 11, 2012 4:05 pm
by rimai
It does it automatically when you enable the expansion relay on RAGen.

Re: Relay Expansion in Webbanner and Portal

Posted: Sun Mar 11, 2012 4:28 pm
by rossbryant1956
I just went back into ragen and enabled:

number of expansion relays enabled=1
send controller data to portal

do I have to upload anything, recreate a new memory file?

Re: Relay Expansion in Webbanner and Portal

Posted: Sun Mar 11, 2012 4:38 pm
by rimai
Just to be sure, please check if you have

Code: Select all

#define RelayExp
on your ReefAngel_Features.h file.

Then, simply upload your code again and it should take care of that.

Re: Relay Expansion in Webbanner and Portal

Posted: Tue Mar 13, 2012 6:45 pm
by rossbryant1956
just deleted my "too quick to complain" post. Did all this now works like a charm. Thx

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 2:09 pm
by javisaman
I'm still having this issue:

I changed the code to get rid of all of the flags. My menu on the RA display is fine and the ports seem to be functioning correctly too. When I compile the code I get the following message as well:

Code: Select all

The following features were detected:
Dimming Signal
Salinity Expansion Module
Wifi
Relay Expansion Module
Number of Relay Expasions: 1
Custom Main Screen
Simple Menu
Date/Time Setup Menu
Binary sketch size: 34,886 bytes (of a 258,048 byte maximum)
Here is my code:

Code: Select all

//@author Javed Aman
//Custom Reef Angel Code

//dev libs

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


#define WhiteLED       Port1
#define BlueLED        Port2
#define FugeLight      Port3
#define Vortech        Port4
#define ATOPump        Port5
#define Return         Port6
#define Heater         Port7
#define Chiller        Port8
#define KoraliaTank    Box1_Port1
#define KoraliaFuge    Box1_Port2
#define LiterMeter     Box1_Port3
#define Skimmer        Box1_Port4
#define SalinityPlug   Box1_Port5



void setup(){
  ReefAngel.Init();
  ReefAngel.AddDateTimeMenu(); 
  ReefAngel.AddWifi();
  
  ReefAngel.Relay.On(Return);
  ReefAngel.Relay.On(Vortech); 
  ReefAngel.Relay.On(LiterMeter);
  ReefAngel.Relay.On(Skimmer);
  ReefAngel.Relay.On(KoraliaFuge);
  ReefAngel.Relay.On(KoraliaTank);
  ReefAngel.Relay.On(SalinityPlug);
  
  ReefAngel.FeedingModePorts = B00110000;
  ReefAngel.WaterChangePorts = B11111000;
  ReefAngel.OverheatShutoffPorts = B01000011;
  ReefAngel.FeedingModePortsE[0] = B00000001;
  ReefAngel.WaterChangePortsE[0] = B00000111;
  
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 820 );
}

void loop() {

  ReefAngel.SingleATO(true, ATOPump, 10, 0);

  ReefAngel.StandardLights(WhiteLED, 14, 25, 20, 35);
  ReefAngel.PWM.SetDaylight(PWMParabola(14,30, 20,30, 0, 25, ReefAngel.PWM.GetDaylightValue()));
  ReefAngel.StandardLights(BlueLED, 12, 25, 21, 35);
  ReefAngel.PWM.SetActinic(PWMParabola(12, 30, 21, 30, 0, 50, ReefAngel.PWM.GetActinicValue())); 

  ReefAngel.StandardLights(FugeLight, 19, 30, 11, 30);
  
  ReefAngel.StandardHeater(Heater, 790, 800);
  ReefAngel.StandardFan(Chiller, 800, 805);
  
  
  ReefAngel.Relay.DelayedOn(Vortech, 2);
  ReefAngel.Relay.DelayedOn(KoraliaTank, 2);
  ReefAngel.Relay.DelayedOn(Skimmer, 10);
  ReefAngel.Portal("javisaman"); 
  ReefAngel.ShowInterface(); 
}

void DrawCustomMain(){

  ReefAngel.LCD.DrawDate(6, 20);
  pingSerial();
  ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,15,54, "SAL:" );
  ReefAngel.LCD.DrawText( COLOR_DARKKHAKI,DefaultBGColor,39,54, ReefAngel.Params.Salinity );
  pingSerial();
  
  
  ReefAngel.LCD.DrawMonitor(15, 63, ReefAngel.Params, 
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue()); //development
  pingSerial();
  
  byte TempRelay = ReefAngel.Relay.RelayData;
  TempRelay &= ReefAngel.Relay.RelayMaskOff;
  TempRelay != ReefAngel.Relay.RelayMaskOn;
  ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
  pingSerial();
  
  TempRelay = ReefAngel.Relay.RelayDataE[0];
  TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
  TempRelay != ReefAngel.Relay.RelayMaskOnE[0];
  ReefAngel.LCD.DrawOutletBox(12, 105, TempRelay);
  pingSerial();
}

void DrawCustomGraph(){
}
The webbanner is still only showing the main relay. Which part of the code is for the webbanner? I can look over it myself too and maybe track down the issue.

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 2:31 pm
by javisaman
Hmm even trying RAGen doesn't help. The features file has the RelyExp flag on and the number of InstalledRelayExpansionModules 1

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 2:37 pm
by rimai
I think you don't have the wifi attachment setup correctly?
Which utility did you use to configure it?
Does it look like this one?

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 3:44 pm
by javisaman
I just tried the new graphical wifi utility. All of the other parameters show up properly, but the second relay still doesn't appear.

I've attached the screenshot. Don't mind the pH and salinity, they haven't been calibrated yet.
The
RAP_screen.jpg
The XML file coming from the controller is this:

Code: Select all

<RA>
<T1>791</T1>
<T2>0</T2>
<T3>0</T3>
<PH>629</PH>
<R>43</R>
<RON>0</RON>
<ROFF>255</ROFF>
<R1>31</R1>
<RON1>0</RON1>
<ROFF1>255</ROFF1>
<R2>0</R2>
<RON2>0</RON2>
<ROFF2>255</ROFF2>
<R3>0</R3>
<RON3>0</RON3>
<ROFF3>255</ROFF3>
<R4>0</R4>
<RON4>0</RON4>
<ROFF4>255</ROFF4>
<R5>0</R5>
<RON5>0</RON5>
<ROFF5>255</ROFF5>
<R6>0</R6>
<RON6>0</RON6>
<ROFF6>255</ROFF6>
<R7>0</R7>
<RON7>0</RON7>
<ROFF7>255</ROFF7>
<R8>0</R8>
<RON8>0</RON8>
<ROFF8>255</ROFF8>
<ATOLOW>0</ATOLOW>
<ATOHIGH>0</ATOHIGH>
<EM>8</EM>
<REM>1</REM>
<PWMA>41</PWMA>
<PWMD>20</PWMD>
<SAL>60</SAL>
</RA>
It doesn't look like it's creating any tags for the relay expansion. Is there a way to check if the flag is being correctly checked in RA_wifi.cpp ? I'm familiar with C++, but not the arduino IDE.

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 4:01 pm
by javisaman
Well if I put junk into the SendXMLData function of RA_wifi.cpp within the RelayExp ifdef, as expected my file doesn't compile because of syntax errors. So I know the flag is set properly, the only thing I can think of is that MAX_RELAY_EXPANSION_MODULES is set to 0 or something. But that also seems unlikely. Very strange indeed.

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 4:07 pm
by rimai
The XML is fine.
<REM>1</REM> indicates the controller is setup properly, but I'm looking at the log of the portal and it has not received anything from your controller.
So, either your wifi attachment is not configured to send data to reefangel.com.
Sorry, the link didn't go through last time.
Does the wifi utility you used look like this?
http://forum.reefangel.com/viewtopic.php?f=15&t=345

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 4:55 pm
by javisaman
Hmm I didn't use that one apparently, I used the one from the download page. I used that one now, I set it up, but my router doesn't support UPnP. I did setup my router to port forward port 2000. I'm surprised nothing has come from my controller, I can go to the portal page and see everything but the extra relay (as seen in the screenshot). Is there more to it than just enabling the router to port forward?

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 5:19 pm
by javisaman
I enabled UPnP and had the utility set everything up correctly. It still doesn't show the other relay

Re: Relay Expansion in Webbanner and Portal

Posted: Thu Jun 21, 2012 6:29 pm
by rimai
Yes...
If you are using Dave's utility, make sure that you set the remote settings to send data to reefangel.com
Here is what you need to do:
Plug the wifi attachment into the USB-TTL cable
Open the utility
Connect to the wifi attachment at 57600 baud
On the remote settings section, make sure you choose reefangel.com and click save remote settings.
That should do it.

Re: Relay Expansion in Webbanner and Portal

Posted: Fri Jun 22, 2012 8:47 am
by javisaman
Yep it worked!!!! Thanks!