Page 1 of 1

Help with a code...

Posted: Tue Mar 27, 2012 6:14 am
by Woja222
Ok, so I'm not as code literate as I thought and the RAgen isn't very clear so some help would be great! I just bought the pwm dimming controller. Here is what I want to do in the end.

Lights:
I want to be able to set the time for whites and actintics to ramp up and down separately on desired times with the ability to set the maximum desired output.
Socket 1:
LED drivers (will have power cut when led dimming circuts go to 0%)
Socket 2:
Main pump
Socket 3:
For a standalone ATO (wont use any of the float switches on the controller)
Socket 4:
Powerhead
Socket 5:
Skimmer
Socket 6:
Drain Water solenoid
Socket 7:
Fill Water solenoid
Socket 8:
Heater

I want a water change setup that will-
Deactivate socket 3 until process is complete
Start with activating socket 6 for a set amount of time then deactivate
After drain is complete activate socket 7 until float switch 1 on the controller is met then deactivate
Reactivate socket 3

I also want float switch 2 to set a high level alarm and deactivate sockets 2, 3, 5, 6, 7, and 8 when it trips.

Also would like to be able to manually override if I wanted to turn on/off any socket temporarily.

Temperate probe for water temperature

Ph probe which I would like to calibrate with 7.0 and 9.0 solution if possible

I would like to be able to connect the controller to the internet via my home router. I have a computer next to the aquarium. An would like to set it up to work through my iphone via the app.

Re: Help with a code...

Posted: Tue Mar 27, 2012 8:21 am
by rimai
Start with this:
Generate an internal memory code and upload to controller.
If you don't know how to, check this thread:
http://forum.reefangel.com/viewtopic.php?f=15&t=60

Then use this code:

Code: Select all

// Autogenerated file by RAGen (v1.2.1.158), (03/27/2012 08:14)
// RA_032712_0814.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
*/


#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 = Port4Bit;
    ReefAngel.WaterChangePorts = Port2Bit | Port3Bit | Port5Bit;
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.LightsOnPorts = 0;

    // Ports that are always on
    ReefAngel.Relay.On(Port2);
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.On(Port4);
    ReefAngel.Relay.On(Port5);
}

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port1);
    ReefAngel.StandardHeater(Port8);
    ReefAngel.PWM.SetActinic(PWMSlope(9,0,17,0,15,100,60,15));
    ReefAngel.PWM.SetDaylight(PWMSlope(9,0,17,0,15,100,60,15));
    if (ReefAngel.HighATO.IsActive())
    {
      ReefAngel.Relay.Off(Port2);
      ReefAngel.Relay.Off(Port3);
      ReefAngel.Relay.Off(Port5);
      ReefAngel.Relay.Off(Port6);
      ReefAngel.Relay.Off(Port7);
      ReefAngel.Relay.Off(Port8);
    }

    ReefAngel.Portal("Woja222");
    ReefAngel.ShowInterface();
}

Re: Help with a code...

Posted: Tue Mar 27, 2012 9:15 am
by Woja222
Got the internal memory loaded but when I try to upload the RA code you posted it states 'class ReefAngelClass' has no member named'Portal'

Re: Help with a code...

Posted: Tue Mar 27, 2012 9:23 am
by Woja222
By the way, I do not have the wifi attatchment. I planned to leave the reef angel connected to my computer through the usb connection to allow it to connect to the internet. How would I go about setting that up?

Re: Help with a code...

Posted: Tue Mar 27, 2012 9:33 am
by rimai
Oh, I thought you did..
Remove the Portal() line then.
You won't be able to use the iPhone app without the wifi attachment.
You can however use the Client Suite PC application on your computer and maybe use a remote connection app on the iphone to access the computer.
Just an idea.
Either way, you will want to enable wifi feature. The Client uses the wifi framework to communicate.
So, you need to:
Open RAGen
Move to tab features
Check Mark wifi
Click Save
Then upload the code again.

Re: Help with a code...

Posted: Tue Mar 27, 2012 9:48 am
by Woja222
I tried deleting that line from the code but still came up with an error. Could you generat a new code for me please? The app will no way at all work without the wifi attatchment? The computer hooked to the reef angel is connected directly to my wifi modem.

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:05 am
by rimai

Code: Select all

// Autogenerated file by RAGen (v1.2.1.158), (03/27/2012 08:14)
// RA_032712_0814.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
*/


#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 = Port4Bit;
    ReefAngel.WaterChangePorts = Port2Bit | Port3Bit | Port5Bit;
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.LightsOnPorts = 0;

    // Ports that are always on
    ReefAngel.Relay.On(Port2);
    ReefAngel.Relay.On(Port3);
    ReefAngel.Relay.On(Port4);
    ReefAngel.Relay.On(Port5);
}

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port1);
    ReefAngel.StandardHeater(Port8);
    ReefAngel.PWM.SetActinic(PWMSlope(9,0,17,0,15,100,60,15));
    ReefAngel.PWM.SetDaylight(PWMSlope(9,0,17,0,15,100,60,15));
    if (ReefAngel.HighATO.IsActive())
    {
      ReefAngel.Relay.Off(Port2);
      ReefAngel.Relay.Off(Port3);
      ReefAngel.Relay.Off(Port5);
      ReefAngel.Relay.Off(Port6);
      ReefAngel.Relay.Off(Port7);
      ReefAngel.Relay.Off(Port8);
    }

    ReefAngel.ShowInterface();
}
The app can work if you really want to.
You need to find a Serial to TCP application that can be installed on your PC and give it a try.
No one has done it before though.
If you got time to try all the dozens of applications out there to find one that suits us, that would be awesome!!

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:13 am
by Woja222
That code is still coming up with the message error compiling

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:17 am
by rimai
It's gotta be a different error then.
The Portal line was removed.

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:21 am
by Woja222
p:2053: undefined referance to 'MenuEntry1()'

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:22 am
by rimai
That's because you enabled Custom Menu feature.
Open RAGen
Go to features tab
Uncheck Custom Menu
Click Save

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:26 am
by Woja222
Now it gave me the message sketch too big...

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:28 am
by rimai
Use the simple menu feature. Sorry

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:35 am
by Woja222
Still is too big of a sketch. Says 32686 bytes of a 32256 byte maximum

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:42 am
by Woja222
By the way, in the near future I'll probably just end up getting the wifi attatchment so I can easily use the app on my iphone

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:42 am
by rimai
What features do you have enabled?
You should only have these enabled:
Wifi
Watchdog Timer
Simple Menu
Version Menu
Display LED PWM

If you are using wifi feature, you don't need any of the other ones, unless you have an RA+ board for additional memory.
If you want the other features, you will need to disable wifi.

Re: Help with a code...

Posted: Tue Mar 27, 2012 10:58 am
by Woja222
When will the RA+ board be available? There is a lot of custom writing I would like to do that I feel the opti-boot is going to limit me on.

Re: Help with a code...

Posted: Tue Mar 27, 2012 11:07 am
by rimai
Pre-order is open.
Should be here in 2 weeks or so.

Re: Help with a code...

Posted: Thu Mar 29, 2012 2:08 pm
by Woja222
What is the price of the plus board? I would've rather had the reef angel plus but it wasn't available when I ordered the optiboot. I was lead to believe that the optiboot would've been enough for my functions.

Re: Help with a code...

Posted: Fri Mar 30, 2012 9:02 pm
by rimai
http://www.reefangel.com/Store.ashx
I'm pretty sure you can fit the code you want in the standard RA.
Only if you really want to pack all features should you need the RA+.

Re: Help with a code...

Posted: Mon Apr 02, 2012 12:29 pm
by Woja222
Can I get to the part of the code where I can change the upper range of the pH calibration;
For example, I want to change 10 to 9.

Thank you.

Re: Help with a code...

Posted: Mon Apr 02, 2012 12:52 pm
by rimai
It's not a code change.
You have to do the math for simple interpolation.
http://forum.reefangel.com/viewtopic.php?p=7561#p7561