For now, I'm going to provide what I have so far, and note what I want to change/add ASAP.
First, my system info:
RA+
Expansion Hub
Expansion Relay
WiFi Module
VorTech RF Module
Dimming Expansion
Standard ATO (Low)
pH Probe
3 Temp Probes (Tank/Sump/Room)
Tank Equipment:
2 Apollo Reef LED Fixtures (Blue/White's dimmable, ML is On/Off)
Waveline DC6000 Return Pump (Do not have DC controller cable as these apparently don't work well with them)
2 VorTech MP40WES
BM CS180 Skimmer
Aqua UV 25watt UV Filter
Avast Marine Pressure Sensor (used in skimmate collection container to shut off skimmer if full)
Finnex 300W Heater
Tunze ATO Pump (the controller failed on me, so I hard wired to the power plug and control it thru RA float)
Refugium Light - Standard clip on HD fixture with a 38 PAR LED bulb
Here are the basic control features I have included in my code and should be working (not uploaded yet, but it compiles):
NOTE - Everything setup for internal memory settings so I can have on-demand control/adjustment with the Android App
- Parabola slope for Actinic/Daylight LED's on Dimmer Expansion Module - Future addition of Cloud/Storm effects
----LED 1 Blue = Channel 0
----LED 2 Blue = Channel 1
----LED 1 White = Channel 2
----LED 2 White = Channel 3
---- Channel 4 & 5 are not used
------Blue Schedule is On 8 AM / Off 9 PM (3 Hour offset)
------White Schedule is On 11 AM / Off 6 PM
- Moon Lights - Schedule is opposite Daylights, but modified to turn off from Midnight to 7:30 AM (They are too bright and non-dimmable) So basically, they turn on from 6 PM and turn off at Midnight, then come on at 7:30 AM and stay on until 11 AM. I may add code to turn them off from 8AM thru 11 AM since they aren't needed while Blues are on.
- Refugium Light - Opposite of Daylights (not modified)
----Also set to turn On during WC Mode (I think my code will do this, but not tested yet.)
- Lights On Mode - Set to turn on all Blue/White/ML Leds and Refugium Light (Blue/Whites brightness controlled by Dimmer, so ML will assure some light even at night... and Refugium Light tagged here as backup in case it doesn't come on during WC Mode)
- ATO controlled by float switch in Return chamber of sump, controlled by Single ATO (Low)
- Temp controlled by T1 Temp Probe (Tank temp)
- Feeding Mode - Will turn off Skimmer, ATO, and Return Pumps. VorTechs should go into Feeding Mode
- WC Mode - Will turn off VorTech Pumps, Skimmer, ATO, and Heater. I left Return pump on because I have a manifold on it and use my valves to use return pump to take out water. In doing this, I need to use the Android App to control the Return Pump port manually. I plan to turn off the Return port to let sump fill up a bit, then go into WC Mode, set up my bucket and valves for the WC, then manually turn the Return port back on (and off again if/when the return section gets too low or as I need to change buckets, etc.
- Overheat Mode - Unlikely to happen with LED's and the DC return pump... but just in case, this will shutoff all LED's except moonlights, Refugium Light, and the Heater.
- VorTech MP40's - Have a schedule for daytime operation (Between 8 AM and 10 PM) and nighttime operation (Between 11 AM and 7 AM)
----Daytime should run as per the internal memory selection for the most part. I have added (what I think) should put them in Nutrient Transport Mode for 30 minutes after Feeding Mode ends. Have not uploaded the code yet to test it.
----Nighttime should basically just set the time range for Night Mode on the VorTechs (15% speed)
- Dosing Pumps - As of right now, I have Pump1 set to dose every 32 minutes for 60 seconds, Pump2 the same (with 5 minute offset). These are brand new and I have yet to calibrate them, nor figure out my tru dosing needs, so I'll leave this alone for now until I see what I need to change.
Here are a few things I want to add ASAP:
- Dosing Pumps - As I figure out the proper dosage rates I need, I'll adjust these memory locations. Also, I may decide to adjust it so that Alk runs only at night, and Cal runs only in day. Thoughts on this?
- Storm effects - Would really like to figure out how to convert Colin's cloud/lightning code to the dimmer expansion. Will work on that when I get some time.
I think that's about it for now. If I think of more, I'll update the post later.
Updated 10/13/14:
- Added #Define statements to name all my ports / Removed Commented section that did this before.
- Used the port names in lieu of default port naming scheme throughout most of the code (Mostly on custom stuff) as per LNevo's suggestion.
- Replaced the RF Daytime / Nightime control coding that used "Timer[1]" also as per LNevo's suggestion. I borrowed code found in his .INO thread and it looks much cleaner and works great!
- Uploaded the Vortech Setup code and synced up both of my MP40's, set 1 as sync and 1 as anti-sync.
- Uploaded this code and rearranged my equipment plugs to the correct (new) ports.
- Decided to add both MP40's to same port (using a plug splitter) since they don't draw much power and I don't need independent control of them power-wise. If I need to change this in the future, I have 1 open port that I can use.
- Dosing pumps are not physically online yet because I didn't have time to test/calibrate them and still need to get all the tubing mounting, etc. situated. Have checked that the port get's activated per the schedule I setup though.
- Everything seems to be working fine but will likely tweek things as I monitor it.
Updated 10/16/14:
- Added command: ReefAngel.RF.SetMode(Feeding_Stop,0,0); just before the UseMemory=true line to fix the issue with the RF module failing to reset. I had thought this issue was fixed and didn't add the workaround this time, but it appears it's still needed. At least LNevo was kind enough to help clear that one up.
- I also changed the VorTech mode change commands (after Feeding Mode and custom "Night mode") because the original version didn't include speed commands. I basically went back to the version I had in my previous code and the 1-line command seems to be working fine.
OK, here is my updated / current INO:
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>
// Define Relay Ports by Name
//Main Relay Box
#define DPump1 1
#define DPump2 2
#define Skimmer 3
#define Fan 4
#define Vortechs 5
#define Open 6
#define Refugium 7
#define Topoff 8
//Expansion Relay Box 1
#define LED1B Box1_Port1
#define LED2B Box1_Port2
#define LED1W Box1_Port3
#define LED2W Box1_Port4
#define LED1M Box1_Port5
#define LED2M Box1_Port6
#define Return Box1_Port7
#define Heater Box1_Port8
////// 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 = Port3Bit | Port8Bit;
ReefAngel.FeedingModePortsE[0] = Port7Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port5Bit | Port8Bit;
ReefAngel.WaterChangePortsE[0] = Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port7Bit;
ReefAngel.LightsOnPortsE[0] = Port1Bit | Port2Bit | Port3Bit | Port4Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port7Bit;
ReefAngel.OverheatShutoffPortsE[0] = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Ports that are always on
ReefAngel.Relay.On( Vortechs );
ReefAngel.Relay.On( Open );
ReefAngel.Relay.On( Return );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.DosingPumpRepeat1( DPump1 );
ReefAngel.DosingPumpRepeat2( DPump2 );
ReefAngel.Relay.DelayedOn( Skimmer );
ReefAngel.StandardFan( Fan );
ReefAngel.MoonLights( Refugium );
ReefAngel.SingleATOLow( Topoff );
ReefAngel.ActinicLights( LED1B );
ReefAngel.ActinicLights( LED2B );
ReefAngel.DayLights( LED1W );
ReefAngel.DayLights( LED2W );
ReefAngel.MoonLights( LED1M );
ReefAngel.MoonLights( LED2M );
ReefAngel.StandardHeater( Heater );
ReefAngel.PWM.Channel0PWMParabola();
ReefAngel.PWM.Channel1PWMParabola();
ReefAngel.PWM.Channel2PWMParabola();
ReefAngel.PWM.Channel3PWMParabola();
ReefAngel.RF.UseMemory = true;
////// Place your custom code below here
//----------------------------------- Custom Moon Light Schedule -------------------------------
if ( NumMins(hour(),minute()) < 450 ) // Turn off Moonlights from Midnight to 7:30 AM
{
ReefAngel.Relay.Off( LED1M );
ReefAngel.Relay.Off( LED2M );
}
//------------------------------- End of Custom Moon Light Schedule ----------------------------
//------------------------------------ Fuge Light on for WC Mode -------------------------------
if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE)
{
ReefAngel.Relay.On( Refugium );
}
//---------------------------------- End Fuge Light on for WC Mode -----------------------------
//------------------------- Set NTM after Feeding Mode and Set Night Mode ----------------------
static unsigned long FeedTime;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) FeedTime=now();
if (now()-FeedTime>0 && now()-FeedTime<3600)
{
// Continue NTM for the 60 minutes
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Smart_NTM,155,5);
}
else if (now()%SECS_PER_DAY<25200 || now()%SECS_PER_DAY>=82800)
{ // 7:00am / 11:00pm
// Night mode (go to 15%)
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Night,15,0);
}
else
{
ReefAngel.RF.SetMode(Feeding_Stop,0,0);
ReefAngel.RF.UseMemory=true; // Will reset all values from memory
}
//----------------------- End Set NTM after Feeding Mode and Set Night Mode --------------------
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "TanksNStuff" );
ReefAngel.ShowInterface();
}