Page 1 of 1

my first full code - any suggestions?

Posted: Mon Mar 05, 2012 7:44 am
by miked

Code: Select all

// Autogenerated file by RAGen (v1.2.1.158), (02/29/2012 16:08)
// RA_022912_1608.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define SIMPLE_MENU
#define PWMEXPANSION
#define ENABLE_ATO_LOGGING
*/


#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 <ReefAngel.h>


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

    ReefAngel.FeedingModePorts = Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePorts = Port4Bit | Port5Bit |Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.LightsOnPorts = 0;

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

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port1);
    ReefAngel.StandardLights(Port2);
    ReefAngel.StandardLights(Port3);
    ReefAngel.StandardHeater(Port4);
    ReefAngel.SingleATOLow(Port5);
ReefAngel.Relay.Set(Port5,!ReefAngel.HighATO.IsActive());

    ReefAngel.Portal("miked");
    ReefAngel.PWM.ActinicPWMSlope(10,0,23,0,5,75,180,5);
    ReefAngel.PWM.DaylightPWMSlope(11,0,21,0,5,65,120,5);
    ReefAngel.ShowInterface();
}
When I first generated the PWM slope code separately it had an extra paren in there, but when I just put my numbers into the RAgen sample output it looked like this. still have not figured how to set the max temp level to shut off the outlet. I designated the heater port but did not see an option to turn it off? I may be overlooking something simple, that is my guess :roll: .

Re: my first full code - any suggestions?

Posted: Mon Mar 05, 2012 7:47 am
by miked
also is there a simple way to have my standard light ports turn on and off 30 minutes prior to and after the PWM slope start. the third 'standard light' port/outlet is for my light cooling fan.

thanks

Re: my first full code - any suggestions?

Posted: Mon Mar 05, 2012 9:21 am
by rimai
I recommend moving the Portal() function to the last function called before ShowInterface().
Do you want all 3 ports to turn on/off with 30 minutes offset or just ports 1 and 2?
The ActinicPWMSlope() needs no values in it. It will use settings stored in internal memory. Makes it easy to change using the smart phone app.

Re: my first full code - any suggestions?

Posted: Mon Mar 05, 2012 9:23 am
by rimai
Oh, the overheat is also configured in the internal memory.
You can set to whatever temperature you want and then use this:

Code: Select all

    ReefAngel.OverheatShutoffPorts = Port4Bit ;

Re: my first full code - any suggestions?

Posted: Mon Mar 05, 2012 10:11 am
by miked
rimai wrote:I recommend moving the Portal() function to the last function called before ShowInterface().
Do you want all 3 ports to turn on/off with 30 minutes offset or just ports 1 and 2?
The ActinicPWMSlope() needs no values in it. It will use settings stored in internal memory. Makes it easy to change using the smart phone app.

from info I got from JBJ today, I will neet the power to LED channels turned on at the exact time I want the slope to start. the blue and white are on separate power cords and separate controllable 2.1mm jacks.

I am unclear on the actinic slope statement. I will try and explain what I intend and please feel free to correct me:
I am using the actinic slope for the blue led channel and want it to run slightly earlier, later, and at more intensity than the white led channel. The white led channel will be the daylight slope.

I also just found out that the drivier runs a minimum (not zero) led voltage so I would need to have the power to each channel turn on and off at the exact time I want the PWM to start and end its ramping cycle. So:

Actinic channel for blue LED and fan would be on at the same time and off at the same time.
Daylight channel for white LED would be on later and off sooner than the Actinic and fan. This may take a bit more work on my end to figure this out.

thanks for the quick reply.

Re: my first full code - any suggestions?

Posted: Mon Mar 05, 2012 10:18 am
by miked
rimai wrote:Oh, the overheat is also configured in the internal memory.
You can set to whatever temperature you want and then use this:

Code: Select all

    ReefAngel.OverheatShutoffPorts = Port4Bit ;
I got that part taken care of, but still can not find out where to set the temp shut off to say 82 degrees (820 is the number I wull put in, but I have not been able to find where)

thank you

Re: my first full code - any suggestions?

Posted: Mon Mar 05, 2012 10:22 am
by miked
rimai wrote: Do you want all 3 ports to turn on/off with 30 minutes offset or just ports 1 and 2?
So I will put the Actinic/Blue LED and fan on standard lights port settings to control both outlest simultaneously and set the white LED on the MHLights port to control its on/of separately . Now to figure out how to set the on/of of those Ports at a specific time to coincide with my dimming plans. thanks again you guys have been a ton of help.

Re: my first full code - any suggestions?

Posted: Mon Mar 05, 2012 10:40 am
by rimai
On RAGen, go to Controller->Internal Memory.
You can set all the light schedule and heater settings.
Those are initial values and then you can always change them later with the Client or any smart phone app.

Re: my first full code - any suggestions?

Posted: Mon Mar 05, 2012 11:24 am
by miked
Thanks Roberto. I cant believe I did not find out the internal memory adjustments sooner. Must have overlooked it. Also I have attached my, hopefully, final code.

Code: Select all

// Autogenerated file by RAGen (v1.2.1.158), (03/05/2012 12:15)
// RA_030512_1215.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define SIMPLE_MENU
#define PWMEXPANSION
#define ENABLE_ATO_LOGGING
*/


#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 <ReefAngel.h>


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

    ReefAngel.FeedingModePorts = Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePorts = Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    ReefAngel.OverheatShutoffPorts = Port4Bit;
    ReefAngel.LightsOnPorts = 0;

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

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port1);
    ReefAngel.MHLights(Port2);
    ReefAngel.StandardLights(Port3);
    ReefAngel.StandardHeater(Port4);
    ReefAngel.SingleATOLow(Port5);    
    ReefAngel.Relay.Set(Port5,!ReefAngel.HighATO.IsActive());

    ReefAngel.PWM.ActinicPWMSlope(10,0,23,0,17,75,180,17);
    ReefAngel.PWM.DaylightPWMSlope(11,0,21,0,17,65,120,17);

    ReefAngel.Portal("miked");
    
    ReefAngel.ShowInterface();
}
this will have blue and white led on and off at separate times and slope differently.
fan on when first led comes on.
heater setup to turn on and off appropriately with an overheat set at 82 F.
Dual ATO setup in a high and high/high(as backup) format as the ATO pump I use can run dry without any ill effects so I would rather have the overflow backup.
feed mode turns off all wavemakers/powerheads
water change mode turns off all wavemakers/powerheads/heater/ATO
WIFI portal and web control will need to be set up later, I have not read the tutorial on that yet but have downloaded the android app.

thanks again for all the help. I hope to have it all up and running in the next couple of hours.