Only works with USB Power

Hello List. I'm new here, but working with the arduino 2 to two years. Excuse my bad English, I am Brazilian.

My problem is as follows:

I have a simple project where I use Arduino Ethernet Shield and Duemileve. The project has been running for 15 days for free.

But now what happens is the following, if I connect the Arduino only on the external source, LEDs accessing but he did not start the program. If I plug in a USB Arduino, the program starts normally.

If I plug in a USB Arduino, and then he started the program I connect the external USB deligar and it still works, but if I try to disconnect and reconnect only with the external SOURCE, accessing the LEDs, but the program does not initializes.

Does anyone know what component of my Arduino Ethernet Shield, or may be defective?

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

#define ONE_WIRE_BUS 8 //Sensor Digital Dallas DS18B20 Externo
volatile int porta = LOW;
const int buttonPin = 4;
int buttonState = 0;
int contador = 300;

float temp;
int tempPin = 0;

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress insideThermometer;

byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(177,54,53,8);
IPAddress gateway(187,42,53,1);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns(179, 28, 156, 1);

IPAddress server(189,18,142,19);

EthernetClient client;

void setup() {
pinMode(buttonPin, INPUT);
//Ethernet.begin(mac, ip);
Ethernet.begin(mac, ip, dns, gateway, subnet);
Serial.begin(9600);
delay(1000);
Serial.println("connecting...");

sensors.begin();
}

void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
delay(50);
buttonState = digitalRead(buttonPin);
if ( porta != buttonState ) {
porta = buttonState;
//connectToServerAci();
connectToServer();
contador = 300;
}
if ( contador == 0 ) {
//connectToServerTemp();
//connectToServerTemp2();
connectToServer();
contador = 300;
}
contador--;
}

void connectToServer() {
Serial.println("connecting to server...");

temp = analogRead(tempPin);
temp = (((temp/1023)*5)*100)-288;

if (client.connect(server, 80)) {
Serial.print("Temperature Interna: ");
Serial.println(temp);

sensors.requestTemperatures();

Serial.print("Temperatura Externa: ");
Serial.println(sensors.getTempCByIndex(0));

Serial.print("Porta 0: ");
Serial.println(porta);

Serial.println("connected");
client.print("GET /LeitorTemperaturaGeral.php?tp1=");
client.print(temp);
client.print("&tp2=");
client.print(sensors.getTempCByIndex(0));
client.print("&ac1=");
client.print(porta);
client.println(" HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
Serial.println("disconnecting.");
client.stop();
}

void connectToServerAci() {
Serial.println("connecting to server...");

if (client.connect(server, 80)) {
Serial.println("connected");
Serial.print("Acionamento Porta 1: ");
Serial.println(porta);
client.print("GET /LeitorTemperatura.php?tipo=ac1&valor=");
client.print(porta);
client.println(" HTTP/1.0");
client.println();
}
else {
Serial.println("connection failed");
}
Serial.println("disconnecting.");
client.stop();
}

void connectToServerTemp() {
Serial.println("connecting to server...");

temp = analogRead(tempPin);
temp = (((temp/1023)*5)*100)-288;

Serial.print("Temperature Interna: ");
Serial.println(temp);

if (client.connect(server, 80)) {
Serial.println("connected");
client.print("GET /LeitorTemperatura.php?tipo=tp1&valor=");
client.print(temp);
client.println(" HTTP/1.0");
client.println();
}
else {
Serial.println("connection failed");
}
Serial.println("disconnecting.");
client.stop();
}

void connectToServerTemp2() {
Serial.println("connecting to server...");
sensors.requestTemperatures();

Serial.print("Temperatura Externa: ");
Serial.println(sensors.getTempCByIndex(0));

if (client.connect(server, 80)) {
Serial.println("connected");
client.print("GET LeitorTemperatura.php?tipo=tp2&valor=");
client.print(sensors.getTempCByIndex(0));
client.println(" HTTP/1.0");
client.println();
}
else {
Serial.println("connection failed");
}
Serial.println("disconnecting.");
client.stop();
}

My first thought would be that your PSU connected to the Arduino DC in jack isn't any good or at least not big enough to work properly. I've not yet used an internet shield but I do know that they should have external power for best operation. The basic regulator is only really good for really light loads. Heavier power supply demands should be met 'off board'. In my case I use LCD's of all types and the backlights are always an issue so I use an external device for breadboarding and If I make a board there are two supplies, one for the processor and one for every thing else sharing only a common ground and it is wired in a star configuration where everything radiates or starts from one point to supply each required ground point. IMO

Doc

Forgot to mention, the external source is good, I've tested. Actually I have several external sources of tension different between 6V to 15V - 2A, and the problem occurs with any source.

You should use a multimeter to measure Vin and 5V when your external source is connected. It would also be helpful to make the measurements with the Ethernet shield connected and without it connected.

Vin = 5V = 8.96 and 4.95 with and without the shield

Vin = 5V = 8.96 and 4.95 with and without the shield

Confused.

Please format differently.

Please give, on separtate lines:

With shield:

Vin = ...
+5V = ...

Without shield:

Vin = ...
+5V = ...

Then we can see what is happening better.

With shield:

Vin = 8,96
+5V = 4,95

Without shield:

Vin = 8,96
+5V = 4,95