sorry not #5
3 and 4 have one of each power cables running to 2+2 ELM's,
{I did rewiring the ELM 60-40 drivers for a manual overdrive for case of emergency and when I finished then I noticed the #3 and #4 powercable swap inside the box, didn't wanted to re-solder again so I just moved the timing....}
I had to go downstairs to my old laptop monitoring the parameters for my testing....here is a current code from the RA+
Code: Select all
#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 <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>
////// Place global variable code below here
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.AddStandardMenu(); // Add Standard Menu
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit
| Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit
| Port7Bit | Port8Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 280 );
// Ports that are always on
//ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
// Set the Lights Overheat probe to be T1
ReefAngel.OverheatProbe = T1_PROBE; // Default: T2_PROBE
// Set the Water Temp probe to be T2, this is used for the StandardHeater and StandardFan functions
ReefAngel.TempProbe = T2_PROBE; // Default: T1_PROBE
////// Place additional initialization code below here
ReefAngel.Timer[1].SetInterval(45);
////// Place additional initialization code above here
}
void loop()
{
// ReefAngel.StandardATO( Port1,55 );
ReefAngel.StandardHeater( Port2,240,255 );
ReefAngel.StandardLights( Port3,11,5,20,5 );
ReefAngel.StandardLights( Port4,8,5,15,55 );
//The following is the timer for Polario
ReefAngel.StandardLights( Port7,9,5,19,5 );
if (hour()>=10 && hour()<18)
{
ReefAngel.Wavemaker( Port5,25 );
ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
}
else
{
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Off(Port6);
}
//ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,14,5,0,100,0) );
//ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,15,35,0,100,0) );
//ReefAngel.PWM.SetChannel( 2, PWMParabola(12,5,17,5,0,100,0) );
//ReefAngel.PWM.SetChannel( 3, PWMParabola(14,5,19,25,0,100,0) );
//ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,23,55,0,100,0) );
//ReefAngel.PWM.SetChannel( 5, PWMParabola(9,3,20,15,50,100,50) );
ReefAngel.PWM.SetChannel( 0, PWMSlope(9,5,14,5,0,100,20,0) );
ReefAngel.PWM.SetChannel( 1, PWMSlope(10,5,13,35,0,100,20,0) );
ReefAngel.PWM.SetChannel( 2, PWMSlope(12,5,17,5,0,100,20,0) );
ReefAngel.PWM.SetChannel( 3, PWMSlope(14,5,19,25,0,100,20,0) );
ReefAngel.PWM.SetChannel( 4, PWMSlope(18,35,23,55,0,100,30,0) );
////// Place your custom code below here
//Float #1
if (ReefAngel.IO.GetChannel(1)) // if float 1 is triggered
{
// ReefAngel.Relay.Off(Port8); // Turn Polario off
ReefAngel.Relay.Off(Port7); // Turn Return off
// BuzzerOn(); // Turn Buzzer on
}
//Float #2
if (ReefAngel.IO.GetChannel(2)) // if float 2 is triggered
{
ReefAngel.Relay.On(Port1); // Turn AutoTopOff on
ReefAngel.Timer[1].Start(); // Start/Trigger timer
}
// Float #3
// if (ReefAngel.IO.GetChannel(3)) // if float 3 is triggered
// BuzzerOn(); // Turn Buzzer on
// Float #4
// if (ReefAngel.IO.GetChannel(4)) // if float 4 is triggered
// ReefAngel.Relay.On(Port7); // Turn Skimmer off
// Float #5
// if (ReefAngel.IO.GetChannel(5)) // if float 5 is triggered
// ReefAngel.Relay.Off(Port8); // Turn Return off
// BuzzerOn(); // Turn Buzzer on
// Timer 1
if (ReefAngel.Timer[1].IsTriggered())
ReefAngel.Relay.Off(Port1); // Turn AutoTopOff off
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 14;
y = 6;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 6;
ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_NAVY,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();
// I/O Expansion
byte bkcolor;
x = 27;
y = 47;
for ( int a=0;a<4;a++ )
{
ReefAngel.LCD.DrawCircleOutline( x+(a*25),y,4,COLOR_NAVY );
if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE;
else bkcolor=COLOR_RED;
ReefAngel.LCD.FillCircle( x+(a*25),y,2,bkcolor );
}
pingSerial();
// Parameters
//#if defined DisplayLEDPWM && ! defined RemoveAllLights
//ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params,
//ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
//#else // defined DisplayLEDPWM && ! defined RemoveAllLights
//ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
//#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
// Parameters
// Set the starting coordinates for displaying the parameters
x =14;
y = 60;
// Change these values as needed. They are the threshold values
// for the low and high temperatures, respectively. The values do
// not contain decimal points.
int lowTempValue = 240;
int highTempValue = 255;
byte TempColor;
// To make changes for each temp sensor, change the value
// of TempColor to be the appropriate color
// T1 Temperature
if ( ReefAngel.Params.Temp[T1_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
else if ( ReefAngel.Params.Temp[T1_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
else { TempColor = PHColor; }
ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y,"LEDs:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T1_PROBE], TempColor, x+30, y,10);
// T2 Temperature
if ( ReefAngel.Params.Temp[T2_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
else if ( ReefAngel.Params.Temp[T2_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
else { TempColor = PHColor; }
ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y+10,"Tank:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T2_PROBE], TempColor, x+30, y+10,10);
// T3 Temperature
if ( ReefAngel.Params.Temp[T3_PROBE] < lowTempValue ) { TempColor = COLOR_BLUE; }
else if ( ReefAngel.Params.Temp[T3_PROBE] > highTempValue ) { TempColor = COLOR_RED; }
else { TempColor = PHColor; }
ReefAngel.LCD.DrawText(TempColor,COLOR_WHITE,x,y+20,"Room:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.Temp[T3_PROBE], TempColor, x+30, y+20,10);
ReefAngel.LCD.DrawText(PHColor,COLOR_WHITE,x+60,y,"PH:");
ReefAngel.LCD.DrawSingleMonitor(ReefAngel.Params.PH, PHColor, x+80, y,100);
// Keep these commented out to remove the DP & AP lines
// DrawText(DPColor,COLOR_WHITE,x+60,y+10,"DP:");
// DrawSingleMonitor(ReefAngel.PWM.GetDaylightValue(), DPColor, x+78, y+10,1);
// DrawText(APColor,COLOR_WHITE,x+60,y+20,"AP:");
// DrawSingleMonitor(ReefAngel.PWM.GetActinicValue(), APColor, x+78, y+20,1);
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 14, 95, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 120 );
pingSerial();
}
void DrawCustomGraph()
{
}
void BuzzerOn()
{
ReefAngel.PWM.SetActinic((now()%2)*100);
}
The #4 relay is powering the 2 ELM's with Channels 0 and 1 (one ELM each)
The #3 relay is powering the 2 ELM's with Channels 2 and 3 (one ELM each)
The #4 is a moonlight
#5 is off becuase the expansion module can't support enough Amps to the fans.
ReefAngel.StandardLights( Port3,11,5,20,5 );
ReefAngel.StandardLights( Port4,8,5,15,55 );
//ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,14,5,0,100,0) );
//ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,15,35,0,100,0) );
//ReefAngel.PWM.SetChannel( 2, PWMParabola(12,5,17,5,0,100,0) );
//ReefAngel.PWM.SetChannel( 3, PWMParabola(14,5,19,25,0,100,0) );
//ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,23,55,0,100,0) );
//ReefAngel.PWM.SetChannel( 5, PWMParabola(9,3,20,15,50,100,50) );
ReefAngel.PWM.SetChannel( 0, PWMSlope(9,5,14,5,0,100,20,0) );
ReefAngel.PWM.SetChannel( 1, PWMSlope(10,5,13,35,0,100,20,0) );
ReefAngel.PWM.SetChannel( 2, PWMSlope(12,5,17,5,0,100,20,0) );
ReefAngel.PWM.SetChannel( 3, PWMSlope(14,5,19,25,0,100,20,0) );
ReefAngel.PWM.SetChannel( 4, PWMSlope(18,35,23,55,0,100,30,0) );
8.05 AM relay #4 turns ON, 9.05 Channel 0 comes ON
10.05 Channel 1
11.05 relay #3
and so on
At evening the Channels 2 and 3 are ...looks like full light before turns OFF at 20.05 PM
Right now I am sitting in front of the tank, the RA+ LCD shows me
Channel 0=0; measuring 7.7 Volts on the dimming module port
ch1=0; 7.29V
ch2=0; 7.74V
ch3=100; 5.49V
ch4=0; 8.0V
ch5=0; 7.9V
but the LED channels 2 and 3 are ON both, can't say full light but almost