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 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?
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.
I also tried to connect the shield directly to rooter
Using duct tape? I could have told you that wouldn't work.
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.
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 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.
//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
}
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.)
Simple Ethernet test code that includes a MAC address number. With arduinos, you typically assign the MAC address in the code.
[/Users/nick/Desktop/Screen shot 2014-05-28 at 9.50.33 PM.png/img]
It doesn't work somehow. It says disconnected.
[/Users/nick/Desktop/Screen shot 2014-05-28 at 9.50.33 PM.png/img][/quote]
Do you really expect us to see a picture on your desktop? Move over, you're blocking the screen.
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.
You can use the mac address from zoomkat's code in reply #3.
SurferTim:
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 even if mac is from #3. Does it work for you?
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.
It says disconnected.
WHAT says "disconnected"? That text isn't anywhere in zoomcat's sketch.
What kind of router do you have?
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.
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
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
}
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.)
Maybe MAC adress is not my real problem. I have WPA2 security on my rooter and it requires a password to connect to Internet. So, I selected to share my Internet with other computer and... Yesssssssssss! Finally. Just reconnected few times my Ethernet Shield.
This exemple comes from:
http://www.instructables.com/id/Arduino-Ethernet-Shield-Tutorial/step4/Server/.
And I am using this sketch, which should display HTML page. But nothing happens... (I entered my IP and MAC addresses.)
/*
Web Server Demo
thrown together by Randy Sarafan
A simple web server that changes the page that is served, triggered by a button press.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
* Connect a button between Pin D2 and 5V
* Connect a 10K resistor between Pin D2 and ground
Based almost entirely upon Web Server by Tom Igoe and David Mellis
Edit history:
created 18 Dec 2009
by David A. Mellis
modified 4 Sep 2010
by Tom Igoe
*/
#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[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDA, 0x02 };
IPAddress ip(191,11,1,1); //<<< ENTER YOUR IP ADDRESS HERE!!!
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);
int buttonPress = 1;
void setup()
{
pinMode(2, INPUT);
// start the Ethernet connection and the server:
Ethernet.begin(mac, ip);
server.begin();
}
void loop()
{
buttonPress = digitalRead(2);
// listen for incoming clients
EthernetClient 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();
//serves a different version of a website depending on whether or not the button
//connected to pin 2 is pressed.
if (buttonPress == 1) {
client.println("<cke:html><cke:body bgcolor=#FFFFFF>LIGHT!</cke:body></cke:html>");
}
else if (buttonPress == 0){
client.println("<cke:html><cke:body bgcolor=#000000 text=#FFFFFF>DARK!</cke:body></cke:html>");
}
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();
}
}
IPAddress ip(191,11,1,1); //<<< ENTER YOUR IP ADDRESS HERE!!!
Are you sure that isn't the router's IP address? The address in your sketch needs to be the address of the arduino, not the address of the router. (Most devices will ask the router for an address, so you don't have to specify one. But that takes additional code.)
(You also have to pick an address that isn't currently in use on your network, but it should be ON your network. So the first parts of the address should match your router's LAN configuration.)
Routers usually use 192.168.1.1 for the router address (on network 192.168.0.0) This is because 192.168.x.x is RESERVED for exactly this sort of use. 191.11.x.x is NOT similarly reserved, and seems to belong to someone in Brazil. That doesn't quite mean that you can't use it, but it's not "good practice."
The address in your sketch needs to be the address of the arduino, not the address of the router
To identify Arduno's address, I used DHCPAddressPrinter code. I think this is my IP address: 192.168.2.3.
The most recent sketch you posted doesn't use DHCP. It also doesn't contain the IP address you said you think the arduino should have. WPA2 settings should be wireless-only and irrelevant to an ethernet-connected device.
I've completely lost track of how you have your arduino connected, how you have it configured, what sketch you're running, and ... pretty much everything else. Can you start over with a complete description of the current setup?