Ethernet shield, can't ping

Hi,
after googling and reading quite a few threads about ethernet shield troubleshooting I ended up with no result. So:
got the ethernet shield on my Arduino Uno.
Loaded default server sketch.

  • When connecting to my switch I get steady green led and occasionally blinking orange on connector. Orange led blinks when I try to ping but ping says "Destination host unreachable".
  • When connecting through cross cable to my PC (Vista) I get steady green led and a lots of orange blinks initially, but it goes off later. Orange led stays off when I try to ping. Ping says: ping transmit failed, error code 1231. (my ipV6 is disabled in network settings, firewall disabled)

In both cases nothing comes up from shield ip in browser. I used default shield ip and MAC (I did make sure that my pc has different last number of ip)
I tried powering from usb and 6V power adaptor.

As my experience with networking is limited to switch, router and a couple of computers and I didn't use full size shields before (only RF transmitters, servos, relays etc.) I have no Idea what could be wrong.
Should I return the shield?
Thanks!

You probably need to post the type of ethernet shield you are using and your arduino code.

Arduino Ethernet Shield V1.1
ENC28J60 controller
port label: HanRun HR911102A 09/44

Default Arduino 0021 example sketch.
Have tried changing IP/MAC.

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192,168,1, 177 };

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
Server server(80);

void setup()
{
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
}

void loop()
{
// listen for incoming clients
Client client = server.available();
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();

// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(analogRead(analogChannel));
client.println("
");
}
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
}

Arduino Ethernet Shield V1.1
ENC28J60 controller
port label: HanRun HR911102A 09/44

Are you using the appropriate librarys and code with the ENC28J60 based ethernet shield? The ENC28J60 is significantly different and more complex to program than the W5100 based shield.

zoomkat:

Arduino Ethernet Shield V1.1
ENC28J60 controller
port label: HanRun HR911102A 09/44

Are you using the appropriate librarys and code with the ENC28J60 based ethernet shield? The ENC28J60 is significantly different and more complex to program than the W5100 based shield.

So that's the problem!
I thought they're compatible. Thanks, saved a lot of time!

Up and running.
Thanks again!

For someone as clumsy as me :slight_smile:
the library for ENC28J60 based shields:
http://www.nuelectronics.com/estore/index.php?main_page=product_info&cPath=1&products_id=4&zenid=4f8763dd32227d54ee11ac472d5c09a4

Dont forget to set an static ip address on your pc, usually it's set as DHCP address that will not works in thta case.

So from set an adress like 192.168.1.1 to ethernet adapter on the pc.

Hi,

i am getting problem in my project when i send command to arduino via ethernet shield to trigger relay.

normaly it works fine but some time when i send command then i got error of ping drop .

or else its totaly got unreachble from pinging.

component:

1.Arduino Uno R3 ATmega328P ATMEGA16U2 Compatible with USB Cable
2.Ethernet W5100 Shield Network Expansion Board W/
3. 2 CHANNEL 5V RELAY BOARD MODULE RELAY EXPANSION BOARD

#include <SPI.h> // needed for Arduino versions later than 0018
#include <Ethernet.h> // Ethernet board connected - Uses A0, A1, (D2 or D4), D10, D11, D12, D13
#include <EthernetUdp.h> // UDP library from: bjoern@cs.stanford.edu 12/30/2008

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x78, 0xE0 }; // <------- PUT YOUR MAC Address Here
byte ip[] = { 10, 195, 82, 251 }; // <------- PUT YOUR IP Address Here
unsigned int localPort = 8888; // Local IP port to listen on
byte gateway[] = { 10, 195, 82, 1 }; // <------- PUT YOUR ROUTERS IP Address to which your shield is connected Here
byte subnet[] = { 255, 255, 255, 0 }; // <------- It will be as it is in most of the cases
EthernetServer server(80); // <------- It's Defaulf Server Port for Ethernet Shield

char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; // buffer to hold incoming packet
EthernetUDP Udp; // An EthernetUDP instance to let us send and receive packets over UDP

int PinA = 3; // Switch Pin 5
int PinB = 4;
int PinC = 5; // Switch Pin 6

void setup() { // run setup only once on boot

Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
Udp.begin(localPort); // Start UDP Connection

pinMode(PinA, OUTPUT); // attach the pin
pinMode(PinB, OUTPUT);
pinMode(PinC, OUTPUT); // attach the pin
digitalWrite(PinA, LOW);
digitalWrite(PinB, HIGH);
digitalWrite(PinC, HIGH);

} // end of setup

void loop() // Start Running System
{
int packetSize = Udp.parsePacket(); // if there's data available, read a packet
if(packetSize)
{
int read = Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE); // read the packet into packetBufffer
packetBuffer[read] = 0;
char ch = packetBuffer[0];

switch(ch)
{
case '0': // if 0 is sent via udp then do this -->>
digitalWrite(PinA, LOW); // Turn PinA Off
break; // end of case 0
case '1': // if 1 is sent via udp then do this -->>
digitalWrite(PinA, HIGH); // Turn PinA On
break; // end of case 1
case '2': // if 2 is sent via udp then do this -->>
digitalWrite(PinB, LOW); // Turn PinB Off
break; // end of case 2
case '3': // if 3 is sent via udp then do this -->>
digitalWrite(PinB, HIGH); // Turn PinB On
break; // end of case 3
case '4': // if 3 is sent via udp then do this -->>
digitalWrite(PinC, LOW); // Turn PinB On
break; // end of case 3
case '5': // if 3 is sent via udp then do this -->>
digitalWrite(PinC, HIGH); // Turn PinB On
break; // end of case 3

default : // if recived info via udp and not found in the case do this -->>

break; // end of case not found
}
}

delay(15); // waits 15ms for udp input wait ...
} // end system run, but now loop and start system run again