6 ms·
I have a fun one. The front door to my house had an automatic door opener, paired with a single-button remote control to unlock and open the door. The remote co
by ghughes 4y ago
I have a fun one. The front door to my house had an automatic door opener, paired with a single-button remote control to unlock and open the door. The remote control was annoying to carry and use. (This was before IoT became a thing.)
I pried open the remote, soldered on an extra circuit bypassing the push switch, and hooked it up to an Arduino. When a packet is sent over serial, the Arduino simulates a button push:
const int basePin = 2;
void triggerRemote() {
digitalWrite(basePin, HIGH);
delay(2000);
digitalWrite(basePin, LOW);
}
void setup() {
pinMode(basePin, OUTPUT);
Serial.begin(9600);
}
void loop() {
if (Serial.available() > 0) {
Serial.read();
triggerRemote();
}
}
This was paired with a tiny web server to do the serial write:
#!/opt/bin/python2.6
PORT = 5525
import BaseHTTPServer, SocketServer
class LoccaHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
server_version = "LoccaServer/1.0"
def do_GET(self):
if self.path.startswith("/trigger"):
serial.write('A')
self.send_response(200)
else:
self.send_error(404)
serial = open("/dev/ttyACM0", 'wb', 0)
httpd = SocketServer.TCPServer(("", PORT), LoccaHTTPRequestHandler, False)
httpd.allow_reuse_address = True
httpd.server_bind()
httpd.server_activate()
httpd.serve_forever()
Finally I threw together an iPhone app with the most basic UI imaginable: a static full-screen photo of the remote; tap once, it fires off a HTTP request, and the door swings open:
- (IBAction)triggerRemote:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://10.0.8.48:5525/trigger"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[NSURLConnection connectionWithRequest:request delegate:nil];
}
That's basically all of the code. Considering how much of a janky hack this is, it worked great.
Ancient write-up with some photos: https://web.archive.org/web/20120103180640/http://ghughes.com/blog/2011/11/27/locca-sure-touch-plus-iphone-plus-arduino/ https://web.archive.org/web/20120103180640/http://ghughes.co...
- bdittmer 4y agoAt one point I had a gist with a bunch of links to a web server that controlled some home automation stuff. Add a link to your Home Screen and you’re good to go! Easy to share as well