Page 2 of 2

Re: Power Control Expansion

PostPosted: Wed Jul 04, 2018 10:56 am
by rimai
Can I see the code?

Re: Power Control Expansion

PostPosted: Wed Jul 04, 2018 4:51 pm
by ucez
Here you go.

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

// Define Relay Ports by Name
#define Return_Pump     1
#define Extra1          2
#define Skimmer         3
#define Heater          4
#define Fuge_Light      5
#define GFO_Pump        6
#define SaltMixPump     7
#define PowerCtlExp     8



//Define Relay 1 Ports by Name
#define FragHeater      Box1_Port1
#define FragPowerhead   Box1_Port2
#define FragLED1        Box1_Port3
#define WaterChange     Box1_Port4
#define FragLED2        Box1_Port5
#define FragFilter      Box1_Port6
#define BrutePump       Box1_Port7
#define SaltUV          Box1_Port8

//Define Power Control Expansion Ports by Name


////// 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 | Port3Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port3Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = 0;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port4Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 869 );


  // Ports that are always on
  ReefAngel.Relay.On( Return_Pump );
  ReefAngel.Relay.On( FragPowerhead);
  ReefAngel.Relay.On( WaterChange);
  ReefAngel.Relay.On( BrutePump);
  ReefAngel.Relay.On( FragFilter);
  ReefAngel.Relay.On( GFO_Pump);
  ReefAngel.Relay.On( SaltMixPump);
  ReefAngel.Relay.On( Extra1);
  ReefAngel.Relay.On( PowerCtlExp);
  ReefAngel.Relay.On( SaltUV);
  ////// Place additional initialization code below here


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

void loop()
{
  ReefAngel.Relay.DelayedOn( Skimmer,10 );
  ReefAngel.StandardHeater( Heater,750,790 );
  ReefAngel.StandardLights( Fuge_Light,21,0,11,0 );
  ReefAngel.StandardLights( FragLED1,12,0,21,0);
  ReefAngel.StandardLights( FragLED2,15,0,18,0);

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

  //if Display Water Level Sensor Active, then turn off Return pump
  if (!ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Return_Pump);
  else ReefAngel.Relay.On(Return_Pump);
 
  //If Skimmate Water Level Sensor Active, then turn of Skimmer pump
  if (!ReefAngel.LowATO.IsActive()) ReefAngel.Relay.Off(Skimmer);
  else ReefAngel.Relay.On(Skimmer);

  //frag tank heater control with T2 probe
  if (ReefAngel.Params.Temp[T2_PROBE]>790) ReefAngel.Relay.Off( FragHeater );
  if (ReefAngel.Params.Temp[T2_PROBE]<750) ReefAngel.Relay.On( FragHeater );
 
  //Enter feeding mode to correspond with automatic feeder at 11AM and 2PM
  if(hour()==11 && minute()==0 && second()==0) ReefAngel.FeedingModeStart();
  if(hour()==14 && minute()==0 && second()==0) ReefAngel.FeedingModeStart();

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

  // This should always be the last line
  ReefAngel.Portal( "XXXXXXXXXXX" );
  ReefAngel.DDNS( "Reef" ); // Your DDNS is XXXXXXXXXXXXX
  ReefAngel.ShowInterface();
}




Re: Power Control Expansion

PostPosted: Wed Jul 04, 2018 7:10 pm
by rimai
You don't have any box2 port in the code.

Re: Power Control Expansion

PostPosted: Thu Jul 05, 2018 5:16 pm
by ucez
I added a test line, but still not working. What am I missing? Still not showing up in head unit either.
#define Dose1 Box2_Port1
ReefAngel.Relay.On( Dose1);

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

// Define Relay Ports by Name
#define Return_Pump     1
#define Extra1          2
#define Skimmer         3
#define Heater          4
#define Fuge_Light      5
#define GFO_Pump        6
#define SaltMixPump     7
#define PowerCtlExp     8



//Define Relay 1 Ports by Name
#define FragHeater      Box1_Port1
#define FragPowerhead   Box1_Port2
#define FragLED1        Box1_Port3
#define WaterChange     Box1_Port4
#define FragLED2        Box1_Port5
#define FragFilter      Box1_Port6
#define BrutePump       Box1_Port7
#define SaltUV          Box1_Port8

//Define Power Control Expansion Ports by Name
#define Dose1           Box2_Port1
#define Dose2           Box2_Port2
#define Dose3           Box2_Port3
#define Dose4           Box2_Port4

////// 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 | Port3Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port3Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = 0;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port4Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 869 );


  // Ports that are always on
  ReefAngel.Relay.On( Return_Pump );
  ReefAngel.Relay.On( FragPowerhead);
  ReefAngel.Relay.On( WaterChange);
  ReefAngel.Relay.On( BrutePump);
  ReefAngel.Relay.On( FragFilter);
  ReefAngel.Relay.On( GFO_Pump);
  ReefAngel.Relay.On( SaltMixPump);
  ReefAngel.Relay.On( Extra1);
  ReefAngel.Relay.On( PowerCtlExp);
  ReefAngel.Relay.On( SaltUV);
  ReefAngel.Relay.On( Dose1);
  ////// Place additional initialization code below here


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

void loop()
{
  ReefAngel.Relay.DelayedOn( Skimmer,10 );
  ReefAngel.StandardHeater( Heater,750,790 );
  ReefAngel.StandardLights( Fuge_Light,21,0,11,0 );
  ReefAngel.StandardLights( FragLED1,12,0,21,0);
  ReefAngel.StandardLights( FragLED2,15,0,18,0);

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

  //if Display Water Level Sensor Active, then turn off Return pump
  if (!ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Return_Pump);
  else ReefAngel.Relay.On(Return_Pump);
 
  //If Skimmate Water Level Sensor Active, then turn of Skimmer pump
  if (!ReefAngel.LowATO.IsActive()) ReefAngel.Relay.Off(Skimmer);
  else ReefAngel.Relay.On(Skimmer);

  //frag tank heater control with T2 probe
  if (ReefAngel.Params.Temp[T2_PROBE]>790) ReefAngel.Relay.Off( FragHeater );
  if (ReefAngel.Params.Temp[T2_PROBE]<750) ReefAngel.Relay.On( FragHeater );
 
  //Enter feeding mode to correspond with automatic feeder at 11AM and 2PM
  if(hour()==11 && minute()==0 && second()==0) ReefAngel.FeedingModeStart();
  if(hour()==14 && minute()==0 && second()==0) ReefAngel.FeedingModeStart();

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

  // This should always be the last line
  ReefAngel.Portal( "" );
  ReefAngel.DDNS( "Reef" ); // Your DDNS is .myreefangel.com
  ReefAngel.ShowInterface();
}




Re: Power Control Expansion

PostPosted: Thu Jul 05, 2018 5:54 pm
by rimai
When I load this code, I get the 3 relay screens on the head unit.
One thing I noticed is the DDNS line. Remove that. The server is not working with that feature anymore and that may be why the portal is not accepting your requests.

Re: Power Control Expansion

PostPosted: Mon Jul 09, 2018 4:14 am
by ucez
Success! Thank you!

Re: Power Control Expansion

PostPosted: Mon Jul 09, 2018 4:43 am
by binder
here's an alternate way to do the dynamic dns for your controller.

https://r.tapatalk.com/shareLink?url=ht ... are_type=t

Sent from my XT1585 using Tapatalk

Re: Power Control Expansion

PostPosted: Mon Jul 09, 2018 5:26 pm
by ucez
The dynamic DNS allows you to control via the universal app? However, the data on the universal app is still correct?

Re: Power Control Expansion

PostPosted: Mon Jul 09, 2018 6:41 pm
by binder
ucez wrote:The dynamic DNS allows you to control via the universal app? However, the data on the universal app is still correct?

Yes it should be.
I'm not sure you will need to use the dynamic dns with the universal app. I was sharing it in case you needed it (since you had been using the reefangel dynamic dns).