i'm very appreciate if some one know how to solve my problem with my salinity expansion.
last week, i just hock up with a new ph expansion to monitor newly added Ca reactor.
after 3 days try out. ph expansion works fine with ca reactor, but my salinity doesnt work at all.
now it shows 6 what ever plug to usb hub or directly to relay box.
anything wrong with my probe or code.
attached code is updated with ph expansion.
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>
// Define Relay Ports by Name
#define Return 1
#define ATOPump 2
#define ZeovitShake 3
#define T5_Channel2 4
#define Co2 5
#define T5_Channel1 6
#define Skimmer 7
#define Wavepump 8
#define CaHCO3 Box1_Port1 //16Ch Port8
#define CaOH2 Box1_Port2 //16Ch Port9
#define ZEO_ST3 Box1_Port4 //16Ch Port11
#define MgCl2 Box1_Port5 //16Ch Port12
#define CaCl2 Box1_Port3 //16Ch Port12
// Define Custom Memory Locations
////// 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.AddSalinityExpansion(); // Salinity Expansion Module
ReefAngel.AddPHExpansion(); // pH Expansion Module
//Co2 Control
ReefAngel.CO2Control(Co2, 650, 670, true);
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port2Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T3_PROBE;
ReefAngel.OverheatProbe = T2_PROBE;
// Feeeding and Water Change mode speed
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
//ReefAngel.DCPump.ExpansionChannel[0] = Sync;
//ReefAngel.DCPump.ExpansionChannel[1] = AntiSync;
//ReefAngel.DCPump.ExpansionChannel[2] = None;
//ReefAngel.DCPump.ExpansionChannel[3] = None;
//ReefAngel.DCPump.ExpansionChannel[4] = None;
//ReefAngel.DCPump.ExpansionChannel[5] = None;
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On(Return);
ReefAngel.Relay.On(Wavepump);
////// Place additional initialization code below here
ReefAngel.CustomLabels[0]="ReturnPump";
ReefAngel.CustomLabels[1]="ATOPump";
ReefAngel.CustomLabels[2]="ZeovitShake";
ReefAngel.CustomLabels[3]="T5_Channel2";
ReefAngel.CustomLabels[4]="Co2";
ReefAngel.CustomLabels[5]="T5_Channel1";
ReefAngel.CustomLabels[6]="Skimmer";
ReefAngel.CustomLabels[7]="WavePump";
////// Place additional initialization code above here
}
void loop()
{
//single ATO
ReefAngel.SingleATO(true,ATOPump,90,1);
//Heater
//ReefAngel.StandardHeater(Heater);
//ZeovitShake
if (hour()==5 && minute()==26 && second()<20) //Dosing ST3 at 22:31
{
ReefAngel.Relay.On(ZeovitShake);
}
else if (hour()==2 && minute()==26 && second()<20) //Dosing ST3 at 6:31
{
ReefAngel.Relay.On(ZeovitShake);
}
else if (hour()==18 && minute()==56 && second()<20) //Dosing ST3 at 6:31
{
ReefAngel.Relay.On(ZeovitShake);
}
else if (hour()==22 && minute()==58 && second()<20) //Dosing ST3 at 6:31
{
ReefAngel.Relay.On(ZeovitShake);
}
else
{
ReefAngel.Relay.Off(ZeovitShake);
}
ReefAngel.Relay.DelayedOn(Skimmer);
// T5 light setup
ReefAngel.ActinicLights(T5_Channel2);
ReefAngel.DayLights(T5_Channel1);
//dosing pump setup
//Main 4
ReefAngel.DosingPumpRepeat1(CaHCO3);
ReefAngel.PWM.SetChannel(2,ReefAngel.Relay.Status(CaHCO3)*100);
ReefAngel.DosingPumpRepeat2(CaOH2);
ReefAngel.PWM.SetChannel(3,ReefAngel.Relay.Status(CaOH2)*100);
//ReefAngel.DosingPumpRepeat(CaCl2,5,120,8);
//ReefAngel.PWM.SetChannel(0,ReefAngel.Relay.Status(CaCl2)*100);
//ZEO ST3
ReefAngel.DosingPumpRepeat3(ZEO_ST3);
ReefAngel.PWM.SetChannel(4,ReefAngel.Relay.Status(ZEO_ST3)*100);
//ZEO SP
// if (hour()==0 && minute()==32 && second()<13)
// {
// ReefAngel.Relay.On(ZEO_SP);
// }
// else if (hour()==3 && minute()==32 && second()<13)
// {
// ReefAngel.Relay.On(ZEO_SP);
// }
// else if (hour()==6 && minute()==32 && second()<13)
// {
// ReefAngel.Relay.On(ZEO_SP);
// }
// else if (hour()==9 && minute()==32 && second()<13)
// {
// ReefAngel.Relay.On(ZEO_SP);
// }
// else if (hour()==12 && minute()==42 && second()<13)
// {
// ReefAngel.Relay.On(ZEO_SP);
// }
// else if (hour()==15 && minute()==32 && second()<13)
// {
// ReefAngel.Relay.On(ZEO_SP);
// }
// else if (hour()==18 && minute()==32 && second()<13)
// {
// ReefAngel.Relay.On(ZEO_SP);
// }
// else if (hour()==21 && minute()==32 && second()<13)
// {
// ReefAngel.Relay.On(ZEO_SP);
// }
// else
// {
// ReefAngel.Relay.Off(ZEO_SP);
// }
// ReefAngel.PWM.SetChannel(5,ReefAngel.Relay.Status(ZEO_SP)*100);
//wave pump setup
if (now() % SECS_PER_DAY >= 8 * SECS_PER_HOUR && now() % SECS_PER_DAY < (8 * SECS_PER_HOUR + 10 * SECS_PER_MIN) )
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(Lagoon,60,20);//Set 6105 to 60% speed with pulse in Lagoon Mode from 9:00~9:10
}
else if (now() % SECS_PER_DAY >= (8 * SECS_PER_HOUR + 10 * SECS_PER_MIN) && now() % SECS_PER_DAY < (10 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(TidalSwell,60,20); //Set 6105 to 55% speed with 20ms pulse in Tidal Swell Mode
}
else if (now() % SECS_PER_DAY >= (10 * SECS_PER_HOUR + 30 * SECS_PER_MIN) && now() % SECS_PER_DAY < (11 * SECS_PER_HOUR + 10 * SECS_PER_MIN) )
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(LongPulse,55,15);//Set 6105 to 60% speed with pulse in ReefCrest Mode
}
else if (now() % SECS_PER_DAY >= (11 * SECS_PER_HOUR + 10 * SECS_PER_MIN) && now() % SECS_PER_DAY < (12 * SECS_PER_HOUR + 0 * SECS_PER_MIN) )
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(ReefCrest,60,20);;//Set 6105 to 55% speed with Long pulse Mode
}
else if (now() % SECS_PER_DAY >= (12 * SECS_PER_HOUR + 0 * SECS_PER_MIN) && now() % SECS_PER_DAY < 15 * SECS_PER_HOUR )
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(TidalSwell,55,20); //Set 6105 to 45% speed with 20ms pulse in Tidal Swell Mode
}
else if (now() % SECS_PER_DAY >= 15 * SECS_PER_HOUR && now() % SECS_PER_DAY < (17 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(ReefCrest,60,20);//Set RW8 to 40% speed with Lagoon Pulse Mode
}
else if (now() % SECS_PER_DAY >= (17 * SECS_PER_HOUR + 30 * SECS_PER_MIN) && now() % SECS_PER_DAY < (18 * SECS_PER_HOUR + 30 * SECS_PER_MIN))
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(TidalSwell,60,20); //Set 6105 to 55% speed with 20ms pulse in Tidal Swell Mode
}
else if (now() % SECS_PER_DAY >= (18 * SECS_PER_HOUR + 30 * SECS_PER_MIN) && now() % SECS_PER_DAY < (19 * SECS_PER_HOUR + 00 * SECS_PER_MIN) )
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(Lagoon,60,20);//Set 6105 to 55% speed with pulse in Lagoon Mode
}
else if (now() % SECS_PER_DAY >= (19 * SECS_PER_HOUR + 0 * SECS_PER_MIN) && now() % SECS_PER_DAY < 20 * SECS_PER_HOUR )
{
ReefAngel.DCPump.UseMemory=false;
//ReefAngel.DCPump.SetMode(TidalSwell,50,20); //Set 6105 to 85% speed with 20ms pulse in Tidal Swell Mode
}
else if (now() % SECS_PER_DAY >= 20 * SECS_PER_HOUR && now() % SECS_PER_DAY < (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
{
ReefAngel.DCPump.UseMemory=false;
//ReefAngel.DCPump.SetMode(ReefCrest,55,20);//Set 6105 to 70% speed with Lagoon Pulse Mode
ReefAngel.DCPump.SetMode(ShortPulse,65,41);
}
else if (now() % SECS_PER_DAY >= (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN) && now() % SECS_PER_DAY < (22 * SECS_PER_HOUR + 35 * SECS_PER_MIN) )
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode(Lagoon,70,20);//Set 6105 to 90% speed with pulse in Lagoon Mode, dossing coral feed.
}
else
{
ReefAngel.DCPump.SetMode(Sine,50,30);
}
// Set RW-8 WaveMode
//if (hour() >= 8 && hour() < 9)
// {
// ReefAngel.PWM.SetChannel(0,GyreMode(45,75,60,true));
// ReefAngel.PWM.SetChannel(1,GyreMode(45,75,60,false));
// }
//else if (hour() >= 9 && hour() < 13)
//{
// ReefAngel.PWM.SetChannel(0,TidalSwellMode(75,true));
// ReefAngel.PWM.SetChannel(1,TidalSwellMode(75,false));
// }
//else if (hour() >= 13 && hour() < 17)
// {
// ReefAngel.PWM.SetChannel(0, ElseMode(60,20,true));
// ReefAngel.PWM.SetChannel(1, ElseMode(60,20,false));
// }
//else if (hour() >= 17 && hour() < 22)
// {
// ReefAngel.PWM.SetChannel(0, NutrientTransportMode(40,60,40,true));
// ReefAngel.PWM.SetChannel(1, NutrientTransportMode(40,60,40,false));
// }
//else
// {
// ReefAngel.PWM.SetChannel(0,ShortPulseMode(50,40,40,true));
// ReefAngel.PWM.SetChannel(1,ShortPulseMode(50,40,40,false));
// }
// Set timer when in feeding mode
// static unsigned long feeding;
// if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
// if (now()-feeding< 1 *SECS_PER_HOUR) {
// Continue NTM for the 60 minutes
// ReefAngel.DCPump.UseMemory=false;
// ReefAngel.DCPump.SetMode(NutrientTransport,35,30);
// }
//Autofeeder
if ( ((hour() == 18)) && (minute() == 58) &&(second() == 30) ) ReefAngel.FeedingModeStart();
if ( ((hour() == 9)) && (minute() == 28) &&(second() == 0) ) ReefAngel.FeedingModeStart();
if ( ((hour() == 14)) && (minute() == 28) &&(second() == 0) ) ReefAngel.FeedingModeStart();
//Skimmer off 1.5 hours when coral feeding.
if (now()%SECS_PER_DAY >= (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN) && now()%SECS_PER_DAY < (23 * SECS_PER_HOUR + 0 * SECS_PER_MIN) )
{
ReefAngel.Relay.Off(Skimmer);
}
////// Place your custom code below here
ReefAngel.UseFlexiblePhCalibration();
// Power Restored - Turn things back on
// Turn off Skimmer if Return pump has been shutoff.
if (!ReefAngel.Relay.Status(Return)) {
ReefAngel.Relay.Off(Skimmer);
//ReefAngel.Relay.Off(Heater);
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "sesame");
ReefAngel.DDNS("sesamehome");
ReefAngel.ShowInterface();
}