Losing my mind

Do you have a question on how to do something.
Ask in here.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Losing my mind

Post by projectx »

I purchased a relay expansion module and figured that I would get the PDE setup so that when it gets here I can just drop the PDE in and hook it up and be off and running.
Did some digging around on here to find how to turn it on. (probably missed it) I found a few things that helped but I am still having issues when compiling. I get complaints about the ports not being defined

Any ideas?


// Autogenerated file by RAGen (v1.1.0.126), (01/29/2012 19:29)
// RA_012912_1929.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File:
#define DirectTempSensor
#define wifi
#define RelayExp
#define SIMPLE_MENU
#define ENABLE_ATO_LOGGING
#define ENABLE_EXCEED_FLAGS
*/


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

#include <avr/pgmspace.h>
// Labels for the web banner
prog_char id_label[] PROGMEM = "projectx";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Canopy";
prog_char probe3_label[] PROGMEM = "Not%20Used";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "Daylight";
prog_char relay3_label[] PROGMEM = "Return";
prog_char relay4_label[] PROGMEM = "Acintic";
prog_char relay5_label[] PROGMEM = "Skimmer";
prog_char relay6_label[] PROGMEM = "Heater";
prog_char relay7_label[] PROGMEM = "Dosing1";
prog_char relay8_label[] PROGMEM = "Dosing2";
prog_char relay11_label[] PROGMEM = "MoonLights";
prog_char relay12_label[] PROGMEM = "Sumplight";
prog_char relay13_label[] PROGMEM = "FtKorilia";
prog_char relay14_label[] PROGMEM = "BkKorilia";
prog_char relay15_label[] PROGMEM = "Actinic2";
prog_char relay16_label[] PROGMEM = "Actinic2";
prog_char relay17_label[] PROGMEM = "Not%20Used";
prog_char relay18_label[] PROGMEM = "Not%20Used";
PROGMEM const char *webbanner_items[] = {
id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label, relay11_label, relay12_label,
relay13_label, relay14_label, relay15_label, relay16_label, relay17_label, relay18_label};


void setup()
{
ReefAngel.Init(); //Initialize controller
// Initialize and start the web banner timer
ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
ReefAngel.Timer[4].SetInterval(120); // set interval to 120 seconds
ReefAngel.Timer[4].Start();

ReefAngel.FeedingModePorts = B00000101;
ReefAngel.WaterChangePorts = B11010101;
ReefAngel.LightsOnPorts = B00001010;
ReefAngel.LightsOnPortsE[0] = B00001100;

// Ports that are always on
ReefAngel.Relay.On(Port3);
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.On(13);
ReefAngel.Relay.On(14);
}

void loop()
{
// Specific functions
ReefAngel.SingleATOLow(Port1);
ReefAngel.StandardLights(Port2);
ReefAngel.StandardLights(11, 21, 0 7, 0);
ReefAngel.StandardLights(12, 7, 0, 20, 0);
ReefAngel.MHLights(Port4);
ReefAngel.MHLights(15);
ReefAngel.MHLights(16);
ReefAngel.StandardHeater(Port6);
ReefAngel.DosingPumpRepeat1(Port7);
ReefAngel.DosingPumpRepeat2(Port8);


// Web Banner stuff
if(ReefAngel.Timer[4].IsTriggered())
{
ReefAngel.Timer[4].Start();
ReefAngel.WebBanner();
}

ReefAngel.ShowInterface();
}
Image
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

DOH!! found it, i was missing the , in the ReefAngel.StandardLights(11, 21, 0 7, 0);

once i rechecked it and added it compiled properly
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Losing my mind

Post by binder »

Instead of using 11, 12, 13, etc, you can use Box1_Port1, Box1_Port2, Box1_Port3, etc. It can make the code a little easier to read if you wanted. You don't have to, just a suggestion.
Exert from the globals.h file

Code: Select all

#define Box0_Port1			Port1
#define Box0_Port2			Port2
#define Box0_Port3			Port3
#define Box0_Port4			Port4
#define Box0_Port5			Port5
#define Box0_Port6			Port6
#define Box0_Port7			Port7
#define Box0_Port8			Port8
#define Box1_Port1			11
#define Box1_Port2			12
#define Box1_Port3			13
#define Box1_Port4			14
#define Box1_Port5			15
#define Box1_Port6			16
#define Box1_Port7			17
#define Box1_Port8			18
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Thanks for the tip. I actually got it all working, I have 2 problems
the 2nd set of relays is not showing on the RA screen
and
on the droid App I am not seeing the 2nd set either, any ideas?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

The second relay box will require you to build your own custom screen.
http://forum.reefangel.com/viewtopic.php?f=14&t=109
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Ok thanks, and to get the additional relays in the Droid App? and also on the Wifi screen? or will the custom menu fix all of that?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

The additional relay on the Android app will have to wait.
Curt is working on the app to show the extra relays. I'm anxiously waiting for that update too :)
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Losing my mind

Post by binder »

The wifi screen only shows the 1st relay as well. Additional relay support just hasn't been added in everywhere yet. It's being planned and worked on (like Roberto said).
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Ah ok, as long as I know that I am good with it. I can see the 2nd relay box in the client as well as the web banner so as long as there is some viability I am good. Thanks for the fast replies,
Image
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Ok, so I have a new development.
when I put my RA into feeding mode it turns off my 2 acinctic channels (1-5 and 1-6) not the 2 pump channels (1-3 and 1-4)
when the Actinics are to come on one of them does the other doesn't, I swapped the 2 power cords between the outlets and the problem stays with the outlet.
here are the bits of my PDE That I have setup for feeding and for the additional lights.
any ideas?

ReefAngel.FeedingModePorts = B00000101;
ReefAngel.FeedingModePortsE[0] = B00110000;
ReefAngel.WaterChangePorts = B11010101;
ReefAngel.WaterChangePortsE[0] = B00110000;
ReefAngel.LightsOnPorts = B00001010;
ReefAngel.LightsOnPortsE[0] = B00001100;

// Ports that are always on
ReefAngel.Relay.On(Port3);
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.On(13);
ReefAngel.Relay.On(14);
ReefAngel.Relay.On(17);
ReefAngel.Relay.On(18);
}

ReefAngel.StandardLights(Port2);
ReefAngel.StandardLights(11, 21, 0, 7, 0);
ReefAngel.StandardLights(12, 7, 0, 21, 0);
ReefAngel.MHLights(Port4);
ReefAngel.MHLights(15);
ReefAngel.MHLights(16);
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

Code: Select all

ReefAngel.FeedingModePortsE[0] = B00110000;
The above line means it will turn off port 5 and 6 when in feeding mode.
The binary number starts from the right to left. Confusing I know, but that's the way it is.
So, this leads me to believe that all your assignments are probably reversed too.
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Actually it makes sense, I will update my PDE when i get home tonight

thanks
Image
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Thanks that did it i reversed all of the expansion module relay ports that I had manually done and now when I do feeding mode the proper channels turn off.
one issue i have is ports 3 and 6 on the relay expansion do not turn on properly unless i power cycle the relay expansion, they show on in the client tool and on my banner. Is this a problem with the expansion or my code?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

Port 3 is supposed to be on all the time, right?
Are you saying that the port turns on and then turn off by itself?
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Correct that port should be on at all times. It seems that it does shut off on its own, i am having the same problem with port 6 too, if i power cycle the entire relay box it seems to bring them back on
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

Can you swap your svga cables between main relay box and expansion box to see if it makes any difference?
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Yea, I will do that tomorrow night when I get home. I might have a few of them laying around here from old monitors if that is the problem
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

I meant the main relay box and the expansion one.
You may not have luck with the ones you had from old monitors unless they have all 15 wires inside.
Most svga cables don't carry all 15 wires inside to save money.
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

I haven't forgot about this, just been slammed with work. It does appear that port 3 is working but port 6 still in order for it to come on I have to power cycle the relay box and then it comes on. I did check to make sure that none of the pins were bent and they were ok.
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

Can you post your latest code?
It's port 6 or port 16?
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

port 13 and 16
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

Can you post your latest code?
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Code: Select all

// Autogenerated file by RAGen (v1.1.0.126), (01/29/2012 19:29)
// RA_012912_1929.pde
//
// This version designed for v0.8.5 Beta 17 or later

/* The following features are enabled for this PDE File: 
#define DirectTempSensor
#define wifi
#define RelayExp
#define SIMPLE_MENU
#define ENABLE_ATO_LOGGING
#define ENABLE_EXCEED_FLAGS
*/


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

#include <avr/pgmspace.h>
// Labels for the web banner
prog_char id_label[] PROGMEM = "projectx";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Canopy";
prog_char probe3_label[] PROGMEM = "Not%20Used";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "Daylight";
prog_char relay3_label[] PROGMEM = "Return";
prog_char relay4_label[] PROGMEM = "Acintic";
prog_char relay5_label[] PROGMEM = "Skimmer";
prog_char relay6_label[] PROGMEM = "Heater";
prog_char relay7_label[] PROGMEM = "Dosing1";
prog_char relay8_label[] PROGMEM = "Dosing2";
prog_char relay11_label[] PROGMEM = "MoonLights";
prog_char relay12_label[] PROGMEM = "Sumplight";
prog_char relay13_label[] PROGMEM = "FtKorilia";
prog_char relay14_label[] PROGMEM = "BkKorilia";
prog_char relay15_label[] PROGMEM = "Actinic2";
prog_char relay16_label[] PROGMEM = "Actinic2";
prog_char relay17_label[] PROGMEM = "Chiller";
prog_char relay18_label[] PROGMEM = "Phosban";
PROGMEM const char *webbanner_items[] = {
    id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
	relay3_label, relay4_label, relay5_label, relay6_label, relay7_label, relay8_label, relay11_label, relay12_label,
	relay13_label, relay14_label, relay15_label, relay16_label, relay17_label, relay18_label};


void setup()
{
    ReefAngel.Init();  //Initialize controller
    // Initialize and start the web banner timer
    ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
    ReefAngel.Timer[4].SetInterval(120);  // set interval to 120 seconds
    ReefAngel.Timer[4].Start();

    ReefAngel.FeedingModePorts = B00000101;
    ReefAngel.FeedingModePortsE[0] = B00001100;
    ReefAngel.WaterChangePorts = B11010101;
    ReefAngel.WaterChangePortsE[0] = B00001100;
    ReefAngel.LightsOnPorts = B00001010;
    ReefAngel.LightsOnPortsE[0] = B00110011;

    // Ports that are always on
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.On(Port5);
    ReefAngel.Relay.On(13);
    ReefAngel.Relay.On(14);
    ReefAngel.Relay.On(17);
    ReefAngel.Relay.On(18);
}

void loop()
{
    // Specific functions
    ReefAngel.SingleATOLow(Port1);
    ReefAngel.StandardLights(Port2);
    ReefAngel.StandardLights(11, 21, 0, 10, 0);
    ReefAngel.StandardLights(12, 7, 0, 21, 0);
    ReefAngel.MHLights(Port4);
    ReefAngel.MHLights(15);
    ReefAngel.MHLights(16);
    ReefAngel.StandardHeater(Port6);
    ReefAngel.DosingPumpRepeat1(Port7);
    ReefAngel.DosingPumpRepeat2(Port8);
    

    // Web Banner stuff
    if(ReefAngel.Timer[4].IsTriggered())
    {
        ReefAngel.Timer[4].Start();
        ReefAngel.WebBanner();
    }

	ReefAngel.ShowInterface();
}
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

I don't see anything wrong with the code.
Does the screen on the controller show 13 and 16 green?
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

I dont have the screen programmed for the expansion, but the client does show both ports are on. If I pull the power cord out of the expansion, not the main relay box, when i plug it back in the relays will turn on
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Losing my mind

Post by rimai »

Have you tried swapping the cables or swapping the relay boxes?
It seems definitely some hardware issue.
I just wanted to confirm that.
If you swap the relay box and the main relay box starts giving you problems then we know for sure it is the box. Can you do that?
Roberto.
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

I can do that, let it run for a few days and see if i start getting odd results
Image
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Swapped the cable, should know tomorrow if it makes a difference or not.
Image
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

The swapping of the cable had no impact, I will swap the boxes now and see what happens in the morning
Image
projectx
Posts: 120
Joined: Sat Apr 23, 2011 6:53 pm

Re: Losing my mind

Post by projectx »

Ok, finally had some time to do the box swap, the problem follows the box. tried to swap the cable etc, same result,
Image
Post Reply