Ethernet shield not working!

My near-brand new ethernet shield isn't connected to the internet. I have the basic web server running. When I go to the ip address, the server doesn't respond. The serial monitor doesn't display anything either. The link and 100M less are always on. I had it working a couple hours ago, but, suddenly, it mysteriously stopped. Thanks in advance. :)

When I go to the ip address, the server doesn't respond.

Bummer.

The serial monitor doesn't display anything either.

The code you posted doesn't indicate that it should.

I had it working a couple hours ago, but, suddenly, it mysteriously stopped.

All I did was...

What did you do?

I began debugging the program. Then, it stopped working. I loaded the example up (which in the new version of arduino includes the serial debugging) and on the serial it only displayed server is at 192.168.1.177 Thanks for responding!

I loaded the example up

Last time I looked there were at least two examples delivered with the IDE. I seem to recall that it was actually slightly more than two.

If you want us to look at the code, to see where it stops sending data to the serial monitor, to offer suggestions on what you might check, you'll need to be a tiny bit more specific about which example you loaded.

The web server Example:

/*
  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[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1, 177);

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

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


  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  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()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connnection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
                    // add a meta refresh tag, so the browser pulls again every 5 seconds:
          client.println("<meta http-equiv=\"refresh\" content=\"5\">");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("
");       
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        } 
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
}

The serial monitor should print client connected when I go to 192.168.1.177.

The serial monitor should print client connected when I go to 192.168.1.177.

I don't see anything in the code to support that statement. There is code to print "new client".

Is the IP address 192.168.1.177 reserved in your router for your Arduino?

To get my ethernet shield to work, I needed to reserve a block of IP addresses that the router would not automatically issue, and tell the router that one of those addresses belonged to my Arduino, so that it could route requests correctly.

What kind of router are you connecting the Arduino to? What have you done to configure that router?

What kind of router are you connecting the Arduino to? What have you done to configure that router?

I haven't configured the router at all, but, I don't know what my router is. My router is up in the attic and I don't really want to go up there now. I tried three more ip addresses and none worked.

I haven't configured the router at all

I think you need to.

My router is up in the attic and I don't really want to go up there now.

I think you need to.

I tried three more ip addresses and none worked.

If the router didn't issue the IP address, it certainly won't know where to forward packets addressed to that IP, so it is not surprising that random IP addresses don't work.

What should I do to configure my router? I'm not trying to port forward or anything. Just on the local network.

When you connect a device to a router, the router automatically assigns it an IP address. At a minimum, you need to ask the router what IP it reserved for the Arduino.

Then, you put that IP address into the code you compile/link/upload to the Arduino.

Then, you will be able to connect to the Arduino.

If the router assigns an IP address, and you use some other address, then packets intended for the Arduino will be mishandled, because the Arduino is not at the address the router thinks it is.

Each router's configuration/query process is a bit different. What works for my router (even if I could remember what it was) will not necessarily work for yours. That is why you need to know what kind of router you have.

Paul:

Your advice is incorrect. The Arduino -- as indicated here (by the source code) -- is NOT using DHCP. No need to consider the router at all -- except for external access and passing it to a DMZ if necessary. For internal access -- all you need is the IP. By Internal -- I mean that both your PC and your Arduino are connected to the internal section of the same router.

This question is not about a project. [u]This question belongs in the Networking section.[/u] There you can debate the library versions and the various fixes to the server program that keep the server code from locking up. (Connection Checking.) I read several fixes recently -- and am quite familiar with the various issues and have modified library code for my original version Ethernet Shield. This problem is much discussed on the networking forum.

YAY I GOT IT WORKING! I was connecting the ethernet shield through network sharing on my mac. I ifconfigged (yes that is a word :)) and found out that the ip address had to be 192.168.2.xxx. Thank you so much for your help! XD XD XD XD XD XD XD XD Sorry about the wrong category. I saw a few other ones in this category and just assumed.

WillR: Paul:

Your advice is incorrect. The Arduino -- as indicated here (by the source code) -- is NOT using DHCP. No need to consider the router at all -- except for external access and passing it to a DMZ if necessary. For internal access -- all you need is the IP. By Internal -- I mean that both your PC and your Arduino are connected to the internal section of the same router.

Partially true, the Arduino IP address has to be in the same subnet (192.168.2.xxx) as the other computers on the network, or the router will not 'route' the packets. It also needs to be an IP address that is not currently being used on the network.

Although, in this case, it’s being NATed by the Mac, so won’t have the same address range as the rest of the lan.