Water Level ATO pump trouble

Expansion modules and attachments
Post Reply
User avatar
joshlawless
Posts: 138
Joined: Thu May 23, 2013 2:52 pm

Water Level ATO pump trouble

Post by joshlawless »

I received my new ATO pump from Roberto, and even though it doesn't always start pumping when it's powered on, I tried to get it set up in software anyways (pending a resolution on the unreliable starting).

Unfortunately, I can't get even the relay to turn on or off as expected. Posted below is my (much simplified, in view of other trouble) code, which includes the line ReefAngel.WaterLevelATO(Box1_Port4,35,40,600);

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
int  ChannelMaxPct [8] = { 30,30,33,23,13,16,10,0};
////// Place global variable code above here

void setup()
{
    ReefAngel.Init();
    ReefAngel.AddStandardMenu();
    ReefAngel.Use2014Screen();
    ReefAngel.AddSalinityExpansion();                
    ReefAngel.AddORPExpansion();                     
    ReefAngel.AddWaterLevelExpansion();
    ReefAngel.Add16ChPWM();                          

    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = Port5Bit | Port6Bit;

    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = Port4Bit;

    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;

    ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;   
    ReefAngel.OverheatShutoffPortsE[0] = Port7Bit;

    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;

    ReefAngel.DCPump.FeedingSpeed = 0;
    ReefAngel.DCPump.WaterChangeSpeed = 0;

    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Port7 );    
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );
    ReefAngel.Relay.On( Box1_Port5 );
    ReefAngel.Relay.On( Box1_Port6 );

    ReefAngel.CustomVar[0] = 0;
    ReefAngel.CustomVar[1] = 0;
    ReefAngel.CustomVar[2] = 0;
    ReefAngel.CustomVar[3] = 0;
    ReefAngel.CustomVar[4] = 0;
    ReefAngel.CustomVar[5] = 0;
    ReefAngel.CustomVar[6] = 0;
    ReefAngel.CustomVar[7] = 0;
}

void loop()
{
  
    if ( ReefAngel.Params.Temp[T1_PROBE] < 775 ) ReefAngel.Relay.On( Port1 );
    if ( ReefAngel.Params.Temp[T1_PROBE] > 780 ) ReefAngel.Relay.Off( Port1 );
    if ( ReefAngel.Params.Temp[T2_PROBE] < 775 ) ReefAngel.Relay.On( Port2 );
    if ( ReefAngel.Params.Temp[T2_PROBE] > 780 ) ReefAngel.Relay.Off( Port2 );
    if ( ReefAngel.Params.Temp[T3_PROBE] < 775 ) ReefAngel.Relay.On( Box1_Port7 );
    if ( ReefAngel.Params.Temp[T3_PROBE] > 780 ) ReefAngel.Relay.Off( Box1_Port7 );
  
    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.Threshold = 75;   
    ReefAngel.DCPump.SetMode( Sine, 100, 240 );
    ReefAngel.DCPump.DaylightChannel = Sync; 
    ReefAngel.DCPump.ActinicChannel = AntiSync;

    for (int i=0; i<8; i++) 
    {
      if ( ReefAngel.CustomVar[i]==0 ) 
      {  
        ReefAngel.PWM.Set16ChannelRaw( i, PWMParabolaHighRes(9,00,20,00,0,ChannelMaxPct[i],0));
      }
      else
      {
        ReefAngel.PWM.Set16ChannelRaw( i, ReefAngel.CustomVar[i]*16 );
      }
    }

    ReefAngel.Relay.DelayedOn( Port3 );
    if (ReefAngel.WaterLevel.GetLevel() > 50) ReefAngel.Relay.Off(Port3);
    if (ReefAngel.DisplayedMenu==FEEDING_MODE) ReefAngel.Relay.Off(Port3);
    if (!ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Override(Port3,0);

    ReefAngel.WaterLevelATO(Box1_Port4,35,40,600); // On at 35% and Off at 40% with 600 second (10 minute) timeout.

    ReefAngel.DosingPumpRepeat( Port4, 0, 240, 30); // neck wipe for skimmer


    if ( ReefAngel.Params.ORP>450 || ReefAngel.Params.ORP==0 ) ReefAngel.Relay.Off( Port8 );
    if ( ReefAngel.Params.ORP<400 && ReefAngel.Params.ORP>0 ) ReefAngel.Relay.On( Port8 );

    ReefAngel.Portal( "joshlawless" );
    ReefAngel.DDNS( "reef" );

    ReefAngel.ShowInterface();
}
The water level is currently showing at 32%, but the indicator for the relay (port 4 on box 1) is off.

A restart will kick it on for about 10 seconds (the relay, although unfortunately not always the pump), but then the red status light shows up on the controller, and the ATO pump (relay) turns back off.

I eventually discovered that this meant the ATO timeout flag was being set, and I could clear the flag through the controller joystick menu. The first time I clear the flag, the pump (relay) turns on again for about 10 seconds, before triggering the timeout again. Each subsequent timeout can't be cleared (entering the menu and clicking the joystick to clear the ATO timeout briefly clicks the red light off and the relay on, but instantly returns the red light and turns off the relay).

From within the controller, there appears to be a place to set an ATO timeout value. This doesn't correspond to the value as I coded directly into the INO, but I've set it up to 255 here (as high as it will go) with no improvement. From the portal, I can confirm that the internal memory version of the high and low levels, and the timeout value (although these shouldn't be used in view of specifying them in the code) are also 35 / 40 / 600.

Can anyone explain what I've done wrong? Or do I still have a hardware problem, even after replacing the expansion hub (maybe the head unit)?
User avatar
joshlawless
Posts: 138
Joined: Thu May 23, 2013 2:52 pm

Re: Water Level ATO pump trouble

Post by joshlawless »

Attached is a small video file, for those who wonder what it must have been like for Sisyphus. In it, I start from the water level page (showing 32), clear the ATO timeout, hear the pump run for 15 seconds before it times out, and clear the timeout several more times (with only a brief flicker of the red status light showing that anything happened).
Attachments
My Movie (small).mp4.zip
Water Level ATO Timeout
(707.81 KiB) Downloaded 493 times
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Water Level ATO pump trouble

Post by rimai »

The ATO function is being used wrong.

Code: Select all

void WaterLevelATO(byte ATORelay, int ATOTimeout, byte LowLevel, byte HighLevel)
Roberto.
User avatar
joshlawless
Posts: 138
Joined: Thu May 23, 2013 2:52 pm

Re: Water Level ATO pump trouble

Post by joshlawless »

Ah, that's what I get for going with forum searches instead of unpacking the libraries.

http://forum.reefangel.com/viewtopic.php?p=42262#p42262
fishflipper
Posts: 121
Joined: Fri Jul 03, 2015 8:29 am

Re: Water Level ATO pump trouble

Post by fishflipper »

i am having the same exact issue. pump comes on at 80% then shuts off 5 seconds later at 82% and triggers the ATO alarm. not sure whats going on.

Code: Select all

ReefAngel.WaterLevelATO( Port7,30,80,100 );
Post Reply