Thursday, February 20, 2014

Raspberry Pi Garage Door Opener

The main purpose for this project was to ensure I didn't leave the garage door open either due to forgetfulness or from accidental opening.  This blog post is what started me off but my implementation, design and experience was slightly different so thought it still worth a write up.

Features:
  • Accessible remotely via smart browser app
  • Sign in with Google account (Auto sign-in from Android phones!) 
  • Maintain current status and ability to offer specific 'open', 'close' and 'stop' operations  
  • Audit log
  • Geo-Location based authorization for 'open' command preventing accidental opening while away
  • Email alerts for door activation and door remaining open for set period
  • REST Service - accessible from other applications

Design



Raspberry Pi


There are other hardware options but I chose the Pi - great if you're familiar with Linux and can co-host other projects/services too.

It's small and quiet - mine was put in a small shoe-box and placed on top of the door opener itself.

It's running Raspbian and connected to my home network with an Edimax wifi adapter (I'll do another post to detail how easy it was to setup the AP configuration).

Server


Source Code and Instructions

It is written in python and uses several other libraries to manage things like GPIO events and REST URLs.  All the details are at the link above.

Of course, it also needs electronics - as others have found, you can use a simple relay to trigger the door.   I also used 2 reed sensors for checking opened/closed state.  The wiring/circuit design was a little complicated but got there in the end.  Details and pictures here.

Browser client


Source Code and Instructions

The first implementation used GWT - it worked fine but found it was quite heavy weight (to support) for such a simple app.

As a learning exercise I tried re-implementing in Dart. I found it to be a much cleaner code-base and ended up adding some additional features.  This is the version I recommend to use.

Reverse Proxy Authenticator


Source Code/Pi-Binary and Instructions

It's a bad idea to open up services to the internet without authentication and SSL.  This options means I didn't have to implement auth directly into py_garage_server.  The other advantage is the ability to proxy other internal apps at the same time.

I didn't write this from scratch but forked and modified for my usage.  It's written in GO but it's not simple or reliable to compile GO on the Pi.  Fortunately it is easy to cross-compile (say on a mac or windows) for the Pi architecture.  Using the binary linked above should work directly on the Pi so you don't have to do this yourself.

To have this running correctly you'll need to:




No comments:

Post a Comment