Arduino Ethernet Shield will not stay online ?

I have an Arduino Ethernet Shield that I did get to work. However, it does not stay working for long....

I am powering my Arduino with a 12 volt 1.2 Ah battery. Attached are 5 sonars, and a speaker...also powered by the battery is a router using about the same power as the Arduino board, and an IP camera using 600mAh. *** Updated battery to a 12 volt, 5 Ah Still disconnects Ethernet Shield after 4 or 5 successful tasks

With a newly charged 12 volt, I ran my Arduino program for about a minute before the Arduino Ethernet Shield was unreachable. The camera stays online, and the router, so power is to all devices.

Where I need help, how do I keep the Arduino Ethernet Shield online? This is the main code I use (NEXT THREE POSTS):

//Create a client connection
  EthernetClient client = server.available();
  if (client) 
  {
    while (client.connected()) 
    {
      if (client.available()) 
      {
        char c = client.read();
        //read char by char HTTP request
        if (readString.length() < 100) 
        {
          //store characters to string
          readString += c;
          //Serial.print(c);
        }
        //if HTTP request has ended (PREVIOUS SIGNALS DONE)
        if (c == '\n') 
        {
          //Serial.println(readString); //print to serial monitor for debuging
          client.println("HTTP/1.1 004A7 OK .ROBOTEEP Network Connected"); //send new page
          client.println("Content-Type: text/html");
          client.println();
          //client.println("Refresh: 5");//refresh every five seconds OR
          //client.println("<meta http-equiv=\"refresh\" content=\"5\">");//refresh every five seconds 
          client.println("<meta http-equiv=\"refresh\" content=\"5\">");//refresh every five seconds 
          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>ROBOTEEP Automation Interface</TITLE>");
          client.println("<meta name='apple-mobile-web-app-capable' content='yes' />");
          client.println("<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />");
          //client.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"http://arduino-autohome.googlecode.com/svn/trunk/autohome.css\" />");   
          //   Above line has example of Font and Paragraph and Background Formatting === comment out for own look
          client.println("</HEAD>");
          //client.println("<body bgcolor=\"#D0D0D0\">");
          client.println("<body bgcolor=\"grey\">");
          client.println("<hr/>");
          client.println("<hr/>");
          //client.println("<h4><center><img border=\"2\" src=\"https://lh3.googleusercontent.com/-C6BoJrRUFko/UEUFeCwkvdI/AAAAAAAAAOc/E7gcYvPV6r4/s960/Logo.jpg\" /></center></h4>");
          client.println("<CENTER>");
          // Relay Control Code
          //RELAY TABLE
          client.println("<center>");
          client.println("<table style=\"background-color: white;\" border=\"5\">");
          client.println("<tr>");
          client.println("<td>");
          client.println("<a href=\"/?AUXOn\"\">Turn On AUX  </a>  ");
          client.println("</td>");
          client.println("<td>");
          client.println(" &nbsp;");
          client.println("</td>");
          client.println("<td>"); 
          client.println("<a href=\"/?AUXOff\"\">Turn Off AUX</a>"); 
          client.println("</td>");
          client.println("<td>");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp; ");
          client.println("</td>");
          client.println("<td>");
          client.println("<a href=\"/?CameraOn\"\">Turn On Camera </a>  ");
          client.println("</td>");
          client.println("<td>");
          client.println(" &nbsp; ");
          client.println("</td>");
          client.println("<td>");
          client.println("<a href=\"/?CameraOff\"\">Turn Off Camera </a>");
          client.println("</td>");
          client.println("<td>");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ");
          client.println("</td>");
          client.println("<td>");
          client.println("<a href=\"http://192.168.0.115/doc/page/login.asp?_1422776186879\" target=\"external\">Open RobotEEP Video Feed</a>");// - 192.168.0.115 will be replaced with code that includes the PORT 8000
          client.println("</td>");
          client.println("</tr>");
          client.println("</table>");
          //IFRAME FOR FORWARD VIDEO FEED - 192.168.0.115 will be replaced with code that includes the PORT
          //client.println("<iframe id=\"myIframe1\" name=\"myIframe1\" src=\"http://192.168.0.104:7789\" height=\"600\" width=\"960\">");
          //client.println("<iframe id=\"myIframe1\" name=\"myIframe1\" src=\"http://192.168.0.115\" height=\"600\" width=\"1024\">");
          //client.println("</iframe>");
          client.println("
");
          client.println("<a href=\"http://192.168.0.104:7789\" target=\"myIframe1\">HOME DVR 1 &nbsp;&nbsp;</a> | <a href=\"http://71.11.198.253:7789\" target=\"myIframe1\">INTERNET DVR &nbsp;&nbsp;</a> | <a href=\"http://192.168.0.115/doc/page/login.asp?_1422776186879\" target=\"external\">ROBOTEEP (New Window)</a>");
          client.println("<center>");
          client.println("<table style=\"background-color: white;\" border=\"5\">");
          client.println("<tr>");
          client.println("<td>");
          client.println("<a href=\"/?End\"\">                                     Checks and Resets</a>");
          client.println("</td>");
          client.println("<td>");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
          client.println("</td>");
          client.println("<td>");
          client.println("<a href=\"/?AutoRVS\"\">                                      Autonomous Reverse</a>");
          client.println("</td>");
          client.println("<td>");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp; ");
          client.println("</td>");
          client.println("<td>");
          client.println("<a href=\"/?AutoFWD\"\">                                      Autonomous Forward</a>");
          client.println("</td>");
          client.println("<td>");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
          client.println("</td>");
          client.println("<td>");
          client.println("<a href=\"/?Shutdown\"\">                                      System Shutdown</a>");
          client.println("</td>");
          //client.println("</table>");
          client.println("<hr/>");
          //MOVEMENT SLECTIONS and DISTANCE READOUTS
          client.println("<table style=\"background-color: white;\" border=\"5\">");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp; ");
          if (digitalRead(AuxPowerRelayPin))
          { 
            client.print("<td align=\"center\" valign=\"middle\" style=\"background-color: black;\"><font color='darkblue'>AUX PWR OFF&nbsp;</td>");
          }
else
          {
            client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='green'>AUX PWR ON&nbsp;&nbsp;</font></td>");
          }
          client.println("<td>");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
          client.println("</td>");
          client.println("<td align=\"center\" valign=\"middle\">");
          client.println("<font size = '4' color='red'>");
          client.print(durationFWD);
          client.println(" inches  </font></td>");
          client.println("<td>");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ");
          client.println("</td>");
          if (digitalRead(CameraRelayPin))
          { 
            client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='darkblue'>CAMERA ON</td>");
          }
          else
          {
            client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='blue'>CAMERA OFF&nbsp;</font></td>");
          }
          client.println("</tr>");
          if (digitalRead(AuxPowerRelayPin))
          { 
            client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='darkblue'>AUX PWR OFF&nbsp;</td>");
          }
          else
          {
            client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='green'>AUX PWR ON&nbsp;&nbsp;</font></td>");
          }
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationFSLT);
          client.println(" inches  </font></td>");
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<a href=\"/?ForwardJump\"\">                                Move Forward</a>");
          client.println("</td>");
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationFSRT);
          client.println(" inches  </font></td>");
          if (digitalRead(CameraRelayPin))
          { 
            client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='darkblue'>CAMERA ON</td>");
          }
          else
          {
            client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='blue'>CAMERA OFF&nbsp;</font></td>");
          }
          client.println("</tr>");
          client.println("<tr>");
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationFLT);
          client.println(" inches  </font></td>");
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<a href=\"/?MFLT\"\">                                 Move Forward Left</a>");
          client.println("</td>");
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationBK);
          client.println(" inches  </font></td>");
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<a href=\"/?MFRT\"\">                                 Move Forward Right</a>");
          client.println("</td>");
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationFRT);
          client.println(" inches  </font></td>");
          client.println("</tr>");
          client.println("</table>");
          client.println("<table style=\"background-color: white;\" border=\"5\">");
          client.println(" &nbsp;&nbsp;&nbsp;&nbsp; ");
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='black'>");
          client.print("ROBOTEEP AWAITING COMMANDS");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          client.println("
");
          //client.print("ROBOTEEP Battery Voltage Read: ");
          //client.println("<font size = '4' color='red'>");
          //client.println(voltage);
client.println("</td>");
          client.println("</tr>");
          client.println("</table>");        
          client.println("</BODY>");
          client.println("</HTML>");
          delay(1);
          //stopping client
          //client.stop();
          // CONTROL ARDUINO PINs
          if(readString.indexOf("CameraOff") >0) 
          {
            digitalWrite(CameraRelayPin, HIGH);
            for (int thisNote = 0; thisNote <= 7; thisNote++) 
            { 
              int noteDuration = 1000/PauseNoteDurations[thisNote];
              tone(A4, PauseMelody[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            //Serial.println("Camera Off");
          }
          if(readString.indexOf("CameraOn") >0) 
          {
            digitalWrite(CameraRelayPin, LOW);
            PIRNoteDurationsPIRMelody();
            //Serial.println("Camera ON");
          }
          if(readString.indexOf("AUXOff") >0) //CHANGED TO AUXOff From CameraOff   0.2615 433pm
          {
            digitalWrite(CameraRelayPin, HIGH);
            for (int thisNote = 0; thisNote <= 7; thisNote++) 
            {
              int noteDuration = 1000/PauseNoteDurations[thisNote];
              tone(A4, PauseMelody[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
               delay(pauseBetweenNotes);
             noTone(A4);
            }
            //Serial.println("AUX OFF");
          }
          if(readString.indexOf("AUXOn") >0) 
          {
            digitalWrite(AuxPowerRelayPin, LOW);
            for (int thisNote = 0; thisNote <= 6; thisNote++) 
            {
              int noteDuration = 1000/PIRNoteDurations[thisNote];
              tone(A4, PIRMelody[thisNote],noteDuration);
               int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            //Serial.println("AUX ON");
          }
          if(readString.indexOf("AUXOff") >0) 
          {
            digitalWrite(AuxPowerRelayPin, HIGH);
            for (int thisNote = 0; thisNote <= 8; thisNote++) 
            {
              int noteDuration = 1000/PauseNoteDurations[thisNote];
              tone(A4, PauseMelody[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
          }
          if(readString.indexOf("Shutdown") >0) 
          {
            for (int Note = 0; Note < 8; Note++) 
            {
               int duration = pace/JBnoteDurations[Note];
               tone(A4, JBmelody[Note],duration);
               delay(duration*1);
               noTone(A4);
            }
            //Serial.println("Reset Attempt");
            //ADD SHUTDOWN SEQUENCES
            End();
          }
          if(readString.indexOf("End") >0) 
          {
            /*for (int Note = 0; Note < 54; Note++) 
            {
               int duration = pace/JBnoteDurations[Note];
               tone(A4, JBmelody[Note],duration);
                delay(duration*1.0);//was 1.2
               noTone(A4);
            }*/
            for (int thisNote = 0; thisNote < 15; thisNote++) 
            {
              int noteDuration = 1000/EscapeDurations7[thisNote];
              tone(A4, EscapeMelody7[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            //Serial.println("Reset Attempt");
            End();
          }
          if(readString.indexOf("AutoFWD") >0) 
          {
            for (int thisNote = 0; thisNote < 20; thisNote++) 
            {
             int noteDuration = 1000/EscapeDurations7[thisNote];
             tone(A4, EscapeMelody7[thisNote],noteDuration);
             int pauseBetweenNotes = noteDuration * 1.30;
             delay(pauseBetweenNotes);
              noTone(A4);
            }
            loop();
            //Forward();
            //Serial.println("Movement Forward Attempt");
          }
          if(readString.indexOf("ForwardJump") >0) 
          {
            for (int thisNote = 0; thisNote < 10; thisNote++) 
            {
              int noteDuration = 1000/EscapeDurations7[thisNote];
              tone(A4, EscapeMelody7[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            ForwardJump();
            //Serial.println("Movement Forward Attempt");
          }
          if(readString.indexOf("AutoRVS") >0) 
          {
            for (int thisNote = 0; thisNote < 15; thisNote++) 
            {
             int noteDuration = 1000/EscapeDurations7[thisNote];
             tone(A4, EscapeMelody7[thisNote],noteDuration);
             int pauseBetweenNotes = noteDuration * 1.30;
             delay(pauseBetweenNotes);
             noTone(A4);
            }
            EscapeReverse();
            //Serial.println("Movement Reverse Attempt");
          }
          if(readString.indexOf("MFLT") >0) 
          {
            for (int thisNote = 0; thisNote < 5; thisNote++) 
            {
             int noteDuration = 1000/noteDurations[thisNote];
             tone(A4, melody[thisNote],noteDuration);
             int pauseBetweenNotes = noteDuration * 1.30;
             delay(pauseBetweenNotes);
             noTone(A4);
            }
            LeftJump();
            //Serial.println("Movement Forward Left Attempt");
          }
          if(readString.indexOf("MFRT") >0) 
          {
            for (int thisNote = 0; thisNote < 5; thisNote++) 
            {
             int noteDuration = 1000/noteDurations[thisNote];
             tone(A4, melody[thisNote],noteDuration);
             int pauseBetweenNotes = noteDuration * 1.30;
             delay(pauseBetweenNotes);
             noTone(A4);
             }
             RightJump();
            //Serial.println("Movement Forward Right Attempt");
          }
          readString=""; //clearing string for next read   
        }//END OF if (c == '\n') (if HTTP request has ended)
      }//END OF if (client.available())
    }//END OF while (client.connected()) 
  }//END OF if (client)
  //===
  if (!client)
  {
    Serial.println("                                                   ===================================");
    Serial.println("                                                   NO INTERNET OR LOCAL PORT AVAILABLE");
    Serial.println("                                                   ===================================");
    int Cycle = 0;
    int CycleLimit = 200;
    if (EthernetControlCount >= 47)//START MAKING SOUNDS
    {
      while (Cycle <= CycleLimit)
      {
        int thisPitchValue = (Cycle + 120);
        int thisPitch = map(thisPitchValue, 400, 1000, 120, 1500);
          // play the pitch:
          tone(A4, thisPitch, 5);
          delay(1);
          Cycle += 1;
          CycleLimit -= 1;
      }
    }
    EthernetClient client = server.available();
    if (EthernetControlCount >= 50)//GIVE ENOUGH TIME FOR ROUTER AND CAMERA TO POWER UP 24-27 for Router
    {
      //Serial.println("                                                      Camera RELAY Now TURNED OFF");
      //Serial.println("                                                    Router RELAY is STILL TURNED ON ");
      //Serial.println("");
      //digitalWrite(CameraRelayPin, HIGH);//CHANGE TO LOW IF NEEDING CAMERA ON, EVEN THOUGH ETHERNET CONTROL IS NOT AVAILABLE
      //digitalWrite(AuxPowerRelayPin, LOW);
      EthernetControlCount = 1;
      //loop();//THIS STARTS ROBOTEEP MOVING IF NO CONNECTION IS MADE (COMMENT OUT TO WAIT FOR CONNECTION BEFORE MOVING)
    }
  }//END OF if (!client) 
  Serial.println(""); 
  delay(10);
  ShowSockStatus();
  //PIR();
  EthernetControl();

Uncomment the client.stop call. The client won’t disconnect and the socket becomes unusable.

          //stopping client
          client.stop();

This is the main code I use (NEXT THREE POSTS):

With all that static text I'm surprised your code didn't crash from lack of memory.

Thank you SurferTim and zoomkat.

SuferTim, I'll add that code back in and try it out.

zoomket, yes, I add allot of debug and leave old code for reference... So, the static text, is that, for example, the updated distances? the commented out stuff? or just everything going on in this section. Thank you for helping me understand.

Example of using the F() macro on static text.

            client.println(F("HTTP/1.1 200 OK")); //send new page on browser request
            client.println(F("Content-Type: text/html"));
            client.println();

            client.println(F("<HTML>"));
            client.println(F("<HEAD>"));
            client.println(F("<TITLE>Arduino GET test page</TITLE>"));
            client.println(F("</HEAD>"));
            client.println(F("<BODY>"));

            client.println(F("<H1>Zoomkat's simple Arduino 1.0 button</H1>"));

            // DIY buttons
            client.println(F("Pin5"));
            client.println(F("<a href=/?on2 target=inlineframe>ON</a>")); 
            client.println(F("<a href=/?off3 target=inlineframe>OFF</a>

")); 

            client.println(F("Pin6"));
            client.println(F("<a href=/?on4 target=inlineframe>ON</a>")); 
            client.println(F("<a href=/?off5 target=inlineframe>OFF</a>

")); 

            client.println(F("Pin7"));
            client.println(F("<a href=/?on6 target=inlineframe>ON</a>")); 
            client.println(F("<a href=/?off7 target=inlineframe>OFF</a>

")); 

            client.println(F("Pin8"));
            client.println(F("<a href=/?on8 target=inlineframe>ON</a>")); 
            client.println(F("<a href=/?off9 target=inlineframe>OFF</a>

")); 

            client.println(F("Pins"));
            client.println(F("&nbsp;<a href=/?off2468 target=inlineframe>ALL ON</a>")); 
            client.println(F("&nbsp;<a href=/?off3579 target=inlineframe>ALL OFF</a>")); 

            client.println(F("<IFRAME name=inlineframe style='display:none'>"));          
            client.println(F("</IFRAME>"));

            client.println(F("</BODY>"));
            client.println(F("</HTML>"));

FYI: The F() macro used with the client.print() and client.println() functions sends one character per packet. That can cause its own problems with some devices. I prefer using a character array, strcpy_P and PSTR.

char tBuffer[64];

// this combines your three calls to client.println() into one call to client.write()
strcpy_P(tBuffer,PSTR("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"));
client.write(tBuffer);

Not as "pretty", but more efficient. Each call to client.write() sends all text in one packet.

Alright, I’ve played with the code. I have made it simpler. It runs part of the time, like before, but the Arduino Mega is getting really hot. So, the code suggestions have freed up the memory but have not helped the project work. Is my Ethernet shield just bad? It has worked this way since I first got it, but assumed it was because I don’t know what I’m doing…

As far as troubleshooting the heat:
I have attached 9 volts to the Arduino, via a 12 volt battery stepped down in voltage. That gets hot.
Running it directly off the 12 volt, not dropping the voltage, gets it even hotter. I am confused!
My compile shows plenty of memory left. My Arduino does not have the 5volt or 3.3 volt sources used, at all.
With only data connections and one speaker on the A4 pin, this project should not be getting so hot.

The Ethernet shield is only a couple months old. The Arduino is about a year old.

My update code looks like this (NEXT THREE POSTS):

void EthernetControl()
{
  //COUNTER SECTION FOR EthernetControl()
  if (EthernetControlCount == 0 || EthernetControlCount == 20 || EthernetControlCount == 40 || EthernetControlCount == 60 || EthernetControlCount == 80)
  {
    int SoundSensorValue = 1000;
    while(SoundSensorValue >= 400, SoundSensorValue -= 100)
    { 
      int pitch = map(SoundSensorValue, 1000, 400, 200, 400);//MAP THE SONAR VALUES TO A WIDE RANGE OF PITCHES
      tone(A4, pitch, 1244);
    }
    for (int i=300; i<1544; i=i*1.01) { tone(A4,i,100); } delay(100); for (int i=2244; i>1708; i=i*.99)
    {
      tone(A4,i,150);
    }
  }
  delay(50);
  EthernetControlCount += 1;
  if (EthernetControlCount >= 300)
  {
    EthernetControlCount = 0;
  }
   
  //Create a client connection
  EthernetClient client = server.available();
  if (client) 
  {
    while (client.connected()) 
    {
      if (client.available()) 
      {
        char c = client.read();
        //read char by char HTTP request
        if (readString.length() < 100) 
        {
          //store characters to string
          readString += c;
        }
        //if HTTP request has ended (PREVIOUS SIGNALS DONE)
        if (c == '\n') 
        {
          //SONAR PINGS
          durationFLT = pingFLT(1001);//GOOD
            delay(29);
          durationFSLT = pingFSLT(1002);//GOOD
            delay(29);
          durationFWD = pingFWD(1003);//GOOD
            delay(29);  
          durationFSRT = pingFSRT(1004);//GOOD
            delay(29);
          durationFRT = pingFRT(1005);//GOOD
            delay(29);  
          durationBK = pingBK(1006);//GOOD
            delay(29);

          client.println(F("<CENTER>"));
          client.println(F("ROBOTEEP Network Connected")); //send new page
          client.println(F("Content-Type: text/html"));

          client.println("<meta http-equiv=\"refresh\" content=\"1\">");//refresh every three seconds - was 5, then 3 

          client.println(F("<HTML>"));
          client.println(F("<HEAD>"));
          client.println(F("<CENTER>"));
          client.println(F("<TITLE>ROBOTEEP</TITLE>"));
          client.println(F("<meta name='apple-mobile-web-app-capable' content='yes' />"));
          client.println(F("<meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' />"));
          client.println(F("</HEAD>"));
          client.println(F("<BODY>"));
          client.println(F("<body bgcolor=\"grey\">"));
client.println(F("<H1>ROBOTEEP Automation Interface</H1>"));
          client.println(F("<H2>Sonars Help Navigate Routes Based On Your Choices</H2>"));
          client.println(F("<H2>====</H2>"));
          client.println(F("<H2>Allow One Second Between Commands</H2>"));

          client.println(F("<center>"));
          client.println(F("<table style=\"background-color: white;\" border=\"5\">"));

          
          client.println(F("<tr>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println("<td align=\"center\" valign=\"middle\">");
          client.println("<font size = '4' color='red'>");
          client.print(durationFWD);
          client.println(" inches  </font></td>");

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("</tr>"));
          

          client.println(F("<tr>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));
          
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationFSLT);
          client.println(" inches  </font></td>");

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationFSRT);
          client.println(" inches  </font></td>");
          
          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("</tr>"));
          

          client.println(F("<tr>"));

          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationFLT);
          client.println(" inches  </font></td>");
          
          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("<a href=/?ForwardJump target=inlineframe>Jump FWD</a>")); 
          client.println(F("</td>"));
  
          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));
          
          client.println("<td align=\"center\" valign=\"middle\" >");
          client.println("<font size = '4' color='red'>");
          client.print(durationFRT);
          client.println(" inches  </font></td>");

          client.println(F("</tr>"));



          //SELECTIONS
          client.println(F("<tr>"));


          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));
          
          client.println(F("<td align=\"center\">"));
          client.print(F("<a href=/?MFLT target=inlineframe>Jump LT</a>")); 
          client.println(F("</td>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("<td align=\"center\">"));
          client.print(F("<a href=/?MFRT target=inlineframe>Jump RT</a>")); 
          client.println(F("</td>")); 
          
          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          
          client.println(F("</tr>"));


          client.println(F("<tr bgcolor=\"black\">"));
          client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='green'></font></td>");
          client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='green'></font></td>");
          client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='green'></font></td>");
          client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='green'></font></td>");
          client.print("<td align=\"center\" valign=\"middle\"  style=\"background-color: black;\"><font color='green'></font></td>");
          client.println(F("</tr>"));


          client.println(F("<tr>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>")); 

          client.println(F("<td align=\"center\">"));
          client.println(F("<a href=/?AutoFWD target=inlineframe>Auto FWD</a>

")); 
          client.println(F("<a href=/?AutoRVS target=inlineframe>Auto RVS</a>")); 
          client.println(F("</td>")); 

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>")); 

          client.println(F("<tr>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>")); 

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("<a href=/?BackwardJump target=inlineframe>Reverse Jump</a>"));
          client.println(F("</td>")); 

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>"));

          client.println(F("<td align=\"center\" valign=\"middle\" >"));
          client.println(F("</td>")); 

          client.println(F("</tr>"));
          
          client.println(F("</table>"));
          client.println(F("<IFRAME name=inlineframe style='display:none'>"));          
          client.println(F("</IFRAME>"));

          client.println(F("</BODY>"));
          client.println(F("</HTML>"));
          
          
          delay(1);
          //stopping client
          client.stop();//was commented out, changed back 20150702 1027am (SurferTim suggestion)
          // CONTROL ARDUINO PINs
          if(readString.indexOf("CameraOff") >0) 
          {
            //digitalWrite(CameraRelayPin, HIGH);
            for (int thisNote = 0; thisNote <= 7; thisNote++) 
            { 
              int noteDuration = 1000/PauseNoteDurations[thisNote];
              tone(A4, PauseMelody[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            readString = " "; //clearing string for next read
            EthernetControl();
          }
          if(readString.indexOf("CameraOn") >0) 
          {
            //digitalWrite(CameraRelayPin, LOW);
            PIRNoteDurationsPIRMelody();
            //Serial.println("Camera ON");
            readString = " "; //clearing string for next read
            EthernetControl();
          }
          if(readString.indexOf("AUXOn") >0) 
          {
            //digitalWrite(AuxPowerRelayPin, LOW);
            for (int thisNote = 0; thisNote <= 6; thisNote++) 
            {
              int noteDuration = 1000/PIRNoteDurations[thisNote];
              tone(A4, PIRMelody[thisNote],noteDuration);
               int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            readString = " "; //clearing string for next read
            EthernetControl();
          }
          if(readString.indexOf("AUXOff") >0) 
          {
            //digitalWrite(AuxPowerRelayPin, HIGH);
            for (int thisNote = 0; thisNote <= 8; thisNote++) 
            {
              int noteDuration = 1000/PauseNoteDurations[thisNote];
              tone(A4, PauseMelody[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            readString = " "; //clearing string for next read
            EthernetControl();
          }
          if(readString.indexOf("AutoFWD") >0) 
          {
            for (int thisNote = 0; thisNote < 20; thisNote++) 
            {
             int noteDuration = 1000/EscapeDurations7[thisNote];
             tone(A4, EscapeMelody7[thisNote],noteDuration);
             int pauseBetweenNotes = noteDuration * 1.30;
             delay(pauseBetweenNotes);
              noTone(A4);
            }
            readString = " "; //clearing string for next read
            EscapeSlow();
            EthernetControl();
          }
          if(readString.indexOf("ForwardJump") >0) 
          {
            for (int thisNote = 0; thisNote < 10; thisNote++) 
            {
              int noteDuration = 1000/EscapeDurations7[thisNote];
              tone(A4, EscapeMelody7[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            readString = " "; //clearing string for next read
            ForwardJump();
            EthernetControl();
          }
          if(readString.indexOf("BackwardJump") >0) 
          {
            for (int thisNote = 0; thisNote < 3; thisNote++) 
            {
              int noteDuration = 1000/EscapeDurations7[thisNote];
              tone(A4, EscapeMelody7[thisNote],noteDuration);
              int pauseBetweenNotes = noteDuration * 1.30;
              delay(pauseBetweenNotes);
              noTone(A4);
            }
            readString = " "; //clearing string for next read
            BackwardJump();
            EthernetControl();
          }
          if(readString.indexOf("AutoRVS") >0) 
          {
            for (int thisNote = 0; thisNote < 15; thisNote++) 
            {
             int noteDuration = 1000/EscapeDurations7[thisNote];
             tone(A4, EscapeMelody7[thisNote],noteDuration);
             int pauseBetweenNotes = noteDuration * 1.30;
             delay(pauseBetweenNotes);
             noTone(A4);
            }
            readString = " "; //clearing string for next read
            EscapeReverse();
            EthernetControl();
          }
          if(readString.indexOf("MFLT") >0) 
          {
            for (int thisNote = 0; thisNote < 5; thisNote++) 
            {
             int noteDuration = 1000/noteDurations[thisNote];
             tone(A4, melody[thisNote],noteDuration);
             int pauseBetweenNotes = noteDuration * 1.30;
             delay(pauseBetweenNotes);
             noTone(A4);
            }
            readString = " "; //clearing string for next read
            LeftJump();
            EthernetControl();
          }
          if(readString.indexOf("MFRT") >0) 
          {
            for (int thisNote = 0; thisNote < 5; thisNote++) 
            {
             int noteDuration = 1000/noteDurations[thisNote];
             tone(A4, melody[thisNote],noteDuration);
             int pauseBetweenNotes = noteDuration * 1.30;
             delay(pauseBetweenNotes);
             noTone(A4);
             }
             readString = " "; //clearing string for next read
             RightJump();
             EthernetControl();
          }
          readString = " "; //clearing string for next read   
        }//END OF if (c == '\n') (if HTTP request has ended)
      }//END OF if (client.available())
    }//END OF while (client.connected()) 
  }//END OF if (client)
  //===
  if (!client)
  {
    readString = " "; //clearing string for next read
    Serial.println("                                                   ===================================");
    Serial.println("                                                   NO INTERNET OR LOCAL PORT AVAILABLE");
    Serial.println("                                                   ===================================");
    int Cycle = 0;
    int CycleLimit = 200;
    //AwaitingInput();     ///COMMENTED OUT FOR TESTING
  }//END OF if (!client) 
  ShowSockStatus();
  EthernetControl();  
}//END OF void EthernetControl();

SHAtoday: As far as troubleshooting the heat: I have attached 9 volts to the Arduino, via a 12 volt battery stepped down in voltage. That gets hot. Running it directly off the 12 volt, not dropping the voltage, gets it even hotter. I am confused! My compile shows plenty of memory left. My Arduino does not have the 5volt or 3.3 volt sources used, at all. With only data connections and one speaker on the A4 pin, this project should not be getting so hot.

The voltage regulator on the Mega is just a linear regulator. The regulator works by converting ((input voltage -output voltage)*output current) to heat. And the regulator is mounted with a very small amount of copper PCB to dissipate this energy.

I have not been able to obtain current usage figures for the Base Mega2560, but the Ethernet Shield consumes over 150ma so if the Mega uses 50ma that is 200ma usage. Lets calculate

(12v battery) anywhere from 10V(dead) to 14.4(charging High) lets pick 12.8 (float value) 12.8-5=7.8 7.8v*.200A= 1.56W

Now, I don't know what the thermal mass the Mega2560 has to dissipate this heat, but 2watts is a lot of heat! for SMT regulators to dissipate.

Here is a good treatise from TI on Heat management design considerations

Just measure the temperature on the regulator. If you cannot hold your finger on it without burning it is over 135 degrees, if you get a second degree burn(blister) on you finger in 5 seconds it is over 155 degrees if you can read the part number off the blister on your finger it is over 190 degrees.

Anything over 155F (68C) is too hot.

NOTE: I recommend using an actual thermometer, fingertips blisters are idiosyncratic, some people have low pain tolerance, and personally this method is contra indicated unless other peoples fingers are used :smiling_imp:

I think your problem is HEAT! The regulator is overheating and shutting down. after continuous use. Create an external power regulator with adequate thermal dissipation (heatSinks).

Chuck.


Check out my Kickstarter Project Memory Panes an expansion RAM Shield for Mega2560's. It adds 1MB of RAM for those projects where 8KB is not enough.

Thank you for your help.

It is Not hot enough to blister me, although it is uncomfortably hot…5 seconds does make me want to remove my finger.
I’ve got the Arduino running on a 12 to 9 volt step down power regulator,
like this one

http://www.amazon.com/Kimdrox-Converter-Power-Supply-Module/dp/B00LXTCQHM/ref=sr_1_1/175-8198563-6103967?ie=UTF8&qid=1436300040&sr=8-1&keywords=12v+to+9v&pebp=1436300060074&perid=10DF7XTT3NPB0AT8N2VP

And, I have another step down from the 12 volt battery to supply 5 volt devices like the SR04s.

Today, I tried using only the pins on the Arduino, not the ones on the Ethernet Shield.
I think it was running a little better. The 12 battery got down to 7 volts, though, so I had to recharge.
I know the pins are pass-though, in regard to the Ethernet shield, but not using them does appear to help…I’m anxious to get my 12-volt recharged so I can test more.

All this being said, when it doe work, it has about a 1-2 second lag between sending commands and the commands being performed. Then, it takes another 1-2 seconds to refresh my connection.
I added code to refresh every second, but everything is still slow.

The code I added

client.println("<meta http-equiv=\"refresh\" content=\"1\">");

Well, I've tried different voltage connections to feed the Arduino (from 9 volts to 14 volts), I have tried stripping my code to make it very simple, I've tried using less devices connected to the Arduino, I've tried using less memory per call,...

My Ethernet shield barely connects, has a 2 to 3 second delay when it can, and just will not stay connected for more than a minute.

My Arduino gets hot enough to blister (next to the power input jack). Once it gets that hot, it starts to fail. I have a great project, but it just doesn't work with an overheating Arduino board and failing Arduino shields.

Thank you for your help.

To others, I suggest keeping it really simple with Arduino.

My Arduino gets hot enough to blister (next to the power input jack).

Sounds like you're really overworking the 5V regulator. Use a lower incoming voltage level (7.5V if you can) or offload some of the 5V current you are asking the regulator to supply. http://www.dipmicro.com/store/DCA-07510