I originally wrote this for Monsoonco.com.  This is a repost.

monsoon officeWe work out of a historic bank in downtown Oakland.  It’s gorgeous. There are high ceilings with gorgeous artwork, and we have not one, but two bank vaults with huge metal doors that we use as conference rooms.  Unfortunately, solving simple problems in a historic building can be a challenge.  Years ago, someone installed a card key system for getting into the office, but by the time we moved in, there were only a few card keys left for employees.  This wasn’t a problem when we were fifteen people, but now over 40 employees ring the doorbell to get in every day…and since we have code to write and apps to design, opening the door 40 times a day isn’t ideal.

How does a crew of hackers solve this kind of a problem?  Simple!  They build and customize a robot that opens the door via a mobile app.

door robot clickerDoor Robot Closeup

Here’s how we did it:

First things first, we need to get the hardware in place.  Using a Raspberry Pi and breakout board, we wired in a simple mechanical claw.  Since this is going to be running 24/7, we wired in a AC-DC converter to keep it powered. Cool. Now we code up a simple Python script to tell the claw to do three things.. First, position the claw at the open position. Then a script that tells the claw to move to a slightly closed position, then back to open again.  That is it.  So you can see from the image below, the script allows the claw to do one job.  Click the button on the remote.

Now the client side.  We wrote both an iPhone app and a web app. I have Android so I’ll use the web app for the screenshots.  Not much to say here. Basically we have a webpage with one button on it.  Click that button and if the server is happy with the communication (and it’s between working hours) you get a happy ‘accepted’ message and a request is sent to the Node server, which in turn sends a request to the Raspberry Pi to execute the button click method.
2014-07-07 20.50.10 2014-07-07 20.49.59

Even though we now have a working device, we live in the real world and need to think about security.  To deal with that we put a few checks in like only letting those authenticated in our system to even access the web page in the first place and passing certain params on the call.  You can put in other checks as well like sending a password or looking for device ID.

As cool as this looks. we really need to put this in a case, propping this up on some business cards is ghetto but we want to do this right.  I’ve built an amp a few years back and put it in a cool plastic case I got from radioshack, so we may do something like this unless I get really ambitious and put something together in 3D and send it to a 3D printer. Next I want to write a javascript app for my Pebble watch so I can simply click a button and have it open the door for me.  More on that later.

When we first started building this we thought it was be a quick half day task.  Turns out it took much longer than we thought.  Mostly because we did not consider; power, where are we going to put this?, how to align the claw to the button, is it close enough to a cat5 line?  What about security?  Even something as simple as wear and tear on the claw gears.  At one point it stopped working.  I looked at the set up and after a few tests realized that the claw was not closing on the button enough to activate the remote, so we have to go back and change the close position by 1 deg.  I bet that a few months from now we will have to tweak it again, but that is just a simple change in the Python script.

But the main point is it WORKS!! Now anyone of us can simply walk up to the door, press a button on our phones and we are in.  This is even better than giving out card keys because; one if someone loses a key, we cannot replace it, and second, if we need to shut someone out, we simply remove them from the approved list on the server.  Same thing with someone who needs access just for a short amount of time.  Just add a profile and log their activity.  Sweet.

Share and Enjoy !

Shares