plss help about ethernet shield

what i did is i connect the ethernet to a router.. i was able to make a simple browser to turn on and off a led, now my problem is i could only control it using pcs connected to the same network(internet router).. what i want is to control it anywhere around the world.. can i ask if there are any network settings or anything i needed to do to be able to control it anywhere as long as you are connected to internet? what i only specify is mac,lan ip, port(80 for default not sure if its the right port but its working). will i include gateway or subnet? thank you for a reply

my problem is i could only control it using pcs connected to the same network(internet router).

How is that router configured? Does it do port-forwarding? Which ports? To where?

You'd need to use the router's public IP address (assigned by the ISP) and the port that gets forwarded to the Arduino to access the Arduino from outside the local network that the router creates.

For outside access a dynamic IP address service like www.no-ip.com or www.dyndns.com is used for the wan IP address tracking, along with port fowarding on the lan router. Below is a link to get your current wan IP address.

http://checkip.dyndns.com/

zoomkat:
For outside access a dynamic IP address service like www.no-ip.com or www.dyndns.com is used for the wan IP address tracking, along with port fowarding on the lan router. Below is a link to get your current wan IP address.

http://checkip.dyndns.com/

thank you for the reply sir... can you not like just enter the gateway of you ISP in your code for the shield to be able to connect to it?.. and another question sir. i am now using the ENC28J60 ethernet, i guess there is no wiznet chip with this can i still use it to control via internet ryt?..

PaulS:

my problem is i could only control it using pcs connected to the same network(internet router).

How is that router configured? Does it do port-forwarding? Which ports? To where?

You'd need to use the router's public IP address (assigned by the ISP) and the port that gets forwarded to the Arduino to access the Arduino from outside the local network that the router creates.

thank you for your reply sir.. uhmm i am still noob with router configuration.. how will i know if its port forwarding and which ports?.. can i get my router's public ip address with cmd prompt right?? thank you for a soon reply..

pisayjames:
thank you for your reply sir.. uhmm i am still noob with router configuration.. how will i know if its port forwarding and which ports?.. can i get my router's public ip address with cmd prompt right?? thank you for a soon reply..

Google 'router port forwarding' to find what port forwarding is. Look for instructions to configure it for your router type.

Google 'what is my IP' to find what the publicly-facing IP address of your router is.

PeterH:

pisayjames:
thank you for your reply sir.. uhmm i am still noob with router configuration.. how will i know if its port forwarding and which ports?.. can i get my router's public ip address with cmd prompt right?? thank you for a soon reply..

Google 'router port forwarding' to find what port forwarding is. Look for instructions to configure it for your router type.

Google 'what is my IP' to find what the publicly-facing IP address of your router is.

thank you for the reply sir.. sir last question. does this method only apply to W5100 based ethernet shields? cause actually i am usning the old ENC28J60 shield.. thank you

thank you for the reply sir.. sir last question. does this method only apply to W5100 based ethernet shields? cause actually i am usning the old ENC28J60 shield.. thank you

The W5100 based ethernet shields are available on ebay now for $10 shipped, so i'd suggest getting one of those.

pisayjames:
thank you for the reply sir.. sir last question. does this method only apply to W5100 based ethernet shields? cause actually i am usning the old ENC28J60 shield.. thank you

This would apply to a Potato if you could manage to get the TCP/IP stack on it. The device that is connected to the network is irrelevant in this situation; It is also about your router.

Arrch:
This would apply to a Potato if you could manage to get the TCP/IP stack on it. The device that is connected to the network is irrelevant in this situation; It is also about your router.

sir what do you mean with Potato?.. and which device did you mean that is irrelevant??....
below is the code i have tried for my old version of the shield. is there anyway i could make this to be controlled outside my network?

// A simple web server that turn an LED on or off"

#include "etherShield.h"
#include "ETHER_28J60.h"

int outputPin = 6;

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};   // this just needs to be unique for your network, 
                                                           
static uint8_t ip[4] = {192, 168, 1, 15}; // IP address for the webserver

static uint16_t port = 80; // Use port 80 - the standard for HTTP

ETHER_28J60 e;

void setup()
{ 
  e.setup(mac, ip, port);
  pinMode(outputPin, OUTPUT);
}

void loop()
{
  char* params;
  if (params = e.serviceRequest())
  {
    e.print("<h1><a href='/?led=off'>Arduino Web Remote</a></h1>");
    if (strcmp(params, "?led=on") == 0)
    {
      digitalWrite(outputPin, HIGH);
      e.print("<a href='?led=off'><button style='border: 1px solid #ff0000; border-left: 10px solid #ff0000' type='button'>LED IS ON</button></a>");
    }
    else if (strcmp(params, "?led=off") == 0)
    {
      digitalWrite(outputPin, LOW);
      e.print("<a href='?led=on'><button style='border: 1px solid #000; border-left: 10px solid #000' type='button'>LED IS OFF</button></a>");
    }
    e.respond();
  }
}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

The type of ethernet shield you are using to connect to your router is irrelevant when it comes to understanding how your router is connected to the internet. You could be using a potato (well, probably not really) as a shield, and the stuff you need to do to enable external (internet) access to the Arduino with (potato) shield would be exactly the same.

PaulS:
The type of ethernet shield you are using to connect to your router is irrelevant when it comes to understanding how your router is connected to the internet. You could be using a potato (well, probably not really) as a shield, and the stuff you need to do to enable external (internet) access to the Arduino with (potato) shield would be exactly the same.

thank you for the reply sir.. so do you mean its ok i use this type of ethernet shield(EJ2680) as long as i am correct with my router settings to have external access on my arduino?(through internet)

pisayjames:
sir what do you mean with Potato?

Cut the "sir" crap.

This is what I mean by a potato:

and which device did you mean that is irrelevant??....

What ever is acting as a server, like a computer, Arduino Ethernet or the aforementioned potato.

thank you for the reply sir.. so do you mean its ok i use this type of ethernet shield(EJ2680) as long as i am correct with my router settings to have external access on my arduino?(through internet)

Yes.

another question... if i control the arduino with a web browser, could it also receive data from the arduino to update it? like for example i turned on a led using the webrowser, thus it display ledon.. now i turned it off using a pushbutton manually, is there a way the browser will automatically say ledoff?

if i control the arduino with a web browser, could it also receive data from the arduino to update it?

That sentence really needs a bunch of nouns, rather than all those pronouns. I have no idea what each of those its refers to.

like for example i turned on a led using the webrowser, thus it display ledon.. now i turned it off using a pushbutton manually, is there a way the browser will automatically say ledoff?

Yes, and no. There is NO way for a server to push information to a client. The client/server relationship is stateless. Once the server sends data to the client, it forgets that the client ever existed.

The server can embed meta tags in the page that it serves that tell the client that it needs to refetch the page every n seconds. It is up to the client software to see those tags, and to act on them.

The server, though, has no idea that a client request is a result of the user loading the page initially or the client refreshing the page.

aww.. too bad.. uhm so is there a way to solve my problem? what i really want is to have somehow like a "webserver" who can send and receive data to my arduino.. any suggestions?

uhm so is there a way to solve my problem?

There does not appear to be a way of correcting your misunderstanding of how client/server architecture works.

what i really want is to have somehow like a "webserver" who can send and receive data to my arduino.

A web server serves data. There is no way to make a server push data to a client. You wouldn't want google pushing data to you, would you?

A web client pulls data. It can include, in the GET request, information that the server uses to tailor the returned data. That could mean that the server does something like turning a pin on or off, too.

The server can tell the client, using meta tags, that it needs to check back later. That "check back later" part is a completely separate transaction, though.

what i mean is that. is there a way where i can make a simple UI with simple buttons to be displayed using a web browser where it can send and receive data from my arduino...?? please help me..

what i mean is that. is there a way where i can make a simple UI with simple buttons to be displayed using a web browser where it can send and receive data from my arduino.

Yes, the Arduino with Ethernet shield can serve up a web page containing a form with submit buttons.

Designing, testing, and implementing a web page is not an Arduino-specific task. If there are Arduino-specific parts you are having problems with, this is the place to discuss them.

What you are struggling with now is not Arduino-specific, so this is not the place for it.

ohhh more too bad for me cause i am not good at html..
uhmm last question.. is there a way that when i open the webserver i made will maintain the last state of my buttons when i reopen it?