I adjusted the timing to slow from 9pm until midnight (and build from 5-8am) to work around the crossover and it seems to work well. That should work OK for now.
Thanks for all the help!
-Jon
Slow down waves at night
- jsclownfish
- Posts: 375
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
- jsclownfish
- Posts: 375
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Slow down waves at night
Reviving an older issue.
I've been paying more attention to wave flow with a couple of anemone's in the tank and I noticed it isn't cycling as I expected. I have two powerheads at the ends of the tank that cycle back and forth with gradual lulls in between at night ('slowing the waves'). I also have two smaller powerheads that mix things up a bit once and hour durng the day with a flow from back to front. When I try to use the code to slow the waves down at night sometimes the cycle that returns the next day isn't alternating, but cycling on and off together. I'm guessing this has to do with the toggle function and maybe where the powerheads left off. So if they were both off at the end of the night cycle, then they both cycle together instead of alternating when the normal day runs. Any ideas how to fix it? Here is my abbreviated code. that covers the wavemaker stuff...
Thanks!
Jon
Code: Select all
/* Main ReefAngelPlus controller with communication for sound,
auxillary monitor, I/O expansion, and extra relaybox, send master time,
flow, buzzer, overflow and reservoir alarms on the I/O
The following features are enabled for this File:
#define DisplayImages
#define SetupExtras
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define RelayExp
#define WDT
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 9
#define CUSTOM_MAIN
#define COLORS_PDE
#define FONT_8x8
#define NUMBERS_8x8
#define CUSTOM_VARIABLES
*/
#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>
#include <IO.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <avr/pgmspace.h>
// Custom Menu Code
void DrawCustomGraph()
{
}
void DrawCustomMain()
{
//Timer and trigger to keep wavemaker timing correct after setting date/time
int t=ReefAngel.Timer[1].Trigger-now();
if (t>=0)
{
ReefAngel.LCD.Clear(255,23,73,53,83);
ReefAngel.LCD.DrawText(0, DefaultBGColor,23,73,t);
}
if (t>300) ReefAngel.Timer[1].ForceTrigger();
//wavemakers extra
ReefAngel.LCD.DrawText(DPColor,DefaultBGColor, 64, 63,"WV:");
if (bitRead(ReefAngel.Relay.RelayDataE[0],Port5-1)==1) ReefAngel.LCD.DrawText(APColor,DefaultBGColor, 82, 63,"v "); //port 5 on
else if (bitRead(ReefAngel.Relay.RelayDataE[0],Port6-1)==1) ReefAngel.LCD.DrawText(APColor,DefaultBGColor, 82, 63," v"); //port 6 on
else ReefAngel.LCD.DrawText(APColor,DefaultBGColor, 82, 63," O "); //port5 and port 6 off, wavemaker delay
//Timer and trigger to keep wavemaker timing correct after setting date/time
int u=ReefAngel.Timer[2].Trigger-now();
if (u>=0)
{
ReefAngel.LCD.Clear(255,82,73,112,83);
if (bitRead(ReefAngel.Relay.RelayDataE[0],Port5-1)==1 || bitRead(ReefAngel.Relay.RelayDataE[0],Port6-1)==1)
{
ReefAngel.LCD.DrawText(0, DefaultBGColor,82,73,u);
}
}
if (u>300) ReefAngel.Timer[2].ForceTrigger();
}
void setup()
{
ReefAngel.Init(); //Initialize controller and start web banner timer
ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));
// Set the ports that get toggled on & off during the following modes
// To enable a port to be toggled, place a 1 in the appropriate position
// Uncomment and update as needed
// Port 87654321
ReefAngel.FeedingModePorts = B00110000;
ReefAngel.FeedingModePortsE[1] = B00110100;
ReefAngel.WaterChangePorts = B10110000;
ReefAngel.WaterChangePortsE[1] = B11111111;
// Ports that are always on
ReefAngel.Relay.On(Port7); //main pump
ReefAngel.Relay.On(Box1_Port1); //chiller
ReefAngel.Relay.On(Box1_Port2); //chiller pump
ReefAngel.Relay.On(Box1_Port4); //phosban pumpo
// Top smaller pumps once an hour for 5 minutes
ReefAngel.Relay.On(Box1_Port5);
ReefAngel.Timer[2].SetInterval(30);
ReefAngel.Timer[2].Start();
//Side to side Wavemaker Pumps
ReefAngel.Relay.On(Port5);
ReefAngel.Timer[1].SetInterval(200);
ReefAngel.Timer[1].Start();
}
void loop()
{
// Specific functions
//1st Heater at 78.8, 2nd Heater at 77.0, MH on at 10AM off at 8PM, Actinics on at 9AM off at 9PM, Fan kicks on at 82.0
ReefAngel.StandardHeater(Port1,788,792);
ReefAngel.StandardHeater(Port2,770,792);
ReefAngel.MHLights(Port3,10,0,20,0,5);
ReefAngel.StandardLights(Port4,9,0,21,0);
ReefAngel.StandardFan(Port8,792,820);
ReefAngel.DosingPumpRepeat(Box1_Port7,0,60,4); // Dose for 4 seconds every 60 minutes with 0 minutes offset
ReefAngel.DosingPumpRepeat(Box1_Port8,5,60,4); // Dose for 4 seconds every 60 minutes with 5 minutes offset
// Wavemaker Code with night option
if (ReefAngel.Timer[1].IsTriggered() )
{
if ((hour() >= 21) || (hour() <= 8)) //from 9p-Midnight
{ //PWMSlope(byte startHour, byte startMinute, byte endHour, byte endMinute, byte startPWM,
// byte endPWM, byte Duration, byte oldValue)
wmpulse=PWMSlope(21,0,8,0,5,30,179,30);
if (wmdelay)
{
ReefAngel.Timer[1].SetInterval(wmpulse); // WM delay function from 30-170 sec.
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Off(Port6);
if (wmport==Port5) wmport=Port6; else wmport=Port5;
wmdelay=false;
}
else
{
ReefAngel.Timer[1].SetInterval(200-wmpulse); // WM bursts timing from 170-30 sec.
ReefAngel.Timer[1].Start();
ReefAngel.Relay.On(wmport);
wmdelay=true;
}
}
else
{
//8a-10p normal wave settings
ReefAngel.Timer[1].SetInterval(200);
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port5);
ReefAngel.Relay.Toggle(Port6);
}
}
//extra small powerheads to increase circulation once an hour
//for 5 min during the day
if (hour()>=8 && hour()<=21)
{
if (minute()<5)
{
if (ReefAngel.Timer[2].IsTriggered())
{
ReefAngel.Timer[2].SetInterval(30);
ReefAngel.Timer[2].Start();
ReefAngel.Relay.Toggle(Box1_Port5);
ReefAngel.Relay.Toggle(Box1_Port6);
}
}
else
{
ReefAngel.Relay.Off(Box1_Port5);
ReefAngel.Relay.Off(Box1_Port6);
}
}
else
{
ReefAngel.Relay.Off(Box1_Port5);
ReefAngel.Relay.Off(Box1_Port6);
}
ReefAngel.Portal("jsclownfish");
ReefAngel.ShowInterface();
}Jon
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
- jsclownfish
- Posts: 375
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Slow down waves at night
Yes during the day cycle. However at night the there are periods of rest that both are off.
-Jon
-Jon
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Slow down waves at night
Change the Toggle on port 6 functions to be reverse from port 5
Code: Select all
ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
Roberto.
- jsclownfish
- Posts: 375
- Joined: Mon Oct 24, 2011 7:52 pm
- Location: Saint Louis
Re: Slow down waves at night
Thanks!