Mike's RSM 500 Code

Share you PDE file with our community

Posts: 12188
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Mon Jul 06, 2015 11:59 am
It has to go more than 82F and stay there for at least 3 seconds to be considered overheat.
Roberto.

Posts: 163
Joined: Wed Oct 24, 2012 8:37 am
PostPosted: Mon Jul 06, 2015 4:15 pm
Ok it's working, sorry for the false alarm. Just never had it sit right at 82 for awhile.

I moved the ph probe gettin the sump to the DT and the ph reading hasn't changed much.

Sent from my HTC One_M8 using Tapatalk
Image

Posts: 163
Joined: Wed Oct 24, 2012 8:37 am
PostPosted: Fri Jul 10, 2015 6:04 pm
pH was reading under 7 for the past two nights...doing the calibration again. Now its around 7.5, but its still way lower than it was at 8.5. Do I need a new probe?
Image

Posts: 163
Joined: Wed Oct 24, 2012 8:37 am
PostPosted: Wed Jun 08, 2016 9:30 am
So I recently ditched my T5 lights for the RSM S Series LEDs. I also did some wiring cleanup, added a skimmate container using High ATO, and just got an Avast Swabbie retrofit.

During the last few days I have been playing around with the Swabbie code. Not using timing in the memory I could get the port to switch on at 4am, but that was the only time (it wasn't running every 4 hours).

So I tried adding lnevo's code for the Swabbie. Compiles fine, but the relay does not run.
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>

// Define Custom Memory Locations
#define Mem_B_SwabbieRepeat   100
#define Mem_B_SwabbieTime     101

void init_memory() {
  // Initialize Custom Memory Locations
  InternalMemory.write(Mem_B_SwabbieRepeat,6);
  InternalMemory.write(Mem_B_SwabbieTime,1);
  }

// Define Named Relay Ports
#define FlowPumps       1
#define Lights          2
#define Return          3
#define VortechL        4
#define VortechR        5
#define Skimmer         6
#define FanSump         7
#define HeaterSump      8

#define Reactor         Box1_Port1
#define Swabbie         Box1_Port2
#define Unused          Box1_Port3
#define Unused          Box1_Port4
#define Unused          Box1_Port5
#define WCMix           Box1_Port6
#define WCFlow          Box1_Port7
#define WCHeater        Box1_Port8

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


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

////// Setup Begin (on controller startup/reset)
void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    // Define labels for LCD screen
    ReefAngel.CustomLabels[0]="Flow Pumps";
    ReefAngel.CustomLabels[1]="Lights";
    ReefAngel.CustomLabels[2]="Return";
    ReefAngel.CustomLabels[3]="Vortech L";
    ReefAngel.CustomLabels[4]="Vortech R";
    ReefAngel.CustomLabels[5]="Skimmer";
    ReefAngel.CustomLabels[6]="Fan";
    ReefAngel.CustomLabels[7]="Heater";

    ReefAngel.CustomLabels[Box1_Port1Label] = "Reactor";
    ReefAngel.CustomLabels[Box1_Port2Label] = "Swabbie";
    ReefAngel.CustomLabels[Box1_Port3Label] = "";
    ReefAngel.CustomLabels[Box1_Port4Label] = "";
    ReefAngel.CustomLabels[Box1_Port5Label] = "";
    ReefAngel.CustomLabels[Box1_Port6Label] = "WCMix";
    ReefAngel.CustomLabels[Box1_Port7Label] = "WCFlow";
    ReefAngel.CustomLabels[Box1_Port8Label] = "WCHeater";
   
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = Port3Bit | Port4Bit | Port5Bit; //Unused ports for testing RF module and random feedmode
   
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port6Bit | Port7Bit | Port8Bit; // Flowpumps,Return,VortechL,Skimmer,Fan,HeaterSump
    ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit ; //Reactor,Swabbie   
   
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port6Bit; //Lights
    ReefAngel.LightsOnPortsE[0] = 0;
   
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port8Bit; //HeaterSump
    ReefAngel.OverheatShutoffPortsE[0] = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;

    // Ports that default on
    ReefAngel.Relay.On( FlowPumps );
    ReefAngel.Relay.On( Return );
    ReefAngel.Relay.On( VortechL );
    ReefAngel.Relay.On( VortechR );
   
    // Ports that default off
    ReefAngel.Relay.Off( Unused );
    ReefAngel.Relay.Off( Swabbie );
    ReefAngel.Relay.Off( WCMix );
    ReefAngel.Relay.Off( WCFlow );
    ReefAngel.Relay.Off( WCHeater );

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

    //5 second timer for power outage detection
    ReefAngel.Timer[1].SetInterval( 5 );   

    ////// Place additional initialization code above here
}
////// Setup End
////// Loop Begin
void loop()
{
    ReefAngel.Relay.On(Reactor);
    ReefAngel.StandardHeater( HeaterSump );
    ReefAngel.StandardFan( FanSump );
    ReefAngel.StandardLights( Lights ); 
   
////// Place your custom code below here

    //HighATO=on, delay start Skimmer | HighATO=off, Skimmer shuts off
    if (ReefAngel.HighATO.IsActive())
      ReefAngel.Relay.DelayedOn( Skimmer );
    else
      ReefAngel.Relay.Off( Skimmer );

    // Vortech MP40 | Constant | Lagoon | ReefCrest | ShortWave 1=10ms | LongWave 1=1s | NutrientTransport 1=10ms | TidalSwell
    if ( ReefAngel.DisplayedMenu != FEEDING_MODE || ReefAngel.DisplayedMenu != WATERCHANGE_MODE ) {
        if ( hour() >= 16 && hour() <= 20 ) {
            ReefAngel.RF.UseMemory = false;
            ReefAngel.RF.SetMode( LongWave, 70, 30 );
        } else if ( hour() >= 20 || hour() < 7 ) {
            ReefAngel.RF.UseMemory = false;
            ReefAngel.RF.SetMode( ReefCrest, 40, 0 );
        } else {
            ReefAngel.RF.UseMemory = true;
        }
    }
   
//    ReefAngel.StandardHeater( HeaterWC, 775, 778 );

   
    // Turn off Skimmer & FanSump & Reactor if Return Pump is off
    if ( !ReefAngel.Relay.Status( Return ) ) {
        ReefAngel.Relay.Override( Skimmer, 0 );
        ReefAngel.Relay.Override( FanSump, 0 );
        ReefAngel.Relay.Override( Reactor, 0 );
    }
   
    // Check the power here, the function is defined below
    CheckPower();
   
////// Place your custom code above here

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

////// Custom Function
void RunSwabbie() {
  int repeat=InternalMemory.read(Mem_B_SwabbieRepeat)*60;
  int runtime=InternalMemory.read(Mem_B_SwabbieTime)*60;
  static time_t t;
 
  // Manual mode
  if (ReefAngel.Relay.isMaskOn(Swabbie)) {
    ReefAngel.Relay.Auto(Swabbie);
    t=now();
  }

  if (now()-t < runtime) {
    ReefAngel.Relay.On(Swabbie);
  } else {
    ReefAngel.DosingPumpRepeat(Swabbie,0,repeat,runtime);   
  }
}

void CheckPower()
{
    static boolean PowerOutage = false;
    static boolean DelayedPowerOutage = false;

    // Power Outage - Leave Only Vortech Pumps active
    if ( !ReefAngel.Relay.IsRelayPresent( EXP1_RELAY ) ) {
        PowerOutage = true;    //Expansion Relay 1 has lost power
    }

    if ( !PowerOutage ) {
        ReefAngel.Timer[1].Start();
    }

    if ( ReefAngel.Timer[1].IsTriggered() ) {
        DelayedPowerOutage = true;
    }

    if ( DelayedPowerOutage ) {
        ReefAngel.Relay.Off ( FlowPumps );
        ReefAngel.Relay.Off ( Return );
        ReefAngel.Relay.Off ( Skimmer );
        ReefAngel.Relay.Off ( Lights );
        ReefAngel.Relay.Off ( FanSump);
        ReefAngel.Relay.Off ( HeaterSump);
        //set vortechs to long wave? something that ripples surface
    }

    // Power Restored
    if ( PowerOutage && ReefAngel.Relay.IsRelayPresent( EXP1_RELAY ) ) {
        PowerOutage = false;
        DelayedPowerOutage = false;
        LastStart = now();
    }
}
////// Custom Function End

When I read the custom memory location of 100 & 101, both result in 255. So I am assuming the memory locations aren't being written. Also when I manually changed the memory from 255 to 6 or 1 the relay has not turned on every six or one hours.

I am guessing maybe it has to do with this line which I do not have. I am not sure how to update it to write the memory for the Swabbie.
Code: Select all
InternalMemory.write(Mem_B_ResetMemory,false);
Image
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Jun 08, 2016 10:19 am
Ignore the init_memory function, it doesnt always work right. but please manually set both memory locations. One needs the runtime and the other gets the repeat value. Runtime should be 1 for one minute and repeat should be 6 for one hour.

Posts: 163
Joined: Wed Oct 24, 2012 8:37 am
PostPosted: Wed Jun 08, 2016 10:46 am
You mean 6 for six hours, right?

So remove init_memory lines and set manually...do I need to update the controller in order to see the swabbie port activate?

I set 100 to 6, and 101 to 1...
Image
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Jun 08, 2016 1:51 pm
You will not see it in the portal if thats what your looking for.

Posts: 163
Joined: Wed Oct 24, 2012 8:37 am
PostPosted: Wed Jun 08, 2016 1:56 pm
The memory values or the relay switching on? I do see the relay switch at 4am.

Sent from my A0001 using Tapatalk
Image
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Jun 08, 2016 3:20 pm
You won't reliably see the port in the portal for relay activity.
User avatar
Posts: 5342
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Wed Jun 08, 2016 3:21 pm
You also need to call RunSwabbie(); in your loop. I don see it there which means its never getting called.
PreviousNext

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 1 guest

cron