Issue getting 2nd Relay to work.
Posted: Sat Sep 14, 2013 9:19 am
So trying to getting a 2nd Relay expansion working (so three including the initial one) and it just is not functioning for me.
I set the dip switches to on|off|off, which should be correct for a second relay expansion, I have the new code uploaded and on the portal and my Android app they show up but they do not turn on and are not controllable.
I just verified all of the dip switches and I verified that it could work by setting the dip switches to off|off|off and making it think it was my 1st expansion. It copied the function of the first expansion at that point fine so the hardware is good, I just must be missing something on the software end of things.
Copy of my code below, not sure what I am missing though, hopefully someone can help out.
I set the dip switches to on|off|off, which should be correct for a second relay expansion, I have the new code uploaded and on the portal and my Android app they show up but they do not turn on and are not controllable.
I just verified all of the dip switches and I verified that it could work by setting the dip switches to off|off|off and making it think it was my 1st expansion. It copied the function of the first expansion at that point fine so the hardware is good, I just must be missing something on the software end of things.
Copy of my code below, not sure what I am missing though, hopefully someone can help out.
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 <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
//// Ports toggled in Feeding Mode
// Turns off Skimmer(Port2), Small Koralia (Port4), and Large Koralia (Port6)
ReefAngel.FeedingModePorts = Port2Bit | Port4Bit | Port6Bit;
// Turns off GFO/Carbon Reactor during feeding
ReefAngel.FeedingModePortsE[0] = Port6Bit | Port5Bit;
//// Ports toggled in Water Change Mode
// Turns off Skimmer (Port2) and Return Pump (Port7)
ReefAngel.WaterChangePorts = Port2Bit | Port7Bit;
// Turns off Heater (Port[0]1), Heater (Port[0]2, Reactor Pump (Port[0]6), and ATO (Port[0]8)
ReefAngel.WaterChangePortsE[0] = Port1Bit | Port2Bit | Port6Bit | Port8Bit;
//// Ports turned off when Overheat temperature exceeded
// To Turn Off: Frag Tank Light (Port1), Dosing Alk (Port3), Dosing Calcium (Port4), Large Koralia (Port6)
ReefAngel.OverheatShutoffPorts = Port1Bit | Port3Bit | Port4Bit | Port6Bit;
// To Turn Off: Heater (Port[0]1), and Heater (Port[0]2)
ReefAngel.OverheatShutoffPortsE[0] = Port1Bit | Port2Bit;
//// Use T1 probe as temperature and overheat functions
// This is the Probe in the Display Tank, Probe 2 is for the Room, and Probe 3 is in the Frag Tank
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Ports that are always on
//Empty
ReefAngel.Relay.On( Box2_Port7 );
//Empty
ReefAngel.Relay.On( Box2_Port8 );
// Skimmer
ReefAngel.Relay.On( Port2 );
//Frag Tank Pump
ReefAngel.Relay.On( Port3 );
//Small Korilia
ReefAngel.Relay.On( Port4 );
//Return Pump to DT
ReefAngel.Relay.On( Port7 );
//Power to 3rd Relay
ReefAngel.Relay.On( Port8 );
//Small Koralia near Vortech
ReefAngel.Relay.On( Box1_Port5 );
//GFO and Carbon Reactor
ReefAngel.Relay.On( Box1_Port6 );
//Vortech
ReefAngel.Relay.On( Box1_Port7 );
//ATO Plug
ReefAngel.Relay.On( Box1_Port8 );
//Ground
ReefAngel.Relay.On( Box2_Port1 );
//Frag Tank Koralia Pumps
ReefAngel.Relay.On( Box2_Port6 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
// Frag Tank Lights
ReefAngel.DayLights( Port1 );
// Alk Dosing
ReefAngel.DosingPumpRepeat1( Box1_Port3 );
//Calcium Dosing
ReefAngel.DosingPumpRepeat2( Box1_Port4 );
//Large Korilia
ReefAngel.WavemakerRandom( Port6,10,20 );
//Heater
ReefAngel.StandardHeater( Box1_Port1 );
//Heater
ReefAngel.StandardHeater( Box1_Port2 );
//LED Light 1400mA
ReefAngel.StandardLights( Box2_Port2,6,0,21,0 );
//LED Light 1400mA
ReefAngel.StandardLights( Box2_Port3,6,0,21,0 );
//LED Light 700mA
ReefAngel.StandardLights( Box2_Port4,6,0,21,0 );
//LED Light 700mA
ReefAngel.StandardLights( Box2_Port5,6,0,21,0 );
//PWM Daylight Dimming
ReefAngel.PWM.DaylightPWMSlope();
//PWM Actinic Dimming
ReefAngel.PWM.ActinicPWMSlope();
ReefAngel.RF.UseMemory = true;
////// Place your custom code below here
if ( ( (hour()==9) && (minute()==30) ) || ( (hour()==19) && (minute() ==30) ) )
{ReefAngel.FeedingModeStart();
ReefAngel.Relay.Set(Port5,now()%60<4);}
else
{ReefAngel.Relay.Off(Port5);}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "vonjankmon" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
pingSerial();
// Relay Expansion
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox( 12, 107, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph( 5, 5 );
}