Control Arduino from website?

I've done some searching on the site and I haven't really found what I'm looking for. I've found a lot of info on setting up an arduino to run a server to connect to directly.

Heres what I'm looking to do I'm hoping some one can help point me in the right direction.

I'd like to access an arduino from a webpage, like a normally hosted webpage not an arduino hosted page. Has anyone done this? My friend is helping me but hes not sure how to get the arduino to log in to a website and/or always keep the IP updated on a dynamic IP network.

Read up on port forwarding and Dynamic DNS, its quite complex and not much to do with the Arduino.

Yeah I know typically it is done at the router but is there a way to just have the arduino connect to any open network and look at a webpage for some value to change when the value you changes it blinks an led. Or something like that.

Does the link go to your arduino?

And thanks for the help folks I know its a very broad newbie question.

The heating controls link which you can't access does that. In this case the Arduino is connected to the webserver by USB, the earlier link is a remote arduino with ethernet shield that provides the data for the Church graphs at the bottom of the above link.

It all kind of depends on how you want the webpage to interact with the arduino and its relationship with the server.

      Simple Ethernet Test

        Arduino server outputs simple text to browser

      The circuit:
      * Arduino Duemilanove
        * Arduino Ethernet shield
        * Basic FTDI breakout 5V
        *LED connected to GND and digital pin 4 via resistor
        By Minde

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 0, 140 };                  // ip in lan
byte gateway[] = { 192, 168, 0, 254 };                  // internet access via router
byte subnet[] = { 255, 255, 255, 0 };                   //subnet mask
Server server(80);                                      //server port
byte sampledata=50;            //some sample data - outputs 2 (ascii = 50 DEC)             
int ledPin = 4;  // LED pin
char link[]=""; //link data
String readString = String(30); //string for fetching data from address
boolean LEDON = false; //LED status flag
void setup(){
//start Ethernet
  Ethernet.begin(mac, ip, gateway, subnet);
//Set pin 4 to output
  pinMode(ledPin, OUTPUT);  
//enable serial datada print  
void loop(){
// Create a client connection
Client client = server.available();
  if (client) {
    while (client.connected()) {
   if (client.available()) {
    char c =;
    //read char by char HTTP request
    if (readString.length() < 30) 
        //store characters to string 
        //output chars to serial port
        //if HTTP request has ended
        if (c == '\n') {
          //lets check if LED should be lighted
             //led has to be turned ON
             digitalWrite(ledPin, HIGH);    // set the LED on
             LEDON = true;
             //led has to be turned OFF
             digitalWrite(ledPin, LOW);    // set the LED OFF
             LEDON = false;             
          // now output HTML data starting with standart header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          //set background to yellow
          //send first heading

HTTP test routines

");          client.println("
");          client.println("
");          //output some sample data to browser          client.println("Sample data: ");          client.print(sampledata);//lets output some data          client.println(" ");//some space between lines          client.println("
");          //drawing simple table          client.println("Simple table: ");          client.println(" ");          client.println("");          client.println("
row 1, cell 1row 1, cell 2
row 2, cell 1row 2, cell 2
");                    client.println(" ");          client.println("
");          //printing some link          client.println("Link: ");          client.print("Visit Scienceprog!");          client.println(" ");          client.println("
");          //controlling led via checkbox          client.println("

LED control

");          //address will look like when submited          client.println("
");                client.println(" ");          //printing LED status          client.print("LED status: ");          if (LEDON)              client.println("ON");          else              client.println("OFF");              client.println("
");          client.println("
");          client.println("");          //clearing string for next read          readString="";          //stopping client          client.stop();            }          }        }      } }

This is a sketch I come across that turns LEDs on and off under direct arduino web control, subject to port forwarding and dynamic DNS.

I'd like to access an arduino from a webpage, like a normally hosted webpage not an arduino hosted page. Has anyone done this?

Your arduino, is it going to have an ethernet shield for direct connection to a network, or do you want to have a pc act as a network interface and the pc communicate the web info to the arduino via the pc serial port?

I'd really like to get around the port forwarding if possible.


It would be connected via wifi through a router to the internet using the sparkfun wifly shield.

spark fun has a nice tutorial to get it to connect to the router automatically.

You say...

I'd really like to get around the port forwarding

... but, reading your posts, I don't think you're really talking about "port forwarding" (or not!)

I'm not trying to be pedantic... but your Google searching will be more productive.

So... Arduino to fetch a webpage (that's the hard part) .... look at what's in it .... do something, depending on what it finds

If the contents of the web page are predictably formatted, that should be fairly "so-able".

It isn't for the Arduino, per se, but a lot of the things you have to solve are incorporated in my FarWatchWatcher, which uses a PC at location "A" to look at a web page, and then put a message on its screen. Specifically, it looks at temperatures being posted on a web page generated by a FarWatch installation, which is on a differnt PC at location "B", and then FarWatchWatcher produces a big panel flashing red/yellow/red/yellow... if the temperature at the remotely monitored premises is nearing freezing.

The programming behind FarWatchWatcher is discussed at....

That is written in Delphi terms, but, as I said, the general principles behind what the program is doing get covered as well.

=== What you want to do is also being done by Pachube users. I find trees in the forest at the Pachube site... and the "solutions" there might vary somewhat from your EXACT proposed way of doing things, but I'm pretty sure the information is in there somewhere. There are certainly many Arduino people there, although there doesn't seem to be much overlap between those Arduinonauts and the good people here at the Arduino forum.

Much of the content at the following will seem irrelevant to your quest, but have a skim through it to orient yourself, and then have a look at the Pachube site.

Intro to Pachube:

=== Going back to...

"Arduino to fetch a webpage (that's the hard part)"

Especially if you control the page it is going to fetch, and can phrase the question as follows, it might pay you to launch a new, more focused thread, as follows. (Even if you can't control the page it fetches, getting the following sorted out will start you on your way to where you're going...)

"Arduino read webpage?

"I want an unattended Arduino to periodically fetch a page from a web-server out there on the net. There's some fixed-format text near the top of the page...

Temperatures from Timbucktoo

Hello Gentle Reader. File updated at....

21-Jan-2011, 07:20

Recent temperatures... oldest reading first. And, for registered users, OnOff1

  72.5 F    32.0 F  --at--  21-Jan-2011, 06:45:54   1568692
  73.4 F    32.0 F  --at--  21-Jan-2011, 06:50:56   1568725
  73.4 F    32.9 F  --at--  21-Jan-2011, 06:55:56   1568751

"I want to pick up the "72.5 F", and have it available in my Arduino in a string-type variable, from which I will do other tnings with it. The 72.5 will always be on the 13th line of the fetched web page.

"I want the Arduino to do this "all by itself"... I don't want to set up a PC near the Arduino to fetch the page, and then pass bits of it on to the Arduino.

"(If you need a page to check answers to this post, feel free to use either....


"(At least one of them is usually available.)"

That question covers at least two things you need... how to ACCESS a page out there on the web, AND how to extract a small string from the fetched page.

I hope you WILL post that question, or a derivative... I wouldn't mind knowing the answers myself! (And concentrating on one part of a bigger project often gets you more useful responses here in the forum.)

set up your router

add a DynDNS client on your LAN