arduino ethernet shield problem

Hi guys i’m new in this. I have a ardiuno uno and an ethernet shield w5100.
I can’t get it work with my ardiuno . I can’t ping the device i try to many times .
Help me.

When i upload the code it is showing below output.And client is not creatiing.

server.avilable() is returning 0

server is at 192.168.1.6
I’m in loop
I’m in loop
I’m in loop
I’m in loop
I’m in loop
I’m in loop
I’m in loop

This is the code i’m using.

#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
};
byte ip = {192, 168, 1, 6};

// 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
Serial.println(“I’m in loop”);
delay(5000);
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("");
client.println("");
// 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(””);
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”);
}
}

The client will not "create" until a client connects to the server.

Are you certain the ip is correct for your localnet?

My PC and shield both are connecting to same rouetr.

My PC IP is 192.168.1.3 so I'm using 192.168.1.6.

Actually I'm staying in hostel so many PC are connected to the same router but whatever the IP I'm using is unique no one is using that.

Have you tried a dhcp start? Maybe somjething is not working on the RJ45 side of the w5100.

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

byte mac[] = {  0x00, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

void setup() {
  Serial.begin(9600);

  // disable SD SPI
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Serial.print(F("Starting ethernet..."));
  if(!Ethernet.begin(mac)) Serial.println(F("failed"));
  else {
      Serial.println(Ethernet.localIP());
      Serial.println(Ethernet.gatewayIP());
  }
}

void loop() {
}

I'm getting Starting ethernet... failed

madhujogineni: I'm getting Starting ethernet... failed

If the router has a dhcp server (which most have by default), then you have a problem on the RJ45 side of the w5100. Try another cable. Try another port on the router.

Check the w5100 IC for solder bridges (solder jumping from one pin to another).

I tried with another cable still it is showing same problem.

Please check the attachment. It shows how I’m connecting to web

Connection.pdf (11.5 KB)

That diagram doesn’t help much. It does not accurately display how router 1 and router 2 are connected. Are these localnets routed or NATed?

edit: Until you get the Arduino to obtain an IP with DHCP, I think you are wasting your time trying other stuff. Just my opinion…

Is there any problem with my shield hardware.....?

madhujogineni: Is there any problem with my shield hardware.....?

Probably.

I'm new to arduino can you help me how to solve hardware issues..

And also Ethernet.begin(mac) is returning 0. on shield I did not find any mac address so I'm assigning my own mac address is there any wrong what I'm doing. Please help me why Ethernet.begin(mac) is failing.

Finally I fixed it…

madhujogineni: Finally I fixed it..

.. and you fixed it how?

edit: You don't have to answer, but a post like this is the guaranteed way to end up on my "do not help" list.