Garage Door Blues – Part 1

If you’ve looked at my blog posts lately, you’ll see that I haven’t contributed in quite some time. I have an excuse. I had to pack up and move from sunny Southern California to the frozen tundra of St. Louis. The transition to a new job was complicated enough, but having to sell a home (at a severe loss) and then find and move into another house was a real distraction. For the time being, my wife and I are renting, as it just didn’t make sense to buy a new house while trying to sell the old one.

Though we like this house we’re in, we probably won’t stay. That’s sad, because we love the neighborhood, and we love the neighbors. We found that after moving from a really big metro area near Los Angeles to a quiet suburb in southwest St. Louis County, the people are unbelievably friendly. Neighbors have baked cookies for us as they welcomed us to the neighborhood. Even the mailman got out of his vehicle to shake my hand and introduce himself. It’s like going back to the 1950s.

So why won’t we stay? Well, the house itself needs too much work. The landlord said he’d like to sell it to us, but there are some major foundation issues with this house, even though it is not even 30 years old. For example, the driveway has settled. Something underground is apparently washing out or – more likely – decomposing, causing the ground to shrink. (We learned that home builders in the past often buried leftover wood right next to the foundation.) The resulting stress carries well into the garage, where the floor is cracked and uneven. Also, the downpour of rain over the past few days has revealed a leak in the basement. The basement has a working sump pump, but the crack in the foundation (which is hidden behind a wall) is too big, and water is getting in. And the roof hasn’t been replaced in a very long time, even though it sustained some hail damage in the prior year. Were we to purchase this house, we would have to throw tens of thousands of dollars at it to get it fixed. Hey, I’m 55, and I just don’t feel like messing with this stuff anymore. Been there, done that. We’d live in an RV if we weren’t convinced that these things somehow attract tornadoes.

But I digress.

One cool thing that I’d like to do for this house is to put a decent garage door opener on it. The current garage door system is highly dysfunctional. The radio connection between the garage door and the remote units is really poor, so unless you pull your car to within millimeters of the door and hold the remote unit out your car window, the door just won’t open. Okay, I know I can just get another set of remotes, or maybe take the existing units apart and tune them up. (I’ve done that in the past.) But, hey, I’m an engineer, and I would like to build something that offers more than just opening and closing a garage door from the comfort of my car. Though I’m not going senile yet, there are times when I go to work and wonder whether I’ve closed the door. In our old home in Southern California, I sort of fixed that problem by mounting a web camera in the garage, and it would post an image of the door to a special website every five seconds. But now I’d like to take it a bit further. I’d like to not only see if I’ve left the door open, but I’d like to actually remotely control the door via the web. That way we can close it using a web app on our iPhones if either of us has left it open. Also, we won’t have to mess with those stupid remote units that practically demand that we run into the garage door before we get close enough to activate it.

So why not use some sort of out-of-box solution? Well, I did my due diligence and purchased an Insteon SmartHome garage door kit. I had misgivings about the purchase before it even arrived, and I tried to cancel the order, but I was too late. It was already packaged and on its way. So when the garage door kit arrived, I thought I’d have nothing to lose by trying it out to see if it worked. But it didn’t work. I’m not completely sure what the problem was, but I can guess that it had something to do with the communication between the base unit and the unit that sat out in the garage. I don’t want to bore you with the details, so I’ll just summarize what I found.

  1. There’s a lot of stuff to hook up. You have to connect the base “hub” unit to your Internet router. Then you have to connect up a garage door unit. Then you have to register the unit online. All this before you can even test it out.
  2. The base unit  communicates with the garage door unit by encoding information over the power lines. WTF? I already have a secure Wi-Fi, why not use that?
  3. Speaking of using power lines to communicate, there can be no blockage between the base unit and the garage door unit. The communication between the two units stops dead if it hits anything other than pure copper. Apparently, this also includes surge protectors. We now live on the eastern edge of Tornado Alley with lots of thunderstorms, and we cannot use a surge protector to help protect our investment.
  4. FYI: Houses typically consume electricity using two phases of normal three-phase power. So if your garage is on a different phase than your base unit, you’re screwed, because that transformer that sits on the power pole outside your house now stands between your base unit and your garage unit.
  5. You have to subscribe to the Insteon online service so that you can get an online server that will talk to your base unit that, ultimately, talks to your garage unit. I looked into my crystal ball and saw monthly payments going to someone just so I can open the garage door. Hmmmm …
  6. The garage unit does not come with a camera, so you cannot perform a visual check on the door. Sure, you can get a camera. Insteon has them available. They all use your Wi-Fi instead of encoding over the power line. Go figure.
  7. There is only one sensor on the garage unit. It tells you when the door is completely closed. It uses a reed switch with a magnet. Reed switches fail. A lot. And, you don’t get any indication that your door is completely open. Or somewhere between open and closed. Okay, I admit maybe I want too much information from my garage door, but I’d like to know if the door failed to close because it detected something in its path. Or maybe it was in the process of closing when it hit something and reversed. It’s hard to discern this type of information if all you have is a single indication of whether the door is closed.
  8. If you have multiple garage doors, you’ll need multiple garage door kits. This gets really expensive, really fast.

Personally, I was frustrated with Insteon because the installation instructions never mentioned anything about ensuring that the base unit and the garage unit could actually communicate. Instead, I just assumed all would be okay, and I spent a couple hours installing and wiring everything up, just to find out that it doesn’t work. No diagnostics were available to give me a hint. And when I tried to call their support line, it was closed for the weekend. Presumably I was supposed to call them during normal working hours. The problem is that I’m working during normal working hours. And I don’t work in my garage.

So after returning the Insteon gear, I set out to create a solution of my own. Some of the guys I work with advised I use a Raspberry Pi to implement my own solution. I didn’t have to dig too far into my pocket to purchase a Pi. It’s only about $35. So … what is a Raspberry Pi? The Raspberry Pi is a complete single board computer that runs Linux. It contains about a Gig of RAM, four USB ports, a RJ-45 10/100 Ethernet port, an HDMI port and a sound port. Okay, it will cost a bit more to purchase the “wall wort” power supply, a 16GB MicroSD card, a tiny USB Wi-Fi transceiver and an HDMI cable. Also, you have to download a free OS and put it on the MicroSD card. There are several alternatives; I used the Raspbian OS. Put it all together and you end up with one really cool computer! It comes with a GUI interface that even contains a web browser. Hook it up to your monitor and keyboard and you essentially have a complete PC. I was even further pleased to see that Ruby 1.9.3 was already installed and ready for action.

After I played around with the Pi for a few days, I started to think about how I could use it to solve the garage door problem. Here’s a list of requirements I came up with:

  • Allow remote monitoring of the garage door position: Open, Closed or somewhere between. This will require two sensors.
  • Send my wife and me a text message if the door is left open for a long period of time. The time can be made adjustable so that we can tell the unit to lower the frequency of text messages in cases where the door is intentionally left open.
  • Take a picture of the garage every five seconds and post it on a web site. BTW: You’ll want to purchase an add-on full HD web camera for about $25.
  • Allow for remotely opening and closing the garage door, based on commands posted through a website. Okay, another purchase is recommended here: the PiFace Digital 2 board has just about everything you need to interface to the garage, including relays for controlling the garage door in parallel with the push-button device already mounted in the garage.
  • Use Hall-effect transistors to sense garage door position. They’re a lot more reliable than reed switches. And they’re cheap. These sensors are about $2.50 apiece. You’ll also want to buy strong ceramic button-size magnets to act as the proximity sensors. Caution: Do NOT let these powerful little magnets anywhere near each other. They’ll hug each other so tightly that you’ll really have to struggle to get them apart. I had to use a putty scraper to break up their little marriage.
  • Work exclusively through the Wi-Fi without need for a base station.
  • Use my own web server. I’ll probably use something from DreamHost or similar. I can allocate a website for next-to-nothing.
  • Handle up to three garage doors independently. I’m not yet that rich, so I have just one door, but I’ve driven around looking for houses lately, and I’ve seen houses with up to three garage doors. There should be no reason to buy another garage door kit for each door. The Pi is perfectly suited to handle multiple doors.

So here’s my confession. I’ve barely started on this project. I’ve run into some interesting challenges, and I will use this blog to document them as well as the solutions I’ve implemented. The next installation in this series will go deeper into the implementation of the above list of features. So far, this has included mixing in a bit of C language with Ruby insofar as necessary to give Ruby the ability to control hardware. It’s been really fun so far. So stay tuned!