Page 3 of 3

Re: Controller randomly resetting

Posted: Wed Nov 27, 2013 9:06 am
by rimai
So, the issue is really coming from somewhere inside your house.
Did you see the yellow LED blinking at all after you removed the Portal function?
What side did you extend? The svga or the usb?

Re: Controller randomly resetting

Posted: Wed Nov 27, 2013 9:44 am
by Mike S
No I didn't see the yellow light blinking led when I plugged the wifi back in and I just tried it a few times again. Should the yellow led start flashing pretty much right away or will it happen randomly? The leds flash green then blue a few times and then I get a steady blinking green light.

I extended the SVGA cable. I tried several that didn't work before getting a pair of svga screw terminals and making my own. Is there a limit to how far you can extend it with a longer USB cable?

Re: Controller randomly resetting

Posted: Wed Nov 27, 2013 9:49 am
by rimai
The yellow led is activity status. If there is no activity, it wouldn't blink.
It wouldn't happen right away either. It would only happen every 5 minutes if you had the Portal() function or every 15 or 30 seconds if you had the client probing the controller.
So, it isn't supposed to blink and I just wanted to make sure it wasn't blinking.
Do you have a long enough USB cable to try it?

Re: Controller randomly resetting

Posted: Wed Nov 27, 2013 11:40 am
by Mike S
I went to a 6 foot USB cable and the stock SVGA cable and the problem is still occurring.

Re: Controller randomly resetting

Posted: Wed Nov 27, 2013 12:00 pm
by rimai
I'm not so sure what else to try, except going to ethernet based.

Re: Controller randomly resetting

Posted: Wed Nov 27, 2013 12:15 pm
by Mike S
Is there a module for that? I'd actually prefer to go ethernet based, but I didn't think that was an option. Could the wifi module be shot?

Re: Controller randomly resetting

Posted: Wed Nov 27, 2013 2:19 pm
by rimai

Re: Controller randomly resetting

Posted: Sat Nov 30, 2013 8:31 am
by Mike S
That Roberto I ordered one and found the thread with the instructions on how to set it up. Hopefully this takes care of the issue.

Re: Controller randomly resetting

Posted: Sat Nov 30, 2013 10:20 am
by rimai
This is the code I used to try a while ago:

Code: Select all

/*
  Web Server

 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield. 

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe

 */

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };
IPAddress ip(192,168,1, 177);
IPAddress remoteserver(198,171,134,6); // www.reefangel.com
EthernetClient clientout;
unsigned long lastmillisout=millis();
unsigned long lastmillisin=millis();
boolean sending=false;
char strout[600];

// Initialize the Ethernet server library
// with the IP address and port you want to use 
// (port 80 is default for HTTP):
EthernetServer server(2000);

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  // start the Ethernet connection and the server:
  Ethernet.begin(mac);
  server.begin();
//  Serial.println(Ethernet.localIP());
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
//    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      while (client.available()) {
        char c = client.read();
        if (sending==false) Serial.write(c);
        lastmillisin=millis();        
      }
      while (Serial.available()){
        memset(strout,0,sizeof(strout));
        int b=Serial.readBytesUntil('>',strout,sizeof(strout));
//        Serial.flush();
        client.print(strout);
        client.print(">");
//        char c = Serial.read();
//        client.print(c);
        if (millis()-lastmillisin>2000)
        {
//          Serial.println("Timeout incoming");
          Serial.flush();
          lastmillisin=millis();
          client.stop();
        }
      }
      if (millis()-lastmillisin>2000)
      {
//        Serial.println("Timeout incoming");
        Serial.flush();
        lastmillisin=millis();
        client.stop();
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    //    Serial.println("client disonnected");
  }
  else
  {
    if (Serial.available())
    {
      memset(strout,0,sizeof(strout)-1);
      int b=Serial.readBytesUntil('\n',strout,sizeof(strout)-1);
      Serial.flush();
//      Serial.println(b);
//      Serial.println("Connecting");
      if (b>10)
      {
        sending=true;
//        Serial.println(strout);
//        Serial.println(" HTTP/1.0");
//        Serial.println();
        if (clientout.connect(remoteserver, 80)) 
        {
//          Serial.println("Connected");
          //        while (Serial.available()){
          //          char c = Serial.read();
          //          clientout.print(c);
          //        }
          clientout.println(strout);
//          clientout.println(" HTTP/1.0");
          clientout.println();
          lastmillisout=millis();
        }
      }
    }
    while (clientout.available()) {
      char c = clientout.read();
      Serial.print(c);
      if (millis()-lastmillisout>8000)
      {
//        Serial.println("Timeout connected");
        lastmillisout=millis();
        clientout.stop();
        sending=false;
      }
    }
    if (!clientout.connected())
    {
      clientout.stop();
      sending=false;
    }
  }
  if (millis()-lastmillisout>8000)
  {
//    Serial.println("Timeout global");
    lastmillisout=millis();
    clientout.stop();
    sending=false;
  }

}

// GET /index.html HTTP/1.0

//GET /status/submitp.aspx?t1=806&t2=0&t3=0&ph=441&id=test&em=0&rem=0&key=&atohigh=0&atolow=0&r=0&ron=0&roff=255 HTTP/1.0

//GET /status/submitp.asp?t1=806&t2=0&t3=0&ph=441&id=test&em=0&rem=0&key=&atohigh=0&atolow=0&r=0&ron=0&roff=255 HTTP/1.0
//Host: forum.reefangel.com
//
//GET /status/submitp.aspx?t1=806&t2=0&t3=0&ph=441&id=test&em=0&rem=0&key=&atohigh=0&atolow=0&r=0&ron=0&roff=255 HTTP/1.0
//Host: forum.reefangel.com
//Connection: Keep-Alive