ZigBee/XBee Garage Door Opener

by February 23, 2012 10:47 AM

I mentioned in my last post that I have three xbee radios that need to be used (played with!) and that we only have one garage door opener between the two of us - I am not the keeper of said opener. Here I present version one of our new networked garage door opener!

The Old Garage Door Switch

Garage Door Opener

The black box you see with the duck tape is a keyless entry system that was here when we bought the house. I'm the only one who used it (being the one without a remote) so I decided to unplug it and steal the wires that run from the garage door opener. The wires are already run and it's conveniently near a wall outlet so it seemed the right thing to do.

In case you don't know (I didn't at first), the wires that run from your garage door opener (the real one attached to the door) to your standard wall switch works by merely closing the circuit between the two wires temporarily. So your wall switch is just a mechanical switch with two electrical contacts that, when the button is pushed, close the circuit. Releasing the button re-opens the circuit, or breaks the connection between the two wires.

With the knowledge of just how simple it is to activate a garage door opener, all I needed was a way to electronically close the circuit between the two wires. That is exactly what a relay is for.

The XBee Garage Door Switch

2012-02-18_Opener_close-up

What this is, is the remote temperature sensor I had already created plus one additional component (and a few wires).

So the stuff at the bottom of the breadboard is still the power management componentry. It takes the 9 volts coming in from the power supply and regulates it down to exactly 3.3 volts for the xbee. Plus a couple of capacitors to smooth out the current.

Above that is the temperature sensor (tiny black thing) and a few resistors used to get the sensor's reading down to a level the xbee can read. And then there's the xbee itself with the temperature sensor still connected to AD0 (pin 20).

The new piece is the light blue component at the very top. That is a Compact 5VDC/1A SPST Reed Relay. I just connected the two wires from the garage door opener to each side of the relay and then ran a wire from AD1 (pin 19) on the xbee through the relay to ground. To trigger the relay, I just have to turn on AD1. So recalling what I said about the garage door switch, I just turn on the pin, closing the circuit with the relay, and then turn it right back off to re-open the circuit. Just like pushing a button switch :)

Tying Everything Together

2012-02-18_App

I left the temperature sensor on the circuit and I left the xbee configured exactly as-is. This means the console app that I used before still works like a champ. I connected the coordinator xbee to my PC, plugged in the above breadboard, ran the application, and I immediately started getting temperature readings from my garage. All I needed then was to be able to send a command to the remote xbee telling it turn on AD1 and then again to turn it back off.

Digi made this really easy with the xbee API. All I need to do is send it a remote AT command configuring AD1. Specifically, I send a Remote AT Command Request to the address of the remote xbee passing the AT command D1 (configure analog/digital pin 1) with the parameter of 5 to turn on high digital output (3.3 volts). I sleep for half a second and then send the same command again with a parameter of 0 turning the pin back off.

Of course, I needed a way to tell my console application to send those commands. For now I just listen for incoming connections on a named pipe. I created a single ASPX page sitting on my local IIS that, on button click, would open a connection to that named pipe and send it the message "Garage Door". The console app triggers the garage door every time it gets this message.  Sweet!

To get to that from my phone, I opened up HTTP traffic in my firewall to private network traffic and gave my PC a static IP address. So as soon as my phone connects to my wireless router, I can open and close the door with my phone. In fact, anyone who knows the password to my router and knows the IP address of my PC can now open and close the door. Unlimited remotes!!

Awesome, But Not Finished Yet

So now everyone who has access to my router can open and close the garage door. That's cool and all, but I'm not done yet. There are several things I don't like about the situation...

First, I want to be able to tell whether or not the door is currently open. No brainer! Not cool if the opening and closing is automated, but I still have to leave my lazy boy to see whether or not I need to close it at the end of the day.

Next, having a breadboard and exposed components dangling on the wall of my garage isn't cool. It's also not good for the circuit being exposed to dust and whatnot. Mostly it isn't cool though.

More importantly are the implementation details. Currently everything is had coded in a very brittle way. First I assume that any message received at the coordinator is going to be a temperature reading on AD0. Second is the garage door opener. Its address is hard coded to that exact xbee module. The pin is hard coded to AD1. And finally, I'm using named pipes to communicate with a console application from a .net application.

Oh, and I'm not logging the temperature readings, so no cool graphs. Not that there would be many readings coming in yet. Still have to solve the cost problem of creating dozens or remote sensors.

I'm definitely excited about what I have so far. And excited about the fact that I can open and close the door from my truck of course. But I have a lot of work (can I even call it that?) ahead of me.

Tags: , ,

Comments (2) -

Nathan Robinson
2/24/2012 2:33:43 AM #

Definately cool! I'm seeing a little switch connected to the ZigBee that the garage door trips when it's close. Then you can get temperature and open/closed garage door readings.

2315A-L Sentrol Garage Door Rail Mount Magnetic Contact Switch
[www.firststopsecurity.com/.../2315a-sentrol-garage-door-rail-mount-magnetic-contact-switch-p-1354]

rtennys
2/24/2012 3:06:23 AM #

Nice! That's not that much more expensive than the distance sensors I've been thinking about. Haven't settled on a solution yet. Also not sure whether I'll integrate it into the same circuit since the xbee has more input pins available, or if I want to make it a stand alone component. I could see a small AAA battery powered sensor mounted above the garage door that could return the current distance reading on-demand instead of constantly broadcasting it. We'll see soon!

Here are some sensor examples I was originally thinking about: http://www.sparkfun.com/categories/84

Pingbacks and trackbacks (1)+

Comments are closed