watch dog timer

New members questions
Post Reply
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

watch dog timer

Post by ryanmell »

can someone explain what the watchdog timer does and if i should enable it with ragen. my timers for my lights don't seem to be working and i trigged the ato by hand and it worked then later that day it didn't kick my ato pump on so i turned it on through the iphone app to fill it up. i don't have a copy of my pde with me. was more curious about what the watchdog timer does

Thanks
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

WDT is a feature of many microprocessor and is considered a supervisory feature.
Its basic function is to wait for a signal from RA every so often. If the signal is not received, it will consider that there is a failure in the code and it will reset the controller to prevent lock-ups.
http://en.wikipedia.org/wiki/Watchdog_timer
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

Post your code when you have a chance.
The ATO also has a timeout feature, where it will kill the ATO off until you manually clear the ATO flag.
This is to prevent pumps from running dry or cause an overflow by dumping the whole fresh water reservoir if the float switch gets stuck or a snail decides to get in the way.
This usually can be seen by the red status led lit in your head unit.
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

ya thats what i thought i removed the timeout feature because of the pump i am using which is a toms vacumn pump which doesnt pump a lot of water real fast i have the two floats set up the bottom one wires up and the top one with the wires down, sounds like i should enable the watchdog, the only thing that scares my is i unplgged the unit for a second to move the cord and when i plugged it back in some of the outlets were switched off is there a way to program which outlets you want to be turned on if there is a power failure?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

No.
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

here's my files

memory

Code: Select all

Autogenerated file by RAGen (v1.1.0.126), (02/04/2012 22:28)
// Memory_020412_2228.pde
//
// This file sets the default values to the Internal Memory
//


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <Phillips6610LCDInv.h>
#include <avr/pgmspace.h>
#include <ReefAngel_EEPROM.h>


Phillips6610LCDInv e;

void setup()
{
    e.lcd_init();
    e.lcd_clear(COLOR_WHITE,0,0,132,132);
    e.lcd_BacklightOn();

    InternalMemory.MHOnHour_write(13);
    InternalMemory.MHOnMinute_write(0);
    InternalMemory.MHOffHour_write(21);
    InternalMemory.MHOffMinute_write(0);
    InternalMemory.MHDelay_write(0);
    InternalMemory.StdLightsOnHour_write(12);
    InternalMemory.StdLightsOnMinute_write(0);
    InternalMemory.StdLightsOffHour_write(22);
    InternalMemory.StdLightsOffMinute_write(0);
    InternalMemory.DP1OnHour_write(20);
    InternalMemory.DP1OnMinute_write(0);
    InternalMemory.DP2OnHour_write(22);
    InternalMemory.DP2OnMinute_write(30);
    InternalMemory.DP1Timer_write(10);
    InternalMemory.DP2Timer_write(10);
    InternalMemory.DP1RepeatInterval_write(60);
    InternalMemory.DP2RepeatInterval_write(60);
    InternalMemory.ATOTimeout_write(90);
    InternalMemory.ATOHighTimeout_write(60);
    InternalMemory.ATOHourInterval_write(0);
    InternalMemory.ATOHighHourInterval_write(0);
    InternalMemory.FeedingTimer_write(900);
    InternalMemory.LCDTimer_write(600);
    InternalMemory.LEDPWMActinic_write(100);
    InternalMemory.LEDPWMDaylight_write(100);
    InternalMemory.WM1Timer_write(0);
    InternalMemory.WM2Timer_write(354);
    InternalMemory.HeaterTempOn_write(780);
    InternalMemory.HeaterTempOff_write(791);
    InternalMemory.ChillerTempOn_write(810);
    InternalMemory.ChillerTempOff_write(785);
    InternalMemory.OverheatTemp_write(1500);
    InternalMemory.PHMax_write(840);
    InternalMemory.PHMin_write(550);
}

void loop()
{
    // display the values
    char buf[128];
    sprintf(buf, "MH %2d:%02d-%2d:%02d,%d", InternalMemory.MHOnHour_read(), InternalMemory.MHOnMinute_read(),
                                         InternalMemory.MHOffHour_read(), InternalMemory.MHOffMinute_read(),
                                         InternalMemory.MHDelay_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
    sprintf(buf, "Std %2d:%02d-%2d:%02d", InternalMemory.StdLightsOnHour_read(), InternalMemory.StdLightsOnMinute_read(),
                                          InternalMemory.StdLightsOffHour_read(), InternalMemory.StdLightsOffMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
    sprintf(buf, "LED A: %d%% D: %d%%", InternalMemory.LEDPWMActinic_read(), InternalMemory.LEDPWMDaylight_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);
    sprintf(buf, "WM1: %ds", InternalMemory.WM1Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, buf);
    sprintf(buf, "WM2: %ds", InternalMemory.WM2Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
    sprintf(buf, "F: %ds", InternalMemory.FeedingTimer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
    sprintf(buf, "S: %ds", InternalMemory.LCDTimer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
    sprintf(buf, "H On: %d -> %d", InternalMemory.HeaterTempOn_read(), InternalMemory.HeaterTempOff_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*9, buf);
    sprintf(buf, "C On: %d -> %d", InternalMemory.ChillerTempOn_read(), InternalMemory.ChillerTempOff_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*10, buf);
    sprintf(buf, "PH %d - %d", InternalMemory.PHMax_read(), InternalMemory.PHMin_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*11, buf);

    delay(10000);
    e.lcd_clear(COLOR_WHITE,0,0,132,132);

    sprintf(buf, "OH: %dF", InternalMemory.OverheatTemp_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
    sprintf(buf, "ATO L: %ds (%dh)", InternalMemory.ATOTimeout_read(), InternalMemory.ATOHourInterval_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
    sprintf(buf, "ATO H: %ds (%dh)", InternalMemory.ATOHighTimeout_read(), InternalMemory.ATOHighHourInterval_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);

    sprintf(buf, "DP1: %2d:%02d", InternalMemory.DP1OnHour_read(), InternalMemory.DP1OnMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
    sprintf(buf, "     %ds", InternalMemory.DP1Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
    sprintf(buf, "DP2: %2d:%02d", InternalMemory.DP2OnHour_read(), InternalMemory.DP2OnMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
    sprintf(buf, "     %ds", InternalMemory.DP2Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*8, buf);

    delay(10000);
    e.lcd_clear(COLOR_WHITE,0,0,132,132);
}
and Pde

Code: Select all

// Autogenerated file by RAGen (v1.0.4.92), (06/03/2011 22:34)
// RA_060311_2234.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File: 
#define DisplayImages
#define WavemakerSetup
#define DateTimeSetup
#define VersionMenu
#define ATOSetup
#define MetalHalideSetup
#define DirectTempSensor
#define DisplayLEDPWM
#define StandardLightSetup
*/


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>


void setup()
{
    ReefAngel.Init();  //Initialize controller

    // Ports that are always on
    ReefAngel.Relay.On(Port8);
}

void loop()
{
    ReefAngel.ShowInterface();

    // Specific functions
    ReefAngel.StandardATO(Port1);
    ReefAngel.StandardLights(Port2);
    ReefAngel.MHLights(Port3);
    ReefAngel.Skimmer(Port4);
    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port6);
    ReefAngel.StandardHeater(Port7);
}
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

i also loaded the memory file first the the pde. also on my controller when i go to the clear ato function all it says is clear ato press exit to cancel there is no ok button or anything
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: watch dog timer

Post by binder »

that just means press tge joystick button to exit
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

ya i just sits there and never clears how long should it take to clear
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: watch dog timer

Post by binder »

You must press the joystick button to clear the screen and return to normal functioning. If you do not press the joystick button, it will sit there indefinitely. That's just how that menu option is designed. So you choose to clear the the ATO timeout, it shows that screen, you press the joystick button again to return to normal operations.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

Do you have the float switches mounted in opposite directions?
http://forum.reefangel.com/viewtopic.php?f=7&t=240
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

yes i have the switches mounted opposite one wires up and one wires down
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

Could it be that they are swapped out?
Try swapping the plugs on the head unit.
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

ya i tried that last night night i don't know why there would be a short i they are sealed up good but the red status light clears when i unplug them from the controller
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

Do you have a meter to test the float switches?
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

I remember you mentioned something about disabling timeout. What exactly did you do?
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

i just went into the memory settings in ragen and changed both fields to 0 i do have a multimeter i will test them when i get home
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

Ahh. I think that's the problem. :(
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

what can't do that?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

Try using this:

Code: Select all

ReefAngel.StandardATO(Port1,1000);
Change 1000 to how many seconds you want timeout to be, except 0.
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

i was trying to avoid a timeout since my top off pump only pumps 3 gallons in an hour
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

That's fine.
The way I posted, you can have a timeout of as much as 32767 seconds, which is a little over 9 hours.
Timeout is always good to have.
It will prevent your pump from running dry and also could prevent a flood if something tampers with the float switch.
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

awesome i will try that when i get home do i need to change the memory file or the pde? the line you posted is from the pde right?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

Yes, PDE.
It will just use the value in the PDE instead of the memory settings.
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

thanks that worked now i need to figure out my lights i have a nova extreme pro with 2 switches and they are plugged into two separate outlets with 2 different settings but both come on and turn off at the same time and i can't get my 2nd powerhead to alternate off and on. i want the 1st powerhead to always be on and the second to cycle on and off thanks for all your help this controller is as addicting as the reef tank itself
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

What I understood from your code is that you have one switch plugged into port2 and another switch into port 3, correct?

Code: Select all

    ReefAngel.StandardLights(Port2);
    ReefAngel.MHLights(Port3);
When creating your memory file or updating it with the Client or smartphone apps, make sure to use different times on MH and Standard light schedule.
For the powerheads, they should be alternating, according to these lines in your code:

Code: Select all

    ReefAngel.Wavemaker1(Port5);
    ReefAngel.Wavemaker2(Port6);
Roberto.
ryanmell
Posts: 51
Joined: Tue Jan 24, 2012 7:28 am

Re: watch dog timer

Post by ryanmell »

ya i think i figured out the lights maybe i added this code

void loop()
{
// Specific functions
ReefAngel.StandardATO(Port1,1600);
// T5 White
ReefAngel.StandardLights(Port2,13,0,21,0);
//T5 Blue
ReefAngel.StandardLights(Port3,12,0,22,0);

as far as the wavemakers go i want powerhead 1 to always stay on and the 2nd one to have random pattern
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: watch dog timer

Post by rimai »

You nailed the lights code :)
The wavemaker:
Add this to setup()

Code: Select all

    randomSeed(analogRead(0));
    ReefAngel.Timer[1].SetInterval(random(15,35));
    ReefAngel.Timer[1].Start(); 
    ReefAngel.Relay.On(Port5);  
And this to loop()

Code: Select all

      if ( ReefAngel.Timer[1].IsTriggered() )
  {
        ReefAngel.Timer[1].SetInterval(random(15,35));
        ReefAngel.Timer[1].Start();
        ReefAngel.Relay.Toggle(Port6);
  }

Roberto.
Post Reply