Page 1 of 1

Custom Coding float swithes

Posted: Sat Feb 14, 2015 11:52 am
by ewaldsreef
Thank you in advance for your valuable time.
I would like one of my float switches in the sump to send an alert, set off the buzzer and activate a relay to engerize a soleniod to cut off the rro water to my top off. once the level drops I would like it to return to normal without needing to clear anything.
I would like the second float to shut off my return( it would monitor water level in the over flow) send an alert and set off the buzzer.
I am still learning the coding. Had my RA over a year now and finally getting around to learning how to do the custom stuff lol.
Again thank you for any help

Re: Custom Coding float swithes

Posted: Sat Feb 14, 2015 12:00 pm
by ewaldsreef
also since I am not using the ato function could I remove this from the menu on the ra unit?

Re: Custom Coding float swithes

Posted: Sat Feb 14, 2015 12:46 pm
by rimai
Which channel do you have the buzzer connected to?

Re: Custom Coding float swithes

Posted: Sat Feb 14, 2015 12:47 pm
by rimai
And which relay port do you want to activate?

Re: Custom Coding float swithes

Posted: Sat Feb 14, 2015 1:28 pm
by ewaldsreef
The buzzer is on the second dimming port. return pump is on port 1and I am looking to
activate port 8 for the shut off valve.

Re: Custom Coding float swithes

Posted: Sat Feb 14, 2015 4:00 pm
by rimai
2nd as in channel 1 of dimming expansion?

Re: Custom Coding float swithes

Posted: Sat Feb 14, 2015 4:19 pm
by ewaldsreef
The second port on the main relay box

Re: Custom Coding float swithes

Posted: Sat Feb 14, 2015 5:29 pm
by rimai
Ah, we call them actiinic and daylight. Which one is it?

Re: Custom Coding float swithes

Posted: Sat Feb 14, 2015 5:54 pm
by ewaldsreef
Actinic. Thank you

Re: Custom Coding float swithes

Posted: Sun Feb 15, 2015 8:54 am
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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

boolean alert=false;

void setup()
{
  ReefAngel.Init();  
}

void loop()
{
  // Low Float for RO water
  if (ReefAngel.LowATO.IsActive()) 
  {
    ReefAngel.Relay.On(Port8);
    alert=false;
  }
  else
  {
    ReefAngel.Relay.Off(Port8);
    alert=true;
  }

  
  // High Float for Overflow
  if (ReefAngel.HighATO.IsActive()) 
  {
    ReefAngel.Relay.On(Port1);
    alert=false;
  }
  else
  {
    ReefAngel.Relay.Off(Port1);
    alert=true;
  }
  
  if (alert)
  {
    ReefAngel.PWM.SetActinic(100);
  }
  else
  {
    ReefAngel.PWM.SetActinic(0);
  }
  
  ReefAngel.ShowInterface();
}

Re: Custom Coding float swithes

Posted: Sun Feb 15, 2015 2:01 pm
by ewaldsreef
Thank you so much for your time. I screwed something up lol
I was unsucessful with the code so I tryed to return to my previous code but now the lights dont workwith the timmer. Here is my current code as I have it.

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>

// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;

////// 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 
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port2Bit | Port3Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port6Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


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

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

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

void loop()
{
    ReefAngel.DayLights( Port2 );
    ReefAngel.ActinicLights( Port3 );
    ReefAngel.Relay.DelayedOn( Port4 );
    ReefAngel.StandardHeater( Port6 );
    overheatflag = InternalMemory.read( Overheat_Exceed_Flag );
    buzzer = overheatflag;
    if ( buzzer >= 1 ) buzzer = 100;
    ReefAngel.PWM.SetActinic( buzzer );

    ////// Place your custom code below here
    

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

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

Re: Custom Coding float swithes

Posted: Sun Feb 15, 2015 2:19 pm
by ewaldsreef
I had AI Vegas on the tank so I did not use the light ports previously. The AIs are not working right now so I went back to my old setup. I have the lights setup to run daylight at 12pm to 9pm with actinics to turn on 30 minute before and after.
Seriusly considering purchasing another setup to learn on and then add to my propigation system in the future. Also purchased and Uno to learn some basics. :D
Again I thank you for your help

Re: Custom Coding float swithes

Posted: Sun Feb 15, 2015 6:56 pm
by ewaldsreef
Got everthing working perfect except the buzzer will not go on when low float is trigger in the sump. It does trigger port 8 Properly

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>

// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;
boolean alert=false;
////// 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 
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port2Bit | Port3Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port6Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;


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

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

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

void loop()
{
    ReefAngel.StandardLights(Port2,11,30,21,30); 
    ReefAngel.StandardLights(Port3,12,0,21,0); 
    ReefAngel.Relay.DelayedOn( Port4 );
    ReefAngel.StandardHeater( Port6 );
    overheatflag = InternalMemory.read( Overheat_Exceed_Flag );
    buzzer = overheatflag;
    if ( buzzer >= 1 ) buzzer = 100;
    ReefAngel.PWM.SetActinic( buzzer );

    ////// Place your custom code below here
    {
  // Low Float for RO water
  if (ReefAngel.LowATO.IsActive()) 
  {
    ReefAngel.Relay.On(Port8);
    alert=false;
  }
  else
  {
    ReefAngel.Relay.Off(Port8);
    alert=true;
  }

  
  // High Float for Overflow
  if (ReefAngel.HighATO.IsActive()) 
  {
    ReefAngel.Relay.On(Port1);
    alert=false;
  }
  else
  {
    ReefAngel.Relay.Off(Port1);
    alert=true;
  }
  
  if (alert)
  {
    ReefAngel.PWM.SetActinic(100);
  }
  else
  {
    ReefAngel.PWM.SetActinic(0);
  }
  
  ReefAngel.ShowInterface();
}


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

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


Re: Custom Coding float swithes

Posted: Sun Feb 15, 2015 7:45 pm
by rimai
Oh yeah....
One condition was overriding the other. Sorry.
Try this:

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>

// Initialize Buzzer variables
byte buzzer=0;
byte overheatflag=0;
boolean alert=false;
////// 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 
  ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
  // Ports toggled in Feeding Mode
  ReefAngel.FeedingModePorts = Port1Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port2Bit | Port3Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port6Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;


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

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


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

void loop()
{
  alert=false;
  ReefAngel.StandardLights(Port2,11,30,21,30); 
  ReefAngel.StandardLights(Port3,12,0,21,0); 
  ReefAngel.Relay.DelayedOn( Port4 );
  ReefAngel.StandardHeater( Port6 );
  overheatflag = InternalMemory.read( Overheat_Exceed_Flag );
  buzzer = overheatflag;
  if ( buzzer >= 1 ) alert=true;

  ////// Place your custom code below here

  // Low Float for RO water
  if (ReefAngel.LowATO.IsActive()) 
  {
    ReefAngel.Relay.On(Port8);
  }
  else
  {
    ReefAngel.Relay.Off(Port8);
    alert=true;
  }


  // High Float for Overflow
  if (ReefAngel.HighATO.IsActive()) 
  {
    ReefAngel.Relay.On(Port1);
  }
  else
  {
    ReefAngel.Relay.Off(Port1);
    alert=true;
  }

  if (alert)
  {
    ReefAngel.PWM.SetActinic(100);
  }
  else
  {
    ReefAngel.PWM.SetActinic(0);
  }

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

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

Re: Custom Coding float swithes

Posted: Sun Feb 15, 2015 8:37 pm
by ewaldsreef
Perfect! Thank you