Arduino ethernet shield showing "ip address at 0.0.0.0"

Hey, it appears my arduino uno with ethernet shield does not work. When i try to run any sort of server or client, or anything using the ethernet shield from the "ethernet" examples (code below), i get the message "ip address at 0.0.0.0". I googled around a bit and on some forums found that it might be that the pins were too long. I cut off a bit of the pins but that did not appear to fix the problem. After lots of googling around i gave up and decided to just buy a new ethernet shield, but this one has the exact same problem. It shows the exact same error.

The code:

/*
  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, 22);

// 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("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          // 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 disconnected");
  }
}

I am wondering whether i may be doing something wrong that causes this not to work, or maybe the arduino uno is just broken. As far as i know the uno works perfectly, i used it to power an amblone setup and after that decided to use it for an ethernet-project. I do have one other USB host shield which should be able to test whether it's the arduino that's broken or something else, but i can not find any simple example to test whether it works by just plugging a mouse or keyboard or something into the shield.

I hope anyone can help me fix this or just diagnose what the problem. Thanks in advance!

Does the ethernet shield have a w5100 IC or some other type, like maybe a w5200 or w5500? Or maybe a 28J60?

I am also struggling with this but I am putting it down to one of a couple of issues:

-As SurferTim suggests you are trying to use a library configured for the wrong type of Wiznet chip. The inbuilt one only works with a W5100 chip. If you have a W5200 chip then the library needs to be altered or replaced.

  • Electical connections to the SPI pins. I used jumper wires to connect just the ICSP pins and pin 10 to the ethernet board and resolved the 0.0.0.0 problem and some packet dropping behaviour.

Problem is i am still occasionally getting issues ... so too early to declare the problem totally solved.

I am wondering whether i may be doing something wrong that causes this not to work, or maybe the arduino uno is just broken.

You need to better explain your ethernet setup. If the ethernet shield has an SD card slot, do you have an SD card in the card slot? If so, remove the SD card.

I have been having a similar problem for the past couple of months. I spent the better part of the day and found that for whatever reason, the pins on the ICSP bus were not making good connection. When I first received my Ethernet shield, everything worked fine, but at some point it stopped working. After trying many things, simple squeezing the boards together right where the ICSP bus is fixed it. Today it lost connection again, and a little squeeze helped again. I'm not sure why the pins spontaneously lose connection, but they do seem to.

Here are some steps to try if getting IP address at 0.0.0.0

  1. Try the EtherEncLib library - Download from GitHub - renatoaloi/EtherEncLib: Ethernet ENC28J60 Library for Arduino
  2. If you have a windows PC, create a new user profile on your PC. Make the new user profile an administrator. Login to the new windows profile and test the ENC28J60 card.