Please Help Setting Up My RA
Posted: Tue Aug 30, 2011 2:34 am
Hi all
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;
}

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;
}