Go Down

Topic: Ethernet Shield stops working (Read 9257 times) previous topic - next topic


Hello all. I modified the Web Server sketch to display a jpg image and refresh every 10 seconds. I point the browser on one of our machines on the network to that Arduino IP and it works perfect. However, the Ethernet shield seems to stop working after a period of time. At first I was testing with a 100 Ft cat 5 cable and it seemed pretty erratic. The ethernet port would suddenly go silent (no traffic or connection lights green/amber). I figured it might be the cable, so this morning I connected it to a 3 ft cat 5 (to my linksys wireless router) and let it run most of the day. At some point it stopped working...lights out. I was out in meetings most of the afternoon, so not sure when it stopped, but it did.

I was wondering if anyone knows what might be causing this or have experienced it.

FYI - Arduino Uno and Arduino Ethernet Shield. SD slot is empty. I have external power to the Arduino card. The IP is set static, and I think I left the MAC as the default that was in the original sketch. It actually ran for longer than when it was connected to the 100 ft cat 5, but eventually did stop sometime this afternoon.


Since you modified the code, it may be a good idea to post it. How does it do if you just reply like a server without sending a jpg image?

You might want to try the server code in this post. It works even if being saturated with requests by multiple devices.


Oct 08, 2012, 11:32 pm Last Edit: Oct 11, 2012, 06:14 pm by rfbase Reason: 1
Thanks! Here is the code. I am new at Arduino and C++....so I suspect the problem is with something I've done. Sorry...should have posted the code.

Code: [Select]
 Web Server

A simple web server that shows the value of the analog input pins.
using an Arduino Wiznet Ethernet shield.

* 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:
  while (!Serial) {
   ; // wait for serial port to connect. Needed for Leonardo only

 // start the Ethernet connection and the server:
 Ethernet.begin(mac, ip);
 Serial.print("server is at ");

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();
       // 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("<!DOCTYPE HTML>");
                   // add a meta refresh tag, so the browser pulls again every 5 seconds:
         client.println("<meta http-equiv=\"refresh\" content=\"3\">");
         // output the value of each analog input pin
         for (int analogChannel = 0; analogChannel < 1; analogChannel++) {
           int sensorReading = analogRead(analogChannel);
           client.print("analog input ");
           client.print(" is ");
           client.print("<br><a href=");
           client.print("><img src=");
           client.print(" border=");
           client.print(" alt=");
           client.print("></a><br />");      
       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
   // close the connection:
   Serial.println("client disonnected");

Edit: Added the code tags


When you say "stops working", does that mean the refresh stops (quits loading page automatically), or the server quits responding? What do you need to do to get it going again? Reload the page on the browser or reset the Arduino?


The ethernet connection on the shield seems to stop working. Meaning, the connection and traffic lights go off and its like there is no power to the ethernet jack. The board (shield) is still lighted, but the lights on the jack are off.

When the jack seems to go dead, and the refresh command is sent, the browser just spins and eventually times-out.

To get it going again you have to pull power on the Arduino, connect the USB, and load the sketch again.

By the way, the ethernet seems to respond flawlessly when the Ardunio is connected to the laptop USB, but when I disconnect and try to run stand-alone the shield seems to lose connection.


By the way SurferTim....thanks....and is there an Arduino group down here? I live in Boca Raton FL.


How are you powering it when the usb is not connected? Have you checked the +5v pin voltage when it fails?

I'm not sure about local Arduino groups. I've been busy with other projects.


Yes, I have external power connected to the Arduino power connection. And it runs for an extended period without USB. Thanks though, I'll keep messing with it. Have a good night.


Sounds like you may have a power problem. It would need around 7 to 9 volts on the power jack. Any less and it wouldn't regulate correctly. Any more and the Uno regulator would get pretty hot powering the ethernet shield.

You're welcome!  :)


One last comment... My router DHCP range is set to serve up IPs from to ...150 (so 50 IPs). And I set the IP on the card to So as far as I understand, it is not using DHCP because I defined the IP, but the IP I defined is outside the range of the router's settings....so maybe that's causing an issue???

Anyway, tomorrow I'll change the Arduino to something like 140 and run it for the day again to see if that helps.

oh...and yes, I have a 9 volt wall wart power supply to the Arduino power plug, so I think power is pretty solid.

Thanks again, I'll post tomorrow with the results just in case anyone is interested.


Oct 09, 2012, 01:41 pm Last Edit: Oct 09, 2012, 02:57 pm by SurferTim Reason: 1
The ip change will not help. Do not assign static ips that may be issued by the dhcp server. That is why they left you ips that are not issued by the dhcp server. Your original assignment was better.

It still sounds like power, especially if the unit on usb power works ok, and if on the wall wart alone it fails. My Mega regulator gets hot if I use the power jack instead of usb power when the ethernet shield is attached. I don't run it that way for that reason.

edit: And the type of power supply makes a difference. There are 9 volt power supplies, and there are 9 volt regulated power supplies. Bear in mind that the output voltage of an unregulated 9 volt power supply could be 40% higher than its rating without a load, and 20% higher under a half load. So if you have an unregulated unit rated at 9 volts 1 amp, then at 500ma, the supply voltage would be about 10.8 volts.

Since the regulator is a linear type, it will now produce more heat than all the ICs on both boards combined, including the 3.3v linear regulator on the ethernet shield. Have you noticed how hot the w5100 gets under normal conditions?



I have just seen something similar on my setup. Had issues getting link status (the LEDs on the ethernet jack) to light up. Changed a few things and got status for a few days. Suddenly, everything stopped. It was not the code. The problem comes from instability between the Wiznet and your ethernet switch/router. The chipset inside the switch need to negotiate with the wiznet and for some reason, it sometimes does not work. I solved my problem by changing the switch. It worked without changing power supplies or cables. I had seen this problem before with another MCU (Rabbit) and its chipset. Just changing switches made the problem go away.

Good luck...


Thanks Stefdageek,

Maybe I'll upgrade the firmware on the switch to see if that helps. It a consumer grade (linksys) device, not commercial, but I wouldn't think that should matter. I'll see if an upgrade helps.



By the way, the ethernet seems to respond flawlessly when the Ardunio is connected to the laptop USB, but when I disconnect and try to run stand-alone the shield seems to lose connection.

So the switch can tell when the usb cable is plugged in?


surferTim...."So the switch can tell when the usb cable is plugged in?"

Got me...not what I was thinking....I was thinking that perhaps the USB connection might be piggybacking (or supplementing) the Arduino's network connection - via the laptops wireless connection. I know that if I have certain mobile devices connected to the laptop -via USB- the device will definitely use the laptop network connection. So...if that is a possibility...then the network connection in the laptop is both filtered from power issues, and probably has better firmware to manage glitches in the network connection. And perhaps a firmware upgrade on the router could help with 'network glitches' that might cause problems that the shield cannot handle (interrupts, collisions). I can test the piggyback possibility this evening. I'll connect everything and disable the laptop wifi to see if the shield's ethernet goes squirrely.

Having said all that...it could absolutely be power issues as you've suggested. It's that time of year around here and we have storms every afternoon, so power is definitely questionable. My real job means that I am not here for extensive testing/monitoring (except on weekends), so the last failure could have been a power surge or loss, but I was not here when it failed so it's hard to say. I would think though that the shield should recover from power loss once it powers up again? And a power loss is an assumption, because the Arduino had power when I came back, just no network connection on the shield.

Go Up