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?
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.
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.
@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).
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:
//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="";
}
}
}
}
}
@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.
mishari:
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.
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.