Tag Archives: Arduino Ethernet

Arduino Ethernet shield problem when on External Power

When Arduino/ethernet shield is connected with an external voltage source I have to press reset button to make it work. But when I use it with the USB source everything works fine. This code is not exactly pretty, but it solves the problem of the need to restart on Ethernet shield startup. Open relay and hooked the coil pins to ground and digital pin 02, and the switched pins to ground and the reset pin. The trick is to before initializing the Ethernet library, check an address in EEPROM. If the flag is 0, we set it to 1 and then trigger the relay, and the unit resets. If the flag is 1, we assume that we just did a warm reset and set the flag back to 0, for next time we power up.

[java]
<pre>int relayPin = 02;
int addr = 128;

void eepThang() {
eep_value = EEPROM.read(addr);
if (eep_value == 1) {
Serial.println("already reset. writing 0");
EEPROM.write(addr, 0);
}
else {
Serial.println("not reset.. writing 1, restarting");
Serial.println(eep_value);
EEPROM.write(addr, 1);
Serial.println("done wrote… here we go");
digitalWrite(relayPin, HIGH);
delay(1000);
}
}</pre>
[/java]

source : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225354009/15