?

Log in

No account? Create an account
Android Garage Door Opener, part 2 - brad's life [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Android Garage Door Opener, part 2 [Oct. 26th, 2008|12:06 pm]
Brad Fitzpatrick
[Tags|, , , ]

This is a follow-up to my previous post to say:

SO. FUCKING. AWESOME.

I got it all working. I now have an Android Activity (GarageDoorActivity) which interacts with an Android Service I wrote (InRangeService), letting me start and stop the service's wifi scanning task. The service gets the system WifiManager, holds a WifiLock to keep the radio active, and then does a Wifi scan every couple seconds, looking for my house.

When my house is in range, it does the magic HTTP request to my garage door opener's webserver (HMAC-signed timestamped URL, for non-replayability/forgeability if sniffed) and my garage door opens. Complete with a bunch of fun Toast notifications (like Growl) and Android Notifications (both persistent ongoing notifications for background scanning, and one-time notifications for things like the garage door actually opening).

I just threw on some shoes and hopped on my motorcycle to do a test lap around the neighborhood. When I got to the corner, I pulled up the activity and press "Start" (aka "Going home now"). A lady on the corner saw me playing with my phone on my motorcycle and said, "The reception's not so good up here." I thanked her, not wanting to explain what I was actually doing.

I then finished the lap around the block and the garage door started opening a few houses away. By the time I pulled up, I could already back the bike into the garage. HELL YES.

Update 2008-11-16: The source code is now available.
LinkReply

Comments:
[User Picture]From: matthew
2008-10-26 11:00 pm (UTC)
You could do something quick and dirty with an arduino board, a relay and maybe a relay switch for detecting door position.
(Reply) (Parent) (Thread)
[User Picture]From: brad
2008-10-26 11:22 pm (UTC)
Hardware isn't really my thing.
(Reply) (Parent) (Thread)
[User Picture]From: brad
2008-10-26 11:22 pm (UTC)
(as in I suck at it... I wish it were my thing.)
(Reply) (Parent) (Thread)
[User Picture]From: matthew
2008-10-26 11:54 pm (UTC)
Well let's fix that. Go get yourself an arduino board. You can get the basic board or a nice little kit with a bunch of useful bits.

Then all you need is a relay to drop into the prototyping area and the rest is software. I think that I've got a relay that'll do the job sitting on my desk at work. Once you work out the software we just need to solder together the relevant bits (I can do that part) and you have yourself a USB garage door opener.
(Reply) (Parent) (Thread)
[User Picture]From: mart
2008-10-27 12:01 am (UTC)

I'd second this. A friend of mine bought one of these kits and had it doing all sorts of cool stuff within a few days of it arriving.

(Reply) (Parent) (Thread)