NEWBIE needs Ethernet Help!

ipsolutions:
Surely there is something simple, stupidly wrong with what I'm doing.

If you can't look at the provided code and see the words "mac" and "ip" on the third/fourth lines (after the comment) then there's not much hope...

PS: Arduino shields don't do DHCP.

The library you need for the example at the Sheepdog Software is part of the standard Arduino environment... if you installed it correctly.

Bit harsh, Fungus... we weren't born knowing about "MAC", "IP", "DCHP", were we?

These things explained at SheepdogSoftware page.

The library you need for the example at the Sheepdog Software is part of the standard Arduino environment... if you installed it correctly.

The "//initialize enc28j60" in the code at the Sheepdog Software site indicates that it will probably not be compatable with the wiznet chip the OP has.

Zoomkat-
Your server code works just fine if I use Firefox as the web browser, but not IE. Any idea why?
I now see the Arduino listed by the arp -a command as a "dynamic" device, correct ip address and MAC. I've no idea why things are now working but am grateful for at least some progress!

Thanks for the help! I appreciate your patience. Will next try internet connection and see what happens...

fungus-
I do know what a MAC and ip address are, and have changed them accordingly in each code I've used.
This does not appear to be the problem.

Us newbies do appreciate the helpful tone most people use on this forum. We are here to learn from you, after all...

If the code works on Firefox and not IE, check your IE security settings. One of them enables/disables Meta Refresh. Could that be the problem?

Sounds like an excellent suggestion, but META-refresh is enabled.

There are a bunch of other options in the Tools menu, too many to try randomly.

fungus:

ipsolutions:
Surely there is something simple, stupidly wrong with what I'm doing.

PS: Arduino shields don't do DHCP.

dude they do as long as he has the W5100 module (standard Ethernet shield or Arduino Ethernet)
the library i am using is

http://gkaindl.com/software/arduino-ethernet

Your server code works just fine if I use Firefox as the web browser, but not IE. Any idea why?

My laptop has IE7 and the meta refresh works ok. Below is another server code to try.

//zoomkat 12-18-10
//routerbot code
//for use with IDE 0021
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html 
//address will look like http://192.168.1.102:84/ when submited
//for use with W5100 based ethernet shields

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

byte mac[] = { 
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 
  192, 168, 1, 102 }; // ip in lan
byte gateway[] = { 
  192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 
  255, 255, 255, 0 }; //subnet mask
Server server(84); //server port

String readString; 

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

void setup(){

  pinMode(4, OUTPUT); //pin selected to control
  //start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  //enable serial data print 
  Serial.begin(9600); 
  Serial.println("servertest1"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  Client client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c);
        } 

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString);

          //now output HTML data header

          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Arduino GET test page</TITLE>");
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>HTML form GET example</H1>");

          client.println("<FORM ACTION=\"http://192.168.1.102:84\" method=get >");

          client.println("Pin 4 \"on\" or \"off\": <INPUT TYPE=TEXT NAME=\"LED\" VALUE=\"\" SIZE=\"25\" MAXLENGTH=\"50\">
");

          client.println("<INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Change Pin 4!\">");

          client.println("</FORM>");

          client.println("
");

          client.println("</BODY>");
          client.println("</HTML>");

          delay(1);
          //stopping client
          client.stop();

          /////////////////////
          if(readString.indexOf("on") >0)//checks for on
          {
            digitalWrite(4, HIGH);    // set pin 4 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            digitalWrite(4, LOW);    // set pin 4 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

Meta refresh in ie8 is turned on/off in the custom section of internet security per the below link.

tkbyd:
Bit harsh, Fungus... we weren't born knowing about "MAC", "IP", "DCHP", were we?

The terms aren't the problem, he's the one throwing those terms around and saying things like "arp -a on the command line".

The problem is that he's going round in circles expecting it to show up on the "router configuration page" when it's never going to - it's not doing DHCP. Somebody needs to break the news...

ipsolutions:
I do know what a MAC and ip address are

I never said you didn't, and that's what's confusing me.

What exactly did I say that makes everybody think I'm calling you a dumbass for not knowing what MAC and IP are?

You spent two pages trying to get DHCP working - it's never going to, but nobody else pointed this out.

You're going round in circles trying to "get the Shield's ip address from my computer" when that's pointless because the IP/MAC are going to be whatever you set them to in the source code (and nothing at all until you initialize the shield).

Knowing that at the start could have saved you days of frustration but I point this out to everybody and I'm the bad guy...?

ipsolutions:
I am unable to execute any Ethernet example routines with any success. What am I missing? How do I find a IP address if the router doesn't even see it?
Tried on two routers, same result.

I feel like I missed step 1 somehow, whatever that is...

The shield won't have a MAC or IP until you initialize it in software, ie. you need to call Ethernet.begin() with MAC and IP address. Arduino shields don't do DHCP.

(Should have been the answer to the very first post...)

OK, that's good, thanks for the explanation.

But why, then, is this routine not working? I got this from zoomkat. My D-Link router is at 192.168.0.1. It is not connected to the internet. It worked before for reasons I never understood, that is, I could type "http://192.168.0.102:84" in the Firefox browser and see the Zoomkat meta-refresh page.

But now not. I changed the ip address to 192.168.0.102 in the code, and the code is below. It no longer works with IE or Firefox. All lights on and looks happy. "Link" LED is on. Something very basic is surely wrong, and this is exquisitely frustrating. Any help appreciated.

// for W5100 ethernet shield
// the IP address will be dependent on your local network/router
// port 80 is default for HTTP, but can be changed as needed
// use IP address like http://192.168.1.102:84/ in your brouser

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

int x=0;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 0, 102 };
Server server(84);

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

void loop()
{
// listen for incoming clients
Client client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
char c = client.read();
// see if HTTP request has ended with blank line
if (c == '\n') {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();

//meta-refresh page every 2 seconds
x=x+1;
client.print("");
client.print("<meta http-equiv="refresh" content="2">");
client.print("Zoomkat's meta-refresh test");
client.print("");
client.print("page refresh number ");
client.println(x);
client.println("
");
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;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
}

Maybe it is just me, but I like to use and tags.
Adding a at the start and at the end may not hurt.

What part "isn't working"? The reply from the Arduino server? Or the meta refresh?
Edit: What I mean is, does the web browser appear to finish downloading the page, or does it whirr and buzz like it isn't finished yet?

BTW, you are probably sending a bunch of packets. This thread may help:
http://arduino.cc/forum/index.php/topic,73170.0.html

The Arduino appears to be executing the code correctly, that is, it is measuring a temperature which I can see on the COM port with serial.print commands. But I don't see anything on the browser page. The browser says it is trying to connect to 192.168.0.102:84, but times out. So it appears there is something wrong with communication to/from Arduino/router/computer.

I will have a look at the link you provided.
Thanks.

Can you ping the Arduino from the computer?

The browser says it is trying to connect to 192.168.0.102:84, but times out.

Are you using http://192.168.0.102:84 in your brouser and not 192.168.0.102:84 ? Open the admin page for your D-link router and see if the arduino is listed as an attached device.

yes, was using http://192.168.0.102:84. The Arduino was never listed as an "attached device" by the router (even when it was working), but I thought this had to do with the DCHP discussion above. It was listed in response to an arp -a command on the cmd line when it was working, with proper MAC and ipadress, but no longer.

I should mention that in one of my efforts to make this work, I listed it in the DCHP reservations list on the router. Don't know if that causes a problem, but didn't before, although it didn't seem to help either.

The Arduino was never listed as an "attached device" by the router (even when it was working), but I thought this had to do with the DCHP discussion above.

There is no DHCP IP address assignment involved in this evolution. A static IP address is assigned to the arduino in the arduino start code.

I should mention that in one of my efforts to make this work, I listed it in the DCHP reservations list on the router. Don't know if that causes a problem, but didn't before, although it didn't seem to help either.

Whatt you did may be a problem. If the DHCP reservaions list reserves an IP address range for DHCP assignment, then you probably need to assign the arduino an IP address outside of that range. Again there is no DHCP involved in this evolution. Just check your router and make sure there is no other device using the 192.168.0.102 (or what ever appropriate IP address you chose) IP address connected to the router. When you start your arduino the router should poll for attached devices and accept the arduino with its static IP address.