I/O Expansion and ATO 1, 2, 3, 4....
Posted: Sun Aug 20, 2017 8:55 am
Hi everyone , I am new here... based in East London, Eastern Cape, South Africa.
I hope you are all well!! I am needing some help with adding more ATO pumps to my Reef Angel (RA) system I currently have ATO1 (StandardAto) operating fine on relay box port 1 with float switches connected to the high and low ATO float switches input ports on the RA controller.
I am needing to sort out ATO2 which I want on relay box port 2 with float switches connected to channnel 0 and channel 1 on the i/o expansion module.
I may also add more ATO's in the future so can anyone please assist with the code.
@rimai
Code is as follows:
#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 <Salinity.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
byte x,y;
byte bkcolor;
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
y=10;
x=15;
for (int a=0;a<6;a++)
{
if(ReefAngel._IO.GetChannel(a)) bkcolor=COLOR_RED;
else bkcolor=COLOR_GREEN;
if (a>2) x=75;
if (a==3) y=10;
ReefAngel.LCD.Clear(bkcolor, x, y-3, x+40,y-1);
ReefAngel.LCD.Clear(bkcolor, x, y+8, x+40,y+10);
ReefAngel.LCD.Clear(bkcolor, x, y, x+3,y+8);
ReefAngel.LCD.Clear(bkcolor, x+37, y, x+40,y+8);
ReefAngel.LCD.DrawText(COLOR_WHITE, bkcolor, x+3, y, "Input");
ReefAngel.LCD.DrawText(COLOR_WHITE, bkcolor, x+32, y, a);
y+=15;
}
}
void DrawCustomGraph()
{
}
/*
For more information about custom main screen (RA forum URL removed)
*/
// Define Relay Ports By Name
#define ATO1 1
#define ATO2 2 *This is the one i must sort out.
#define Skimmer 3
#define Daylights 4
#define Flowpumps1 5
#define Flowpumps2 6
#define Heaters 7
#define Return 8
void setup()
{
ReefAngel.Init(); // Initialize Controller
ReefAngel.AddDateTimeMenu();
ReefAngel.AddStandardMenu();
ReefAngel.SetTemperatureUnit(Celsius); // set Temperature to Celsius
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit; // Turn off Ports 1, 2, 3, 5, 6, 7 and 8 when Water Change Mode is activated
ReefAngel.OverheatShutoffPorts = Port4Bit | Port7Bit; // Turn off Ports 4 and 7 when Overheat Occurs
ReefAngel.LightsOnPorts = Port4Bit; // Turn on/off Ports 4 when Turn Lights On/Off is activated
ReefAngel.OverheatProbe = T1_PROBE | T2_PROBE | T3_PROBE; // Use Temperature probe 1, 2 and 3 to check for overheat
ReefAngel.TempProbe = T1_PROBE | T2_PROBE | T3_PROBE; // Use Temperature probe 1, 2 and 3 to check temperature
// Always on
ReefAngel.Relay.On(Return);
ReefAngel.Relay.On(Skimmer);
ReefAngel.Relay.On(Flowpumps1);
ReefAngel.Relay.On(Flowpumps2);
}
void loop()
{
ReefAngel.StandardATO(ATO1); // Standard ATO
ReefAngel.StandardLights(Daylights); // Daylight Lights
ReefAngel.StandardHeater(Heaters); // Heater
ReefAngel.PWM.StandardDaylight(); // Dimming for Daylight Channel
ReefAngel.PWM.StandardActinic(30); // Dimming for Actinic Channel
ReefAngel.ShowInterface(); // Display everything on the LCD screen
}
If i can see the ReefAngel.StandardATO code as it is written in the RA memory then i may be able to use that as the only difference will be that the input ports for the float switches will be on the i/o expansion module and not the RA controller as with ATO1.
I hope you are all well!! I am needing some help with adding more ATO pumps to my Reef Angel (RA) system I currently have ATO1 (StandardAto) operating fine on relay box port 1 with float switches connected to the high and low ATO float switches input ports on the RA controller.
I am needing to sort out ATO2 which I want on relay box port 2 with float switches connected to channnel 0 and channel 1 on the i/o expansion module.
I may also add more ATO's in the future so can anyone please assist with the code.
@rimai
Code is as follows:
#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 <Salinity.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
byte x,y;
byte bkcolor;
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
y=10;
x=15;
for (int a=0;a<6;a++)
{
if(ReefAngel._IO.GetChannel(a)) bkcolor=COLOR_RED;
else bkcolor=COLOR_GREEN;
if (a>2) x=75;
if (a==3) y=10;
ReefAngel.LCD.Clear(bkcolor, x, y-3, x+40,y-1);
ReefAngel.LCD.Clear(bkcolor, x, y+8, x+40,y+10);
ReefAngel.LCD.Clear(bkcolor, x, y, x+3,y+8);
ReefAngel.LCD.Clear(bkcolor, x+37, y, x+40,y+8);
ReefAngel.LCD.DrawText(COLOR_WHITE, bkcolor, x+3, y, "Input");
ReefAngel.LCD.DrawText(COLOR_WHITE, bkcolor, x+32, y, a);
y+=15;
}
}
void DrawCustomGraph()
{
}
/*
For more information about custom main screen (RA forum URL removed)
*/
// Define Relay Ports By Name
#define ATO1 1
#define ATO2 2 *This is the one i must sort out.
#define Skimmer 3
#define Daylights 4
#define Flowpumps1 5
#define Flowpumps2 6
#define Heaters 7
#define Return 8
void setup()
{
ReefAngel.Init(); // Initialize Controller
ReefAngel.AddDateTimeMenu();
ReefAngel.AddStandardMenu();
ReefAngel.SetTemperatureUnit(Celsius); // set Temperature to Celsius
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit; // Turn off Ports 1, 2, 3, 5, 6, 7 and 8 when Water Change Mode is activated
ReefAngel.OverheatShutoffPorts = Port4Bit | Port7Bit; // Turn off Ports 4 and 7 when Overheat Occurs
ReefAngel.LightsOnPorts = Port4Bit; // Turn on/off Ports 4 when Turn Lights On/Off is activated
ReefAngel.OverheatProbe = T1_PROBE | T2_PROBE | T3_PROBE; // Use Temperature probe 1, 2 and 3 to check for overheat
ReefAngel.TempProbe = T1_PROBE | T2_PROBE | T3_PROBE; // Use Temperature probe 1, 2 and 3 to check temperature
// Always on
ReefAngel.Relay.On(Return);
ReefAngel.Relay.On(Skimmer);
ReefAngel.Relay.On(Flowpumps1);
ReefAngel.Relay.On(Flowpumps2);
}
void loop()
{
ReefAngel.StandardATO(ATO1); // Standard ATO
ReefAngel.StandardLights(Daylights); // Daylight Lights
ReefAngel.StandardHeater(Heaters); // Heater
ReefAngel.PWM.StandardDaylight(); // Dimming for Daylight Channel
ReefAngel.PWM.StandardActinic(30); // Dimming for Actinic Channel
ReefAngel.ShowInterface(); // Display everything on the LCD screen
}
If i can see the ReefAngel.StandardATO code as it is written in the RA memory then i may be able to use that as the only difference will be that the input ports for the float switches will be on the i/o expansion module and not the RA controller as with ATO1.