0

I am just running the below DHCPAddressPrinter sketch in Arduino example to setup EthernetShield with MAC and IP

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = {
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02
};


// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  // this check is only needed on the Leonardo:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for (;;)
      ;
  }
  // print your local IP address:
  Serial.print("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print(".");
  }
  Serial.println();
}

void loop() {

 }

After uploading the sketch to arduino,below is the output shown in console

Sketch uses 13,614 bytes (42%) of program storage space. Maximum is 32,256 bytes.
Global variables use 539 bytes (26%) of dynamic memory, leaving 1,509 bytes for local variables. Maximum is 2,048 bytes.

And there is nothing shown in Serial monitor This is the image of Ethernetshield's some leds glowing after connecting to Router. My router is Binatone Wireless ADSL2+ Router.

enter image description here enter image description here

I checked arp -a,

C:\Users\Radhamani>arp -a

Interface: 192.168.1.6 --- 0x3
  Internet Address      Physical Address      Type
  192.168.1.1           6c-fd-b9-24-c6-fe     dynamic
  192.168.1.255         ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.251           01-00-5e-00-00-fb     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static
  255.255.255.255       ff-ff-ff-ff-ff-ff     static


Interface: 192.168.198.1 --- 0xe
  Internet Address      Physical Address      Type
  192.168.198.255       ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.251           01-00-5e-00-00-fb     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static


Interface: 192.168.234.1 --- 0xf
  Internet Address      Physical Address      Type
  192.168.234.255       ff-ff-ff-ff-ff-ff     static
  224.0.0.22            01-00-5e-00-00-16     static
  224.0.0.251           01-00-5e-00-00-fb     static
  224.0.0.252           01-00-5e-00-00-fc     static
  239.255.255.250       01-00-5e-7f-ff-fa     static

Complete result of ipconfig:

Wireless LAN adapter Wi-Fi:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::901:3297:48ad:9e7d%3
   IPv4 Address. . . . . . . . . . . : 192.168.1.6
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1
Ethernet adapter VMware Network Adapter VMnet1:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::c954:40b2:c8c1:de0%14
   IPv4 Address. . . . . . . . . . . : 192.168.198.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :
Ethernet adapter VMware Network Adapter VMnet8:
   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::2837:7e01:c799:d627%15
   IPv4 Address. . . . . . . . . . . : 192.168.234.1
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . :

Serial.println in the program is not printing anything.Looks like Ethernet shield is not getting IP.I am not sure where I am wrong.Please help me to fix this issue

migrated from electronics.stackexchange.com Mar 15 '15 at 18:02

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

2

Based on the image .. i see that the programmer pins at the back of the shield and the arduino aren't connected properly.. That might be the error or at least happened with me. Apart from that, certain network need to identify the mac address from a look up table and if the shield mac address matches, then only network transactions are allowed. Also i suggest you to drop the virtual machine mac address and networking protocols and try upon the base OS which you have on your computer.

0

The SD might need disconnecting. Add below to setup().

pinMode(10, OUTPUT);
digitalWrite(10, HIGH);

Also check the pin assignment for the W5100 (in the Ethernet library).

Cheers!

-1

check the DHCP service of your router is active or not :)

  • I had the same problem with my project in which I was using Arduino Ethernet schield 2. I suppose to get the IP address in serial moniter using simple sample program but later I found that when we use Arduino Ethernet schield 2 we need to use the library "<Ethernet2.h" instaed of Ethernet.h – Amol Nardelwar Jan 2 '17 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.