Turning off/on a ports when ATO turns on/off

Do you have a question on how to do something.
Ask in here.
Post Reply
GugsJr
Posts: 68
Joined: Fri Jun 20, 2014 6:30 am

Turning off/on a ports when ATO turns on/off

Post by GugsJr »

My top off container is connected to a conical tank and when I turn on my ATO pump it over flows the conical tank.

So here is what I'd like to program.

When the low ATO sensor trips I'd like it to turn off the main pump, then 2 minutes later turn on the ATO pump.

When the high ATO sensor trips turn off the ATO pump then 2 minutes later turn on the main pump.

Thank you
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Turning off/on a ports when ATO turns on/off

Post by rimai »

Try this.

Code: Select all

#include <Salinity.h>
#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 <RA_CustomLabels.h>
#include <RA_CustomSettings.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

unsigned long low_trigger=0;
unsigned long high_trigger=0;

void setup()
{
  ReefAngel.Init();  
  ReefAngel.Use2014Screen();
  ReefAngel.Relay.On(Port8); // Main pump
  ReefAngel.Relay.Off(Port7); // ATO pump
}

void loop()
{
  if (ReefAngel.LowATO.IsActive() && low_trigger==0)
  {
    low_trigger=now();
    ReefAngel.Relay.Off(Port8);
  }
  else
  {
    if (now()-low_trigger>5 && low_trigger!=0)
    {
      low_trigger=0;
      ReefAngel.Relay.On(Port7);
    }
  }

  if (ReefAngel.HighATO.IsActive() && high_trigger==0)
  {
    high_trigger=now();
    ReefAngel.Relay.Off(Port7);
  }
  else
  {
    if (now()-high_trigger>5 && high_trigger!=0)
    {
      high_trigger=0;
      ReefAngel.Relay.On(Port8);
    }
  }
  ReefAngel.ShowInterface();
}
This assumes that both floats are going to trip when the float is away from the wires.
If you need to invert any of them, just add an ! in from of either ReefAngel.LowATO.IsActive() or ReefAngel.HighATO.IsActive().
! means not.
Roberto.
GugsJr
Posts: 68
Joined: Fri Jun 20, 2014 6:30 am

Re: Turning off/on a ports when ATO turns on/off

Post by GugsJr »

Thank you, I'll try this and let you know.
Post Reply