Please Help Setting Up My RA

Do you have a question on how to do something.
Ask in here.
Post Reply
Francois
Posts: 30
Joined: Tue Aug 30, 2011 2:08 am
Location: South Africa

Please Help Setting Up My RA

Post by Francois »

Hi all :D

I recently purchase the RA and played with the PDE file abit, only got the USA cables today as I couldn't connect anything on my RA due to our sockets been SA. This is what I want to do with the RA:

1. ATO
2. Standard lights on 08:00 am off 09:00 pm (Actinics)
3. Standard lights on 08:30 am off 08:00 pm (Mid Morning Lights)
4. Standard lights on 09:00 am off 07:00 pm (Pre-Main Lights)
5. Standard lights on 09:30 am off 06:30 pm (Main Lights)
6. Standard lights on 06:30 am off 12:30 pm (Sump Lights)
7. Skimmer pump (All ways on but off during water change)
8. Return ( All ways on but off when doing water change )

Relay expansion box 1

1. Power head (All ways on but off when feeding and doing water change)
2. Power head (All ways on but off when feeding and doing water change)
3. Power head (On 09:00 am off 07:00 pm but off when feeding) I could only code this as standard lights.
4. Power head (On 09:00 am off 07:00 pm but off when feeding) I could only code this as standard lights.
5. Standard Heater (Heater) on and off a certain temp. (Temp. in Celsius)
6. Standard Fan ( Chiller ) on and off a certain temp. (Temp. in Celsius)
7. Standard Fan ( Normal Fans ) on 09:00 am off 07:00 pm
8. Not in use

Moonlights and WiFi attached to the controller aswell

This is what I code so far with Robertos help:

// Autogenerated file by RAGen (v1.0.4.92), (08/05/2011 12:21)
// RA_080511_1221.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File:
#define ATOSetup
#define DisplayLEDPWM
#define wifi
#define RelayExp
#define StandardLightSetup
*/


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

// Labels for the web banner
#include <avr/pgmspace.h>
prog_char id_label[] PROGMEM = "rimai";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "Not%20Used";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "Actinic";
prog_char relay3_label[] PROGMEM = "Halide";
prog_char relay4_label[] PROGMEM = "Powerhead%202";
prog_char relay5_label[] PROGMEM = "Powerhead%201";
prog_char relay6_label[] PROGMEM = "Chiller";
prog_char relay7_label[] PROGMEM = "Heater";
prog_char relay8_label[] PROGMEM = "Sump";
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};


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

ReefAngel.FeedingModePorts = B00000000;
ReefAngel.FeedingModePortsE[0] = B00001111;
ReefAngel.WaterChangePorts = B11000000;
ReefAngel.WaterChangePortsE[0] = B00000011;
ReefAngel.OverheatShutoffPorts = B00011000;
ReefAngel.LightsOnPorts = B00011110;

// Ports that are always on
ReefAngel.Relay.On(Port7);
ReefAngel.Relay.On(Port8);
ReefAngel.Relay.On(Box1_Port1);
ReefAngel.Relay.On(Box1_Port2);
}

void loop()
{
ReefAngel.ShowInterface();

// Specific functions
ReefAngel.StandardATO(Port1);
ReefAngel.StandardLights(Port2,8,0,21,0);
ReefAngel.StandardLights(Port3,8,30,20,0);
ReefAngel.StandardLights(Port4,9,0,19,0);
ReefAngel.StandardLights(Port5,9,30,18,30);
ReefAngel.StandardLights(Port6,6,30,12,30);
ReefAngel.StandardLights(Box1_Port3,9,0,18,30);
ReefAngel.StandardLights(Box1_Port4,9,0,18,30);
ReefAngel.StandardHeater(Box1_Port5);
ReefAngel.StandardFan(Box1_Port6);
ReefAngel.StandardFan(Box1_Port7);
ReefAngel.PWM.SetActinic(MoonPhase());
ReefAngel.PWM.SetDaylight(MoonPhase());

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


byte MoonPhase()
{
int m,d,y;
int yy,mm;
long K1,K2,K3,J,V;
byte PWMvalue;
m=month();
d=day();
y=year();
yy=y-((12-m)/10);
mm=m+9;
if (mm>=12) mm-=12;
K1=365.25*(yy+4712);
K2=30.6*mm+.5;
K3=int(int((yy/100)+49)*.75)-38;
J=K1+K2+d+59-K3;
V=(J-2451550.1)/0.29530588853;
V-=int(V/100)*100;
V=abs(V-50);
PWMvalue=4*abs(50-V); // 5.12=100% 4=~80%
//pinMode(lowATOPin,OUTPUT);
return (PWMvalue*100)/255;
}
Image
Francois
Posts: 30
Joined: Tue Aug 30, 2011 2:08 am
Location: South Africa

Re: Please Help Setting Up My RA

Post by Francois »

Can I change the Labels for the web banner as what I want it to be? I'm going to program the RA tonight and see how it goes.
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Please Help Setting Up My RA

Post by binder »

Francois wrote:Can I change the Labels for the web banner as what I want it to be? I'm going to program the RA tonight and see how it goes.
Yes. You will just need to modify the labels in this section. Also, you will want to change the userid (idlabel) to be your own id and not Roberto's. You can just pick any id, there's not a specific assignment of id's.

With the labels, if you want to insert a space, you must put in the %20 otherwise an error will occur.

Code: Select all

prog_char id_label[] PROGMEM = "rimai";   // put your own id here
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "Not%20Used";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "Actinic";
prog_char relay3_label[] PROGMEM = "Halide";
prog_char relay4_label[] PROGMEM = "Powerhead%202";
prog_char relay5_label[] PROGMEM = "Powerhead%201";
prog_char relay6_label[] PROGMEM = "Chiller";
prog_char relay7_label[] PROGMEM = "Heater";
prog_char relay8_label[] PROGMEM = "Sump";
This should get you started. Also, this will only do the main relay box. There are additional labels that are needed for the relay box.

curt
Francois
Posts: 30
Joined: Tue Aug 30, 2011 2:08 am
Location: South Africa

Re: Please Help Setting Up My RA

Post by Francois »

Like this:

prog_char id_label[] PROGMEM = "Francois";
prog_char probe1_label[] PROGMEM = "Water";
prog_char probe2_label[] PROGMEM = "Room";
prog_char probe3_label[] PROGMEM = "Outside";
prog_char relay1_label[] PROGMEM = "ATO";
prog_char relay2_label[] PROGMEM = "Actinic";
prog_char relay3_label[] PROGMEM = "Lights%201";
prog_char relay4_label[] PROGMEM = "Lights%202";
prog_char relay5_label[] PROGMEM = "Lights%203";
prog_char relay6_label[] PROGMEM = "Sump%20Lights";
prog_char relay7_label[] PROGMEM = "Skimmer";
prog_char relay8_label[] PROGMEM = "Return";

//Relay Exspansion 1

prog_char relay1_label[] PROGMEM = "PowerHead%201";
prog_char relay2_label[] PROGMEM = "PowerHead%202";
prog_char relay3_label[] PROGMEM = "PowerHead%203";
prog_char relay4_label[] PROGMEM = "PowerHead%204";
prog_char relay5_label[] PROGMEM = "Heater";
prog_char relay6_label[] PROGMEM = "Chiller";
prog_char relay7_label[] PROGMEM = "Fans";
prog_char relay8_label[] PROGMEM = "Not%20In%20Use";
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Please Help Setting Up My RA

Post by binder »

The relay expansion should be:

Code: Select all

prog_char relay11_label[] PROGMEM = "PowerHead%201";
prog_char relay12_label[] PROGMEM = "PowerHead%202";
prog_char relay13_label[] PROGMEM = "PowerHead%203";
prog_char relay14_label[] PROGMEM = "PowerHead%204";
prog_char relay15_label[] PROGMEM = "Heater";
prog_char relay16_label[] PROGMEM = "Chiller";
prog_char relay17_label[] PROGMEM = "Fans";
prog_char relay18_label[] PROGMEM = "Not%20In%20Use";
You will notice that it's 11 through 18 which indicates that it is the 1st expansion relay.

curt
Francois
Posts: 30
Joined: Tue Aug 30, 2011 2:08 am
Location: South Africa

Re: Please Help Setting Up My RA

Post by Francois »

I got a problem,that PDE that I created with RA Gen it cant load it says sketch to big. Plz help.
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Please Help Setting Up My RA

Post by binder »

Francois wrote:I got a problem,that PDE that I created with RA Gen it cant load it says sketch to big. Plz help.
Shorten the names of the labels. Instead of doing Powerhead, do a PH. The longer the labels, the more space it requires.

Also, you can remove the #define StandardLightSetup from the ReefAngel_Features.h file. That's only necessary if you are going to change the values from the setup screen and you have things hard coded. So you are just wasting space with that one.

Also, you may want to enable the simple menu (#define SIMPLE_MENU) for your ReefAngel_Features.h file. This will reduce code size a lot and strip out extra menu stuff that you don't need.

curt
Francois
Posts: 30
Joined: Tue Aug 30, 2011 2:08 am
Location: South Africa

Re: Please Help Setting Up My RA

Post by Francois »

binder wrote:
Francois wrote:I got a problem,that PDE that I created with RA Gen it cant load it says sketch to big. Plz help.
Shorten the names of the labels. Instead of doing Powerhead, do a PH. The longer the labels, the more space it requires.

Also, you can remove the #define StandardLightSetup from the ReefAngel_Features.h file. That's only necessary if you are going to change the values from the setup screen and you have things hard coded. So you are just wasting space with that one.

Also, you may want to enable the simple menu (#define SIMPLE_MENU) for your ReefAngel_Features.h file. This will reduce code size a lot and strip out extra menu stuff that you don't need.

curt
Ok, I'm getting closer to solving this problem ;) .Ok I've done all that and copied #define SIMPLE_MENU in my ReefAngel_Features.h file and PDE file, It goes throught and states at the end avrdude done. Thank You and on top of it Problem uploading to the board, what does this mean? did the code upload to the board or not :roll:
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Please Help Setting Up My RA

Post by rimai »

If it says "Problem uploading to board", it did not.
Make sure you select the correct board on "Tools->Board" and the correct COM port under "Tools->Serial Port".
Which operating system are you using?
Roberto.
Francois
Posts: 30
Joined: Tue Aug 30, 2011 2:08 am
Location: South Africa

Re: Please Help Setting Up My RA

Post by Francois »

rimai wrote:If it says "Problem uploading to board", it did not.
Make sure you select the correct board on "Tools->Board" and the correct COM port under "Tools->Serial Port".
Which operating system are you using?
I'm using win 7 64 bit, on "Tools->Board" there are three boards Reef Controller, Reef Controller w/ obtiboot and Reef Angel Plus, I selected Reef Controller as stated in the manual, I selected the right serial port which is COM 13.Did I choose the right board?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Please Help Setting Up My RA

Post by rimai »

Ok, to make sure the COM port it is indeed correct, when you open and close the Arduino Software and have the USB cable connected to the head unit, does the controller reboot?
Roberto.
Francois
Posts: 30
Joined: Tue Aug 30, 2011 2:08 am
Location: South Africa

Re: Please Help Setting Up My RA

Post by Francois »

Yeah! I got it sorted code is uploaded, I choose Reef Controller w/ obtiboot and it went through like a charm. Thanx for the help guys. Now next will be setting up the WiFi unit.
Image
Post Reply