help with coding my new toys

Expansion modules and attachments
Post Reply
goisles1
Posts: 44
Joined: Wed Aug 14, 2013 10:35 am

help with coding my new toys

Post by goisles1 »

Hi,

I have a Avast Swabbie and Skimmate Locker that I need to program

I need the following:

ATO Low port #1 for my ATO pump
ATO HIGH port #3 for my Locker to shut off Skimmer when Locker is full
Swabbie port #4 to run every 5 hours for 180mins

Any advice on how to do this? Can it be achieved using the Wizard? I know there is a dosing option I can most likely use for the Swabbie.

But, Once I program ATO Low on Port 1, it's greyed out for all the other ports in the wizard.

Thanks,
Rob
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: help with coding my new toys

Post by rimai »

Code: Select all

ReefAngel.Relay.Set(Port3, ReefAngel.ATOHigh.IsActive()) ;
Try this for your high ATO port and skimmer.
The swabbie, do you want it on for 3 hrs and off for 2 hrs? Is that the schedule?
Roberto.
goisles1
Posts: 44
Joined: Wed Aug 14, 2013 10:35 am

Re: help with coding my new toys

Post by goisles1 »

rimai wrote:

Code: Select all

ReefAngel.Relay.Set(Port3, ReefAngel.ATOHigh.IsActive()) ;
Try this for your high ATO port and skimmer.
The swabbie, do you want it on for 3 hrs and off for 2 hrs? Is that the schedule?
Thanks Roberto. I will try that for the skimmer

For the Swabbie, that was a typo.. meant to say secs not mins.

I want it to run for 3 mins every 5 hours.

So I gave it a shot.. Skimmer is actually on port 2 not 3.

Here is the new code.. does it look ok?

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.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port4Bit | Port5Bit | Port8Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 850 );


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

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

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

void loop()
{
    ReefAngel.SingleATO( true,Port1,1200,0 );
    ReefAngel.Relay.Set(Port2, ReefAngel.ATOHigh.IsActive()) ;
    ReefAngel.Relay.DelayedOn( Port2,30 );
    ReefAngel.Relay.DelayedOn( Port3,30 );
    ReefAngel.StandardLights( Port4,11,45,19,45 );
    ReefAngel.StandardHeater( Port5,771,792 );
    ReefAngel.DosingPumpRepeat( Port7,0,60,180 );
    ReefAngel.StandardHeater( Port8,771,792 );
    ReefAngel.PWM.SetDaylight( MoonPhase() );
    ReefAngel.PWM.SetActinic( MoonPhase() );
    ReefAngel.PWM.SetChannel( 0, PWMSlope(13,0,18,30,0,30,60,0) );
    ReefAngel.PWM.SetChannel( 1, PWMSlope(12,0,19,30,0,60,60,0) );
    ////// Place your custom code below here
    

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

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

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

Re: help with coding my new toys

Post by rimai »

I don't think it will work the way it is now, because you are using the delayedon on port 2 also.
You need to change both lines to this:

Code: Select all

if (ReefAngel.ATOHigh.IsActive()) 
  ReefAngel.Relay.DelayedOn( Port2,30 );
else
  ReefAngel.Relay.Off( Port2 );
Then, add this for your swabbie:

Code: Select all

ReefAngel.Relay.Set(Port4, now()%18000<180 );
Roberto.
carlii
Posts: 91
Joined: Sat Mar 17, 2012 7:22 pm

Re: help with coding my new toys

Post by carlii »

Just for everyone else who has this setup: ATOHigh was inverted. It should be HighATO

if (ReefAngel.HighATO.IsActive())
ReefAngel.Relay.DelayedOn( Port2,30 );
else
ReefAngel.Relay.Off( Port2 );
carlii
Posts: 91
Joined: Sat Mar 17, 2012 7:22 pm

Re: help with coding my new toys

Post by carlii »

How do I code the portal to alert me when the HighATO switch is off? I tried 0 but I don't get alerts.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: help with coding my new toys

Post by rimai »

Did you wait long enough for the controller to send data to portal?
Roberto.
carlii
Posts: 91
Joined: Sat Mar 17, 2012 7:22 pm

Re: help with coding my new toys

Post by carlii »

I get an alert if I set the portal accordingly. "ATO High Port < 255"

What are the possible values for ATO High Port?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: help with coding my new toys

Post by rimai »

Now that I think of it, it may not work :(
The portal doesn't save zeros.
You may need to set a custom variable set as opposite to float switch.

Code: Select all

ReefAngel.CustomVar[0]=!ReefAngel.HighATO.IsActive();
Roberto.
carlii
Posts: 91
Joined: Sat Mar 17, 2012 7:22 pm

Re: help with coding my new toys

Post by carlii »

I got this response while I had the portal set to notify on High ATO.

Forum ID: carlii
Current Value: 0
ATO High Port < 255
Skimmate Locker Full
Skimmate Locker Full


Does this mean that a value of "0" is possible.
carlii
Posts: 91
Joined: Sat Mar 17, 2012 7:22 pm

Re: help with coding my new toys

Post by carlii »

All is well. ATO High = 0 worked. Thanks.
Post Reply