Generic Ethernet shield vs Official Ethernet shield

I have an official arduino Ethernet shield and a generic Ethernet shield. The official shield works without any problems, but the generic shield is very slow and sometimes does not work at all.

I suspect it's got to do with the SPI bus. When I test the SD card only it seems fine and when I test the Ethernet port only it seams fine. The problem begins when I combine them in a web server configuration.

Anybody else experiencing the same problem? Can somebody shed some light on this problem?

I did some further test with my web server sketch and it seems that the generic board can not handle large HTML files. Everything works on the official shield but it does not work on the generic.

I also have to mention that the generic board needs to be physical powered down for it to work with smaller HTML files.

So my conclusion: Chuck the generic board and only use official boards from now on. The old saying is true "You get what you pay for".

I can't comment on HTML files, but I would have thought that the shield was just a communications device and and the size of the file would be immaterial.

The deafening silence in response to your plea

Anybody else experiencing the same problem?

Is likely to mean "no". This means you need to ascertain why you have a problem that nobody else has, particularly as it is very likely that more people use generic than official shields.

It could be that the shield is suss but, if so, it is probably just that one. It could be that you are the first person in the universe to tax it with a large HTML file, but it isn't likely, and you don't say what large is anyway. But the absence of any response suggests that user error is the most likely cause of your problem. This is not to deny that you have fixed a perceived problem, but you might not have fixed the real one.

I have re-written my sketch using the SDfat library. This solved my problem. It could be that I am doing something wrong with my code.

Here is the code of my Home automation attempt:

Part 1:

#include <SPI.h>
#include <Ethernet.h>
#include <SdFat.h>
#include <SdFatUtil.h>
// size of buffer used to capture HTTP requests
#define REQ_BUF_SZ 73
#define output_size 13
#define ind_size 4

// #define Num_SABaclup_lights 2
const uint8_t NUM_SENSORS = 12;
const int errorPin = 49;
const int chipSelect = 4;

/************ SDCARD STUFF ************/
SdFat sd;
SdFile root;
SdFile file;
SdFile myFile;

Sd2Card card;
SdVolume volume;
 
// store error strings in flash to save RAM
#define error(s) error_P(PSTR(s))
 
void error_P(const char* str) {
  PgmPrint("error: ");
  SerialPrintln_P(str);
  if (card.errorCode()) {
    PgmPrint("SD error: ");
    Serial.print(card.errorCode(), HEX);
    Serial.print(',');
    Serial.println(card.errorData(), HEX);
  }
  while(1);
}

// MAC address from Ethernet shield sticker under board
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x48, 0x67 };
IPAddress ip(192,168,101,201); // IP address, may need to change depending on network
IPAddress gateway( 192, 168, 101, 2  );
IPAddress subnet( 255,255,255,0 );
EthernetServer server(80);  // create a server at port 80

char HTTP_req[REQ_BUF_SZ] = {0}; // buffered HTTP request stored as null terminated string
char req_index = 0;              // index into HTTP_req buffer

//output number             1,        2,        3,        4,        5,        6,        7,        8,        9,       10,       11,       12,       13
char* LIStringOn[]= {"LI01=1", "LI02=1", "LI03=1", "LI04=1", "LI05=1", "LI06=1", "LI07=1", "LI08=1", "LI09=1", "LI10=1", "LI11=1", "LI12=1", "LI13=1"};
char* LIStringOff[]={"LI01=0", "LI02=0", "LI03=0", "LI04=0", "LI05=0", "LI06=0", "LI07=0", "LI08=0", "LI09=0", "LI10=0", "LI11=0", "LI12=0", "LI13=0"};
int LIout[] =       {      14,       15,       16,       17,       18,       19,       20,       21,       22,       23,       24,       25,       26};  //Output numbers
int ind[] =         {    2,      5 ,       6,      7};    //Information pins
char* INStringOn[]= { "On", "Close", "Close", "Close"};   //text for indication information ON
char* INStringOff[]={"Off",  "Open",  "Open",  "Open"};   //text for indication information OFF  

int Mains_State = 0;              //Used for mains Off alarm

void setup()
{
    // disable Ethernet chip
    pinMode(53, OUTPUT);
    digitalWrite(53, HIGH);
    
    Serial.begin(9600);       // for debugging
    // initialize SD card
    PgmPrint("Free RAM: ");
    Serial.println(FreeRam());  
 
    if (!card.init(SPI_HALF_SPEED, 4)) error("card.init failed!");
    if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
    
    if (!volume.init(&card)) error("vol.init failed!");  // initialize a FAT volume
    PgmPrint("Volume is FAT");
      Serial.println(volume.fatType(),DEC);
      Serial.println();
    if (!root.openRoot(&volume)) error("openRoot failed");
    // list file in root with date and size
    PgmPrintln("Files found in root:");
    root.ls(LS_DATE | LS_SIZE);
    Serial.println("");
       
    for (int i = 0; i<output_size; i++){ // Define outputs
    pinMode(LIout[i], OUTPUT);
    }
     
    for (int i = 0; i<ind_size; i++){ // Define inputs
    pinMode(ind[i], INPUT);
    }
      
    Ethernet.begin(mac, ip, gateway, gateway, subnet);  // initialize Ethernet device
    server.begin();           // start to listen for clients
    pinMode(3, OUTPUT);      // Buzzer output for mains
}

void(* resetFunc) (void) = 0;//declare reset function at address 0

void loop()
{
    EthernetClient client = server.available();  // try to get client

    if (client) {  // got client?
        digitalWrite(errorPin, LOW);
        boolean currentLineIsBlank = true;
        while (client.connected()) {
            if (client.available()) {   // client data available to read
                char c = client.read(); // read 1 byte (character) from client
                // limit the size of the stored received HTTP request
                // buffer first part of HTTP request in HTTP_req array (string)
                // leave last element in array as 0 to null terminate string (REQ_BUF_SZ - 1)
                if (req_index < (REQ_BUF_SZ - 1)) {
                    HTTP_req[req_index] = c;          // save HTTP request character
                    req_index++;
                }
                // last line of client request is blank and ends with \n
                // respond to client only after last line received
                if (c == '\n' && currentLineIsBlank) {
                    // send a standard http response header
                    client.println("HTTP/1.1 200 OK");
                    // remainder of header follows below, depending on if
                    // web page or XML page is requested
                    // Ajax request - send XML file
                    if (StrContains(HTTP_req, "ajax_inputs")) {
                        // send rest of HTTP header
                        client.println("Content-Type: text/xml");
                        client.println("Connection: keep-alive");
                        client.println();
                        Serial.println(HTTP_req);
                        SetSWs();
                        // send XML file containing input states
                        XML_response(client);
                    }
                    else {  // web page request
                        // send rest of HTTP header
                        client.println("Content-Type: text/html");
                        client.println("Connection: keep-alive");
                        client.println();
                        // send web page
                      if (!myFile.open("index.htm", O_READ)) {
                      sd.errorHalt("opening index.htm for read failed");
                      }
                      // read from the file until there's nothing else in it:
                      int data;
                      while ((data = myFile.read()) >= 0)
                      {
                      client.write(data);
                      }
                      myFile.close();
                    }
                    // display received HTTP request on serial port
                    // Serial.print(HTTP_req);
                    // reset buffer index and all buffer elements to 0
                    req_index = 0;
                    StrClear(HTTP_req, REQ_BUF_SZ);
                    break;
                }
                // every line of text received from the client ends with \r\n
                if (c == '\n') {
                    // last character on line of received text
                    // starting new line with next character read
                    currentLineIsBlank = true;
                } 
                else if (c != '\r') {
                    // a text character was received from client
                    currentLineIsBlank = false;
                }
            } // end if (client.available())
        } // end while (client.connected())
        delay(1);      // give the web browser time to receive the data
        client.stop(); // close the connection
    } // end if (client)

mainscheck();

} //End Void loop

Part 2:

// checks if received HTTP request is switching on/off SWs
void SetSWs(void)
{
for (int i = 0; i<output_size; i++){
    if (StrContains(HTTP_req, "alloff")){
      digitalWrite(LIout[i], LOW);
    }
    else{
        if (StrContains(HTTP_req, LIStringOn[i]))digitalWrite(LIout[i], HIGH);
        else if (StrContains(HTTP_req, LIStringOff[i]))digitalWrite(LIout[i], LOW);
        }
    }
}

// send the XML file SW status
void XML_response(EthernetClient cl)
{
    int count;                 // used by 'for' loops
    cl.print("<?xml version = \"1.0\" ?>");
    cl.print("<inputs>");

    // Indication
for (int i = 0; i < ind_size; i++) {
        cl.print("<ind>");
        if (digitalRead(ind[i])) cl.print(INStringOn[i]);
        else cl.print(INStringOff[i]);
        cl.println("</ind>");
    }

    // Outputs
for (int i = 0; i<output_size; i++){ 
    cl.print("<LI>");
    if (digitalRead(LIout[i])) cl.print("on");
    else cl.print("off");
    cl.println("</LI>");
    }
cl.print("</inputs>");
}

// sets every element of str to 0 (clears array)
void StrClear(char *str, char length)
{
    for (int i = 0; i < length; i++) {
        str[i] = 0;
    }
}

// searches for the string sfind in the string str
// returns 1 if string found
// returns 0 if string not found
char StrContains(char *str, char *sfind)
{
    char found = 0;
    char index = 0;
    char len;
    len = strlen(str);
    if (strlen(sfind) > len) return 0;
    while (index < len) {
        if (str[index] == sfind[found]) {
            found++;
            if (strlen(sfind) == found) return 1;
        }
        else found = 0;
        index++;
    }
    return 0; 
}

void mainscheck(void)
{
    if (!digitalRead(2)and Mains_State == 1){
  //    Serial.println("mains fail");  
      Mains_State = digitalRead(2);  // Store the main check value
    }
    if (digitalRead(2) and Mains_State == 0){   // Check is mains failure cleared
  //     Serial.println("mains return");
  // Buzzer for mains sullpy return
      digitalWrite(3, HIGH);
      delay (1000);
      digitalWrite(3, LOW);
      Mains_State = 1;
    }
}

HTML Code

Part 1:

<!DOCTYPE html>
<html>
    <head>
        <title>Automation</title>
        <meta name = 'viewport' content = 'user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width'/>
        <script language="JavaScript">
		minutesToCount = 10;
		strLI01 = "";
		strLI02 = "";
		strLI03 = "";
		strLI04 = "";
		strLI05 = "";
		strLI06 = "";		
		strLI07 = "";
		strLI08 = "";
		strLI09 = "";
		strLI10 = "";
		strLI11 = "";
		strLI12 = "";		
		strLI13 = "";
		var LI01_state = 0;
		var LI02_state = 0;
		var LI03_state = 0;
		var LI04_state = 0;
		var LI05_state = 0;
		var LI06_state = 0;		
		var LI07_state = 0;
		var LI08_state = 0;
		var LI09_state = 0;
		var LI10_state = 0;
		var LI11_state = 0;
		var LI12_state = 0;		
		var LI13_state = 0;
		function GetArduinoIO()
		{
			minutesToCount = 10;
			nocache = "&nocache=" + Math.random() * 1000000;
			var request = new XMLHttpRequest();
			request.onreadystatechange = function()
			{
				if (this.readyState == 4) {
					if (this.status == 200) {
						if (this.responseXML != null) {
							// XML file received - contains analog values, switch values and LI states
							var count;
							var num_in = this.responseXML.getElementsByTagName('ind').length;
							for (count = 0; count < num_in; count++) {
								document.getElementsByClassName("indications")[count].innerHTML =
									this.responseXML.getElementsByTagName('ind')[count].childNodes[0].nodeValue;
							}
							// LI 1
							if (this.responseXML.getElementsByTagName('LI')[0].childNodes[0].nodeValue === "on") {
								document.getElementById("LI1").className = "onbutt";
								LI01_state = 1;
							}
							else {
								document.getElementById("LI1").className = "offbutt";
								LI01_state = 0;
							}
							// LI 2
							if (this.responseXML.getElementsByTagName('LI')[1].childNodes[0].nodeValue === "on") {
								document.getElementById("LI2").className = "onbutt";
								LI02_state = 1;
							}
							else {
								document.getElementById("LI2").className = "offbutt";
								LI02_state = 0;
							}
							// LI 3
							if (this.responseXML.getElementsByTagName('LI')[2].childNodes[0].nodeValue === "on") {
								document.getElementById("LI3").className = "onbutt";
								LI03_state = 1;
							}
							else {
								document.getElementById("LI3").className = "offbutt";
								LI03_state = 0;
							}
							// LI 4
							if (this.responseXML.getElementsByTagName('LI')[3].childNodes[0].nodeValue === "on") {
								document.getElementById("LI4").className = "onbutt";
								LI04_state = 1;
							}
							else {
								document.getElementById("LI4").className = "offbutt";
								LI04_state = 0;
							}
							// LI 5
							if (this.responseXML.getElementsByTagName('LI')[4].childNodes[0].nodeValue === "on") {
								document.getElementById("LI5").className = "onbutt";
								LI05_state = 1;
							}
							else {
								document.getElementById("LI5").className = "offbutt";
								LI05_state = 0;
							}
							// LI 6
							if (this.responseXML.getElementsByTagName('LI')[5].childNodes[0].nodeValue === "on") {
								document.getElementById("LI6").className = "onbutt";
								LI06_state = 1;
							}
							else {
								document.getElementById("LI6").className = "offbutt";
								LI06_state = 0;
							}
							// LI 7
							if (this.responseXML.getElementsByTagName('LI')[6].childNodes[0].nodeValue === "on") {
								document.getElementById("LI7").className = "onbutt";
								LI07_state = 1;
							}
							else {
								document.getElementById("LI7").className = "offbutt";
								LI07_state = 0;
							}
							// LI 8
							if (this.responseXML.getElementsByTagName('LI')[7].childNodes[0].nodeValue === "on") {
								document.getElementById("LI8").className = "onbutt";
								LI08_state = 1;
							}
							else {
								document.getElementById("LI8").className = "offbutt";
								LI8_state = 0;
							}
							// LI 9
							if (this.responseXML.getElementsByTagName('LI')[8].childNodes[0].nodeValue === "on") {
								document.getElementById("LI9").className = "onbutt";
								LI09_state = 1;
							}
							else {
								document.getElementById("LI9").className = "offbutt";
								LI09_state = 0;
							}
							// LI 10
							if (this.responseXML.getElementsByTagName('LI')[9].childNodes[0].nodeValue === "on") {
								document.getElementById("LI10").className = "onbutt";
								LI10_state = 1;
							}
							else {
								document.getElementById("LI10").className = "offbutt";
								LI10_state = 0;
							}
							// LI 11
							if (this.responseXML.getElementsByTagName('LI')[10].childNodes[0].nodeValue === "on") {
								document.getElementById("LI11").className = "onbutt";
								LI11_state = 1;
							}
							else {
								document.getElementById("LI11").className = "offbutt";
								LI11_state = 0;
							}
							// LI 12
							if (this.responseXML.getElementsByTagName('LI')[11].childNodes[0].nodeValue === "on") {
								document.getElementById("LI12").className = "onbutt";
								LI12_state = 1;
							}
							else {
								document.getElementById("LI12").className = "offbutt";
								LI12_state = 0;
							}
							// LI 13
							if (this.responseXML.getElementsByTagName('LI')[12].childNodes[0].nodeValue === "on") {
								document.getElementById("LI13").className = "onbutt";
								LI13_state = 1;
							}
							else {
								document.getElementById("LI13").className = "offbutt";
								LI13_state = 0;
							}
						}
					}
				}
			}
			// send HTTP GET request with LIs to switch on/off if any
			request.open("GET", "ajax_inputs" +  strLI01 + strLI02 +strLI03 + strLI04 + strLI05 + strLI06 + strLI07 + strLI08 + strLI09 + strLI10 + strLI11 + strLI12 + strLI13 +nocache, true);
			request.send(null);

			strLI01 = "";
			strLI02 = "";
			strLI03 = "";
			strLI04 = "";
			strLI05 = "";
			strLI06 = "";			
			strLI07 = "";
			strLI08 = "";
			strLI09 = "";
			strLI10 = "";
			strLI11 = "";			
			strLI12 = "";
			strLI13 = "";		
		}
		// service LIs when checkbox checked/unchecked
		function GetButton1()
		{
		if (LI01_state === 1) {
				LI01_state = 0;
				strLI01 = "&LI01=0";
			}
			else {
				LI01_state = 1;
				strLI01 = "&LI01=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton2()
		{
		if (LI02_state === 1) {
				LI02_state = 0;
				strLI02 = "&LI02=0";
			}
			else {
				LI2_state = 1;
				strLI02 = "&LI02=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton3()
		{
		if (LI03_state === 1) {
				LI03_state = 0;
				strLI03 = "&LI03=0";
			}
			else {
				LI03_state = 1;
				strLI03 = "&LI03=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton4()
		{
		if (LI04_state === 1) {
				LI04_state = 0;
				strLI04 = "&LI04=0";
			}
			else {
				LI04_state = 1;
				strLI04 = "&LI04=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton5()
		{
		if (LI05_state === 1) {
				LI05_state = 0;
				strLI05 = "&LI05=0";
			}
			else {
				LI05_state = 1;
				strLI05 = "&LI05=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton6()
		{
		if (LI06_state === 1) {
				LI06_state = 0;
				strLI06 = "&LI06=0";
			}
			else {
				LI06_state = 1;
				strLI06 = "&LI06=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton7()
		{
		if (LI07_state === 1) {
				LI07_state = 0;
				strLI07 = "&LI07=0";
			}
			else {
				LI07_state = 1;
				strLI07 = "&LI07=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton8()
		{
		if (LI08_state === 1) {
				LI08_state = 0;
				strLI08 = "&LI08=0";
			}
			else {
				LI08_state = 1;
				strLI08 = "&LI08=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}

HTML Code

Part2:

		function GetButton9()
		{
		if (LI09_state === 1) {
				LI09_state = 0;
				strLI09 = "&LI09=0";
			}
			else {
				LI09_state = 1;
				strLI09 = "&LI09=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton10()
		{
		if (LI10_state === 1) {
				LI10_state = 0;
				strLI10 = "&LI10=0";
			}
			else {
				LI10_state = 1;
				strLI10 = "&LI10=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton11()
		{
		if (LI11_state === 1) {
				LI11_state = 0;
				strLI11 = "&LI11=0";
			}
			else {
				LI11_state = 1;
				strLI11 = "&LI11=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton12()
		{
		if (LI12_state === 1) {
				LI12_state = 0;
				strLI12 = "&LI12=0";
			}
			else {
				LI12_state = 1;
				strLI12 = "&LI12=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		function GetButton13()
		{
		if (LI13_state === 1) {
				LI13_state = 0;
				strLI13 = "&LI13=0";
			}
			else {
				LI13_state = 1;
				strLI13 = "&LI13=1";
			}
			GetArduinoIO();
			setTimeout('GetArduinoIO()', 1000);
		}
		
		function Alloff()
		{
		strLI01 = "&alloff";
		LI01_state = 0;
		LI02_state = 0;
		LI03_state = 0;
		LI04_state = 0;
		LI05_state = 0;
		LI06_state = 0;		
		LI07_state = 0;
		LI08_state = 0;
		LI09_state = 0;
		LI10_state = 0;		
		LI11_state = 0;
		LI12_state = 0;
		LI13_state = 0;		
		GetArduinoIO();
		setTimeout('GetArduinoIO()', 1000);
		}
		function start(){
    	startclock();
		GetArduinoIO();
		}
	</script>
	<style>
	body{			
		width: 320px;
		font: 12px Arial, sans-serif;
		float: left;
	}
	br {
   		display: block;
   		margin: 4px 0;
	}
	.wrapper{
   position: relative;
   float: left;
   width: 320px;
}
	.container {
		position: relative;
   		float: left;
		margin: 0 10px 10px 0;
		border: 1px solid;
	    width: 148px;
	} 
	.regbutt {
		width:120px;
		filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf',GradientType=0);
		background-color:#ededed;
		-moz-border-radius:15px;
		-webkit-border-radius:15px;
		border-radius:15px;
		border:2px solid #dcdcdc;
		display:inline-block;
		cursor:pointer;
		color:#777777;
		font-family:arial;
		font-size:14px;
		}
		.offbutt {
		width:120px;
		-moz-box-shadow: 2px 2px 20px -1px #3dc21b;
		-webkit-box-shadow: 2px 2px 20px -1px #3dc21b;
		box-shadow: 2px 2px 20px -1px #3dc21b;
		background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #44c767), color-stop(1, #5cbf2a));
		background:-moz-linear-gradient(top, #44c767 5%, #5cbf2a 100%);
		background:-webkit-linear-gradient(top, #44c767 5%, #5cbf2a 100%);
		background:-o-linear-gradient(top, #44c767 5%, #5cbf2a 100%);
		background:-ms-linear-gradient(top, #44c767 5%, #5cbf2a 100%);
		background:linear-gradient(to bottom, #44c767 5%, #5cbf2a 100%);
		filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#44c767', endColorstr='#5cbf2a',GradientType=0);
		background-color:#44c767;
		-moz-border-radius:15px;
		-webkit-border-radius:15px;
		border-radius:15px;
		border:2px solid #18ab29;
		display:inline-block;
		cursor:pointer;
		color:#ffffff;
		font-family:arial;
		font-size:14px;
		}
		.onbutt {
		width:120px;
		-moz-box-shadow: 2px 2px 20px -1px #f5978e;
		-webkit-box-shadow: 2px 2px 20px -1px #f5978e;
		box-shadow: 2px 2px 20px -1px #f5978e;
		background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #f24537), color-stop(1, #c62d1f));
		background:-moz-linear-gradient(top, #f24537 5%, #c62d1f 100%);
		background:-webkit-linear-gradient(top, #f24537 5%, #c62d1f 100%);
		background:-o-linear-gradient(top, #f24537 5%, #c62d1f 100%);
		background:-ms-linear-gradient(top, #f24537 5%, #c62d1f 100%);
		background:linear-gradient(to bottom, #f24537 5%, #c62d1f 100%);
		filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f24537', endColorstr='#c62d1f',GradientType=0);
		background-color:#f24537;
		-moz-border-radius:15px;
		-webkit-border-radius:15px;
		border-radius:15px;
		border:2px solid #d02718;
		display:inline-block;
		cursor:pointer;
		color:#ffffff;
		font-family:arial;
		font-size:14px;
		}
		.regbutt:active, .onbutt:active, .offbutt:active{
	    position:relative;
	    top:3px;
		left:1px;
		}
		*{
		color: white;	
		font-family: Arial, Helvetica, sans-serif;
		-webkit-appearance: none;
		}
		
	</style>

</head>
<body onload="start()" style="background-color:#000">

<script>
function startclock() {

  if (minutesToCount!=0) {
    finalTime = new Date();
    minutesEnd = finalTime.getMinutes() + minutesToCount;
    finalTime.setMinutes(minutesEnd, finalTime.getSeconds());
    minutesToCount = 0;
  }

  currentTime = new Date();
  milliSecLeft = finalTime.getTime() - currentTime.getTime();
  currentTime.setTime(milliSecLeft);

  //Calculate and format the time elements
  minutes = currentTime.getMinutes();
  if (minutes < 10) { minutes = '0' + minutes; }
  seconds = currentTime.getSeconds();
  if (seconds < 10) { seconds = '0' + seconds; }

  //Display the time left
  timeLeftText = minutes + ' m ' + seconds + ' s ';
  document.getElementById('timeLeft').innerHTML = timeLeftText;

  //Recall the function if there is time left - or display end time
  if (milliSecLeft > 0) {
    setTimeout("startclock()", 500);
  } else {
	minutesToCount = 10;
	startclock();
    GetArduinoIO();
  }
}
</script>

<div class="wrapper">
<center>
	<h1>Automation</h1>

</center>
</div>

<div class="wrapper">
<center>
<div class="container">
	<em><strong>Information</strong></em>


	Mains Supply: <span class="indications"></span>

	Front door: <span class="indications"></span>

	Sliding door: <span class="indications"></span>

	Back door: <span class="indications"></span>

</div>
        <div class="container">
        Auto in: <span id="timeLeft"></span>
        <input type="button" value="Update" onClick="GetArduinoIO()" class="regbutt">


</div>

<div class="container" >
Turm all off

<input type="button" id="alloff" onclick="Alloff()" value="Switch All Off" class="regbutt">


</div>
</center>
</div>
<div class="wrapper">
<center>
<div class="container">	
<em><strong>Main Entrance</strong></em>

<input type="button" id="LI1" onclick="GetButton1()" value="Foyer" class="offbutt">


<input type="button" id="LI2" onclick="GetButton2()" value="Down Lights" class="offbutt">


<input type="button" id="LI3" onclick="GetButton3()" value="Outside" class="offbutt">


</div>
<div class="container">	
<em><strong>Sitting Room</strong></em>

<input type="button" id="LI8" onclick="GetButton8()" value="Main Lights" class="offbutt">


<input type="button" id="LI9" onclick="GetButton9()" value="Lamp" class="offbutt">


<input type="button" id="LI10" onclick="GetButton10()" value="Outside" class="offbutt">


</div>
<div class="container" >
<em><strong>Living Room</strong></em>

<input type="button" id="LI4" onclick="GetButton4()" value="Main Lights" class="offbutt">


<input type="button" id="LI5" onclick="GetButton5()" value="Down Lights" class="offbutt">


<input type="button" id="LI6" onclick="GetButton6()" value="Lamp Floor" class="offbutt">


<input type="button" id="LI7" onclick="GetButton7()" value="Lamp Stand" class="offbutt">


</div>
<div class="container">	
<em><strong>Kitchen</strong></em>

<input type="button" id="LI11" onclick="GetButton11()" value="Main Lights" class="offbutt">


</div>
<div class="container">	
<em><strong>Scullery</strong></em>

<input type="button" id="LI12" onclick="GetButton12()" value="Main Lights" class="offbutt">


<input type="button" id="LI13" onclick="GetButton13()" value="Outside" class="offbutt">


</div>


</div>
</body>
</html>

I am using a manual refresh in the code. I know this can be timed but I am implementing it on an existing network and having the device request an update every second will be to much strain on the network. If you connect from your cell phone from outside the local network it is also very slow. Nothing to do with the Arduino or the Shield but to cellular network, port forwarding and dynamic DNS.

The following code does not disable the ethernet chip.

void setup()
{
    // disable Ethernet chip
    pinMode(53, OUTPUT);
    digitalWrite(53, HIGH);

This code disables the w5100 SPI

void setup()
{
    // disable Ethernet chip
    pinMode(10, OUTPUT);
    digitalWrite(10, HIGH);

Thanks SurferTim, but I am using a Mega and the SS pin is on 53 when using a Mega.

erasmudj: Thanks SurferTim, but I am using a Mega and the SS pin is on 53 when using a Mega.

No. The w5100 slave select is on D10, no matter which Arduino the shield is connected to. The HARDWARE slave select (determines SPI master or slave) is D53, but that has nothing directly to do with disabling the w5100 SPI.

I use the Mega 2560 with the ethernet shield.

Thanks for the info.

I will change my sketch.

Update!!!

I did some more test on my original code utilizing the SD library and not to SDFat library and I was able to resolve the original problem by sending the data in 64 byte packets, rather than one byte per packet http://forum.arduino.cc/index.php/topic,134868.0.html.

It came back to my coding ability. :cold_sweat: