A few times a year, the last person coming into the house via the garage will forget to shut the door, leaving its contents vulnerable to critters or the unruly, post-apocalyptic mobs speeding through our quiet suburban streets at night. The obvious solution is to check it each night before I go to bed. But that’s a lot of diligent peeking into the garage (where there are known spiders) for an event that occurs a few times a year. Invariably, after two weeks of “no change,” I completely lose interest until it happens again a few months later.
The most recent incident coincided with my finishing the stack of old Make magazines in the reading room, thinking I really ought to do some kind of project with the Arduino Uno on the bookshelf besides making the LED blink. Some sleuthing online found the GarageMote, a nifty little project where two Moteinos (tiny Arduino-compatible boards with on-board transmitters) are combined with a Raspberry Pi serving as a gateway. How could I resist the opportunity to completely over-engineer a solution to an infrequent (but bothersome) problem? But could I complete it before the raccoons gained unfettered access to the power tools in my garage?
The Moteino is about the size of an SD card:
I went with the higher-powered transmitter because I didn’t want to deal with any interference from the load-bearing walls between the garage and the Carson Household Backbone Network. (It sometimes floors me that I have >20 devices on my home network). Power would not be a constraint.
The first step was to solder all the little header pins onto each Moteino. Because my soldering skills had atrophied in the two years since my last significant project, it was necessary to do a thorough inspection on the first unit before I powered it up and found myself up a Creeque Alley without a paddle. Two egregious solder blobules were exorcised. Before starting the second unit, I picked up some do-over aids like a tip cleaner, solder wick and solder sucker.
In retrospect, I should have started with the GarageMote unit because it’s only four components (two resistors, a diode and a relay) and not all pins needed to be soldered.
To keep the package small, I opted for a Moteino without an on-board USB jack. Initial powering and programming is done via an FTDI connector. This was really, really easy to use. Soon: LED on. LED off. Yay!
Felix’s sample code snippets included the logic for the GarageMote plus the library for the transmitter, making the entire endeavor pretty simple. I added a few more debugging routines to let me test the serial port communication (each Moteino can emit a haiku) and pin inputs (snarky comments). And because I was now a pro at making the LED blink, that’s a diagnostic in case the serial port is not connected (which in most cases, it wouldn’t be).
I tested the components by waving magnets in front of the sensors and gleefully watching the changes in the state machine. Yes, I am easily amused.
The Raspberry Pi linux gateway is the human interface to all of this. In concept, I could check and change the status of the garage door by hitting a web server. Given how many *nix machines and web servers I’ve set up in my lifetime, I assumed the procedure would be equivalent to my looking at it for a few seconds before the operating system self-configured. But no, this was the most challenging aspect because the components were fussy.
Configuring the Raspberry Pi was very straightforward. I plugged the video out into my TV, booted Ubuntu, and then set up the WiFi card so I could do everything remotely from the comfort of the man couch. The individual components to the gateway — Node, a SerialIO driver, a custom-compiled version of NGiNX, self-signed certificate — individually installed without a hitch. I even chose the correct pins to wire up from the GPIO pins on the Pi to the Moteino and … spent time over the next couple of weeks debugging why the NGiNX server wasn’t proxying requests to Node and reviewed Felix’s guide. I believe there may have been issues with the lack of a real-time clock on the Pi and the self-signed certificate. Or maybe it was just a Transient Subspace Anomaly.
After verifying everything was working, I installed it onto the garage door. During the first attempt, I bent a sensor wire too much, breaking a solder joint and one of the leads at the most inconvenient place ever. A part was ordered and much longer wires used, reinforced by electrical tape. It was solid!
In testing the installation, I realized the door vibrates a lot as it’s in motion. This wrought havoc with sensor alignment until I installed a horizontal guide (a piece of leftover base board from my kitchen remodeling project) on which the sensors are zip tied. Power comes from an old cell phone charger rescued from a recycling bin.
The complete overkill and renewal of my Geek Cred was a lot of fun. After cleaning up the assembly, I’m going to add some automation rules to the server side to warn if the door is left open and, if no response is made, shut it automatically. Next project may involve controlling the thermostat in the house.