Arduino Router reset with Http

SurferTim: What does that mean? Does it give you the "OMG, I'm lost" message? Does the server quit responding? Both? Or just fails to do anything with no message at all?

it was doing nothing i guess.

i did never get the message "Google connect - OK".

 EthernetClient googleClient;
  char server[] = "www.google.com";    // name address for Google (using DNS)
  digitalWrite(yellowLed, HIGH);
  delay(1000);
  digitalWrite(yellowLed, LOW); 
  if (googleClient.connect(server, 80))
  {
    Serial.println("Google connect - OK");
    digitalWrite(greenLed, HIGH);
    digitalWrite(redLed, LOW);
    googleClient.stop();
    return true;
  }
  else
  {
    Serial.println("Google connect - FAIL");
    digitalWrite(greenLed, LOW);
    digitalWrite (redLed, HIGH);
    digitalWrite(routerPin1, LOW);
    delay(30000);
    digitalWrite(routerPin1, HIGH);
    delay(30000);
    return false;
  }
}

Removed this from the code

void resetRouter(void) {
digitalWrite(routerPin1, LOW);
delay(lastGoogleCheck);
digitalWrite(routerPin1, HIGH);
delay(lastGoogleCheck);
}

and added this to the setup "boolean checkIfGoogleIsAlive()"

digitalWrite(routerPin1, LOW); // Pin to the relay, resetting router
    delay(30000);
    digitalWrite(routerPin1, HIGH); // Pin to the relay, resetting router
    delay(30000);

See how that does. I'm running your code here now with those changes and it seems to be doing ok. With the old code, it would seem to freeze after a while if you disconnected the ethernet cable due to this delay.

delay(lastGoogleCheck);

lastGoogleCheck ends up being a really large number.

Sorry double post.

Does manually resetting the router without restarting the Arduino get things going again?

SurferTim: See how that does. I'm running your code here now with those changes and it seems to be doing ok. With the old code, it would seem to freeze after a while if you disconnected the ethernet cable due to this delay.

delay(lastGoogleCheck);

lastGoogleCheck ends up being a really large number.

Thanks, i will let it run stable for some hours then unplug the Ethernet cable then plug it back in to see how it react.

SurferTim: Does manually resetting the router without restarting the Arduino get things going again?

did not though about that. But I'm just using the Ethernet cable from a switch currently. So if i unplug Ethernet cable from arduino Ethernet shield this will be like router is failing (losing connection).

So if i unplug Ethernet cable from arduino Ethernet shield this will be like router is failing (losing connection).

I'm doing the same thing, and my ethernet shield recovers ok. It is still running and I have disconnected the CAT5 cable a few times without a freeze or lockup. I get the OMG message, but if I reconnect the cable, it goes right back to it.