A little help

Basic / Standard Reef Angel hardware
Post Reply
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

A little help

Post by topjimmy »

I am not sure what happened but it was in short term a disaster. I updated my RA last night with this code

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 <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
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // 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 );

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

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

void loop()
{
    ReefAngel.Relay.DelayedOn( Port2 );
    ReefAngel.Relay.DelayedOn( Port3 );
    ReefAngel.StandardHeater( Port4 );
    ReefAngel.DayLights( Port7 );
    ReefAngel.PWM.Channel0PWMParabola();
    ReefAngel.PWM.Channel1PWMParabola();
    ////// Place your custom code below here
    


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

// Read memory for RF Wave Settings and use for Tunze/Jaebo
int mode=InternalMemory.RFMode_read();
int speed=InternalMemory.RFSpeed_read();
int duration=InternalMemory.RFDuration_read();

// Change this to what you want your min/max based on vortech speed
// This is for those functions that take both, but only one memory slot.
int minOffset=5;
int maxOffset=10;

int min=speed-minOffset;
int max=speed+maxOffset;

switch (mode) {

    case Lagoon:
        //lagoon
         ReefAngel.PWM.SetDaylight( SineMode(min,max,duration,true) );
       // ReefAngel.PWM.SetActinic( SineMode(min,max,duration,false) );
        break;
    case ReefCrest:
     //reefcrest
       ReefAngel.PWM.SetDaylight( ReefCrestMode(speed,duration,true) );
        //  ReefAngel.PWM.SetActinic( ReefCrestMode(speed,duration,false) );
       break;
    case NutrientTransport:
     //nutrient transport
     ReefAngel.PWM.SetDaylight( NutrientTransportMode(min,max,duration,true) );
      //  ReefAngel.PWM.SetActinic( NutrientTransportMode(min,max,duration,false) );
     break;
  
  }
////// Place your custom code above here

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

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

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Dimming Expansion
    x = 15;
    y = 2;
    for ( int a=0;a<6;a++ )
    {
      if ( a>2 ) x = 75;
      if ( a==3 ) y = 2;
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
      ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
      y += 10;
    }
    pingSerial();

    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 43, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
    pingSerial();

    // Main Relay Box
    byte TempRelay = ReefAngel.Relay.RelayData;
    TempRelay &= ReefAngel.Relay.RelayMaskOff;
    TempRelay |= ReefAngel.Relay.RelayMaskOn;
    ReefAngel.LCD.DrawOutletBox( 12, 84, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
}
For some reason the ATO power never turned off, what is worse is that it put, over night, almost 10 gallons of freshly made Kalk into the system. My Ph is almost at 10 accorCding to the RA, I am probably looking at a complete loss, but time will tell I guess.

Is there anything in that sketch that would keep that port on?
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

A little help

Post by lnevo »

What port is your ato pump on? All i see are On ports...
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

port 3, heater on port 4

I had put a delay on it just to be safe during water changes and such....possibly a bad idea....
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A little help

Post by rimai »

Yeah. That port is coded to be on all the time and not as ATO.
You need to change this:

Code: Select all

ReefAngel.Relay.DelayedOn( Port3 );
Assuming you are using the ATO Low port, to this:

Code: Select all

ReefAngel.SingleATO(true,Port3,60,0);
Roberto.
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

I did it late last night and was stupid enough not to make sure it was working correctly.

Thanks for the help . I'll make the change and hope for the best.
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

A little help

Post by lnevo »

Yeah, you basically declared it as an always on port...no setting for ato functionality. :(
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

I should know better than to do something like that and not test functionality. What It did was delayed the start for the 60 seconds after the upload, so it appeared as if it was off and functioning as ATO, then I left and the gd thing turned on , just like it should have. :? DOH!
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A little help

Post by rimai »

Yeah, that's exactly what happened :(
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A little help

Post by rimai »

Since you are pumping Kalk, my recommendation is to kill that port if pH rises to a certain level...
Like this:

Code: Select all

ReefAngel.SingleATO(true,Port3,60,0);
if (ReefAngel.Params.PH>850) ReefAngel.Relay.Off(Port3);
Roberto.
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

A little help

Post by lnevo »

rimai wrote:Since you are pumping Kalk, my recommendation is to kill that port if pH rises to a certain level...
Like this:

Code: Select all

ReefAngel.SingleATO(true,Port3,60,0);
if (ReefAngel.Params.PH>850) ReefAngel.Relay.Off(Port3);
+1
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

Good idea.

I need to set up the peristaltic pump I have for dosing the Kalc on that port. At least it would not have been able to dump 10 gallons in over night.
Image
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

OK So I set up my dosing pump to be my ATO pump.

So let me run this by you, dosing pump comes on every 60m for 20s
If ATO low is on ( i assume that means water level is low) then it lets the timer go on.
If the ATO high is on ( I assume this means water level is too high) then turn off the port,or don't turn it on at all.
If the ph is at or goes over 8.5 during the time on turn off the port.

How would I code that?
I have a basic idea but I want to be sure.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A little help

Post by rimai »

It was already posted earlier in this thread:
http://forum.reefangel.com/viewtopic.php?p=24659#p24659
Roberto.
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

rimai wrote:It was already posted earlier in this thread:
http://forum.reefangel.com/viewtopic.php?p=24659#p24659
Well kind of, I don't want the ato to trigger the event, just allow it to happen or not, at the same interval.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A little help

Post by rimai »

Ahh.. Sorry... I misread the post.

Code: Select all

  if (ReefAngel.LowATO.IsActive())
    ReefAngel.DosingPumpRepeat(Port3,0,60,20);
  else
    ReefAngel.Relay.Off(Port3);
  if (!ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port3);
  if (ReefAngel.Params.PH>850) ReefAngel.Relay.Off(Port3);    
This will do the following, assuming both floats are pointing down:
ATO Low is down, let the timer run.
ATO Low is up, turn port off
ATO High is down, does nothing
ATO High is up, turn port off
Is that what you wanted?
Roberto.
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

I think that is perfect. thanks again.
Image
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

just a quick question,

Both the ato floats are oriented in the same direction, cable up. On the portal, what is the significance of the ato color being red or green?

If ATO low (the float lowest in the sump) is green that means that the float is high, and the pump will not turn on,

The ATO high is red, and should never go green unless there is more water in the sump than should be.

right?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A little help

Post by rimai »

The green means the float piece is not floating.
Roberto.
topjimmy
Posts: 139
Joined: Tue May 08, 2012 8:16 am

Re: A little help

Post by topjimmy »

ok i'm good then ato low is red ,ato high is green just as it should be
Image
Post Reply