Friday, August 10, 2012
Garage Controller - New Device at My House
I have a nice big garage that I use a lot, but I constantly leave the doors open. Seems about half the time I get part way down the dirt road away from home and have to try and remember if I closed the doors. This means coming back and checking so OCD doesn't set in and drive me nuts wondering if the doors are open. Be nice if I could look on my smart phone and see if the doors are open from anywhere and close them if necessary. Looks like a job for another little computer. I had an Arduino handy, a couple of Xbees and a little relay board set aside for this so the project shouldn't be too much trouble, All I need is an enclosure of some kind. I found my very most favorite enclosure for this kind of thing on Amazon:
I already had one of these installed by the phone company on the side of the house and just happened to stumble across it on Amazon. They're 9x6x3 and weather resistant. The one I have has been there for years and nothing inside has been damaged, so this should be fine.
Here it is with the Arduino, one of the newer XBee shields and a four relay board mounted inside. There's lots of room left for other devices and various wires from things around the garage. For example, the beige box next to it is the differential temperature controller for my solar water heater. Here in the desert, I only pay to heat water in the middle of winter on heavily overcast days. I don't even allow power to get to the heating element for 8 months of the year. In the future, control of that power and monitoring the temperature of the water will be handled by this new device. The little XBee shield is a relatively new device and works really well.
I chose this particular board because it would allow me to put the XBee tx and rx pin on something other than 0 and 1 and it was relatively inexpensive; around $7 with shipping. It also has a protoype area for mounting some screws to get inputs into the system. I've found using the arduino serial port for an XBee leads to massive problems when I try to debug various things. Without a serial port, you just can't find problems. So, I mounted some screw terminals on the XBee board to take inputs and hooked up some magnetic sensors on the garage doors.
Sorry, it's a little out of focus, I must have moved a bit, but you can see the terminals for the magnetic switch inputs and the relay outputs for the door switches. I just ran wires to the regular garage door switches to control them, they were relatively close. I use a two second pulse to open and close the doors and monitor closure for the door sensors.
There was an unexpected side benefit of this, I can now tell the door to close. That may not sound like much, but remember, garage doors are a toggle. If they're closed and you push the button, they open. You always have to go check to see if they are already closed before pushing the button because you may be opening them instead. The idiocy of toggle buttons drives me nuts.
Currently, the Xbee simply transmits the status of the doors every few seconds and my House Controller displays the status on its LCD display. It also provides the status on the Controller web page along with buttons to take care of closing or opening the doors. Now, I can pull out my phone, look at the web page and close the darn doors if I left them open. I've been wanting that for years.
One nice thing about my home automation, it gets easier over time. I already have the XBee network set up, adding a new device is easy. I have the code already written and available in several devices for copying to a new one. I have code for watchdog timers, parsing inputs for commands and formatting status updates ready in several versions. Adding a few lines to the House Controller to put it up on the web is pretty painless and the Controller has lots of memory left for this kind of thing.
Plus, the discovery of the enclosure I mentioned above. This thing keeps the weather out, is easy to get into to debug or make changes, holds a lot of stuff, can be locked (keep kids out), and can survive the weather, especially if you paint it. This will become the default enclosure for all my outside projects from now on since I can get it pretty easily and it works so well. I may even get a few of them and retrofit some of the devices I already have. I get really tired of unscrewing a lid to check an led when I could just open a door. It's annoying that I didn't think of it before. It would have saved me hours when I was working on the Pool Controller. I was constantly opening that thing up and changing something as I decoded the protocol and worked out control strings.