Controlling robot over a wireless internet connection

This is how I made my robot [Salvius] able to be controlled using a wireless internet connection. The process is simple and costs very little if you don't have the parts already. One of the best things about using this method to control your robot is that you don't even need a specific remote control. You can use any wireless enabled device like a phone, iPod, tablet, or laptop computer to control your robot. Also, there will be no need for any programs to be installed on the device you are using as a remote because everything is installed on the robot in a similar configuration to a regular web server. All you have to do is type a URL in your address bar and press enter.

WiFi-Enable Your Robot!

For this project you will need:

I purchased these parts from Trossen Robotics. They are an online vendor for robotic parts and I have found that they have a great selection. You can visit their site at:
For this example I will be showing you how to simply turn an LED on and off by using a web browser. I will post updates for doing this with more complex parts like motor controllers in a later post.

Here is a picture of this working:
LED off

LED on
In the photos the arduino is programmed to render a web page that has two buttons; one turns the LED on and the other turns it off.

Here is the code for the Arduino:

        The circuit:
* Arduino Uno
        * Arduino Ethernet shield
        * LED connected to GND and pin 5
        This code is based on work done by Minde

#include <SPI.h>
#include <Client.h>
#include <Ethernet.h>
#include <Server.h>
#include <Udp.h>

// change these to fit your setup:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x00, 0x0F }; // physical mac address
byte ip[] = { 192, 168, 1, 177 };             // ip in lan
byte gateway[] = { 192, 168, 0, 1 };     // internet access via router
byte subnet[] = { 255, 255, 255, 0 };                //subnet mask

EthernetServer server(80);                           //server port

byte sampledata=50;            //some sample data - outputs 2 (ascii = 50 DEC)          
int ledPin = 5;  // LED pin
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);
  pinMode(ledPin, OUTPUT);  //Set pin 4 to output
  Serial.begin(9600);  //enable serial data print
void loop(){
// Create a client connection
EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
   if (client.available()) {
    char c =;
     //read char by char HTTP request
    if (readString.length() < 100)
        //store characters to string
        readString += c; //replaces readString.append(c);
        //output chars to serial port
        //if HTTP request has ended
        if (c == '\n') {
          //dirty skip of "GET /favicon.ico HTTP/1.1"
          if (readString.indexOf("?") <0)
            //skip everything
          //lets check if LED should be lighted
        if(readString.indexOf("L=ON") >0)//replaces if(readString.contains("L=1"))
             //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");
          client.print("<body style=background-color:#FFB880>"); // background color
          client.println("<h1>Web Remote</h1>");          //send first heading
          client.println("<hr />");
          //controlling led via checkbox
          client.println("<h2>LED Control</h2>");
          //address will look like when submited
          if (LEDON)
          client.println("<form method=get name=LED><input type=submit name=L value=ON CHECKED><input type=submit value=OFF></form>");
          client.println("<form method=get name=LED><input type=submit name=L value=ON><input type=submit value=OFF></form>");
          //printing LED status
          client.print("<font size='4'>LED status: ");
          if (LEDON)
              client.println("<font color='green' size='4'>ON");
              client.println("<font color='grey' size='4'>OFF");  
          client.println("<hr />");
          client.println("<hr />");
          //clearing string for next read
          //stopping client