Pages: [1]   Go Down
Author Topic: IP-based Lighting-Control System using Arduino  (Read 1374 times)
0 Members and 1 Guest are viewing this topic.
Philippines
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

--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... smiley
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need to study the ethernet examples and acquire the hardware for the arduino that supports an ethernet connection.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Philippines
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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_ smiley
Logged

Offline Offline
God Member
*****
Karma: 7
Posts: 647
"In this house, we obey the Laws of Thermodynamics" Homer J. Simpson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some simple web based control code.

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="";

        }
      }
    }
  }
}

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

universe
Offline Offline
Sr. Member
****
Karma: 0
Posts: 258
I'm enjoying my Life
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think it is powerful tools for you:
http://arduino.cc/blog/2012/05/23/ardugate-controlling-arduino-with-web-browser/

Does it satisfy you?
Logged

Philippines
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually I was really lost at first...Sorry for that.. What my project is this...
Logged

Philippines
Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Pages: [1]   Go Up
Jump to: