Go Down

Topic: Ethernet Shield Seems Sketchy (Read 1 time) previous topic - next topic


Firstly, here is the ethernet shield I am using.  Supposedly it is fully compatible with the Uno

The instant that I insert an ethernet cable into the RJ45 socket the link, 100M, and fulld lights illuminate.  This certainly makes it seem as though the board is not dead.  I also have an LED in digital pin 13 and ground which supposedly is the ethernet chip's clock.

19 times out of 20 when I issue a Ethernet.begin(mac) command, code execution hangs for 90 seconds and an LED inserted between digital pin 13 and GND stays solidly lit.  For whatever reason, some random bits of new code will work just fine, instantly establish a DHCP connection and send and receive data.  Below is some troubleshooting code that ran perfectly the first time I tried it and has failed every time since then:

Code: [Select]

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {  0x11, 0xBB, 0xBB, 0xCC, 0xDE, 0x05 };
char serverName[] = "www.google.com";

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  // start the serial library:
  // start the Ethernet connection:
  Serial.println("Attempting connection...");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
  // give the Ethernet shield a second to initialize:

  // if you get a connection, report back via serial:
  if (client.connect(serverName, 80)) {
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.0");
  else {
    // kf you didn't get a connection to the server:
    Serial.println("connection failed");

void loop()
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();

  // if the server's disconnected, stop the client:
  if (!client.connected()) {

    // do nothing forevermore:

Can anyone suggest anything to help stabilize things for me?  I know the shield isnt' dead since I've had it send data but it is extraordinarily unreliable.


Do you have a uSD memory card in the ethernet shield slot? That can cause the symptoms you describe. You can use them together easily, but they must be initialized correctly, or eventually you will have troubles like this.

Just checking...


Thanks for your reply Tim.  No, no card in the slot.


Oddly, I had a bit of luck making the shield respond to pings by setting pin 10 to output.  That shook something loose and allowed the shield to respond to ping requests from my laptop, but setting that pin has not worked again since that first attempt.


Try this code. You can change the network settings to yours if you want to try a ping.
Code: [Select]
#include <SPI.h>
#include <Ethernet.h>

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

void setup() {

  Serial.println("Starting w5100");

void loop() {

If the serial monitor shows (or your ip), then the SPI and w5100 are communicating on the SPI bus. If it shows anything else, like, then something is wrong with the hardware.

Insure the ICSP connector is connected fully. That is how the SPI bus gets to the shield.


Tim, thanks for your help.  This is what came back:



A second attempt yielded this.  Not sure if this is any help at all:



Feb 04, 2013, 07:43 pm Last Edit: Feb 04, 2013, 07:58 pm by ChemE Reason: 1
Odd, a different mask comes back every time:


EDIT:  I mashed the heck out of the shield and by keeping the serial monitor open and using the reset button this is what I now get:

Starting w5100
Starting w5100
Starting w5100


Feb 04, 2013, 07:58 pm Last Edit: Feb 04, 2013, 08:01 pm by SurferTim Reason: 1
Sounds like you have/had a bad connection on one of the pins. If you used as the ip, you should be good to go as far as the SPI is concerned. Now, can you ping it?


Wow, so apparently the problem was the LED going from digital pin 13 to GND!  With that removed your code and all the other internet code works fine.  Thanks so much for your help.  I knew somehow the problem was me and not the hardware!


You must leave D10-D13 alone when using the SPI bus on an Uno. The Uno has a small LED on D13, but you can't use it when you are using the SPI. It is the clock line.

The Mega uses different pins for SPI.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131