Page 1 of 1

RMC's Humble Code Abode

Posted: Mon Jun 30, 2014 1:59 pm
by RMc
Hi all - this is a preemptive thread to track all future code efforts.

My aquarium is a 92 gallon Bow front corner with 3 strings of LED's (controlled by a small typhoon led controller), a 30g sump + 5g refugium. I dose Kalk in the top off water.

Full tank shot: http://i.imgur.com/SZp7WEP.jpg

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.AddStandardMenu();  // Add Standard Menu

    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    ReefAngel.AddPHExpansion();  // pH Expansion Module
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port2Bit | Port4Bit | Port5Bit | Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port8Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port8Bit;
    // 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( Port4 );
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port6 );

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

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

void loop()
{
    ReefAngel.StandardFan( Port1,800,810 );
    ReefAngel.Relay.DelayedOn( Port2,10 );
    ReefAngel.DosingPumpRepeat( Port3,0,20,60 );
    ReefAngel.DosingPumpRepeat( Port7,0,20,30 );
    ReefAngel.StandardLights( Port8,11,0,19,0 );
    ReefAngel.PWM.SetDaylight( PWMParabola(8,0,20,30,15,100,15) );
    ReefAngel.PWM.SetActinic( PWMParabola(10,30,20,30,15,100,15) );
    ////// Place your custom code below here
    

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

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

I'm using the basic Reef Angel Plus package and will start by controlling:
  • (Port 1) Canopy fan when temperature exceeds 81 degrees. Otherwise keep it off to minimize evaporation
  • (Port 2) Skimmer - turn off for water changes / feeding - delay 10 minutes
  • (Port 3) ATO - (External relay / float to prevent overflow) turn on for 1 minute every 20 minutes
  • (Port 4,5,6) Jebao 45 + Jebao 25 + Return - turn off during feeding / water changes
  • (Port 7) a small circulation pump in the sump used to prevent detritus buildup - turn on for 30 seconds every 20 minutes
  • (Port 8) Extra string of LED's which turns on mid day
  • Testing the PWM output with 2 LED strings (blue + white/red/green)
In the future I'd like to:
  • Control the Jebao pumps (softer night mode / alternate modes day to day / simulate storm surges)
  • Add a more powerful DC return pump and vary the flow
  • Add a DC pump to the refugium to decrease flow to a trickle at night
  • Create a chilled + stirred feeder tank and dose cyclopeeze throughout the day
  • PWM Addon: control all lights using the RA + weather pattern / moonlight
  • Wifi Module - monitor the aquarium while away
  • Maybe humidity sensor under the stand with a ventilation fan

Re: RMC's Humble Code Abode

Posted: Mon Jun 30, 2014 2:05 pm
by rimai
Awesome!! Tank looks good :)

Re: RMC's Humble Code Abode

Posted: Mon Jun 30, 2014 3:09 pm
by lnevo
Move that wifi module up in your priority list! Otherwise great start! You can also save yourself 2 relay ports. You dont *need* the jaebos plugged in.

Re: RMC's Humble Code Abode

Posted: Mon Jun 30, 2014 3:29 pm
by RMc
Hi Inevo - you're right, I could have the return pump + 2 jebaos on a splitter; however I do want them to turn off during feeding time.

Also, right now I don't have anything else to automate. Hopefully that will change soon ;)

PS: thank you to the mod for fixing my link and not berating me for sneaking a URL past the filter.

Re: RMC's Humble Code Abode

Posted: Mon Jun 30, 2014 3:33 pm
by rimai
RMc wrote: PS: thank you to the mod for fixing my link and not berating me for sneaking a URL past the filter.
:)
Yeah, I think it is 5 post. You are almost there!!!
Just to complement what lnevo recommended, you can also turn off the DC/Jebao pumps using only the dimming signal and that way you can always leave them plugged into the wall.

Re: RMC's Humble Code Abode

Posted: Wed Jan 14, 2015 7:39 pm
by RMc
Believe it or not I just got around to reprogramming my RA...whew...took a little bit of plugging and unplugging and com port foolery and getting the TTL on the right pins...but! the code is in.

Re: RMC's Humble Code Abode

Posted: Tue Jan 27, 2015 7:13 am
by RMc
Having some trouble with inconsistent relay activity.

http://pasteboard.co/EExwAhl.png

My ATO (#3 green) and a small circulation pump (#7 blue) are supposed to be turning on for 60/30 seconds every 20 minutes.

ReefAngel.DosingPumpRepeat( Port3,0,20,60 );
ReefAngel.DosingPumpRepeat( Port7,0,20,30 );

However, if you look at the relay activity it seems that they're not consistently doing so. Both are set to "auto" as viewed on the portal.

Any ideas?

Re: RMC's Humble Code Abode

Posted: Tue Jan 27, 2015 7:53 am
by lnevo
You will not see the results in the portal accurately as the portal only sends updates every 5 minutes and the status is sent at the time. If the port is already off you will not see that it was on.

Roberto, I have an idea how we can address this, going to open an issue to discuss the options...

Re: RMC's Humble Code Abode

Posted: Wed Jan 28, 2015 9:25 am
by RMc
Another Q: on the portal, is there a way to see PH and temp on separate graphs so that changes are more readily apparent? Both of mine just look like flat lines because of the vertical scaling.

Re: RMC's Humble Code Abode

Posted: Wed Jan 28, 2015 9:49 am
by cosmith71
Yup. Just click on the labels at the top to turn them on and off.

--Colin

RMC's Humble Code Abode

Posted: Wed Jan 28, 2015 12:09 pm
by lnevo