RA crashing after add ons

Expansion modules and attachments
Post Reply
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

RA crashing after add ons

Post by smoothdog »

Two days ago I added my usb expansion hub, 2nd relay box and PWM dimming module. For the past 2 nights now the RA head unit has locked up in the middle of the night and stopped functioning. The red status light has given 3 blinks repeatedly each time. I have also noticed that the client app gives an error when trying to refresh the memory tab now too. FYI I also have a wifi module and RF module that were hooked up with no problems prior to this issue. I am running a little custom code for redundant ATO switches, neck cleaner and Vortech pump schedule, but this code was all running before the new modules were added, I just changed the neck cleaner port.

#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 <Humidity.h>
#include <DCPump.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.FeedingModePorts = 0;
ReefAngel.FeedingModePortsE[0] = Port4Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port8Bit;
ReefAngel.WaterChangePortsE[0] = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit;
ReefAngel.LightsOnPortsE[0] = Port3Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit;
ReefAngel.OverheatShutoffPortsE[0] = Port3Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;


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

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


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

void loop()
{
ReefAngel.DayLights( Port1 );
ReefAngel.DayLights( Port2 );
ReefAngel.DayLights( Port4 );
ReefAngel.ActinicLights( Port5 );
ReefAngel.CO2Control( Port7 );
ReefAngel.SingleATOLow( Port8 );
if (!ReefAngel.HighATO.IsActive()) ReefAngel.Relay.Off(Port8);
ReefAngel.DayLights( Box1_Port3 );
ReefAngel.StandardHeater( Box1_Port5 );
ReefAngel.StandardHeater( Box1_Port7 );
ReefAngel.PWM.DaylightPWMSlope();
ReefAngel.PWM.ActinicPWMSlope();
ReefAngel.PWM.Channel0PWMSlope();
ReefAngel.PWM.Channel1PWMSlope();
ReefAngel.PWM.Channel2PWMSlope();
ReefAngel.PWM.Channel3PWMSlope();
ReefAngel.RF.UseMemory = true;
ReefAngel.RF.SetMode(Storm,65,10);
////// Place your custom code below here

//#define Constant 0
//#define Random1 1 // Lagoonal
//#define Random2 2 // Reef Crest
//#define ShortWave 3
//#define LongWave 4
//#define Smart_NTM 5 // Nutrient Transport Mode
//#define Smart_TSM 6 // Tidal Swell Mode
//#define Feeding_Start 7
//#define Feeding_Stop 8
//#define Night 9
//#define Storm 10
//#define Custom 11
//#define Slave_Start 97
//#define Slave_Stop 98
//#define None 99


// Evening mode Control
if (hour()>=18 || hour()<2) // Defining "Nightmode" hours for VorTech = between 6 PM and 2 AM
{
ReefAngel.RF.UseMemory=false;
ReefAngel.RF.SetMode(Random1,65,5);
}
else
{
//ReefAngel.RF.SetMode(Feeding_Stop,0,0); //Temp fix for coming out of Night mode
ReefAngel.RF.UseMemory=true;
}

if ( ( (hour()==0) && (minute()==00) ) || ( (hour()==4) && (minute() ==00) ) || ( (hour()==8) && (minute() ==00) ) || ( (hour()==12) && (minute() ==00) ) || ( (hour()==16) && (minute() ==00) ) || ( (hour()==20) && (minute() ==00) ) )
ReefAngel.Relay.Set(Box1_Port8,now()%60<30);
else
ReefAngel.Relay.Off(Box1_Port8);
////// Place your custom code above here

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

void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();

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

// Relay Expansion
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox( 12, 96, TempRelay );
pingSerial();

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

void DrawCustomGraph()
{
}
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

Ok, this is getting ridiculous. Just came home and luckily decided to do some work on the tank and found this thing locked up again with the status light giving the 3 blink signal again. PH in the reactor is down to 6.2 because it didn't shut off the CO2, the last 2 times it was up to 6.7. Alslo, since my ATO hasn't been running the way it should I'm down about a couple of gallons in the sump that will have to be manually added due to the ATO timeout I have set so it can't over fill. Tried checking the memory tab from the client using the USB connection this time and still getting an error:

*****9/10/2013 8:10:31 PM*****
Message:
Index was outside the bounds of the array.
StackTrace:
at ReefAngelWCFListener.ReefAngelListener.GetAllMemoryValuesPost10(String[] locations)

*****9/10/2013 8:10:32 PM*****
Message:
Value cannot be null.
Parameter name: String
StackTrace:
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at ReefAngelClient.Form1.DisplayMemoryValues()


Does anybody have any ideas what this could be? I'm going on an overnight camping trip this weekend and if this isn't fixed soon I'll need to rip the whole thing apart again and put it back the way it was. I'm beginning to get really frustrated with this thing at this point.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA crashing after add ons

Post by rimai »

Try this for the Client:
http://forum.reefangel.com/viewtopic.php?p=25736#p25736
Have you updated the your RA Installer lately?
Try uninstalling the RA Installer, download a fresh copy from the website, install again and upload your code again.
Then connect one module at a time, to see if you can isolate to a particular module.
Roberto.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

Hi Roberto, I tried unplugging add ons from the expansion hub one by one and when I unplugged the RF expansion module the main unit came back online, I tried replugging it and each time the head unit dropped out, even when using different ports in the expansion hub, so I just left the RF module unplugged. After a few more minutes though, the controller went offline again. I then unplugged an re-plugged the whole expansion hub and it came back online.

I also installed the controller software on a totally different laptop and uploaded my code again but still saw these issues after that. I also installed the client and loaded the memory file but still get the error when trying to refresh the memory tab.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA crashing after add ons

Post by rimai »

I'm taking that you are using the original usb cables, right?
It seems the hub is what is causing this, according to what you are saying. Does it do the same thing if just the hub is connected?
Roberto.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

Yes, all cables are what came with the modules. After unplugging and replugging thing in it reset and is currently working. If/when it goes down again I'll try pulling all modules out of the hub and see if the hub alone causes an issue.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

Went down again about an hour ago and this time I noticed when I unplugged the RF module and the display came back online that the date time on the display showed a year of something like 2060 and time of 5PM so all lights came on early. I power cycled the controller and I have unplugged everything from the expansion hub so it's the only thing plugged in now.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

I think it may be the PWM dimming module. I tried the relay by itself and every combination of relay and other expansions and every time it has crashed so far the PWM has been plugged in. I'm running with everything but the PWM now and it's been stable for a while. I'll let this burn in over night and see how it does.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

Looks like the PWM dimming module was causing the issue. There have been no issues since unplugging only this module.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

On a side note, the memory tab still reports an error when trying to refresh.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA crashing after add ons

Post by rimai »

Is that a new module?
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA crashing after add ons

Post by rimai »

I just posted the new ini file for v1.0.9 libs
http://forum.reefangel.com/viewtopic.php?p=31776#p31776
Roberto.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

I bought the module 6 months ago but my build was delayed and I just got to hook it up this week.

The new .ini fixed the memory tab, thanks!
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA crashing after add ons

Post by rimai »

Ok, can you try updating the firmware of the dimming module?

Open the enclosure and locate the 6pin header.
Use the same cable you upload codes to RA.
Plug the black wire on the GND marking.
Make sure the board is selected to RA w/ optiboot.
Upload the code below.

Code: Select all

#include <Wire.h>
#include <avr/wdt.h>

byte PWMports[] ={
  3,5,6,9,10,11};
byte ChannelValue[] = {
  0,0,0,0,0,0};

byte cmdnum=255;
byte datanum=255;
void setup()
{
  Serial.begin(57600);
  Wire.onReceive(receiveEvent);
  Wire.onRequest(NULL);
  Wire.begin(8);
  randomSeed(analogRead(0));
  pinMode(3,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);
  wdt_enable(WDTO_1S);
}

void loop()
{
  //Serial.println(ChannelValue[0],DEC);
  if (cmdnum!=255)
  {
    ProcessCMD(cmdnum,datanum);    
    cmdnum=255;
    datanum=255;
  }
}

void receiveEvent(int howMany) {
  wdt_reset();
  if (howMany==5)
  {
    byte cmd1, cmd2, cmd3, cmd4, cmd5;
    cmd1=Wire.read();
    cmd2=Wire.read();
    cmd3=Wire.read();
    cmd4=Wire.read();
    cmd5=Wire.read();
    if (cmd1=='$' && cmd2=='$' && cmd3=='$')
    {
      cmdnum=cmd4;
      datanum=cmd5;
      //Serial.println(cmd4,DEC);
      //Serial.println(cmd5,DEC);
    }
  }
  else
  {
    for (int a=0;a<howMany;a++)
    {
      Wire.read();
    }
  }  
}

void ProcessCMD(byte cmd, byte data)
{
  wdt_reset();
  // Individual Channel
  if (cmd>=0 && cmd<=5)
  {
    ChannelValue[cmd]=data;
    analogWrite(PWMports[cmd],data);
  }
}
Roberto.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

I updated the firmware and will reconnect it in the morning when I can keep an eye on it.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

Initial impressions are that this fixed the issue. The red status light came on mid day and stayed on but everything is still functioning (I see this from time to time normally). If it holds up more than 24hrs then I think we're good. Thanks Roberto.
User avatar
DrewPalmer04
Posts: 818
Joined: Tue May 29, 2012 2:12 pm
Location: Christopher, IL

Re: RA crashing after add ons

Post by DrewPalmer04 »

Good to see you're still at it smooth. Enjoy that RA!
Out for now...but not over.

VISIT: Ethernet Module/Wifi Alternative
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

Thanks Drew. I'd like to but the issues have reared their ugly head again. Things seemed to be going ok until I got home from our camping trip and the pwm controlled leds started flashing hi/low cost ontinuously. Tried resetting it again and it ran for a couple hours before it started flashing again. The wifi keeps flaking out at the same time too. I've unplugged the pwm module again for now.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

I just noticed as I posted this that the wifi is offline yet again. If I can't get these issues straightened out quickly I'm going to dump this thing and get something else. I don't mind updating firmware as needed but I'm tired of chasing down issues every time I change something.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: RA crashing after add ons

Post by rimai »

This issue is mostly cause by something that is introducing noise in the system.
We can try the new dimming module board. It is not reprogrammable though.
PM me for RMA.
Roberto.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

I've got one more thing to try first. I had the RF module right next to the PWM module and I'm wondering if that is causing interference and maybe explaining the hi/lo flashing of the leds (corresponding to the RF signal to the vortechs?) I'm going to try moving them further apart to see if that fixes the issue. If that doesn't work I'll contact you for RMA.

In the mean time I guess I need to also try re-running the WiFi module setup again since out of the blue it refuses to connect to my network now.
smoothdog
Posts: 43
Joined: Wed Jan 02, 2013 11:53 am

Re: RA crashing after add ons

Post by smoothdog »

No joy, after moving them as far apart as the supplied cords allow the controller flipped out again and left the CO2 stuck on and started flashing the PWM controlled LEDs again. I'll shoot a PM with info for RMA.
Post Reply