Garage Door Opener with iPhone App

EDIT - Dec 19*******************

I just finished an imp project in which I use an imp in an April board to open/close my garage door. Since I also do IOS programming I made a iPhone app with a nice little momentary button to control it. This is a really easy project, assuming that you can solder and follow an electronic circuit schematic. You probably aren’t here if you can’t.

If there is a lot of interest, I’d be willing to look into submitting an IOS app to the Apple app store for this. I need to find out if I can use the electric imp logo and name in the app first, however.

For the hardware piece, you can purchase everything you need at Radio Shack. I found this really nice circuit layout for an arduino project, and it is exactly what you need. (Except that I had to swap out the 1K resistor with a 560 ohm, as the 1K was not driving my transistor hard enough to power the relay coil.)

Here is a link to the schematic:

Pin 9 on the April impee goes to the resistor.
GND goes to GND on the impee.
V+ goes to VIN on the impee.

Then I made a simple switch program with three values that could be set by the HTTP IN program. I only use value “2” for this project since I want a momentary “On” for the garage door opener.

I’m a total n00b here, but this is the code I used, and it works:

// Garage Door Opener for HTTP control

// input class for Switch control channel
class input extends InputPort
name = "Switch control"
type = “number”

function set(value)
// Momentary On/Off for Garage Door App
if(value == 2)
//Switch pin to HIGH
// Wait one second
//Switch pin to LOW

// Configure pin 9 as an open drain output with internal pull up
//Set pin 9 to LOW initially

// Register with the server
imp.configure(“Garage Door”, [input()], []);

// End of code.


Sweet! I’m doing about the same for controlling the heating in my summer house. Thanks for sharing.

Blogging about it…

How exactly are you hooking this up to your Garage door opener? Is there some accessible line that you are powering that says “open” or close?

Where is your feedback status of the garage door?

My garage door, and I assume many others, has an external hookup for a momentary pushbutton that activates the door. You are just closing the circuit for a moment and then opening it. My code just turns one of the digital pins on, sleeps for a second, and then turns it off. That closes the relay, and the circuit, and then opens it.

I haven’t set up feedback yet, though I would like to connect the two switches on the door that indicate if it is up or down, and then send that back. Right now the only response from the imp is “OK”, and I don’t have that sent to my iPhone app at the moment.

Very nice! I did this with my April board, but also included a Hall sensor to detect whether the garage was open or closed. I liked this because it eliminated the (unpredictable) variable of someone using a remote, wall trigger, or keypad to open the garage.

I have a similar external AC trigger with my garage that I switched via relay. I also added a temperature sensor for the hell of it.

No iOS app here though. I run it all via a (secured) web page that is accessible from a browser.

When I get the time, I may post some code and pictures of the final product.

hi jwehr, trying to create the iPhone app acc. to your code. Although the imp code is easy to follow I’m a newbie at the iPhone side. I get some errors in Xcode about missing declarations on params, request and connection. Can you pls. help me out here?

@moose in your .h file you should add the following lines of code, to declare them:

NSArray *params NSMutableURLRequest *request NSURLConnection *connection

After you’ve added this everything should work just fine!
Let me know if it worked for you, I’m doing this from my iPhone so I don’t now if it’s correct.

@minneschalekamp Thanks, I added the code to my ViewController.h but still get error messages (different ones though). To avoid long iterations I attached both ViewController files. Could you pls have a look what seesm to be missing (for some reason the .h and .m named files were not allowed to be attached, so I appended .txt to the names)?

@moose in your .h you should declare them after the @interface, so to get it working it should look like this (in your case):

@moose - sorry, I should have all this code in github… thanks to minnie for replying about the header files. I need to clean the code up a little as well.

Last night I mounted everything a little more permanently…

I found an old fiber to copper convertor box at work that was a perfect case for this project. All the pins are connected to RJ-45 which runs inside the opener to a small relay circuit, and you can see the green wires coming from the relay to the opener pushbutton contacts. This way I can easily remove the imp and impee if I need to, and I can pop the imp out without opening the case. Also, give the antenna some more line of sight…

I do need some help with the rest of this. My opener has switches that get toggled for open and close. Can someone help me with sending that information back in the http response? Right now you get an “OK”, and I print that to the IOS app (new code), but I think that comes form the electricimp servers, since you get it even if the imp is off. It would be nice to get the status of the switch on viewDidLoad, and after the open/close command is sent. I’ll try to get this up on github asap. Thanks!

Ha - you beat me to it !

I just finished my Imp powered garage door opener too. I added an RFID reader into the mix so I can open the door without getting the phone out. We also get a notification whenever the door is opened which tells you which card opened the door so you know who just got home. Fun project.

You Tube Vid of Garage Door Opener

Strange, clicking the link brings you right back to this page. Either way, any way to make the video public, I would love to see it (You Tube says “This video is private”)

I fixed the link -

Ok, so that’s rather nice. Do you use the prowl api direct from an HTTP out block?

Hi Hugo - I just send the HTTP out to a server which has a Python script for each event which calls the Prowl API.

Is it possible to run the api directly ?

It looks like it could be possible with the standard HTTP out block too, but only with preset messages (ie, the text sent down an output from the imp can’t go into the URL until you can use agents, so you’d have to hardcode it in the URL on the HTTP out block).

You’re right Hugo, you can send a notification from the planner directly to Prowl to get a notification on your iPhone or Android device.

I posted the steps here -->Prowl to IOS / Android Notifications

Could you just use the transistor wired to the opener, rather than switching it with a relay?