Help with kalk dosing, base on PH and ReefAngel.HighATO.IsActive()

Post Reply
acabano13
Posts: 6
Joined: Sun Jan 14, 2024 12:47 pm

Help with kalk dosing, base on PH and ReefAngel.HighATO.IsActive()

Post by acabano13 »

Hello,

tried the code below, but looks like with the float switch moving up and down(water flow), the ATO SW relay port is toggling, any pointers is greatly appreciated.

if ( ReefAngel.Params.PH > 810 ) ReefAngel.Relay.Off( Port7 );
if ( ReefAngel.Params.PH < 800 && ReefAngel.HighATO.IsActive() < 1) ReefAngel.Relay.On( Port7 );

Note:
kalk dosing, base on PH and ReefAngel.HighATO.IsActive() if possible.

Thanks,
User avatar
brennyn21
Posts: 116
Joined: Mon Nov 23, 2020 5:40 pm

Re: Help with kalk dosing, base on PH and ReefAngel.HighATO.IsActive()

Post by brennyn21 »

Do you have another port that is also based off the HighATO port then?
Sincerely, Brennyn
acabano13
Posts: 6
Joined: Sun Jan 14, 2024 12:47 pm

Re: Help with kalk dosing, base on PH and ReefAngel.HighATO.IsActive()

Post by acabano13 »

yes, port 6 I'm currently using as a standard ATO
User avatar
brennyn21
Posts: 116
Joined: Mon Nov 23, 2020 5:40 pm

Re: Help with kalk dosing, base on PH and ReefAngel.HighATO.IsActive()

Post by brennyn21 »

Can you post your code?
Sincerely, Brennyn
User avatar
brennyn21
Posts: 116
Joined: Mon Nov 23, 2020 5:40 pm

Re: Help with kalk dosing, base on PH and ReefAngel.HighATO.IsActive()

Post by brennyn21 »

this will keep port 6 off if that is your goal when port 7 is on

if ( ReefAngel.Relay.Status( Port7 ) ) ReefAngel.Relay.Off( Port6 );

if (ReefAngel.Params.PH > 810) {
ReefAngel.Relay.Off(Port7);
}

if (ReefAngel.Params.PH < 800 && ReefAngel.HighATO.IsActive() < 1) {
ReefAngel.Relay.On(Port7);
}
Sincerely, Brennyn
acabano13
Posts: 6
Joined: Sun Jan 14, 2024 12:47 pm

Re: Help with kalk dosing, base on PH and ReefAngel.HighATO.IsActive()

Post by acabano13 »

My observation with the kalk code below, is that the port 7 toggles when PH value fluctuates, same with the float sw (movement)

#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 <IO.h>
#include <AI.h>
#include <PH.h>
#include <ReefAngel.h>

//#include <Salinity.h>
//#include <ORP.h>
//#include <DCPump.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.AddStandardMenu(); // Add Standard Menu
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port6Bit | Port7Bit | Port8Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 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( 800 );
// Calibrate PH probe
ReefAngel.PHMin=567;
ReefAngel.PHMax=872;

// Ports that are always on
ReefAngel.Relay.On( Port2 ); // DayActLight
ReefAngel.Relay.On( Port5 ); // Lifter, Refugium pump, UV Pump and UV Sterilizer
ReefAngel.Relay.On( Port8 ); // Return, Powerhead, Skimmer and Wavemaker Pump

// Ports that are always off
ReefAngel.Relay.Off( Port7 ); // Kalk Pump

////// Place additional initialization code below here


////// Place additional initialization code above here
}

void loop()
{
// Delayed On
//ReefAngel.Relay.DelayedOn( Port2,8 ); for Skimmer

// Tank Heater code
ReefAngel.StandardHeater( T1_PROBE,Port3,770,780 ); // Main tank Heater
if ( ReefAngel.Params.Temp[ T1_PROBE ] <= 750 ) ReefAngel.Relay.On( Port3 ); // Tank Temperature low limit

// Refugium Lights code
ReefAngel.StandardLights( Port4,23,0,5,0 ); // Refugium Lights

// ATO code
ReefAngel.StandardATO( Port6,90 ); // ATO Port

// LED Lights code
//ReefAngel.StandardLights( Port2,13,0,24,0 ); // LED fixture power
//ReefAngel.PWM.SetDaylight( PWMSlope( 16,0,22,0,2,50,60,0 ) ); // Daylight PWMSlope
//ReefAngel.PWM.SetActinic( PWMSlope( 15,0,23,0,2,45,60,0 ) ); // Actinic PWMSlope

// Feeding code
ReefAngel.StandardLights( Port1,18,55,19,20 );
//if ( ReefAngel.Relay.Status( Port1 ) ) ReefAngel.Relay.Off( Port8 ); // During Feeding Mode, port turned Off
if ( ReefAngel.Relay.Status( Port1 ) ) ReefAngel.Relay.Off( Port8 ); // During Feeding Mode, port turned Off
else ReefAngel.Relay.On( Port8 );


// Kalk dosing code
if ( ReefAngel.Params.PH >= 100 && ReefAngel.Params.PH <= 620 ) ReefAngel.Relay.Off( Port7 ); // Failsafe to shut-off reactor.
if ( ReefAngel.Params.PH > 810 ) ReefAngel.Relay.Off( Port7 );
if ( ReefAngel.Params.PH < 800 && ReefAngel.HighATO.IsActive() < 1) ReefAngel.Relay.On( Port7 );




////// Place your custom code above here

ReefAngel.Portal( "acabano" );
// This should always be the last line
ReefAngel.ShowInterface();
}



// RA_STRING1=null
// RA_STRING2=null
// RA_STRING3=null
// RA_LABEL LABEL_PORT5=LftrRefuPmpUv
// RA_LABEL LABEL_PORT8=RtnSkmWavePwrHd
// RA_LABEL LABEL_PORT2=DayActLight
// RA_LABEL LABEL_PORT6=ATO
// RA_LABEL LABEL_PORT1=Feed
// RA_LABEL LABEL_PORT4=RefuLight
// RA_LABEL LABEL_PORT7=Kalk
// RA_LABEL LABEL_DAYLIGHT=Daylight
// RA_LABEL LABEL_PORT3=Heater
// RA_LABEL LABEL_ACTINIC=Actinic
acabano13
Posts: 6
Joined: Sun Jan 14, 2024 12:47 pm

Re: Help with kalk dosing, base on PH and ReefAngel.HighATO.IsActive()

Post by acabano13 »

ended up using the below statements, but would like to add some kind of a timeout to "if ( ReefAngel.Params.PH <= 8000 ) ReefAngel.Relay.On( Port7 );"

// Kalk dosing code
if ( ReefAngel.Params.PH >= 1000 && ReefAngel.Params.PH <= 6200 ) ReefAngel.Relay.Off( Port7 ); // Failsafe to shut-off reactor
if ( ReefAngel.Params.PH >= 8100 ) ReefAngel.Relay.Off( Port7 );
if ( ReefAngel.Params.PH <= 8000 ) ReefAngel.Relay.On( Port7 );
Post Reply