Page 1 of 1
Setup PH controls for CaRx, Temp, and ATO
Posted: Sun Oct 26, 2014 12:41 pm
by mng777777
Hello,
I am new to this and need some help. I have my RA up and running. I ran the wizard and have everything setup the way I want, but there are a couple of things that are not addressed in the wizard. I have been reading up on the forums, and found some code, but I am in a little over my head. I don't know where to put the code or even if it's what I really need so... some help would be appreciated!
1) I have two PH probes. One in my reactor, and one in display. I need to define which relay will be controlled by each probe.
2) I have two Temp probes. One in DT, one in Sump. I need to define which relay will be controlled by each probe.
3) I have two float switches. One in sump, one in overflow. I need to define which relays will be controlled by each switch.
I imagine that the solution to each of these will look pretty similar, and I think I stumbled onto something of value in the ReefAngel library, but I don't understand this well enough yet. If offering help, please understand that simply posting code isn't going to get me there. I need some direction on how/what to do with the code.
I would like to start experimenting but I am not clear on the best way to save backups that I can revert back to.
Thanks in advance for your help!
Re: Setup PH controls for CaRx, Temp, and ATO
Posted: Sun Oct 26, 2014 5:50 pm
by mng777777
I think I have the PH, and Temps figured out. Will someone please review my work so far and tell me if it looks correct?
(Any Concerns/Improvements?)
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 <Humidity.h>
#include <DCPump.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.Use2014Screen(); // Let's use 2014 Screen
ReefAngel.AddPHExpansion(); // pH Expansion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port7Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port2Bit | Port3Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port4Bit;
// Use T1 and T2 probe as temperature and T1 as overheat functions
ReefAngel.TempProbe = T1_PROBE | T2_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Ports that are always on
ReefAngel.Relay.On( Port2 ); // Reactor Feed
ReefAngel.Relay.On( Port7 ); // Return Pump
ReefAngel.Relay.On( Port8 ); // Skimmer
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.CO2Control( Port1 );
ReefAngel.SingleATOLow( Port3 );
ReefAngel.StandardHeater( Port4 );
ReefAngel.Relay.DelayedOn( Port5 );
ReefAngel.MoonLights( Port6 );
////// Place your custom code below here
ReefAngel.CustomLabels[0]="CO2";
ReefAngel.CustomLabels[1]="Reactor";
ReefAngel.CustomLabels[2]="ATO";
ReefAngel.CustomLabels[3]="Heater";
ReefAngel.CustomLabels[4]="Power Heads";
ReefAngel.CustomLabels[5]="Fuge Light";
ReefAngel.CustomLabels[6]="Return";
ReefAngel.CustomLabels[7]="Skimmer";
if ( ReefAngel.Params.PHExp < 820 ) ReefAngel.Relay.Off( Port2 ); //Reactor Feed
if ( ReefAngel.Params.PHExp >= 840 ) ReefAngel.Relay.On( Port2 ); //Reactor Feed
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "mng777777" );
ReefAngel.ShowInterface();
}
Assuming all is good there, I am still trying to figure out how to ID and use two floats. One is for ATO function and the other is for emergency (in case of overflow shut off return)
Re: Setup PH controls for CaRx, Temp, and ATO
Posted: Sun Oct 26, 2014 5:54 pm
by rimai
You need to add some custom code.
There is a section inside loop() like this:
Code: Select all
////// Place your custom code below here
////// Place your custom code above here
That's where you place the code.
So, for #1:
You can use like this:
Code: Select all
if (ReefAngel.Params.PHExp < 780) ReefAngel.Relay.Off(Port1);
if (ReefAngel.Params.PHExp > 790) ReefAngel.Relay.On(Port1);
It will use your expansion module to turn on/off Port1.
Similar for #2:
Code: Select all
if (ReefAngel.Params.Temp[T2_PROBE] < 780) ReefAngel.Relay.Off(Port2);
if (ReefAngel.Params.Temp[T2_PROBE]> 790) ReefAngel.Relay.On(Port2);
It will use Temperature 2 to turn on/off Port2
For #3, it is the same concept with just different syntax:
Code: Select all
if (ReefAngel.LowATO.IsActive)
ReefAngel.Relay.Off(Port3);
else
ReefAngel.Relay.On(Port3);
And you can use LowATO or HighATO
Re: Setup PH controls for CaRx, Temp, and ATO
Posted: Mon Oct 27, 2014 7:12 am
by mng777777
I am getting this error:
Code: Select all
sketch_oct26b:90: error: could not convert 'ReefAngel.ReefAngelClass::HighATO.RA_ATOHighClass::IsActive' to 'bool'
Re: Setup PH controls for CaRx, Temp, and ATO
Posted: Mon Oct 27, 2014 7:32 am
by cosmith71
Use this:
Code: Select all
if (ReefAngel.HighATO.IsActive())
ReefAngel.Relay.Off(Port3);
else
ReefAngel.Relay.On(Port3);
The () after ReefAngel.HighATO.IsActive is missing.
--Colin