Saturday, January 19, 2008

Tired of nagging about the Lights?

Home automation pays for itself. When I was a boy, I remember the constant refrain of "turn off the lights" - red faced rants on learning about the other direction that a switch could flick for some reason did nothing but amuse me. That was probably because I wasn't paying the bills.

Now I have four energy wasters of my own, pay the bills, and worry about the impact of our collective energy squandering on the world. I still remind them to turn off the lights, but now I have an energy warden: my HAI home automation system. It runs security, smoke alarms, thermostats, and lights in a completely programmable and coordinated way.

The first step was installation of the security devices. I prefer wired items for the core security system, because there are fewer things that can go wrong. My favorite security device is a motion detector with both infrared and radar: the GE Precision RCR-A. There are no false alarms and nothing escapes the watchful eye of this detector. Doors and windows need sensors to detect opening and closing. I suggest you skip the sonic glass break detectors, they create way to many false alarms to be useful.

Special thermostats replace the existing ones so they can be controlled by the central system, smoke and carbon monoxide can be wired to the central system, and you can add any other sensors you would like, such as humidity or other temperature sensors.

The lights are replaced with special switches that can report their status and be controlled by the central system. I use UPB switches because they are extremely reliable, and don't require any changes to your house wiring. I have tried X10 switches in the past, but they are slow, not reliable, subject to interference from many appliances, and can actually cross-talk with a neighbor who is also using X10. I considered wireless switches like Z-Wave, but they didn't have the selection or tight integration with the HAI that I was looking for. Now that HAI has Z-wave support, I would consider Z-wave if it is competitive on price and switch selection. Even though Z-wave is wireless, it could be faster and more reliable than UPB since UPB has to coexist with the power signal and there is the added expense of bridging your two 120V lines using a UPB coupler. The ideal solution is hardwire control of your light switches, where the switches all have a dedicated low voltage control line back to the panel, but that isn't practical unless you are building a new house and plan for this before the sheetrock is installed.

Installing the switches is very easy. You simply shut off the circuit breaker that supplies the switch you want to replace, remove the switch plate cover, remove the switch from the wall outlet box, and remove the wires from the old switch. Then you use the supplied wire nuts to connect the new switch wires to the house wires, and reinstall the switch and switch plate cover. The new switches use decora style rocker switches, so you may need to order new switch cover plates too. Sometimes it isn't obvious which wire is the supply line from the breaker and which is the line from the switch to the light fixture, so when in doubt use a voltmeter to check (the supply "hot" will always have voltage, but the fixture "load" will only have voltage when the light is on). It can get a bit cramped when you have three or more switches in a single box (this is called 3-gang or 4-gang), but it just take patience to carefully bend the wires toward the back of the outlet boxes.

When you have more than one switch that controls the same fixture, you use an auxiliary switch that sends control commands to the master over the "traveler" wire. There are several different ways to wire a multi-switch system, but the most common is for the supply line to come into one switch, a traveler line connecting one switch to the other, and the fixture load in the second switch box. Again, the voltmeter can really help here in understanding the wire layout. If you are confused and unwilling to research this, you can skip these fixtures or consult an electrician.

To interact with the system, you need keypads, which in addition to arming and disarming the system, can be used to control any feature in the house. You also can buy software to control the system from your PC, using a web browser, mobile phone, or windows media center.

Once you have this all in place, you have tremendous flexilibility and power to control the house. You can turn lights on slowly in the morning to wake up, and turn them off an hour after sunrise. You can turn off lights after no motion is detected for an hour. You can turn off all lights in the house (or most of them) when you arm the security system. You can turn off the HVAC automatically if the fire alarm goes off. You can turn off the HVAC when doors and windows are open for fresh air. You can turn up and down the thermostat based upon motion or other occupancy indicators. You can check to see if the kids still have the lights on in their room using your computer, or manually override anything using your computer or phone.

The switches cost about $50 a piece, so they pay for themselves after they save 250 - 500 kilowatt hours, which for a 500 watt fixture is 500 - 1000 hours. if you have lights staying on 12 or more hours a day because they aren't getting turned off, they can pay for themselves in a couple of months. The thermostats are $100 a piece, but can pay for themselves even faster. Saving yourself from getting worked up over the waste: priceless.

Friday, January 18, 2008

Cat5e plus Asterisk / Trixbox

I bought my current house after the sheetrock was put in, so I wasn't able to specify the wiring.

One thing I learned from the last house is that I didn't want to rely exclusively on wireless anymore. Neighbors had 2.4GHz cordless phones and microwaves that really-must-be-dangerous-they-are-so-RF-leaky. Aside from the mysterious drop outs for 10 minutes to an hour, the performance difference was too great for work or for large file transfers.

Fortunately I discovered that the electrical contractor used Category 5e (Cat 5e) wiring for the telephone jacks. They has become fairly common because you can have 4 telephone lines carried over this kind of cable. I was happy because Cat5e is capable of carrying Gigabit Ethernet instead of phone signals.

I had two problems to overcome. I did still want phone service, and the jacks were daisy-chained (wires went from one jack to another) instead of home run (all jacks connected to the basement using independent wires).

For the phone service, I decided to use a Voice over IP (VOIP) solution that sends phone service over the data network I would deploy on the Cat5e. To do this, first I took one of my old notebooks, and installed Trixbox.

Trixbox can be downloaded from trixbox.org as an ISO image that can be used to burn a bootable CD. I rebooted the notebook with this CD, and it reformatted the hard drive, installed Linux (CentOS a Redhat clone), and installed all of the additional software to turn the notebook into a phone switch that is probably more capable than the ones at most offices. The only questions the installer asks are the time zone, what the root password should be, and some optional questions about network address. There is no Linux knowledge required to use the product. If you don't already own an old notebook with a Pentium III processor and 256MB of memory, you can buy one for $100 - $200 on eBay.

Now that I had the phone switch, I needed phones that could use the data network. There are two options - either buy a data phone or buy an analog adapter that translates between the analog phones most people use at home and the data network.

I mostly decided to buy new phones. The Cisco 7960 can often be bought used on eBay for as little as $100, and it is a great phone. This way you can put calls on hold, transfer calls from room to room, use the phone directory, conference calling or other advanced features. Cisco ships most phones configured to use their proprietary data signaling, but you can download a firmware update for free from cisco.com that supports the SIP standard.

If you prefer to use an analog phone or fax, you can buy a box that translates from analog to data, such as the Sipura spa-3000 or spa-2002 (Sipura is now also owned by Cisco / Linksys). These are available for around $50 on eBay. These boxes are about the size of a deck of cards, and have both a data network and analog phone modular jack. They have a web based admin utility to configure the phones to connect to the VOIP phone switch.

The daisy chained wiring was probably the least desirable aspect of the wiring. Modern data networks are switched, not shared, so the jacks needed a network switch to connect the two segments. So rather than directly connecting the two wires in each wall outlet box, I terminated them as two Cat5e jacks. This is very easy - Leviton makes keystone Cat5e jacks that allow you to connect the eight wires from the cable into the jack without special tools or soldering. These jacks then snap into a wall outlet cover that replaces the phone jack outlet cover.

If you use a Cisco phone, it has a built-in switch so you can just connect the two jacks on the phone to the two jacks on the wall outlet using two network cables. If you use the spa-20002 you need to also use an inexpensive ethernet switch, like the Netgear GS605. You'll also want such a switch if you want to connect PCs or Tivos to the wired network. For some rooms you might decide to use a WIFI access point with a built-in switch (like the D-Link DIR-655 Xtreme N Gigabit Router) to bridge the wired and wireless worlds.

After the network is assembled, you can then configure your phones to talk to the VOIP switch running on your laptop. Each phone can get a separate extension, so no more yelling to call the kids downstairs - the phone is your intercom. Each extension is also private so we don't have to worry about kids picking up the phone while we're on conference calls with clients on snow days.

You then need to decide how you will call the outside world. You can either get another spa-3000 and connect your phone company analog line to your network, sign up for VOIP service from an enlightened provider that will let you use your own equipment (such as Inphonex or VoipStreet, not Vonage or your cable/phone company's VOIP service usually won't let you do this). We have both - 1 analog phone line from Verizon for critical calls, and two different VOIP providers. We use two VOIP providers because VoipStreet gives you extra phone numbers very cheaply but doesn't let you call international and charges for 800# minutes, and Inphonex doesn't charge for toll-free calls and does let you call international. You can have different phones ring on different extensions very easily through the web based configuration on the Trixbox/Asterisk VOIP switch.

We're very happy with this phone setup. We get advanced features for the phones, can have eight people dialing out at the same time, and our monthly phone bill is less than half what it used to be. The system is very reliable, and so is my data network. Now that I can plug in when I am doing a webcast, snow days are a lot less disruptive than they used to be. But I saved my favorite feature for last - wake up calls that I can schedule for any room in the house from my computer, playing the mp3 music my children request (currently it is "It's the Best Day Ever" from SpongeBob - did I mention their ages are 6, 8, 8, and 10?).

For futher reading on Asterisk, I suggest:
http://nerdvittles.com/index.php?p=137
http://asteriskathome.sourceforge.net/handbook/
http://www.voip-info.org/wiki/view/Asterisk+Cisco+79XX+XML+Services
http://www.cisco.com/en/US/docs/voice_ip_comm/cuipph/7960g_7940g/sip/6_0_7_4/english/administration/guide/siptrb60.html

Family Technology

My wife calls me Sysdadmin because now that we have 4 little geeks running around the house with laptops, ipods, cellphones, and game gear that all needs technical support.

Between the home network, the groupware server, the IP phone system, and the home automation system, I have a new appreciation for the corporate IT guys who support me.

I created this blog to share my experiences about technology for the family.