Ethernet Shield / WebServer Issues

Gentlemen:

Let me start off by saying that I read all possible threads regarding Ethernet shield issues and none of them really helped me.
My problem is: I can't get even the most basic standard WebServer sketch to work.
I have done the following

  • I mounted my Ethernet shield on top of my Arduino
  • my Arduino is powered by USB
  • the Ethernet shield is connected to one of the ports on my router
  • the internal IP addresses of my router/PC are 192.168.1.1 / 192.168.1.100
  • I changed the respective line in the sketch with ip(192, 168, 1, 101);
  • also, I tried with the standard MAC address and also with the one that is printed on the shield (in byte mac[]...)
  • I uploaded the sketch
  • I reset the Ethernet shield
  • I also disabled my firewall
    And still, when I go to http://192.168.1.101/ in IE, I get the following: "Internet Explorer cannot display the webpage"

Any help from the advanced users is greatly appreciated. I can use my Arduino for all kind of sensor/analog input/digital output projects but I can't connect it to the network

Thanks!

Can you ping the Arduino from the PC?

as in if I can perform a "ping 192.168.1.101"?
no sir - I tried many times:
Reply from 192.168.1.100: Destination host unreachable.

OK, let's start at the beginning. Compile and upload this sketch. Does the serial monitor show 192.168.1.101? If it shows anything else, like 0.0.0.0, then you have a w5100 or SPI bus problem.

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

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,101);

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

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

 // Start ethernet
 Serial.println(F("Starting ethernet..."));
 Ethernet.begin(mac, ip);
 Serial.println(Ethernet.localIP());

 delay(2000);
 Serial.println(F("Ready"));
}

void loop() {
}

this one looks fine - here's what my serial monitor responded:

Starting ethernet...
192.168.1.101
Ready

however, still not working :slight_smile:

thank you very much for your prompt and professional replies!

Good. Then try this one. It checks the connection to the router. Does it get an IP or show "failed"? If it shows an IP, can you ping that IP from your PC?

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

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

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

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

 // Start ethernet
 Serial.println(F("Starting ethernet..."));
 if(!Ethernet.begin(mac)) Serial.println(F("failed"));
 else Serial.println(Ethernet.localIP());

 delay(2000);
 Serial.println(F("Ready"));
}

void loop() {
}

Well, this one failed:

Starting ethernet...
failed
Ready

It took about a minute to display that (in case that matters).

Thanks again.

Then there is a problem with the ethernet side of the w5100, the ethernet cable, or the router. Does you PC get its IP from the router or is it a static assignment?

the shield is a brand-new, never-used Arduino Ethernet Shield
the Ethernet cable is also a brand new one - I took it from a new router box
the router is the one I've been using for 2 years - the cable is plugged into the third port (there are 4 of them)
since I'm not very network-savvy, I'd assume "the PC gets its IP from the router"

2-15-2015 12-13-54 AM.png

According to that printout, your PC does get its IP from the router. You must have a problem with the w5100. There have been reports of solder bridges between the w5100 pins, causing failures. Check the w5100 IC for these bridges.

Click here to see an example.

OK, thank you very much. I'll check with the vendor then.
I guess I'll convince them to give me another shield to test with.
Your support is greatly appreciated! I'll keep you posted.
Cheers,
--MD

For the benefit of other users:
I was able to fix the issue by connecting to another router.
Since the first router is technically fine, I assume there are some differences between the way the two routers were set-up.
Thanks

mdimkov:
For the benefit of other users:
I was able to fix the issue by connecting to another router.
Since the first router is technically fine, I assume there are some differences between the way the two routers were set-up.
Thanks

So its mean the problem in the router?because im facing the same problems too..please help me

Try another router.

SurferTim:
Try another router.

i just have one router.. :frowning:

Do you have a friend or relative that has one? Arduinos are pretty portable.

Simple client test code you can try unmodified to see if an outside server can be reached.

//zoomkat 3-1-13
//simple client checkip test
//for use with IDE 1.0.1 or later
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "checkip.dyndns.com"; // test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600); 
  Serial.println("Better client ip test 3/1/13"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET / HTTP/1.0"); //download text
    client.println("Host: checkip.dyndns.com");
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}