Unexpected Light turning off

Do you have a question on how to do something.
Ask in here.
Post Reply
Fireshimp
Posts: 7
Joined: Fri Oct 26, 2012 4:35 pm

Unexpected Light turning off

Post by Fireshimp »

Hi

I need some help regard lighting schedule programimg. I am trying to control light schedule and intensity at diff timing of the day. But the light was turn off by it self (At diff timing for continus 2 day after upload the code) . I cannot turn back on through menu from head unit. to recover, need to power off then on again to resume schedule. Now I donot know it is programing issues or the relay box problem. (I just chage head unit due to joystick problem).
I had attached code below.
Please help

void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.SetTemperatureUnit( Celsius ); // set to Celsius Temperature

ReefAngel.AddStandardMenu(); // Add Standard Menu

// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port3Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 300 );


// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port6 );

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


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

void loop()
{
ReefAngel.StandardLights( Port2,5,55,22,10 );
ReefAngel.Relay.DelayedOn( Port3,60 );
ReefAngel.StandardLights( Port4,22,0,7,0 );
ReefAngel.StandardFan( Port5,270,280 );
ReefAngel.StandardLights( Port7,6,0,22,0 );
ReefAngel.StandardATO( Port8,60 );
//ReefAngel.PWM.SetDaylight( PWMSlope(8,0,22,0,15,90,60,15) );
//ReefAngel.PWM.SetActinic( PWMSlope(8,0,22,0,15,90,60,15) );
////// Place your custom code below here
//if (hour()==8) ReefAngel.PWM.SetDaylight(20);
//if (hour()==9) ReefAngel.PWM.SetDaylight(40);
//if (hour()==6) ReefAngel.PWM.SetDaylight(0);
//if (hour()==6) ReefAngel.PWM.SetActinic(15);
if (hour()==10) ReefAngel.PWM.SetDaylight(15);
if (hour()==10) ReefAngel.PWM.SetActinic(50);

if (hour()==11) ReefAngel.PWM.SetDaylight(50);
if (hour()==11) ReefAngel.PWM.SetActinic(75);

if (hour()==12) ReefAngel.PWM.SetDaylight(90);
if (hour()==12) ReefAngel.PWM.SetActinic(90);

if (hour()==16) ReefAngel.PWM.SetDaylight(50);
if (hour()==16) ReefAngel.PWM.SetActinic(75);

if (hour()==17) ReefAngel.PWM.SetDaylight(25);
if (hour()==17) ReefAngel.PWM.SetActinic(25);

if (hour()==20) ReefAngel.PWM.SetDaylight(15);
if (hour()==20) ReefAngel.PWM.SetActinic(25);

if (hour()==21) ReefAngel.PWM.SetDaylight(0);
if (hour()==21) ReefAngel.PWM.SetActinic(25);

if (hour()==22) ReefAngel.PWM.SetDaylight(0);
if (hour()==22) ReefAngel.PWM.SetActinic(0);


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

// This should always be the last line
ReefAngel.ShowInterface();
}
Fireshimp
Posts: 7
Joined: Fri Oct 26, 2012 4:35 pm

Re: Unexpected Light turning off

Post by Fireshimp »

By the way I set light power source at port 2.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Unexpected Light turning off

Post by rimai »

Try this:

Code: Select all

#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    ReefAngel.AddStandardMenu();  // Add Standard Menu

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port3Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port2Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 300 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port6 );

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

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

void loop()
{
    ReefAngel.StandardLights( Port2,5,55,22,10 );
    ReefAngel.Relay.DelayedOn( Port3,60 );
    ReefAngel.StandardLights( Port4,22,0,7,0 );
    ReefAngel.StandardFan( Port5,270,280 );
    ReefAngel.StandardLights( Port7,6,0,22,0 );
    ReefAngel.StandardATO( Port8,60 );
    //ReefAngel.PWM.SetDaylight( PWMSlope(8,0,22,0,15,90,60,15) );
    //ReefAngel.PWM.SetActinic( PWMSlope(8,0,22,0,15,90,60,15) );
    ////// Place your custom code below here
    //if (hour()==8) ReefAngel.PWM.SetDaylight(20);
    //if (hour()==9) ReefAngel.PWM.SetDaylight(40);
    //if (hour()==6) ReefAngel.PWM.SetDaylight(0);
    //if (hour()==6) ReefAngel.PWM.SetActinic(15);

    if (hour()<10) ReefAngel.PWM.SetDaylight(0);
    if (hour()<10) ReefAngel.PWM.SetActinic(0);
    
    if (hour()==10) ReefAngel.PWM.SetDaylight(15);
    if (hour()==10) ReefAngel.PWM.SetActinic(50);
    
    if (hour()==11) ReefAngel.PWM.SetDaylight(50);
    if (hour()==11) ReefAngel.PWM.SetActinic(75);
    
    if (hour()>=12 && hour()<16) ReefAngel.PWM.SetDaylight(90); 
    if (hour()>=12 && hour()<16) ReefAngel.PWM.SetActinic(90);
    
    if (hour()==16) ReefAngel.PWM.SetDaylight(50);
    if (hour()==16) ReefAngel.PWM.SetActinic(75);
    
    if (hour()>=17 && hour()<20) ReefAngel.PWM.SetDaylight(25);
    if (hour()>=17 && hour()<20) ReefAngel.PWM.SetActinic(25);
    
    if (hour()==20) ReefAngel.PWM.SetDaylight(15);
    if (hour()==20) ReefAngel.PWM.SetActinic(25);
    
    if (hour()==21) ReefAngel.PWM.SetDaylight(0);
    if (hour()==21) ReefAngel.PWM.SetActinic(25);
    
    if (hour()>=22) ReefAngel.PWM.SetDaylight(0);
    if (hour()>=22) ReefAngel.PWM.SetActinic(0);
    

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

    // This should always be the last line
    ReefAngel.ShowInterface();
}
Roberto.
Amos Poh
Posts: 107
Joined: Sun Jul 22, 2012 4:51 am
Location: Singapore

Re: Unexpected Light turning off

Post by Amos Poh »

rimai wrote:Try this:

Code: Select all

#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    ReefAngel.AddStandardMenu();  // Add Standard Menu

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port3Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port2Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T1_PROBE;
    ReefAngel.OverheatProbe = T1_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 300 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port6 );

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

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

void loop()
{
    ReefAngel.StandardLights( Port2,5,55,22,10 );
    ReefAngel.Relay.DelayedOn( Port3,60 );
    ReefAngel.StandardLights( Port4,22,0,7,0 );
    ReefAngel.StandardFan( Port5,270,280 );
    ReefAngel.StandardLights( Port7,6,0,22,0 );
    ReefAngel.StandardATO( Port8,60 );
    //ReefAngel.PWM.SetDaylight( PWMSlope(8,0,22,0,15,90,60,15) );
    //ReefAngel.PWM.SetActinic( PWMSlope(8,0,22,0,15,90,60,15) );
    ////// Place your custom code below here
    //if (hour()==8) ReefAngel.PWM.SetDaylight(20);
    //if (hour()==9) ReefAngel.PWM.SetDaylight(40);
    //if (hour()==6) ReefAngel.PWM.SetDaylight(0);
    //if (hour()==6) ReefAngel.PWM.SetActinic(15);

    if (hour()<10) ReefAngel.PWM.SetDaylight(0);
    if (hour()<10) ReefAngel.PWM.SetActinic(0);
    
    if (hour()==10) ReefAngel.PWM.SetDaylight(15);
    if (hour()==10) ReefAngel.PWM.SetActinic(50);
    
    if (hour()==11) ReefAngel.PWM.SetDaylight(50);
    if (hour()==11) ReefAngel.PWM.SetActinic(75);
    
    if (hour()>=12 && hour()<16) ReefAngel.PWM.SetDaylight(90); 
    if (hour()>=12 && hour()<16) ReefAngel.PWM.SetActinic(90);
    
    if (hour()==16) ReefAngel.PWM.SetDaylight(50);
    if (hour()==16) ReefAngel.PWM.SetActinic(75);
    
    if (hour()>=17 && hour()<20) ReefAngel.PWM.SetDaylight(25);
    if (hour()>=17 && hour()<20) ReefAngel.PWM.SetActinic(25);
    
    if (hour()==20) ReefAngel.PWM.SetDaylight(15);
    if (hour()==20) ReefAngel.PWM.SetActinic(25);
    
    if (hour()==21) ReefAngel.PWM.SetDaylight(0);
    if (hour()==21) ReefAngel.PWM.SetActinic(25);
    
    if (hour()>=22) ReefAngel.PWM.SetDaylight(0);
    if (hour()>=22) ReefAngel.PWM.SetActinic(0);
    

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

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

Thanks Roberto for the help.

Fireshimp do update us if it worked. ;)
Fireshimp
Posts: 7
Joined: Fri Oct 26, 2012 4:35 pm

Re: Unexpected Light turning off

Post by Fireshimp »

Look like it work now. No incident happen today. I will continue to monitor for next cycle.
Thanks

But anyway, How to explain logic to control PWM can cause relay port to turn it self off?
Post Reply