I do a fair amount of video conference based meetings via Google Hangouts when working from home. I wanted a way to let those in the house know that I was in a meeting, and also prevent them from accidentally barging in, so I came up with this system which will lock/unlock the door and show an indicator light automatically when I'm on a Hangout.
The Lock mechanism
The lock is an automotive door lock, these can be found online for $5-7 a piece, and will work with anything from 5-12V DC power comfortably
Because the lock is simply a 2-wire motor there are a couple things to note:
- You can burn them out if you keep 12V applied for too long when at the end of range
- You lock/unlock by reversing the polarity, which means using an H-Bridge style circuit, or in my case, a pair of relays
- there is no catch mechanism to hold the lock at either end of the range, so you'll need to come up with something to hold it in position, but a little bit of friction seems sufficient.
Wiring
The wiring is relatively straight-forward and includes:
- connecting GPIO 0 and 2 from the ESP8266 to the relay inputs via 2N2222 transistors
- using the RX pin of the ESP8266 muxed to GPIO 3 for indicator LED because the ESP8266-01 only has 2 default exposed GPIO pins
- I use the "improved stability" hookup for power to the ESP8266
I'm using the ESP8266 arduino libraries, and a sketch that is based on the WiFiWebServer example. This results in two URLs being enabled: /lock/0 for unlock and /lock/1 to lock. Yes - if you are on my home wifi, you could lock me in or out of my office.
The sketch is included in the code section of this project.
Triggering from Hangouts
The way hangouts detected is pretty simple. I simply poll Chrome every 5 seconds for a list of tab URLs, using Python and the appscript library to get access to Chrome's AppleEvent model. I check these with a regex that indicates an active hangout.
As this is a pretty simple hack - I place take a shortcut and have the Python script monitor the lock state - strictly speaking this would be better done by the sketch, closer to the lock itself, but as I'll only be using this from my desktop in my home office, I took this approach as it is easier to iterate on the Python script than to pull the ESP module and put it back in the programmer.
Here is the Python script - note that to get a static IP for the ESP8266, the easiest way is to assign it one based on MAC address in your router's DHCP settings.
The Python script is included in the code section below.
Next Steps
- in addition to the indicator LED, include a small LCD readout of time remaining in current meeting
- include a higher voltage, low current ZAP if someone ignores the light and touches the doorknob
- build a noise canceling sound field that prevents dog barks from coming in the door
Comments