Go Down

Topic: Where can I get MAC address on my Ethernet shield? (Read 48247 times) previous topic - next topic

Nick2012Future

There supposed to be a sticker on the bottom of the shield, but what do I do if I don<t have it. The only thing is <HR911105A> and I guess it's not MAC number. I also tried to connect the shield directly to rooter, hoping to see it on my status. That wasn't successful. Any suggestions? 

PaulS

The MAC address is simply a 6 byte number that no other computer in your network has. just make something up. It is not likely to be used by another computer on your network. If it, by some small miracle is, change it to some other random 6 bytes.

Quote
I also tried to connect the shield directly to rooter

Using duct tape? I could have told you that wouldn't work.
The art of getting good answers lies in asking good questions.

JChristensen

A unique MAC address can be purchased in hardware form for $0.30 or less.  If your project also uses a real-time clock, these can be had that also contain a unique MAC address.

No I don't work for Microchip, hold their stock, or have any other relationship with them.  :D

zoomkat


There supposed to be a sticker on the bottom of the shield, but what do I do if I don<t have it. The only thing is <HR911105A> and I guess it's not MAC number. I also tried to connect the shield directly to rooter, hoping to see it on my status. That wasn't successful. Any suggestions? 


Simple Ethernet test code that includes a MAC address number. With arduinos, you typically assign the MAC address in the code.

Code: [Select]

//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields
//remove SD card if inserted

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600);
  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  } 
}

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.1"); //download text
    client.println("Host: web.comporium.net");
    client.println("Connection: close");  //close 1.1 persistent connection 
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

westfw

Quote
you typically assign the MAC address

Which is to say: neither the Wiznet-based (official, smart) ethernet shields, nor the en28j60-based (cheap, dumb) ethernet shields have a built-in ethernet address like a PC ethernet card would, you MUST set up the HW address from software.  As the OP says, there should be a sticker on the board, but it is just an address assigned from the Arduino (?) address space, and doesn't match up with anything that is actually programmed onto the board hardware.

You can't quite pick ANY unique address, because some of them are multicasts or have other special meanings, but there are a bunch of "locally administered" ethernet addresses that have bit1 of the first byte set (and bit0 clear), and you should be pretty safe picking any of those.  Something like AA-BB-CC-00-xx-yy (where xx and yy are numbers you pick different for each of your arduinos) would work fine and be particularly identifiable in traces, dhcp tables, and etc.  Arduino Unos used to ship with a serial number in their EEPROM, but I don't know whether they still do (and it's pretty easy for it to get erased.)

Nick2012Future

Quote
Simple Ethernet test code that includes a MAC address number. With arduinos, you typically assign the MAC address in the code.


[img][/Users/nick/Desktop/Screen shot 2014-05-28 at 9.50.33 PM.png/img]

It doesn't work somehow. It says disconnected.

PaulS

Quote
[img][/Users/nick/Desktop/Screen shot 2014-05-28 at 9.50.33 PM.png/img]

Do you really expect us to see a picture on your desktop? Move over, you're blocking the screen.
The art of getting good answers lies in asking good questions.

Nick2012Future

Quote
Do you really expect us to see a picture on your desktop? Move over, you're blocking the screen.

I just draged and dropped the picture in the messenger. So I am figuring out  it doesn't work so. 

SurferTim

You can use the mac address from zoomkat's code in reply #3.

Nick2012Future


You can use the mac address from zoomkat's code in reply #3

I forgot to remove SD card, anyway I got the same result <disconnected>  even if mac is from #3. Does it work for you?

SurferTim

Works for me. Post the code you are using.

The only time it won't work is if you are using 2 ethernet shields on the same localnet with that same mac address.

westfw

Quote
It says disconnected.

WHAT says "disconnected"?  That text isn't anywhere in zoomcat's sketch.
What kind of router do you have?

Nick2012Future

Quote
there should be a sticker on the board, but it is just an address assigned from the Arduino (?) address space, and doesn't match up with anything that is actually programmed onto the board hardware


I already told there is absolutely no sticker anywhere, the only thing I have it's "HR911105A" . I remember we used LabView to assign mac address to Arduino board. Can this procedure be repeated or it takes only once? If it can be repeated anymore so, I don't remember it's mac.   

Nick2012Future

Quote
Works for me. Post the code you are using.


I am using the same code as in reply#3. It should say "connected" . I have D-LInk rooter:

http://www3.pcmag.com/media/images/203587-d-link-xtreme-n-dual-band-gigabit-router-dir-825-front.jpg


Code: [Select]
if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.1"); //download text
    client.println("Host: web.comporium.net");
    client.println("Connection: close");  //close 1.1 persistent connection 
    client.println(); //end of get request
  }
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor
  }

  Serial.println();
  [u]Serial.println("disconnecting.");[/u]
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

westfw

Quote
I already told there is absolutely no sticker

yes, I saw that.  My comment was "THEY should have put a sticker on it", not "YOU should look for the sticker."

Every sketch that you run has to load a MAC address onto the shield; it doesn't have any permanent storage at all.
A particular sketch MIGHT decide to use EEPROM to store a MAC address so that it would be easy for different boards to have semi-permanent different addresses that don't conflict, but there's no "standard" way to store that address (the sketch would have to do it on its own.)  It looks like all of the ethernet examples use a hardwired DEAD.BEEF.FEED, so don't try to run more than one of the examples on the same net at the same time.

(There are a number of "zero-config" protocols out there, but I think they all depend on the devices already having a "factory-assigned" unique MAC address in the hardware, which the Arduino ethernet boards DO NOT HAVE.)

Go Up