Pages: [1]   Go Down
Author Topic: Opening and closing gate  (Read 977 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

With a bit of googling, I think I can use arduino to open and close my gate. The handyman connected these cables to a doorbell switch http://bit.ly/Vtw8de one press to open and one to close. How can I hook up an Arduino so that I can open and close my gate through the internet?
Logged

NE PA
Offline Offline
Full Member
***
Karma: 5
Posts: 156
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You can probably use a solid state relay to toggle the connection just like the switch does. However you'd need to confirm how much voltage is going through it and whether it is momentary (which I assume it is) or not before somebody can really help.
Logged


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

Hi. This is entirely possible, I have a door to my dorm room that opens by checking my email, the problem is making it. With a little more info I could help better.
First, how is the gate opened now? Is it electric with a keypad? If not (and it is manual) then there is two ways to do this. First you could have the arduino unlock the gate, and not actually open it, or the harder but much cooler option is having the gate actually open for you. If your gate is just a manual gate you will need to chose if you want this to be easy or "Hard".
If the gate is already automated somehow, you will(probably) need to crack open the controll box, are you ok with that? You could also have the arduino just punch in your code for you if you dont want to open it up, but this would be something that I have never messed with.

My last question is: Have you ever worked with arduino's or other micro-controllers? This is not neccesary, but it helps. Any prior programming knowledge also helps alot.
Logged

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

Hi,

Thank you very much for your responses smiley

@Quick5pnt0 how do I find out this information? I could go out and get a multimeter today but I'm not sure how to use it. I believe it's momentarily where I press the switch the gate starts opening, even when I release the switch, (sending the switch into an "off" state), the gate will continue to open until it's reached it's programmed limit. After then when I press the switch again, the gate will start to close.

@coltstrgj there is no keycode per se, it's controlled wirelessly via remote control or an indoor switch (it seems that the remote triggers a relay). I chose to connect the relay to the photographed switch since the location of the switch is within close proximity to a LAN port and a wireless access point (I prefer to use the access point to conserve ports).
Logged

0
Offline Offline
Tesla Member
***
Karma: 143
Posts: 9577
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How can I hook up an Arduino so that I can open and close my gate through the internet?

Arduino, ethernet shield, some hardware, and code similar to the below:

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, 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

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

Hi,

Thank you very much for your responses smiley

@Quick5pnt0 how do I find out this information? I could go out and get a multimeter today but I'm not sure how to use it. I believe it's momentarily where I press the switch the gate starts opening, even when I release the switch, (sending the switch into an "off" state), the gate will continue to open until it's reached it's programmed limit. After then when I press the switch again, the gate will start to close.

@coltstrgj there is no keycode per se, it's controlled wirelessly via remote control or an indoor switch (it seems that the remote triggers a relay). I chose to connect the relay to the photographed switch since the location of the switch is within close proximity to a LAN port and a wireless access point (I prefer to use the access point to conserve ports).
Perfect. If you could get another remote, you could have a servo or motor easily press the button, or you could wire in to that same relay that you mentioned. You should also look at the arduino wifi shields, I have not worked much with them, but it shouldn't be too hard.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12631
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How can I hook up an Arduino so that I can open and close my gate through the internet?

Perhaps you should also add to the requirements that only you can open the gate. If you expose your web server to the internet people will find and attack it - you don't want to have other people opening and closing your gate.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Tesla Member
***
Karma: 143
Posts: 9577
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
If you expose your web server to the internet people will find and attack it -

I've been running perosnal web servers for ~12 years and really never had that issue.
Logged

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

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

Hi,

Thank you very much for the feedback. I believe I will use the webserver code and possibly modify it so that I can do challenge response. Ideally I would like to use XMPP and supply the open/close commands over google talk.

I'm having difficulty choosing the parts, there is a supplier in Thailand http://www.arduino.in.th/category/1/arduino-board that seems to have a whole range of arduinos and I'm not sure which one to get. From what I can gather, I think of using this Arduino http://www.arduino.in.th/product/1/arduino-uno-r3 this Shield http://www.arduino.in.th/product/5/ethernet-wiznet-5100micro-sd-card-shield and this relay http://www.arduino.in.th/product/63/2-channel-relay-10a-with-optocoupler-module. Could somebody confirm that these are all the components required to make this work?
Logged

Pages: [1]   Go Up
Jump to: