Page 1 of 2

Re: Reef Angel Malfunctioning

Posted: Mon Sep 23, 2013 7:29 am
by rimai
I'm going to lower the refresh rate in the libraries to see if we can get better results.

Re: Reef Angel Malfunctioning

Posted: Mon Sep 23, 2013 10:19 am
by ecam
Okay FYI.

Im not sure if this is relevant. But its never happened before. After removing the RF switch I went out. I came back home around 3:15pm to see my fish tank in the dark (the lights don't go out till 8:15). The head unit was saying the time was 8:30pm. I promptly pulled the plug and its been working fine since.


As for the library update please let me know when i can but the RF switch back online.

Re: Reef Angel Malfunctioning

Posted: Wed Sep 25, 2013 8:57 am
by ecam
Roberto, any updates?

Re: Reef Angel Malfunctioning

Posted: Wed Sep 25, 2013 9:51 am
by rimai
It is going to be on the next release.
There is no target date for next release yet though.

Re: Reef Angel Malfunctioning

Posted: Wed Sep 25, 2013 12:29 pm
by ecam
So is there anything I can do for my RF module. or is it just useless, till the new update (say it aint so Roberto). I really like my mode switching.

Please help!!!!

Re: Reef Angel Malfunctioning

Posted: Wed Sep 25, 2013 1:29 pm
by rimai
Try to find out where you are picking up the noise that is causing the issue.
I also checked the libs code and found out that if you use UseMemory=false, which I think you are, you can change the refresh yourself.
Can you post your code?

Re: Reef Angel Malfunctioning

Posted: Thu Sep 26, 2013 5:32 am
by ecam
here you go roberto. Also what noise are you referring to for the RF switch. The only change to my setup has been that I now run 4 MP40s as opposed to 2.

Code: Select all

#include <RA_ATO.h>
#include <RF.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 <Salinity.h>
#include <RF.h>fa
#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
    // Ports toggled in Feeding Mode
ReefAngel.WaterChangePorts = Port1Bit | Port8Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
  ReefAngel.FeedingModePorts = Port1Bit | Port6Bit | Port8Bit; // Turn off Ports 1, 6, 7 and 8 when Water Change Mode is activated
  ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit| Port5Bit;
  ReefAngel.OverheatShutoffPorts = Port2Bit |Port3Bit | Port4Bit | Port5Bit | Port7Bit; // Turn off Ports 3,
    ReefAngel.TempProbe = T3_PROBE;
    ReefAngel.OverheatProbe = T3_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 825 );

    // Setup ATO Port for AI communication
    ReefAngel.AI.SetPort( lowATOPin );


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


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

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

void loop()
{   //Port1 Return pump...  on all the time!!!
    ReefAngel.Relay.Set( Port2, !ReefAngel.Relay.Status( Port4 ) ); //Refuge
ReefAngel.Relay.Off( Port3); // Start with the relay off
if (hour()>=5 && hour()<10) ReefAngel.Relay.On(Port3); // Moonlight Between 5-10am turn the relay on
if (hour()>=20 && hour()<=23) ReefAngel.Relay.On(Port3); // From 8pm-Midnight turn the relay on

   ReefAngel.StandardLights( Port4,10,0,20,0 ); //ATI Actinic
    ReefAngel.StandardLights( Port5,11,0,19,0 );  //ATI Daylight
    ReefAngel.StandardLights( Port6,10,0,20,0 );  //ATI Fan
    ReefAngel.StandardHeater( Port7,778,790 ); //Heater
    ReefAngel.Relay.DelayedOn( Port8,2 ); //Skimmer
//    ReefAngel.AI.SetChannel( White, PWMParabola(11,0,17,0,0,75,0) );
//    ReefAngel.AI.SetChannel( Blue, PWMParabola(9,0,20,0,15,100,0) );
//    ReefAngel.AI.SetChannel( RoyalBlue, PWMParabola(9,0,20,0,15,100,(MoonPhase()/5)<3 ? 3:MoonPhase()/5) );
    ReefAngel.RF.UseMemory = false;
    ReefAngel.RF.SetMode( ReefCrest,85,10 );
  //  ReefAngel.RF.SetChannel( Radion_White, PWMParabola(9,0,20,0,0,60,0) );
  //  ReefAngel.RF.SetChannel( Radion_RoyalBlue, MoonPhase() );
  //  ReefAngel.RF.SetChannel( Radion_Red, PWMParabola(9,0,20,0,15,65,15) );
  //  ReefAngel.RF.SetChannel( Radion_Green, PWMParabola(9,0,20,0,15,50,15) );
  //  ReefAngel.RF.SetChannel( Radion_Blue, MoonPhase() );
 //   ReefAngel.RF.SetChannel( Radion_Intensity, PWMParabola(9,0,20,0,15,94,15) );
  //  if ( second()==0 ) ReefAngel.RF.RadionWrite();


    ////// Place your custom code below here
    
    
ReefAngel.RF.UseMemory = false;
if (hour()>=6 && hour()<11)
  ReefAngel.RF.SetMode(ReefCrest,85,10);
else if (hour()>=11 && hour()<13)
  ReefAngel.RF.SetMode(ReefCrest,85,10);
else if (hour()>=13 && hour()<16)
  ReefAngel.RF.SetMode(Smart_NTM,85,15);
else if (hour()>=16 && hour()<19)
  ReefAngel.RF.SetMode(ReefCrest,65,10);
else
  ReefAngel.RF.SetMode(Lagoon,40,10);
         
     
        
    // Hardcode PH calibrations
     //ReefAngel.PHMin=544; // PH7.0
     //ReefAngel.PHMax=830; // PH10.0

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

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

void DrawCustomMain()
{
    int x,y;
    char text[10];
    // Aqua Illumination
    x = 10;
    y = 20;
    ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x,y,"WH:" );
    ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+38,y,"BL:" );
    ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+76,y,"RB:" );
    for ( int a=0;a<3;a++ )
    {
      ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+18,y,ReefAngel.AI.GetChannel(a) );
      x += 38;
    }
    pingSerial();

    // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 48, ReefAngel.Params,
    ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
    ReefAngel.LCD.DrawMonitor( 15, 48, 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, 94, TempRelay );
    pingSerial();

    // Date and Time
    ReefAngel.LCD.DrawDate( 6, 122 );
    pingSerial();
}

void DrawCustomGraph()
{
}



Re: Reef Angel Malfunctioning

Posted: Thu Sep 26, 2013 9:04 am
by rimai
To use the new code, you will need to return the RF module to the original firmware.

Re: Reef Angel Malfunctioning

Posted: Thu Sep 26, 2013 9:05 am
by rimai
Try this code:

Code: Select all

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

////// Place global variable code below here

byte myRFMode=0;
byte myRFDuration=0;
byte myRFSpeed=0;

////// Place global variable code above here


void setup()
{
  // This must be the first line
  ReefAngel.Init();  //Initialize controller
  // Ports toggled in Feeding Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port8Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
  ReefAngel.FeedingModePorts = Port1Bit | Port6Bit | Port8Bit; // Turn off Ports 1, 6, 7 and 8 when Water Change Mode is activated
  ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit| Port5Bit;
  ReefAngel.OverheatShutoffPorts = Port2Bit |Port3Bit | Port4Bit | Port5Bit | Port7Bit; // Turn off Ports 3,
  ReefAngel.TempProbe = T3_PROBE;
  ReefAngel.OverheatProbe = T3_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 825 );

  // Setup ATO Port for AI communication
  ReefAngel.AI.SetPort( lowATOPin );


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


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


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

void loop()
{   //Port1 Return pump...  on all the time!!!
  ReefAngel.Relay.Set( Port2, !ReefAngel.Relay.Status( Port4 ) ); //Refuge
  ReefAngel.Relay.Off( Port3); // Start with the relay off
  if (hour()>=5 && hour()<10) ReefAngel.Relay.On(Port3); // Moonlight Between 5-10am turn the relay on
  if (hour()>=20 && hour()<=23) ReefAngel.Relay.On(Port3); // From 8pm-Midnight turn the relay on

  ReefAngel.StandardLights( Port4,10,0,20,0 ); //ATI Actinic
  ReefAngel.StandardLights( Port5,11,0,19,0 );  //ATI Daylight
  ReefAngel.StandardLights( Port6,10,0,20,0 );  //ATI Fan
  ReefAngel.StandardHeater( Port7,778,790 ); //Heater
  ReefAngel.Relay.DelayedOn( Port8,2 ); //Skimmer
  //  ReefAngel.AI.SetChannel( White, PWMParabola(11,0,17,0,0,75,0) );
  //  ReefAngel.AI.SetChannel( Blue, PWMParabola(9,0,20,0,15,100,0) );
  //  ReefAngel.AI.SetChannel( RoyalBlue, PWMParabola(9,0,20,0,15,100,(MoonPhase()/5)<3 ? 3:MoonPhase()/5) );
  //  ReefAngel.RF.UseMemory = false;
  //  ReefAngel.RF.SetMode( ReefCrest,85,10 );
  //  ReefAngel.RF.SetChannel( Radion_White, PWMParabola(9,0,20,0,0,60,0) );
  //  ReefAngel.RF.SetChannel( Radion_RoyalBlue, MoonPhase() );
  //  ReefAngel.RF.SetChannel( Radion_Red, PWMParabola(9,0,20,0,15,65,15) );
  //  ReefAngel.RF.SetChannel( Radion_Green, PWMParabola(9,0,20,0,15,50,15) );
  //  ReefAngel.RF.SetChannel( Radion_Blue, MoonPhase() );
  //   ReefAngel.RF.SetChannel( Radion_Intensity, PWMParabola(9,0,20,0,15,94,15) );
  //  if ( second()==0 ) ReefAngel.RF.RadionWrite();


  ////// Place your custom code below here


  ReefAngel.RF.UseMemory = false;
  if (hour()>=6 && hour()<11)
    myRFSetMode(ReefCrest,85,10);
  else if (hour()>=11 && hour()<13)
    myRFSetMode(ReefCrest,85,10);
  else if (hour()>=13 && hour()<16)
    myRFSetMode(Smart_NTM,85,15);
  else if (hour()>=16 && hour()<19)
    myRFSetMode(ReefCrest,65,10);
  else
    myRFSetMode(Lagoon,40,10);


  // Hardcode PH calibrations
  //ReefAngel.PHMin=544; // PH7.0
  //ReefAngel.PHMax=830; // PH10.0

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

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

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Aqua Illumination
  x = 10;
  y = 20;
  ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x,y,"WH:" );
  ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+38,y,"BL:" );
  ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+76,y,"RB:" );
  for ( int a=0;a<3;a++ )
  {
    ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+18,y,ReefAngel.AI.GetChannel(a) );
    x += 38;
  }
  pingSerial();

  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 48, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 48, 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, 94, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 122 );
  pingSerial();
}

void DrawCustomGraph()
{
}

void myRFSetMode(byte m, byte s, byte d)
{
  if (m!=myRFMode || s!=myRFSpeed || d!=myRFDuration || millis()<5000)
  {
    myRFMode=m;
    myRFSpeed=s;
    myRFDuration=d;
    ReefAngel.RF.SetMode(m,s,d);
  }
}

Re: Reef Angel Malfunctioning

Posted: Thu Sep 26, 2013 10:28 am
by ecam
rimai wrote:To use the new code, you will need to return the RF module to the original firmware.

Roberto, i was regarding in one of the post that you thought the dimming home might be having adverse affects with the Angel. Should i try disconnect the hub and finding out if that works?

http://forum.reefangel.com/viewtopic.php?f=12&t=3865


Cause this same thing happened to me last weekend. With the time changing on me.

Re: Reef Angel Malfunctioning

Posted: Thu Sep 26, 2013 10:46 am
by rimai
Yes, same problem. It's related to the expansion bus signal.
The 2 modules that can do that are the old dimming module and the RF module.
But if you replaced the twi.c, you should not see the controller blinking and the time changing. Your controller should reboot instead.
I'm thinking some interference noise is causing your RF module to lockup, which causes all that.

Re: Reef Angel Malfunctioning

Posted: Thu Sep 26, 2013 10:56 am
by ecam
rimai wrote:Yes, same problem. It's related to the expansion bus signal.
The 2 modules that can do that are the old dimming module and the RF module.
But if you replaced the twi.c, you should not see the controller blinking and the time changing. Your controller should reboot instead.
I'm thinking some interference noise is causing your RF module to lockup, which causes all that.

What kind of interference, am i looking for?

I haven't really added any electric devices in my tank area, expect for the new MP40s and your new modules

Re: Reef Angel Malfunctioning

Posted: Thu Sep 26, 2013 3:31 pm
by ecam
rimai wrote:To use the new code, you will need to return the RF module to the original firmware.
rOBERTO I RAN THIS UPDATE I SAW THE INITIAL 3 LIGHT FLASH AND THE ENDING AND NOTHING IN BETWEEN.. dID IT WORK?

Re: Reef Angel Malfunctioning

Posted: Thu Sep 26, 2013 3:50 pm
by rimai
Yes, that's how the original firmware is.

Re: Reef Angel Malfunctioning

Posted: Sat Sep 28, 2013 7:01 pm
by ecam
Roberto just happened again with the old firmware restored. Any other ideas?

Re: Reef Angel Malfunctioning

Posted: Sat Sep 28, 2013 7:54 pm
by rimai
Did you load the code I posted?
Does it work ok without the RF module?

Re: Reef Angel Malfunctioning

Posted: Sat Sep 28, 2013 8:32 pm
by ecam
yes to both

Re: Reef Angel Malfunctioning

Posted: Sat Sep 28, 2013 9:59 pm
by rimai
What is it actually doing?

Re: Reef Angel Malfunctioning

Posted: Sat Sep 28, 2013 10:45 pm
by ecam
Dont understand the question.. but will try to answer a few possible version;

When the RF module fails. It puts my RA into a flashing red status on the head unit at which points it no longer takes instructions. whatever it is doing at the time of the freeze will continue. (i.e: my lights were on for over 18 hrs one day!!!! i disconnect the module and everything goes back o normal.

Re: Reef Angel Malfunctioning

Posted: Sat Sep 28, 2013 10:46 pm
by ecam

Code: Select all

    #include <RA_ATO.h>
    #include <RF.h>
    #include <ReefAngel_Features.h>
    #include <Globals.h>
    #include <RA_Wifi.h>
    #include <Wire.h>
    #include <OneWire.h>
    #include <Time.h>
    #include <DS1307RTC.h>fafa
    #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>fa
    #include <IO.h>
    #include <ORP.h>
    #include <AI.h>
    #include <PH.h>
    #include <WaterLevel.h>
    #include <ReefAngel.h>

    ////// Place global variable code below here
      byte myRFMode=0;
        byte myRFDuration=0;
        byte myRFSpeed=0;


    ////// Place global variable code above here


    void setup()
    {
        // This must be the first line
        ReefAngel.Init();  //Initialize controller
        // Ports toggled in Feeding Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port8Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
      ReefAngel.FeedingModePorts = Port1Bit | Port6Bit | Port8Bit; // Turn off Ports 1, 6, 7 and 8 when Water Change Mode is activated
      ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit| Port5Bit;
      ReefAngel.OverheatShutoffPorts = Port2Bit |Port3Bit | Port4Bit | Port5Bit | Port7Bit; // Turn off Ports 3,
        ReefAngel.TempProbe = T3_PROBE;
        ReefAngel.OverheatProbe = T3_PROBE;
        // Set the Overheat temperature setting
        InternalMemory.OverheatTemp_write( 825 );

        // Setup ATO Port for AI communication
    //    ReefAngel.AI.SetPort( lowATOPin );



        // Ports that are always on
        ReefAngel.Relay.On( Port1 );
        ReefAngel.Relay.On( Box1_Port2 );  // Razor Led
        ReefAngel.Relay.On( Box1_Port4 ); // Sump Equipment - UV, Pump
        ReefAngel.Relay.On( Box1_Port5 ); // MP40s   
        ReefAngel.Relay.On( Box1_Port6 ); // JBJ
        ////// Place additional initialization code below here
       

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

    void loop()
    {
      //  Port1 Return pump...  on all the time!!!
          ReefAngel.Relay.Set( Port2, !ReefAngel.Relay.Status( Port4 ) ); //Refuge
      //  Port3 ...  not used
          ReefAngel.StandardLights( Port4,10,0,20,0 ); //ATI Actinic
          ReefAngel.StandardLights( Port5,11,0,19,0 );  //ATI Daylight
          ReefAngel.StandardLights( Port6,10,0,20,0 );  //ATI Fan
          ReefAngel.StandardHeater( Port7,778,790 ); //Heater
          ReefAngel.Relay.DelayedOn( Port8,2 ); //Skimmer
         
          //box 2
          ReefAngel.Relay.Off( Box1_Port1); // Lunar Hub Not used   Port #9
    //   Box1_Port2 Razor_LED (Sump)...  on all the time!!!      Port #10
          ReefAngel.Relay.Off( Box1_Port3); // Start with the relay off       Port #11
                  if (hour()>=5 && hour()<10) ReefAngel.Relay.On(Box1_Port3); // Moonlight Between 5-10am turn the relay on
                  if (hour()>=20 && hour()<=23) ReefAngel.Relay.On(Box1_Port3); // From 8pm-Midnight turn the relay on

    //   Box1_Port4 Ecotech MP_40 Pumps  on all the time!!!      Port #12
    //   Box1_Port5 Razor_LED (Sump)...  on all the time!!!      Port #13
    //   Box1_Port6 JBJ ATO ...          on all the time!!!      Port #14
         ReefAngel.Relay.Off( Box1_Port7);  // ALK Doser ...      Port #15
         ReefAngel.Relay.Off( Box1_Port8);  // Calc Doser ...     Port #16


    ReefAngel.PWM.SetDaylight( MoonPhase() );

    // ReefAngel.PWM.SetDaylight(PWMParabola(20,0,23,0,0, MoonPhase(),0 ));


    //    ReefAngel.AI.SetChannel( White, PWMParabola(11,0,17,0,0,75,0) );
    //    ReefAngel.AI.SetChannel( Blue, PWMParabola(9,0,20,0,15,100,0) );
    //    ReefAngel.AI.SetChannel( RoyalBlue, PWMParabola(9,0,20,0,15,100,(MoonPhase()/5)<3 ? 3:MoonPhase()/5) );
        ReefAngel.RF.UseMemory = false;
        ReefAngel.RF.SetMode( ReefCrest,85,10 );

      //  ReefAngel.RF.SetChannel( Radion_White, PWMParabola(9,0,20,0,0,60,0) );
      //  ReefAngel.RF.SetChannel( Radion_RoyalBlue, MoonPhase() );
      //  ReefAngel.RF.SetChannel( Radion_Red, PWMParabola(9,0,20,0,15,65,15) );
      //  ReefAngel.RF.SetChannel( Radion_Green, PWMParabola(9,0,20,0,15,50,15) );
      //  ReefAngel.RF.SetChannel( Radion_Blue, MoonPhase() );
    //   ReefAngel.RF.SetChannel( Radion_Intensity, PWMParabola(9,0,20,0,15,94,15) );
      //  if ( second()==0 ) ReefAngel.RF.RadionWrite();



    /////////////////////////////////////////
    // Define Your dosing pumps
    /////////////////////////////////////////
    #define numDPumps 2
    byte pumpRelays[numDPumps]={ Box1_Port7, Box1_Port8 };
    int DPVolume[numDPumps]={ 30, 30 } ; // 30ml for each alk and calcium
    int DPRepeat[numDPumps]={ 60, 60 } ; // Repeat every 60 miniutes
    /////////////////////////////////////////
    // Define Calibration here
    /////////////////////////////////////////
    int CalTime[numDPumps]={ 600, 600 }; // 10 minutes / 10 minutes
    int CalVol[numDPumps]={ 350, 300 }; // 350ml / 300ml

    /////////////////////////////////////////
    // Function: RunDosingPumps()
    /////////////////////////////////////////
    void RunDosingPumps() {
      float rate;
      int calcTime[numDPumps];

      for (int i=0;i < numDPumps; i++) {
        rate=(float)CalVol[i]/CalTime[i];
        calcTime[i]=DPVolume[i]/rate/(1440/DPRepeat[i]);

        // Run the pumps
        ReefAngel.DosingPumpRepeat(pumpRelays[i], i*20, DPRepeat[i], calcTime[i]); // Offset between each pump is 20 minutes
      }

      // Display Time calculated in portal
      ReefAngel.CustomVar[0]=calcTime[0];
      ReefAngel.CustomVar[1]=calcTime[1];
    }

    /////////////////////////////////////////
    // Function: LogDosingPumps()
    /////////////////////////////////////////
    void LogDosingPumps() {
      static time_t pumpTimer[numDPumps];
      static boolean pumpStatus[numDPumps];
      float rate;

      for (int i=0;i< numDPumps;i++) {
        if (ReefAngel.Relay.Status(pumpRelays[i])) {
          if (!pumpStatus[i]) {
            pumpTimer[i]=now()-pumpTimer[i]; // Pump was off, timer is now a time
            pumpStatus[i]=true;
          }
        } else {
          if (pumpStatus[i]) {
            pumpTimer[i]=now()-pumpTimer[i]; // Pump was on, timer is now a timer
            pumpStatus[i]=false;
       
            rate=(float)CalVol[i]/CalTime[i];

            // Report How much volume has been dosed per day.
            // Could make this in minutes... excercise for the reader..
            ReefAngel.CustomVar[2]=pumpTimer[0]*rate;
            ReefAngel.CustomVar[3]=pumpTimer[1]*rate; 
          }
        }
     
        // Clear timer at end of day
        if (now()%SECS_PER_DAY==SECS_PER_DAY-1) pumpTimer[i]=0;
      } 
    }






        ////// Place your custom code below here
       
       
          ReefAngel.RF.UseMemory = false;
          if (hour()>=6 && hour()<11)
            myRFSetMode(ReefCrest,85,10);
          else if (hour()>=11 && hour()<13)
            myRFSetMode(ReefCrest,85,10);
          else if (hour()>=13 && hour()<16)
            myRFSetMode(Smart_NTM,85,15);
          else if (hour()>=16 && hour()<19)
            myRFSetMode(ReefCrest,65,10);
          else
            myRFSetMode(Lagoon,40,10);
             
         
           
        // Hardcode PH calibrations
         //ReefAngel.PHMin=544; // PH7.0
         //ReefAngel.PHMax=830; // PH10.0

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

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

    void DrawCustomMain()
    {
        int x,y;
        char text[10];
        // Aqua Illumination
        x = 10;
        y = 20;
        ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x,y,"WH:" );
        ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+38,y,"BL:" );
        ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+76,y,"RB:" );
        for ( int a=0;a<3;a++ )
        {
          ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+18,y,ReefAngel.AI.GetChannel(a) );
          x += 38;
        }
        pingSerial();

        // Parameters
    #if defined DisplayLEDPWM && ! defined RemoveAllLights
        ReefAngel.LCD.DrawMonitor( 15, 48, ReefAngel.Params,
        ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
    #else // defined DisplayLEDPWM && ! defined RemoveAllLights
        ReefAngel.LCD.DrawMonitor( 15, 48, 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, 94, TempRelay );
        pingSerial();

        // Date and Time
        ReefAngel.LCD.DrawDate( 6, 122 );
        pingSerial();
    }

        void DrawCustomGraph()
        {
        }

        void myRFSetMode(byte m, byte s, byte d)
        {
          if (m!=myRFMode || s!=myRFSpeed || d!=myRFDuration || millis()<5000)
          {
            myRFMode=m;
            myRFSpeed=s;
            myRFDuration=d;
            ReefAngel.RF.SetMode(m,s,d);
          }
        }
here is my code with ur update

Re: Reef Angel Malfunctioning

Posted: Sat Sep 28, 2013 10:58 pm
by rimai
If it is still doing that, you didn't replace the twi.c correctly.
That would only happen if you didn't do it. With the one I posted earlier, the controller would reboot.

Re: Reef Angel Malfunctioning

Posted: Sun Sep 29, 2013 6:25 am
by ecam
Roberto. I told you the light sequence when I uploaded. And u mentioned that it seemed like it work. Is there anyway I can ping the unit to see what version of the twi file it is running. So that we can confirm

Re: Reef Angel Malfunctioning

Posted: Sun Sep 29, 2013 8:07 am
by rimai
The light sequence you mentioned was in the RF module.
I'm talking about the red status led on RA.
An easy way to know is to open the head unit and move the SDA and SCL jumpers on the head unit.
They are in the vertical position now. Moving them to the horizontal position will cause the bus to lock.
Also, I just remember you should not have the Radion code either, even if commented. The auto-feature selection is enabling the code and you are just going back to square one.

Code: Select all

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

////// Place global variable code below here

byte myRFMode=0;
byte myRFDuration=0;
byte myRFSpeed=0;

////// Place global variable code above here


void setup()
{
  // This must be the first line
  ReefAngel.Init();  //Initialize controller
  // Ports toggled in Feeding Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port8Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
  ReefAngel.FeedingModePorts = Port1Bit | Port6Bit | Port8Bit; // Turn off Ports 1, 6, 7 and 8 when Water Change Mode is activated
  ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit| Port5Bit;
  ReefAngel.OverheatShutoffPorts = Port2Bit |Port3Bit | Port4Bit | Port5Bit | Port7Bit; // Turn off Ports 3,
  ReefAngel.TempProbe = T3_PROBE;
  ReefAngel.OverheatProbe = T3_PROBE;
  // Set the Overheat temperature setting
  InternalMemory.OverheatTemp_write( 825 );

  // Setup ATO Port for AI communication
  ReefAngel.AI.SetPort( lowATOPin );


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


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


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

void loop()
{   //Port1 Return pump...  on all the time!!!
  ReefAngel.Relay.Set( Port2, !ReefAngel.Relay.Status( Port4 ) ); //Refuge
  ReefAngel.Relay.Off( Port3); // Start with the relay off
  if (hour()>=5 && hour()<10) ReefAngel.Relay.On(Port3); // Moonlight Between 5-10am turn the relay on
  if (hour()>=20 && hour()<=23) ReefAngel.Relay.On(Port3); // From 8pm-Midnight turn the relay on

  ReefAngel.StandardLights( Port4,10,0,20,0 ); //ATI Actinic
  ReefAngel.StandardLights( Port5,11,0,19,0 );  //ATI Daylight
  ReefAngel.StandardLights( Port6,10,0,20,0 );  //ATI Fan
  ReefAngel.StandardHeater( Port7,778,790 ); //Heater
  ReefAngel.Relay.DelayedOn( Port8,2 ); //Skimmer
  //  ReefAngel.AI.SetChannel( White, PWMParabola(11,0,17,0,0,75,0) );
  //  ReefAngel.AI.SetChannel( Blue, PWMParabola(9,0,20,0,15,100,0) );
  //  ReefAngel.AI.SetChannel( RoyalBlue, PWMParabola(9,0,20,0,15,100,(MoonPhase()/5)<3 ? 3:MoonPhase()/5) );


  ////// Place your custom code below here


  ReefAngel.RF.UseMemory = false;
  if (hour()>=6 && hour()<11)
    myRFSetMode(ReefCrest,85,10);
  else if (hour()>=11 && hour()<13)
    myRFSetMode(ReefCrest,85,10);
  else if (hour()>=13 && hour()<16)
    myRFSetMode(Smart_NTM,85,15);
  else if (hour()>=16 && hour()<19)
    myRFSetMode(ReefCrest,65,10);
  else
    myRFSetMode(Lagoon,40,10);


  // Hardcode PH calibrations
  //ReefAngel.PHMin=544; // PH7.0
  //ReefAngel.PHMax=830; // PH10.0

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

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

void DrawCustomMain()
{
  int x,y;
  char text[10];
  // Aqua Illumination
  x = 10;
  y = 20;
  ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x,y,"WH:" );
  ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+38,y,"BL:" );
  ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+76,y,"RB:" );
  for ( int a=0;a<3;a++ )
  {
    ReefAngel.LCD.DrawText( COLOR_DODGERBLUE,DefaultBGColor,x+18,y,ReefAngel.AI.GetChannel(a) );
    x += 38;
  }
  pingSerial();

  // Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 48, ReefAngel.Params,
  ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
  ReefAngel.LCD.DrawMonitor( 15, 48, 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, 94, TempRelay );
  pingSerial();

  // Date and Time
  ReefAngel.LCD.DrawDate( 6, 122 );
  pingSerial();
}

void DrawCustomGraph()
{
}

void myRFSetMode(byte m, byte s, byte d)
{
  if (m!=myRFMode || s!=myRFSpeed || d!=myRFDuration || millis()<5000)
  {
    myRFMode=m;
    myRFSpeed=s;
    myRFDuration=d;
    ReefAngel.RF.SetMode(m,s,d);
  }
}

Re: Reef Angel Malfunctioning

Posted: Sun Sep 29, 2013 11:16 am
by ecam
So im running this code now. Removing all AI and ECOtech radion references \

Code: Select all

    #include <RA_ATO.h>
    #include <RF.h>
    #include <ReefAngel_Features.h>
    #include <Globals.h>
    #include <RA_Wifi.h>
    #include <Wire.h>
    #include <OneWire.h>
    #include <Time.h>
    #include <DS1307RTC.h>fafa
    #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>fa
    #include <IO.h>
    #include <ORP.h>
    #include <PH.h>
    #include <WaterLevel.h>
    #include <ReefAngel.h>

    ////// Place global variable code below here
      byte myRFMode=0;
        byte myRFDuration=0;
        byte myRFSpeed=0;


    ////// Place global variable code above here


    void setup()
    {
        // This must be the first line
        ReefAngel.Init();  //Initialize controller
        // Ports toggled in Feeding Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port8Bit; // Turn off Ports 5 and 6 when Feeding Mode is activated
      ReefAngel.FeedingModePorts = Port1Bit | Port6Bit | Port8Bit; // Turn off Ports 1, 6, 7 and 8 when Water Change Mode is activated
      ReefAngel.LightsOnPorts = Port2Bit | Port3Bit | Port4Bit| Port5Bit;
      ReefAngel.OverheatShutoffPorts = Port2Bit |Port3Bit | Port4Bit | Port5Bit | Port7Bit; // Turn off Ports 3,
        ReefAngel.TempProbe = T3_PROBE;
        ReefAngel.OverheatProbe = T3_PROBE;
        // Set the Overheat temperature setting
        InternalMemory.OverheatTemp_write( 825 );




        // Ports that are always on
        ReefAngel.Relay.On( Port1 );
        ReefAngel.Relay.On( Box1_Port2 );  // Razor Led
        ReefAngel.Relay.On( Box1_Port4 ); // Sump Equipment - UV, Pump
        ReefAngel.Relay.On( Box1_Port5 ); // MP40s   
        ReefAngel.Relay.On( Box1_Port6 ); // JBJ
        ////// Place additional initialization code below here
       

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

    void loop()
    {
      //  Port1 Return pump...  on all the time!!!
          ReefAngel.Relay.Set( Port2, !ReefAngel.Relay.Status( Port4 ) ); //Refuge
      //  Port3 ...  not used
          ReefAngel.StandardLights( Port4,10,0,20,0 ); //ATI Actinic
          ReefAngel.StandardLights( Port5,11,0,19,0 );  //ATI Daylight
          ReefAngel.StandardLights( Port6,10,0,20,0 );  //ATI Fan
          ReefAngel.StandardHeater( Port7,778,790 ); //Heater
          ReefAngel.Relay.DelayedOn( Port8,2 ); //Skimmer
         
          //box 2
          ReefAngel.Relay.Off( Box1_Port1); // Lunar Hub Not used   Port #9
    //   Box1_Port2 Razor_LED (Sump)...  on all the time!!!      Port #10
          ReefAngel.Relay.Off( Box1_Port3); // Start with the relay off       Port #11
                  if (hour()>=5 && hour()<10) ReefAngel.Relay.On(Box1_Port3); // Moonlight Between 5-10am turn the relay on
                  if (hour()>=20 && hour()<=23) ReefAngel.Relay.On(Box1_Port3); // From 8pm-Midnight turn the relay on

    //   Box1_Port4 Ecotech MP_40 Pumps  on all the time!!!      Port #12
    //   Box1_Port5 Razor_LED (Sump)...  on all the time!!!      Port #13
    //   Box1_Port6 JBJ ATO ...          on all the time!!!      Port #14
         ReefAngel.Relay.Off( Box1_Port7);  // ALK Doser ...      Port #15
         ReefAngel.Relay.Off( Box1_Port8);  // Calc Doser ...     Port #16


    ReefAngel.PWM.SetDaylight( MoonPhase() );

    // ReefAngel.PWM.SetDaylight(PWMParabola(20,0,23,0,0, MoonPhase(),0 ));


        ReefAngel.RF.UseMemory = false;
        ReefAngel.RF.SetMode( ReefCrest,85,10 );



        ////// Place your custom code below here
       
       
          ReefAngel.RF.UseMemory = false;
          if (hour()>=6 && hour()<11)
            myRFSetMode(ReefCrest,85,10);
          else if (hour()>=11 && hour()<13)
            myRFSetMode(ReefCrest,85,10);
          else if (hour()>=13 && hour()<16)
            myRFSetMode(Smart_NTM,85,15);
          else if (hour()>=16 && hour()<19)
            myRFSetMode(ReefCrest,65,10);
          else
            myRFSetMode(Lagoon,40,10);
             
         
           
        // Hardcode PH calibrations
         //ReefAngel.PHMin=544; // PH7.0
         //ReefAngel.PHMax=830; // PH10.0

         RunDosingPumps();
         LogDosingPumps();
        ////// Place your custom code above here

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

    void DrawCustomMain()
    {

        pingSerial();

        // Parameters
    #if defined DisplayLEDPWM && ! defined RemoveAllLights
        ReefAngel.LCD.DrawMonitor( 15, 48, ReefAngel.Params,
        ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
    #else // defined DisplayLEDPWM && ! defined RemoveAllLights
        ReefAngel.LCD.DrawMonitor( 15, 48, 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, 94, TempRelay );
        pingSerial();

        // Date and Time
        ReefAngel.LCD.DrawDate( 6, 122 );
        pingSerial();
    }

    /////////////////////////////////////////
    // Define Your dosing pumps
    /////////////////////////////////////////
    #define numDPumps 2
    byte pumpRelays[numDPumps]={ Box1_Port7, Box1_Port8 };
    int DPVolume[numDPumps]={ 3, 3 } ; // 1ml for each alk and calcium
    int DPRepeat[numDPumps]={ 240, 240 } ; // Repeat every 4 hrs 5x a day
    /////////////////////////////////////////
    // Define Calibration here
    /////////////////////////////////////////
    int CalTime[numDPumps]={ 600, 600 }; // 10 minutes / 10 minutes
    int CalVol[numDPumps]={ 350, 300 }; // 350ml / 300ml... .58 / .5

    /////////////////////////////////////////
    // Function: RunDosingPumps()
    /////////////////////////////////////////
    void RunDosingPumps() {
      float rate;
      int calcTime[numDPumps];

      for (int i=0;i < numDPumps; i++) {
        rate=(float)CalVol[i]/CalTime[i];
        calcTime[i]=DPVolume[i]/rate/(1440/DPRepeat[i]);

        // Run the pumps
        ReefAngel.DosingPumpRepeat(pumpRelays[i], i*20, DPRepeat[i], calcTime[i]); // Offset between each pump is 20 minutes
      }

      // Display Time calculated in portal
      ReefAngel.CustomVar[0]=calcTime[0];
      ReefAngel.CustomVar[1]=calcTime[1];
    }

    /////////////////////////////////////////
    // Function: LogDosingPumps()
    /////////////////////////////////////////
    void LogDosingPumps() {
      static time_t pumpTimer[numDPumps];
      static boolean pumpStatus[numDPumps];
      float rate;

      for (int i=0;i< numDPumps;i++) {
        if (ReefAngel.Relay.Status(pumpRelays[i])) {
          if (!pumpStatus[i]) {
            pumpTimer[i]=now()-pumpTimer[i]; // Pump was off, timer is now a time
            pumpStatus[i]=true;
          }
        } else {
          if (pumpStatus[i]) {
            pumpTimer[i]=now()-pumpTimer[i]; // Pump was on, timer is now a timer
            pumpStatus[i]=false;
       
            rate=(float)CalVol[i]/CalTime[i];

            // Report How much volume has been dosed per day.
            // Could make this in minutes... excercise for the reader..
            ReefAngel.CustomVar[2]=pumpTimer[0]*rate;
            ReefAngel.CustomVar[3]=pumpTimer[1]*rate; 
          }
        }
     
        // Clear timer at end of day
        if (now()%SECS_PER_DAY==SECS_PER_DAY-1) pumpTimer[i]=0;
      } 
    }


        void DrawCustomGraph()
        {
        }

        void myRFSetMode(byte m, byte s, byte d)
        {
          if (m!=myRFMode || s!=myRFSpeed || d!=myRFDuration || millis()<5000)
          {
            myRFMode=m;
            myRFSpeed=s;
            myRFDuration=d;
            ReefAngel.RF.SetMode(m,s,d);
          }
        }

Re: Reef Angel Malfunctioning

Posted: Sun Sep 29, 2013 3:13 pm
by rimai
You must remove this:

Code: Select all

        ReefAngel.RF.UseMemory = false;
        ReefAngel.RF.SetMode( ReefCrest,85,10 );
The whole idea is to not use the SetMode function and you introduced it again, which will bring you right back to square one again.
Also, make sure that your RF module is connected when you reboot the controller or it will only change mode in the next mode change time.

Re: Reef Angel Malfunctioning

Posted: Sun Sep 29, 2013 3:40 pm
by ecam
Done. good thing cause it was just time-travelling on me

Re: Reef Angel Malfunctioning

Posted: Thu Oct 03, 2013 12:01 pm
by ecam
Roberto, it appears that code did the trick. its been connected to the RA for a week with no issues. i will now put the pumps under the control of the RA and see what happens

Re: Reef Angel Malfunctioning

Posted: Sat Apr 26, 2014 4:59 pm
by Veeresh
Hi Guys

I got my unit last month with the following configuration

RA Plus
Expansion Hub
Expansion Relay 1
Salinity Expansion
Wifi Module
RF Module

I have having the same problem. THE RA bus lock up cause the Radion Light to stay on and the Relay box also hangs. My chiller freeze the tank to below 23 C.

The moment I unplug the RF module from the Expansion hub all revert to normal. When I connect the RF module back to the Expansion hub, I have the bus lock after several hours.

I remove the Ecotech Tech pump and radion led light code and disconnect the RF module and the problem disappears.

I also tried to recompile with the old twi.c and the bus lock still up..

Can anybody help ? Could this be hardware problem ? I did not flash the RF module with the firmware because the problem still persist according to ecam...


Veeresh
version 1.1.0

Re: Reef Angel Malfunctioning

Posted: Fri May 16, 2014 3:37 pm
by Veeresh
Hi Guys

I had my Hub Expansion module replaced and he problem disappear.

No more "Bus Lock Error"

Veeresh
Just Sharing