Last question before I buy RA

Related to the development libraries, released by Curt Binder
Post Reply
tkeracer619
Posts: 159
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Last question before I buy RA

Post by tkeracer619 »

I am wanting to turn on an outlet for a few (20) seconds starting at minute intervals and repeat 3 or 4 times.

This seems like the only controller available atm that I might be able do this with.

On times would be...
7:55:00 - 7:55:20
7:56:00 - 7:56:20
7:57:00 - 7:57:20
7:58:00 - 7:58:20

... and so on.

Your thoughts?

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

Re: Last question before I buy RA

Post by rimai »

Yeap... very easy :)

Code: Select all

  if (minute()<=3 && second()<=20) ReefAngel.Relay.On(Port1); else ReefAngel.Relay.Off(Port1);
The above code would do:
7:00:00-7:00:20
7:01:00-7:01:20
7:02:00-7:02:20
7:03:00-7:03:20
But we can change it to be whatever minute range you need.
I just did 0 to 3 because it is the easiest to do.
Roberto.
tkeracer619
Posts: 159
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: Last question before I buy RA

Post by tkeracer619 »

Sick!

Thanks for your help :)
Image
tkeracer619
Posts: 159
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: Last question before I buy RA

Post by tkeracer619 »

I put this into my pde and its operating at every hour instead of just at 7.


This is what I have so far... it has been 10 years since I did any code :? .

Code: Select all


/* The following features are enabled for this PDE File: 
#define DisplayImages
#define DateTimeSetup
#define wifi
#define SIMPLE_MENU

*/

#define Actinic                      1
#define T5A                          2
#define T5B                          3
#define MH                           4
#define Autofeeder              5
#define Blank2                     6
#define FastFlush                 7
#define ReverseOsmosis      8


#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>

#include <avr/pgmspace.h>
// Labels for the web banner
prog_char id_label[] PROGMEM = "rimai";
prog_char probe1_label[] PROGMEM = "Disp";
prog_char probe2_label[] PROGMEM = "Frag";
prog_char probe3_label[] PROGMEM = "Room";
prog_char relay1_label[] PROGMEM = "Actinic";
prog_char relay2_label[] PROGMEM = "T5A";
prog_char relay3_label[] PROGMEM = "T5B";
prog_char relay4_label[] PROGMEM = "MH";
prog_char relay5_label[] PROGMEM = "Feed";
prog_char relay6_label[] PROGMEM = "Empty";
prog_char relay7_label[] PROGMEM = "Flush";
prog_char relay8_label[] PROGMEM = "RO";
PROGMEM const char *webbanner_items[] = {
    id_label, probe1_label, probe2_label, probe3_label, relay1_label, relay2_label,
	relay3_label, relay4_label, relay5_label, relay7_label, relay8_label};


void setup()
{
    ReefAngel.Init();  //Initialize controller
    // Initialize and start the web banner timer
    ReefAngel.LoadWebBanner(pgm_read_word(&(webbanner_items[0])), SIZE(webbanner_items));
    ReefAngel.Timer[4].SetInterval(180);  // set interval to 180 seconds
    ReefAngel.Timer[4].Start();

    ReefAngel.FeedingModePorts = B00000000;
    ReefAngel.WaterChangePorts = B00000000;
    ReefAngel.OverheatShutoffPorts = B00000111;
    ReefAngel.LightsOnPorts = B00000111;
}

void loop()
{
    // Specific functions
  ReefAngel.StandardLights(Actinic,11,0,1,0);  //Actinic schedule 11:00am - 1:00am
  ReefAngel.StandardLights(T5A,11,30,23,15);  //Blue Plus 1 schedule 11:30am - 11:15pm
  ReefAngel.StandardLights(T5B,11,45,23,30);  //Blue Plus 2 schedule 11:45am - 11:30pm
  ReefAngel.MHLights(MH,12,30,21,15,15);  //Metal Halide schedule 12:30pm - 9:15pm with 15min cool down
  ReefAngel.StandardLights(FastFlush,9,45,9,55);  //RO Fast Flush schedule 9:45am - 9:55pm
  ReefAngel.StandardLights(ReverseOsmosis,9,45,13,0);  //RO Fast Flush schedule 9:45am - 1:00pm

if (minute()<=3 && second()<=20) ReefAngel.Relay.On(Port5); //AutoFeeder Timer
        else ReefAngel.Relay.Off(Port5);

    // Web Banner stuff
    if(ReefAngel.Timer[4].IsTriggered())
    {
        ReefAngel.Timer[4].Start();
        ReefAngel.WebBanner();
    }

	ReefAngel.ShowInterface();
}
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Last question before I buy RA

Post by rimai »

Sorry, I thought you wanted at every hour.
If you want just at 7:00am you need to use this:

Code: Select all

  if (hour()==7 && minute()<=3 && second()<=20) ReefAngel.Relay.On(Port1); else ReefAngel.Relay.Off(Port1);
Change the hour()==7 to hour()==19 if you want 7pm.
Roberto.
tkeracer619
Posts: 159
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: Last question before I buy RA

Post by tkeracer619 »

Thanks!

Now if I can get the web stuff figured out Ill go plug stuff into it.
Image
tkeracer619
Posts: 159
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: Last question before I buy RA

Post by tkeracer619 »

So I got WiFi connected and it was working as advertised but this morning its timing out. Is there anything I missed with my ode that would make for an unstable controller. I set it up on the tank but didn't plug anything in yet. Wanted it to run for a week or two with no problems before relying on it. :(
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Last question before I buy RA

Post by rimai »

Is the blue LED on the wifi attachment blinking?
Is the green LED bliking fast or slow?
Can you ping the wifi attachment?
When you try to browse, do you see the orange LEDs blinking?
Can you connect to the wifi attachment using TeraTerm in telnet mode?
Roberto.
tkeracer619
Posts: 159
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: Last question before I buy RA

Post by tkeracer619 »

I'm out of town so I had my fish feeder stop by and take a look. Green LED was blinking slow. Had him reset the router and the controller. Still slow green blink...

I had my web admin remote desktop onto my server to ping it for me and check out the router settings. Turns out the router decided this am to change the IP to the wifi module. He re-forwarded the port and made the IP static. Good to go! Way too many settings in that Cisco router for a noob like me :roll:

Thanks for the help!
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Last question before I buy RA

Post by binder »

A suggestion for you with the router and IP address. I would customize your DHCP server to server up a "static ip" for the wifi module based on its MAC address. Most routers should allow for that to be done. I actually use this in my setup and do not mess with assigning a static ip on the wifi module itself.

curt
tkeracer619
Posts: 159
Joined: Thu Nov 24, 2011 9:50 pm
Location: Golden, CO

Re: Last question before I buy RA

Post by tkeracer619 »

Thanks for the tip!

I am pretty sure thats what he did but I will double check when I get home.
Image
Post Reply