An annoying problem with ethernet shield

Hi everyone,

I have a Arduino UNO R3 + Ethernet Shield w5100 and I use them for a client application in which the program regularly makes a HTTP request in a loop to my local server on my computer. After these requests, It retrieves some data and will compare them with its current status and make some changes if necessary. That's basically all my code does / or will do.

After i load the code into the Arduino, it easily starts working . Everything goes normal, looks normal. I even can see the data retrieved and display it on a LCD Display. When i change the data on the server, the arduino immediately sees this change, which is what i intent to do anyway.

The problem is that after some random time (5-10 min), the ethernet shield stops!!! Its TX AND RX Leds turn off and it stops receiving and transmitting data. (while it is working, these LEDs are constantly blinking). The ethernet basically hangs.

The peculiar thing is that this lasts only 30-60 secs (sometimes longer) and then it starts working again. This whole thing repeats itself. It is working 5-10 mins then it stops 30-60 secs then it starts working again,which is annoying. (When it stops, I open the serial monitor or just simply touch the board and it starts working, weird right ??)Something important might happen during its off time and the arduino might not detect it.

Do you have any idea about what the problem is ? I also looked for it on the internet and saw some comments saying that this might be due to something about the buffer or over-heating. If so, how can i fix that ?

I know that lots of people are having the same sort of problem with this shield, and hopping that someone has the solution.

If you have something that might help, please let me know, I'd appreciate.

So thanks in advance.

Emin

If the power was interrupted, the w5100 would reset and lose its network settings, so I would rule that out.

If it overheated, I would expect very erratic performance after the recovery, so I don't think that is it.

Check to insure the ethernet shield is firmly inserted into the Arduino. If the pins are not making good contact, that could cause the problem you describe, especially the "when I touch it, it starts working again" phenomenon.

If that fails, I recommend posting your code. I've been using the ethernet shield for a couple years now with excellent results lately. It took a while for me to get most of the problems ironed out of my code.

Thank you for caring and the advice.

I tried something different a few hours ago and since then it's been working without any fault or problem. I found the solution here (actually not so sure this is the solution because it's been only 1.5 hours and don't know if it will do the same thing later on).

What i did was the following;

1-) I simply removed all the "Serial.println("x")" lines in the code (I used to print all the fetched data out on the serial monitor for debugging purposes. It turned out that that was slowing it down somehow). I think that the code runs much faster now.

2-) I used a delay of 500 ms inside the loop before making the next request. This caused a bit longer delay on the LCD display (now i can see the change about 6-7 secs later but that's not a big deal for now)

[I don't still know the exact problem,]

Apparently, these two were making the Ethernet shield behave like that.

Now it is still working and seems to be going to work in a long time.

I hope that gives you a clue about what is really going on.

Thanks again.

I use a baud rate of 115200 for my serial output and abbreviate my serial debug messages to as short as possible, and it doesn't seem to affect my sketches that way. How often are you making requests?

If I want fast network communication, especially localnet, then I use UDP packets. Ten updates per second is easily obtained.

I have never thought of playing around with the baud rate. It is always 9600 in my codes. However, today i learned that this really might matter in such a case. So, i'll take it into account for sure from now on.

The requests were in a loop like below

void loop()
{
.
.
httpRequest(); // makes a request if the client is connected
.
.

}

I modified it as below

void loop()
{
delay(500);
.
httpRequest(); // makes a request if the client is connected
.
.
}

This is not the final code of course, i'll change it and probably make the request in a timer interrupt about every sec since the main program will have lots of things to do. I just wanted to see if the ethernet shield works properly.

I don't know about UDP packets, so could you give me a helpful reference link or a piece of code from which I can learn.

Thank you so much again. I am really pleased.

Kind regards.

Yes, the baud rate really makes difference! The Serial print functions are blocking once you fill up the serial transmit buffer, at least from the experiments I tried.

The NTP client example included with the IDE was my starting point. I use Linux for the UDP "server". What OS are you using on your server now? There really isn't a "server" with UDP, but since the NTP protocol refers to the NTP server as a server, so will I. Currently I use a Raspberry Pi as the server.