Page 1 of 1

Two Single ATO's Setup

Posted: Thu Dec 20, 2012 9:23 am
by Lockes
Hey all

I am trying to figure out how to setup two separate float switches.

1. ATO for my tank
2. ATO for my top up container while I am away on holiday

or even setup the other float that will not affect the topup but will be able to tell me when the water level is low on my ipad app so that I can manually fill it up a bit

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

////// Place global variable code below here


////// Place global variable code above here

void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 64);
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 19, 4 , "BOBS REEF");
ReefAngel.LCD.Clear(COLOR_MAROON, 1, 13, 132, 13);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 75, 119, 75);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 59, 119, 59);
pingSerial();


ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, COLOR_WHITE, 33, 15, "Tank Water");
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
pingSerial();
ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, DefaultBGColor, 15, 26, text);
ConvertNumToString(text, ReefAngel.Params.Temp[T2_PROBE], 10);
pingSerial();
ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, DefaultBGColor, 60, 26, text);

ReefAngel.LCD.DrawLargeText(COLOR_MEDIUMSEAGREEN, COLOR_WHITE, 15, 35, "pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);

ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, 15, 42, text);
pingSerial();

ReefAngel.LCD.DrawLargeText(COLOR_MEDIUMSEAGREEN, COLOR_WHITE, 60, 35, "pH2");
ConvertNumToString(text, ReefAngel.Params.PHExp, 100);

ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, 60, 42, text);
pingSerial();

ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,84,"ATO");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,94,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,104,"CO2");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,114,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,84,"Return");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,94,"Vortech");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,104,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,114,"Heater");
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawCircleOutletBox(60, 86, TempRelay, true);
}

void DrawCustomGraph()
{

}

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    // 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 = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 260 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );

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

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

void loop()
{
    ReefAngel.SingleATO( true,Port2,60,0 );
    ReefAngel.StandardLights( Port3,4,0,23,0 );
    ReefAngel.StandardHeater( Port7,250,255 );
    ////// Place your custom code below here
    if (ReefAngel.Params.PHExp <= 735) ReefAngel.Relay.Off(Port6);  // If probe 2 PH <= 7.35 - turn off CO2
    if (ReefAngel.Params.PHExp >= 752) ReefAngel.Relay.On(Port6);  // If probe 2 PH >= 7.52 - turn on CO2    if (ReefAngel.Params.PH <= 790) Relay.Off(Port6);  // If PH <= LowPH - turn off CO2
    if (ReefAngel.Params.PH <= 790) ReefAngel.Relay.Off(Port6);  // If probe 1 PH <= 7.90 - turn off CO2
   

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

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

Re: Two Single ATO's Setup

Posted: Thu Dec 20, 2012 11:07 am
by rimai
Yes, you can use the 2nd float for anything.
Do you want to turn on/off a particular port?

Re: Two Single ATO's Setup

Posted: Thu Dec 20, 2012 12:22 pm
by Lockes
Yeah, want it to turn on/off another port for the second pump.

Can you assist with the code?

Thanks for all your help as always

Re: Two Single ATO's Setup

Posted: Thu Dec 20, 2012 12:23 pm
by rimai
What port is it?

Sent from my Galaxy S3 using Tapatalk 2

Re: Two Single ATO's Setup

Posted: Thu Dec 20, 2012 10:57 pm
by Lockes
We can make it 4 or 8 for now

Re: Two Single ATO's Setup

Posted: Thu Dec 20, 2012 11:03 pm
by rimai
Try this:

Code: Select all

    ReefAngel.SingleATO( true,Port4,60,0 ); // Low ATO float switch
    ReefAngel.Relay.Set( Port8, ReefAngel.HighATO.IsActive()); // High ATO float switch