Siri: Open the Garage

This weekend I decided to play around with my garage and Siri to produce the following:

I made Siri open and close my garage by speaking those phrases. The magic was definitely too long to explain in a video, so I thought I’d document what I’d done.

 The hardware

First, I needed to somehow connect my garage door to the internet. There are a variety of solutions here, such as Raspberry Pi, but my favorite is an Arduino with an Ethernet Shield. I also needed a pretty long ethernet cable to stretch from our router down to the garage via the front of our house. 200 ft ended up being way too long but better safe than sorry.

Amazon Order

The reason I love the Arduino is because of the following code you can upload onto it, RESTduino which allows you to communicate to the Arduino using a standard REST interface.

So now I could set and read digital pins on a microcontroller in my garage. Time to make it do something.

Most garage door motors have little panels that you can take off to access their circuitry. Ours had 3 pins. Two on the left that needed to be connected whenever you wanted the motor to run, and one on the right that needs a continuous supply of voltage (This is the trip switch that prevents it from crushing your car).

Garage Motor Pins

My first test was just touching an alligator clip to the two pins. This produced the desired effect of opening the garage. Now, the question was, how do I make the two pins touch using the Arduino.

My go-to piece of equipment to solve this is a relay. An arduino can supply up to 5 Volts, so I poppped into my local radio shack and got a 5V relay.

A relay has 5 pins. 2 coil pins, a normally-open, a normally-closed, and an output pin. When the coil supplies less than 5 volts, the normally-closed pin is connected to the output. When it supplies more than 5 volts, the normally-open pin is connected to the output.

Relay Diagram

I connected the left garage pin to the normally-open pin on the relay and the middle garage pin to the output pin on the relay. I then hooked up the left pin on the coil to a digital pin on the arduino, and the right pin to ground.

Lo and behold, now when I supplied 5V to my digital pin on the arduino, the garage door would open. You had to make sure to keep supplying 5V until the door was done moving, and then shut it off so that the door could be moved again. I wrote a simple addition to the Restuino sketch which would now toggle open/close the garage when you hit “/GARAGE” on the Arduino server.

              int selectedPin = 7;

              pinMode(selectedPin, OUTPUT);

              digitalWrite(selectedPin, HIGH);

              client.println("HTTP/1.1 200 OK");
              client.println("Content-Type: text/html");


              digitalWrite(selectedPin, LOW); 

Next, I wanted to be able to read whether the garage was open or closed. My current system would just toggle the state without knowing. I duct taped a small switch onto the track the garage door moved on so that it would be triggered when the door was open.

Switch on garage track

Now I could have different URLs for opening and closing the garage. If the garage was already open and you tried to open it again, nothing would happen. Eventually I’d like to put in some security such as, if the garage door has been left open for more than 15 mins, then automatically close it. That’s for another weekend though.

Here’s the whole setup:

Whole setup

 The software

Originally, this was going to be the end of the project, since now I had a URL that I could hit and it would open or close the garage. I saved the open URL to my home screen on my phone and tweeted out that I was done with my project.

I then walked upstairs and chatted with the housemates about other projects we could work on to make a smart house. I reflected on the fact that the original inspiration for the project was from the Google Wear video where the girl says “Open the garage” to her watch. I then jokingly opened siri and said “Open the garage”. Siri responded with “I can’t find an app named ‘The Garage’”. Lightbulbs went off. We realized we could get around the fact that Siri has no API by making apps named the phrases we’d like to recognize.

My housemate Colton quickly whipped together two apps named “Close the garage” and “Open the garage” which just hit specific URLs and then immediately close themselves.

It’s a bit of a hack since you have to say those exact words to make it work, i.e. you can’t say “Open the garage door”, but I say it’s good enough.

And that was how I made Siri open my garage door on a Saturday afternoon.

Picture of Siri

P.S. That video was actually taken the very first time all the systems worked together. That smile is a very genuine smile :)

P.P.S Github repo for the arduino code is here and iOS app is here


Now read this

A Love Letter to MIT

I love MIT. I love MIT more than I’ve loved any institution or organization in my entire life. I love this place so much; I helped design one of its most iconic symbols, the Brass Rat MIT can be a really difficult place. That can happen... Continue →