pH control linked to water level and timed safety
pH control linked to water level and timed safety
I currently have an ato based on my water level expansion, and a separate kalk container on a port for pH control via a RA dosing pump to combat night time pH drops.
I want to program a safety code that prevents the port from being on for more than a cumilative 10 minutes per hour, or alternatively to wait at least ten minutes between max 5 minute doses. Another alternative is to prevent pH control port from dosing if my water level is above for example 55 to prevent too much of a salinity drop.
I want to program a safety code that prevents the port from being on for more than a cumilative 10 minutes per hour, or alternatively to wait at least ten minutes between max 5 minute doses. Another alternative is to prevent pH control port from dosing if my water level is above for example 55 to prevent too much of a salinity drop.
Last edited by Irieivan on Wed Sep 06, 2017 3:24 pm, edited 1 time in total.
Re: pH control linked to water level and timed safety
What is the code you are using for the dosing pump?
Roberto.
Re: pH control linked to water level and timed safety
I am using the standard pH control code from the wizard. Dont have access to post code at the moment, will post tomorrow.
Personally i think the best failsafe will be the water level fail safe instead of timed failsafes?
Personally i think the best failsafe will be the water level fail safe instead of timed failsafes?
Last edited by Irieivan on Thu Sep 07, 2017 9:03 am, edited 1 time in total.
Re: pH control linked to water level and timed safety
This is the code I have set up with the wizrd, have no idea how to code or where to put what.
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 <PAR.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.Use2014Screen(); // Let's use 2014 Screen
ReefAngel.AddWaterLevelExpansion(); // Water Level Expansion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port8Bit;
ReefAngel.FeedingModePortsE[0] = Port1Bit | Port2Bit | Port4Bit | Port5Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit;
ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit | Port4Bit | Port5Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
ReefAngel.LightsOnPortsE[0] = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port7Bit | Port8Bit;
ReefAngel.OverheatShutoffPortsE[0] = 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( Port1 );
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port2 );
ReefAngel.Relay.On( Box1_Port5 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.PHControl( Port2,819,821 );
ReefAngel.StandardLights( Port4,9,0,19,0 );
ReefAngel.Relay.DelayedOn( Port5,1 );
ReefAngel.WaterLevelATO( Port6,225,44,46 );
ReefAngel.StandardHeater( Port7,255,265 );
ReefAngel.Relay.DelayedOn( Port8,1 );
ReefAngel.Relay.DelayedOn( Box1_Port4,1 );
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Irieivan" );
ReefAngel.ShowInterface();
Re: pH control linked to water level and timed safety
I think the easiest way would be to constrain it. I think the way I would go is the first 10 minutes of every hour, this way it would never exceed and you'd be making hourly adjustments only.
Code: Select all
if (now%3600<600) {
ReefAngel.PHControl(...);
} else {
ReefAngel.Relay.Off(Port2);
}
Re: pH control linked to water level and timed safety
Thank you for the response.
Would that code allow it to only activate the port if pH reaches below set point or is that regardless of set point?
My day time pH reaches 8.3+ so even a 5min kalk dose is overkill during the day. Lights off at 9pm, so is there a way to add to the code above to only dise between 10pm and 9am for the 1st 5mins of every hour.
Would that code allow it to only activate the port if pH reaches below set point or is that regardless of set point?
My day time pH reaches 8.3+ so even a 5min kalk dose is overkill during the day. Lights off at 9pm, so is there a way to add to the code above to only dise between 10pm and 9am for the 1st 5mins of every hour.
Re: pH control linked to water level and timed safety
It would be based on how you setup the PH Control function. In my example it's using Internal Memory so from the portal check the high and low PH settings. If you want to hard-code it, you would do as you had before:
ReefAngel.PHControl( Port2,819,821 );
ReefAngel.PHControl( Port2,819,821 );
Re: pH control linked to water level and timed safety
Thanks for you response, but i am totally clueless when it gets to coding.
Is there not something similar to the osc function that apex users have?
Something to the effect of:
If pH<8.20, on every ten minutes for ten seconds, but if pH> thn 8.25 then OFF?
I dont know what hard coding is either. Cant one simply insert code into the sketch which is created and saved by wizard, and then export it to controller ?
Is there not something similar to the osc function that apex users have?
Something to the effect of:
If pH<8.20, on every ten minutes for ten seconds, but if pH> thn 8.25 then OFF?
I dont know what hard coding is either. Cant one simply insert code into the sketch which is created and saved by wizard, and then export it to controller ?
Re: pH control linked to water level and timed safety
That's exactly what he posted above.
If you look in your code, there is a place to put custom code in the loop section.
If you look in your code, there is a place to put custom code in the loop section.
Roberto.
Re: pH control linked to water level and timed safety
Thanks again for the help and apologies for always asking what might seem to you as stupid questions.
So i dont have to add anything to the code, just insert it into my current sketch where it tells me //// place custome code below here?
So i dont have to add anything to the code, just insert it into my current sketch where it tells me //// place custome code below here?
Re: pH control linked to water level and timed safety
If i wanted to only dose the kalk for 2.5 minutes every 30 minutes, i just change the code above from 1800<150?
Re: pH control linked to water level and timed safety
Take out or comment the line that has the original PHControl statement so you dont get confused later
You can comment it with a // in front.

Re: pH control linked to water level and timed safety
Like I keep saying, I am too stupid for this.
And when I try to upload, I get an error:
invalid operands of type time_t00'and'init' to binary'operator%'
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 <PAR.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.Use2014Screen(); // Let's use 2014 Screen
ReefAngel.AddWaterLevelExpansion(); // Water Level Expansion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port3Bit | Port8Bit;
ReefAngel.FeedingModePortsE[0] = Port1Bit | Port2Bit | Port4Bit | Port5Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit;
ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit | Port4Bit | Port5Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
ReefAngel.LightsOnPortsE[0] = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit | Port7Bit | Port8Bit;
ReefAngel.OverheatShutoffPortsE[0] = 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( Port1 );
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port2 );
ReefAngel.Relay.On( Box1_Port5 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.PHControl( Port2,819,822 );
ReefAngel.Relay.DelayedOn( Port3,2 );
ReefAngel.StandardLights( Port4,9,0,19,0 );
ReefAngel.Relay.DelayedOn( Port5,1 );
ReefAngel.WaterLevelATO( Port6,225,44,46 );
ReefAngel.StandardHeater( Port7,255,265 );
ReefAngel.Relay.DelayedOn( Port8,1 );
ReefAngel.Relay.DelayedOn( Box1_Port4,1 );
////// Place your custom code below here
if (now%3600<600) {ReefAngel.PHControl(...);} else {
ReefAngel.Relay.Off(Port2);
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "Irieivan" );
ReefAngel.ShowInterface();
}
invalid operands of type time_t00'and'init' to binary'operator%'
Re: pH control linked to water level and timed safety
When I replace the (...) in the suggested code with my pH control values, I get the same error
Re: pH control linked to water level and timed safety
I think there is a typo.
It should be now() and not just now
It should be now() and not just now
Roberto.
Re: pH control linked to water level and timed safety
if (now(%3600<600) {
ReefAngel.PHControl(Port2,819,822);
} else {
ReefAngel.Relay.Off(Port2);
}
Error again:
Expected primary expression before'%' token
ReefAngel.PHControl(Port2,819,822);
} else {
ReefAngel.Relay.Off(Port2);
}
Error again:
Expected primary expression before'%' token
Re: pH control linked to water level and timed safety
Ok got it figured out thanks