Page 1 of 1

A little help

Posted: Tue Apr 30, 2013 5:17 am
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?

A little help

Posted: Tue Apr 30, 2013 5:37 am
by lnevo
What port is your ato pump on? All i see are On ports...

Re: A little help

Posted: Tue Apr 30, 2013 5:43 am
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....

Re: A little help

Posted: Tue Apr 30, 2013 6:53 am
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);

Re: A little help

Posted: Tue Apr 30, 2013 7:15 am
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.

A little help

Posted: Tue Apr 30, 2013 7:22 am
by lnevo
Yeah, you basically declared it as an always on port...no setting for ato functionality. :(

Re: A little help

Posted: Tue Apr 30, 2013 7:37 am
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!

Re: A little help

Posted: Tue Apr 30, 2013 7:52 am
by rimai
Yeah, that's exactly what happened :(

Re: A little help

Posted: Tue Apr 30, 2013 7:54 am
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);

A little help

Posted: Tue Apr 30, 2013 8:14 am
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

Re: A little help

Posted: Tue Apr 30, 2013 10:18 am
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.

Re: A little help

Posted: Tue May 07, 2013 12:46 pm
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.

Re: A little help

Posted: Tue May 07, 2013 1:54 pm
by rimai
It was already posted earlier in this thread:
http://forum.reefangel.com/viewtopic.php?p=24659#p24659

Re: A little help

Posted: Tue May 07, 2013 2:22 pm
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.

Re: A little help

Posted: Tue May 07, 2013 2:35 pm
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?

Re: A little help

Posted: Tue May 07, 2013 6:39 pm
by topjimmy
I think that is perfect. thanks again.

Re: A little help

Posted: Wed May 08, 2013 6:01 pm
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?

Re: A little help

Posted: Wed May 08, 2013 6:05 pm
by rimai
The green means the float piece is not floating.

Re: A little help

Posted: Wed May 08, 2013 6:10 pm
by topjimmy
ok i'm good then ato low is red ,ato high is green just as it should be