--Hi,, can someone help us about the design of our project?? We really don't have any idea on what to do first... Our project is to control the light (IP-based) using this Arduino microcontroller... As of now we are still currently having research since we are quiet unfamiliar with this one... We will highly appreciate your help.. tnx' a lot...
You need to study the ethernet examples and acquire the hardware for the arduino that supports an ethernet connection.
Actually i understand a little bit now,, Its not actually IP-based,.. It is a IP based in asense that I will be using the ethernet shield connected to the arduino platform.. But I still need lots of research especially on how to design the project itself.. My project should control the light (On/Off) using Arduino.. Still don;t know how to design it...
tnx Zoomkat for your Reply
First thing is to write a reasonably clear description of what you would like to do.
Then think about what the problems are and decide if you can eliminate problems by changing your requirements (or not).
Do you really mean one light, or do you mean you want to control many lights?
What kind of light are we talking about and LED or a room light or a searchlight?
If it is just one light then where does IP come into it, why not just use a switch?
Since you are talking about IP I assume you really mean many lights.
Also I guess the lights are not individually wired back to some central point and that is why you are thinking about IP and having some local intelligence at each light switch?
If you want intelligence at each switch then you need to consider how the device at each switch will get power and also the wiring for your IP network.
As I started saying first thing is to have a clear idea of what you wish to achieve.
If you don't know what that is you are lost from the start
Some simple web based control code.
//zoomkat 4-1-12
//simple button GET for servo and pin 5
//for use with IDE 1.0
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html, or use ' instead of "
//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>
#include <Servo.h>
Servo myservo;Â // create servo object to control a servo
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
EthernetServer server(84); //server port
String readString;
//////////////////////
void setup(){
 pinMode(5, OUTPUT); //pin selected to control
 //start Ethernet
 Ethernet.begin(mac, ip, gateway, subnet);
 server.begin();
 myservo.write(90); //set initial servo position if desired
 myservo.attach(7); //the pin for the servo control
 //enable serial data print
 Serial.begin(9600);
 Serial.println("server servo/pin 5 test 1.0"); // so I can keep track of what is loaded
}
void loop(){
 // Create a client connection
 EthernetClient 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); //print to serial monitor for debuging
     client.println("HTTP/1.1 200 OK"); //send new page
     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>Zoomkat's simple Arduino button</H1>");
    Â
     client.println("<a href=\"/?on\"\">ON</a>");
     client.println("<a href=\"/?off\"\">OFF</a>");
     client.println("</BODY>");
     client.println("</HTML>");
     delay(1);
     //stopping client
     client.stop();
     ///////////////////// control arduino pin
     if(readString.indexOf("on") >0)//checks for on
     {
      myservo.write(40);
      digitalWrite(5, HIGH);  // set pin 4 high
      Serial.println("Led On");
     }
     if(readString.indexOf("off") >0)//checks for off
     {
      myservo.write(140);
      digitalWrite(5, LOW);  // set pin 4 low
      Serial.println("Led Off");
     }
     //clearing string for next read
     readString="";
    }
   }
  }
 }
}
I think it is powerful tools for you:
Does it satisfy you?
Actually I was really lost at first...Sorry for that.. What my project is this...
I will used the Arduino microcontroller and an ethernet shield to control the light (Flourescent or bulb) anywhere location I want.. Meaning I also need to create a web server for the control... Only 1 light can be controlled... Someone told me that a relay will be used to connect form the light's power source...the input of the relay is the output of the Arduino... Something like that..,, My worst problem actually is the code... tnx creativen, I will have to study that code given by you...,, If someone understands what I really mean,, I will appreciate any help coming from you guys... thank you and Godbless...