help with initial programming PLEASE

New members questions
Post Reply
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

help with initial programming PLEASE

Post by iratefrizz »

Hey!
I just got my reef angel in the mail yesterday and am super excited to get it working and play with the programming. BUT I am going out of town on training for 6 months so I need to get it set up and working as fast as possible so my wife has less to worry about while I am away.
I have the RA+ with Wifi right now. (still have to set it up)
I intend to purchase the salinity expansion and one more power box at the least. (prolly not till i get back though)

on that note. (all of my plans below are open to change this was just initial thoughts. Also, if there are already plugs in place for one of the items listed than the numbers could be changed around of course!)

IDK if anyone has the time or experience to write up quick code for what I need. I plan to spend some time this evening perusing the forum for advice and examples but wanted to ask for help right away. Once I get it in there I'm sure I can modify it

I have Reefbreeder photon 48 so I do not need light control.
plug 1
I am going to put my two power heads and wavemaker on a surge protector to control them all simultaneously.
plug 2
lights simply for turning on and off
plug 3
heater -turn on if below 81.9 turn off if above 82
plug 4
fan - turn on if above 82 turn off if below 82
plug 5
aqua lifter for top off. (controlled by separate unit)
plug 6
fuge light - turn on @ 2000 turn off @ 0800
plug 7
protein skimmer
plug 8
return pump

functions wanted (able to do at push of button on phone or controller)
WATER CHANGE
-turn off pumps plug 1 & 8 - aqua lifter plug 5

FEEDING TIME
0850 turn off pumps plug 1 & 8
0910 turn pumps back on
1750 turn off pumps plug 1 & 8
1810 turn pumps back on

BRINE SHRIMP / FUGE GROW
Turn off return pump plug 8 & skimmer plug 7 turn ON fuge light plug 6
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: help with initial programming PLEASE

Post by rimai »

Start with the wizard.
Menu Tools->Reef Angel Wizard
Roberto.
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

I was unaware that there was a wizard. I will check that out.
Thank you
Image
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

OK. two things.
I was able to find and use the wizard to create my basic program. I was wondering, however, how I would add in the shutoff pumps during feeding times (listed above)

next thing I noticed was several people have their controller shown in their signature block? how do I do that?
but more importantly How do i label plugs as return pump or fuge light etc. ??

Thank you again!
I can't wait to get a break in homework and study material so I can really dive into the programming. so many things I want to do lol
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: help with initial programming PLEASE

Post by lnevo »

Are you using the DCPump class? Lets see the code... Assuming you have wifi..go to portal go under web banners. Pick the banner you want. Copy the code shown to your signature.
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

lnevo wrote:Are you using the DCPump class? Lets see the code... Assuming you have wifi..go to portal go under web banners. Pick the banner you want. Copy the code shown to your signature.
I am not sure If I am or not lol. I just went through the Wizard.
I am not sure how to even get the code. :/ i feel silly with lack of programming knowledge lol.

I do have wifi. I just got it to connect but it is still trying to connect to router to set up port forwarding. not sure how long it is going to try to connect to router. but its still trying :)
HOWEVER I changed the description above. I think I am going to sell my wavemaker pump in the back of my tank and only run two power heads on ports 5 and 6 on random. and I will NOT have a fan installed at this time.

and thanx for info on showing my status in signature.

here is an attempt to attach code lol

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 <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
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 869 );


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

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

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

void loop()
{
    ReefAngel.StandardHeater( Port3,806,810 );
    ReefAngel.StandardLights( Port4,20,0,8,0 );
    ReefAngel.WavemakerRandom( Port5,15,45 );
    ReefAngel.WavemakerRandom( Port6,15,45 );
    ReefAngel.Relay.DelayedOn( Port7,10 );
    ////// Place your custom code below here
    

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

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

Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: help with initial programming PLEASE

Post by lnevo »

Ok, in this case for feeding mode you would add in between the custom code section something like this:

if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Off(Port6);
}
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

lnevo wrote:Ok, in this case for feeding mode you would add in between the custom code section something like this:

if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Off(Port6);
}
OK thats fine I can do that. BUT i have an auto feeder and want the pumps to turn off to give the fish time to get food so it doesn't get flushed down to the sump lol.
So I wanted to have the pumps on a schedule so they turn off at 0755 turn back on at 0810 and then turn off again at 1755 and on at 1810.
which is why I didn't use the on a time schedule operation. PLUS im using the wave function.
Image
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

would something like this work
ReefAngel.StandardLights( Port5,8,10,17,55 );
ReefAngel.StandardLights( Port5,18,10,7,55 );
ReefAngel.StandardLights( Port6,8,10,17,55 );
ReefAngel.StandardLights( Port6,18,10,7,55 );
ReefAngel.StandardLights( Port1,8,10,17,55 );
ReefAngel.StandardLights( Port1,18,10,7,55 );

that way it turns on after a feeding turns off before feeding. turns on after feeding and turns off after feeding?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: help with initial programming PLEASE

Post by lnevo »

No that wont work. The last statement for each port will be the one that sets the status. All the other lines are overridden. I'll try and post something tomorrow for you to try.
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

Found this on another thread or something similar. will this work?

Code: Select all

    if (hour()==8 && minute()>=0 && minute()<=15) ReefAngel.Relay.Off(Port6);
    if (hour()==8 && minute()>=0 && minute()<=15) ReefAngel.Relay.Off(Port5);    
    if (hour()==18 && minute()>=0 && minute()<=15) ReefAngel.Relay.Off(Port6);
    if (hour()==18 && minute()>=0 && minute()<=15) ReefAngel.Relay.Off(Port5); 
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: help with initial programming PLEASE

Post by lnevo »

Its one way to skin this cat...
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

well I guess I will give it a shot :)
Image
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

few more questions.
I am on portal but it says
Connection status unreachable IP (not sure where I even put the IP let alone which IP to put)
when I try to change settings from portal I get
this error
Only available with valid wifi address. Please make sure your controller is sending data to the Portal web server

next I have wifi set up and I think I got port forwarding set up through my router / vpn but idk what I'm supposed to put for "away host" on the app.
Still Don't understand how to get the RA status in my signature block.
Thank You

Josh
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: help with initial programming PLEASE

Post by rimai »

I don't think your port forwarding is setup correctly.
When you go to http://www.yougetsignal.com/tools/open-ports/ does it show port 2000 open?

For your sig, you must enter this in your signature:
Go to User Control Panel->Profile->Edit signature
Roberto.
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

No, It isn't forwarding. I have dd-wrt and used it to set port forwarding but its not for that type of port forwarding I guess. :/

Put that code into my signature but I don't think it worked... I guess i'll find out in a minute for sure though :)
Image
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

OK I was able to set up port forwarding and it works.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: help with initial programming PLEASE

Post by lnevo »

iratefrizz wrote:Put that code into my signature but I don't think it worked... I guess i'll find out in a minute for sure though :)
It needs to be in an IMG tag. Here's what's in mine. This is how it should look in the Edit signature box.

Code: Select all

[img]http://forum.reefangel.com/status/banner_5.aspx?id=lnevo&t=-4[/img]
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: help with initial programming PLEASE

Post by lnevo »

Looks like you got it working :)
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

lnevo wrote:Looks like you got it working :)
I DID I happened to think about the situation about 20 minutes before it was stated that I had to put it in the img box. :)
NOW for hopefully my last question for a while... how do I make the app on my phone have labels that match my portal here? is that possible...
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: help with initial programming PLEASE

Post by binder »

iratefrizz wrote:
lnevo wrote:Looks like you got it working :)
I DID I happened to think about the situation about 20 minutes before it was stated that I had to put it in the img box. :)
NOW for hopefully my last question for a while... how do I make the app on my phone have labels that match my portal here? is that possible...
if it is the android app, then goto the settings inside the app and make sure your portal name is entered and then choose download labels.


Sent from my iPad mini
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

OOOK so back to initial issues. I was able to get it working and all was well. but now I am unable to connect to my reef angel from my phone or through the portal. the funny thing is. that it shows what is on and off and the fans turning on and off like they are but when i click to turn one of them off it comes up with this error

"Only available with valid wifi address. Please make sure your controller is sending data to the Portal web server"

what might i be missing?
I went into my router and the ip that was in there was not correct as far as i can telll. like it had changed on me. so i changed it back to what i thought it should be. but its still not work
thank you in advance.
Josh
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: help with initial programming PLEASE

Post by rimai »

Yeah, routers tend to do that :(
One way to avoid this is to assign a static ip address based on MAC address in your router, so it will always assign the same ip address to your wifi attachment.
That way, the port forwarding will stay correct everytime.
Roberto.
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

I think i remember how to do that. but any idea why after changing it back to the original IP address I still received the same errors... ? like the portal on here was receiving updates but I couldn't change any settings or turn anything on or off. but the ap on my phone still wouldn't connect. :(
Image
ReEfnWrX
Posts: 234
Joined: Tue Nov 05, 2013 8:40 am
Location: Houston TX

Re: help with initial programming PLEASE

Post by ReEfnWrX »

Are you accessing your RA through the AP using your LAN or WAN IP address? If you are using your WAN IP address that can change to
Image
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

I am currently in the states whereas my tank and RA is in Japan. so I am using the WAN IP which is the IP that changed. my wife can connect to it IN home using LAN but sometimes it still returns errors (no big deal) but not sure why i can't connect at all on my phone (or hers if she is using away setting) but the portal on here is able to read what its sending out but cant change things
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: help with initial programming PLEASE

Post by rimai »

The controller is capable of sending data out without a problem, that's why it shows current data. It doesn't depend on port forwarding or anything.
The problem is that you can't connect from outside because the port forwarding got messed up with the ip change.
Roberto.
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

ok. i understand... so now i just need to track down the problem with port forwarding? that should all be router settings correct? nothing with the RA programming?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: help with initial programming PLEASE

Post by rimai »

Correct. It's all inside the router.
Roberto.
iratefrizz
Posts: 21
Joined: Tue Nov 12, 2013 8:42 pm
Location: Okinawa

Re: help with initial programming PLEASE

Post by iratefrizz »

Thank you I'll update when i get it fixed or ask more questions
Image
Post Reply