Home Automation EZine
Volume 2 Issue 1
February 1997

Features
Home Pre-Wire Guide
A/V Basics
Alex - Dan Hoehnen
PLC Controllers
Steve Nolen's Home
Lucky Lindy
Signal Balancing
Steve's Cyberhome
CES Report
Temperature Sensors

Columns
Editorial
CEBUS
Letters
Events

Home Automation Products & Services

Reviews
XTend
Cyberhouse
LynX-SOFT
WinJukebox

Current Issue
EZine Archive

Return to Main Menu

 

[an error occurred while processing this directive]

Dan's HA System (better known as Alex)
by Dan Hoehnen dhoehnen@infinet.com

Dan maintains a Home Automation Index that can be found at
http://www.infinet.com/~dhoehnen/ha/list.html.


Yep, that's right, I named my home automation system Alex. I figure most great computer systems have had a name (namely HAL from 2001) so if my system was going to compete with those, it had better have a name too. Alex doesn't stand for anything, it's just the name of my recently departed cat.

Alex is pc based and runs under Windows 3.1. Click here to jump to a description of Alex.

My first HA system was based on the HCS II from Circuit Cellar. Continue reading for more information on the HCS.


HCS II

I started with an HCS II system from Circuit Cellar. This is a stand-alone single board computer aimed at the home automation market. It had 16 digital inputs (DI's), 8 digital outputs (DO's) and 8 analog inputs (AI's). It supports an rs-485 network connection which allows additional IO units, LCD interfaces, IR interfaces, etc. to be easily added using only 2 twisted pairs of wire (1 pair for power, 1 pair for the rs-485). Speech, phone and other interfaces are also available. The HCS is programmed using a simple, Basic like language.

For a complete description of its features and options check out the Circuit Cellar Web Page.

In addition to the main processor (HCS2-DX) I had an LCD-Link module, a PL-Link module and a BUF-Term module.

The LCD-Link sits on the rs-485 network and provides you with a user interface to the system. It supports most 80 character LCD's. These are usually configured as either 2 lines x 40 characters (2x40) or 4x20. It also supports 4 push buttons and 3 LED's. With a slight modification, I was able to get my LCD-Link to support a 4 line by 40 character (4x40) display (I just didn't think a 4x20 or 2x40 was going to be big enough).

The PL-Link also sits on the rs-485 network. It provides the X-10 interface by connecting to a TW-523 module plugged into a nearby outlet.

The BUF-Term option provides isolation for the 16 DI's and the 8 DO's. It also has handy screw terminals for all 24 IO points to facilitate connections.

As far as functionality goes... it did the following:

  • All first floor lights, outside lights, garage lights and lights in my workshop are X-10 controlled.
  • The LCD-Link is mounted on the kitchen wall for easy access to all home automation functions.
  • Outside lights come on in the evening, varying randomly by up to 30 minutes.
  • Outside lights go off in the morning, varying randomly by up to 30 minutes.
  • During the day, X-10 OFF commands are sent to outside lights every hour. This is because I have 2 sons who like to push buttons.
  • During the night, X-10 ON commands are sent to outside lights every hour.
  • A motion detector in the kitchen was used to turn on the kitchen light whenever motion was detected between 8pm and midnight. The light was then turned off after 5 minutes of no motion.
  • If motion in the kitchen is detected between midinght and 6am, then only the little light over the sink is turned on so that you are not blinded when you walk into the kitchen in the middle of the night.
  • If the garage door is open and it's night time, a buzzer is sounded every 15 minutes. You can, of course, override this if you want the door open.
  • When you push the button on the LCD-Link to enter BED mode, the light at the bottom of the steps turns on (so you can see where you are going) and then all first floor lights turn off. Two minutes later, the light at the bottom of the steps is turned off.
  • When AWAY mode is active and night time comes along, lights are turned on and off just as they would be if we were home. If bedtime rolls along and we are still away, BED mode is automatically entered and the lights go thru the above mentioned sequence. Thus, whether we are home or away, the house always looks the same from a lighting point of view.
  • My workshop door is locked always and is accessed via a keypad and electric door strike. The kaypad is a Radio Shack model intended for their alarm systems. When the correct combination is entered, a DI is activated, which in turn causes a DO to be set for 1 second that energizes a relay that supplies the AC voltage to the door stike. This also causes the workshop lights to be turned on. This is just like being "buzzed in" in an apartment building. In case of a power failure that lasts longer than 35 minutes (UPS, remember), a key can be used to unlock the door.

I was very happy with the HCS2-DX, but I wanted to add some features that just weren't available for it yet. Mainly, these are voice recognition and voice mail capabilities. So, I decided that for the ultimate in flexability, I would use an IBM compatible pc and write my own code to do what I wanted.

Thus, Alex was born...


Alex

Main Features

  • Voice Recognition
  • Text-to-Speech
  • Voice announcement of callers using caller ID
  • X-10
  • Video distribution
  • RS-485 network

Computer Hardware:

My HA pc was put together with almost all used components. I scoured several local used computer stores to find the necessary parts.

  • 486DX-25 motherboard with 8 slots in a desktop case
  • 8 meg RAM
  • 250 meg IDE hard drive
  • 1.44 meg floppy drive
  • VGA card and 14" mono VGA monitor
  • IDE hard/floppy/io controller (1 par, 1 game, 2 ser)
  • Multi-port serial card - 4 ports share 1 IRQ (COM5 - COM8)
  • 32 bit digital I/O card
  • Linksys ethernet card (used to be arcnet)
  • TV Coder - VGA to TV converter (by Creative Labs)
  • ACE 5000 - data/fax/voice modem, sound card, cd-rom interface
  • Sound Blaster 16 ASP MCD sound card - used for voice recognition and text-to-speech

Other Hardware:

  • UPS - APC Personal Powercell, 250VA (170 watt)
  • 12 volt, 3 amp regulated power supply
  • Marrick LynX-10 processor - X10 interface
  • BUF-Term from HCS system (above) for isolation on digital I/O
  • LCD-Link from HCS system (above) for user interface
  • Info Express ethernet hub
  • RS232 / RS485 converter - used to talk to the LCD-Link
  • RS422 / RS232 converter - used to monitor traffic on the RS485 network
  • Radio Shack Multiple Video Distribution System (MVDS) (2 of 'em)
  • Ramsey FM stereo transmitter - used to broadcast caller ID and house status info anywhere in the house/yard.
  • Motion detectors
  • One-for-All IR Command Center (URC 3000)
  • One-for-All-6 Universal remote control (URC 4005)
  • X-10 RF receivers (2)
  • X-10 RF transmitters (wall mount, hand held, keychain)
  • X-10 plug-in transmitters
  • X-10 wall switches and appliance modules
  • 6400 series in-wall X-10 transmitters (2)
  • Sears Craftsman garage door opener with 3-function remote and a Plug In Remote Light Control module.
  • Casio "Wrist Remote Controller" watch - IR capable, learning watch!
  • Panasonic B&W surveillance camera

Hardware Configuration

  • The UPS powers everything except the monitor. It is able to keep everything running for about 35 minutes if the power fails. Of course, X10 does not work if the AC fails, but everything else does. The security system is powered from a separate UPS, capable of powering the alarm system for days.
  • The LynX-10, by Marrick Limited, handles the X-10 to PC interface. The LynX-10 connects to a PC using a standard RS232 serial port. It connects to the power line via a TW523 module and standard RJ-11 phone cable. It is available as either a kit or fully assembled.

    The LynX-10 is great because you don't have to constantly poll it to see if an X-10 command has been received. The LynX-10 monitors the power line and when it 'hears' an X-10 command it sends a message over the serial port to the PC. This generates an interrupt which you can then process by writing an interrupt service routine in DOS, or by responding to a message in Windows.

    You can send an X-10 command by sending the command to the LynX-10 over the serial port. The LynX-10 immediately passes it on to the TW523.

    Other features include:

    • Collision detection & auto re-transmission
    • Check if AC power is present
    • Optional - 8 DO's and 8 DI's
    • and much, much more!

    You can contact Marrick Limited for more information. The Lynx-10 is also sold at several of the suppliers listed in my Home Home Automation Index.

  • The 12 volt supply powers all motion detectors, keypads, LCD-Link, BUF-Term, relays, 232 to 485 converter, etc.
  • 5 of the 7 serial ports are all in use at the same time with the following functions:

    COM1: Mouse
    COM2: Reachout
    COM3: ACE 5000 modem
    COM4: does not exist
    COM5: LCD-Link (RS-485 network)
    COM6: Marrick LynX-10 X10 interface
    COM7: not used
    COM8: not used

  • Parallel port - not currently used
  • Digital I/O card - This card is organized as 4, 8 bit ports. I am currently only using 3 of the ports. One is for outputs and 2 are for inputs. These 3 ports all go thru the BUF-Term for isolation. One of the input ports is configured on the BUF-Term to sense contact closures, the other is configured to sense inputs that are in the +/- 30 volt range. The BUF-Term also provides good drive capability on the DO's, so I can drive relays, LED's, piezo buzzers, etc., directly.
  • The Info Express ethernet hub provides 8 UTP ports and 1 BNC port. It connects a Win95 PC and a laptop via UTP. I ran coax from the BNC port to Alex in my workshop. This allows me to easily add more PC's to the network in my workshop by just daisy-chaining more pc's together. Currently, I have 1 Win95 and 2 WFW 3.11 pc's on the network.
  • The RS-232 to RS-485 converter is used on COM5 to talk to the LCD-Link. This is a half duplex 485 network. I built the converter using wirewrap techniques. It is of the automatic variety, which means it detects when I am sending data and automatically switches to TX mode. It then switches back to RX mode when I am done sending data. Without the automatic feature, you must toggle RTS (or some other serial handshaking signal) in order to switch from TX mode to RX mode and vice-versa.
  • The RS-422 to RS-232 converter is only used for debugging. RS-422 is basically the same as RS-485, except 422 is full duplex since there is no facility to tri-state the transmit driver. Thus, I attached the RX side of the 422 converter to the 485 network in order to use another pc to monitor the network traffic.
  • Radio Shack MVDS - The 2 Radio Shack MVDS units are used to put the Alex VGA screen on channel 14, the VCR on channel 66, and a surveillance camera on channel 18. Thus, tuning the TV to any of the above channels lets me see the corresponding picture. Channel 3 is normally used, and is the output from the cable converter box. The MVDS combines all 4 signals and puts each one on its own channel. The MVDS has been discontinued, but still may be found at some RS warehouses. It sells for about $20 or $30 USD and is only mono (no stereo).
  • The ACE 5000 is a data/fax/voice modem, sound card and cd-rom interface all on one card. It accomplishes this by using the new MWave DSP from IBM. There are currently several cards on the market using the MWave DSP. These cards all incorporate a data/fax/voice modem, sound card and cd-rom interface into a single card. Click here to go to a WEB page dedicated to the MWave DSP. This page includes a description of the MWave DSP, a list of MWave based cards, software updates, etc.

    I purchased a development kit from IBM for $25 that provides an API for the MWave DSP on the ACE 5000 card. For some reason, this development kit is not as readily or easily available as it was a year ago when I purchased it.

  • Description of other hardware coming soon...

X-10 Configuration

  • Housecode A - first floor lights
  • Housecode G - garage lights
  • Housecode H - workshop lights
  • Housecode O - outside lights
  • Housecode P - Christmas lights (only up at Xmas time)
  • Housecode D - used for sending commands/messages. For example, when D1 ON is received by Alex, Alex turns on the family room lights and dims them to a pre-set level. Other D commands turn on lamps (that have no light switch), turn off all lights downstairs except for the family room (this is for when we are watching a movie at night and my kids have left every light on in the house), and turn on/off the baby room monitor.
  • All X-10 light switches have been modified to allow local dimming and to disable the slide switch that prevents the switch from receiving X-10 commands. The slide switch was disabled by soldering the little metal bar in place. This also prevents the arcing problem that I have had on several switches. How these darn things ever got UL approval, I'll never know. The FAQ has info on these mod's.
  • Appliance modules are used for the flourescent workshop lights.
  • Both 2-way and 3-way wall switch configurations are in use.

Software

Alex runs under Windows 3.1. It is comprised of 5 different programs, all of which I wrote using Borland C++ 4.02. I only use C, not C++. The programs communicate with each other using global Windows messages, no DDE or OLE. The global messages are sent using the Windows SendMessage function. Some of the messages are replied to using the Windows ReplyMessage function.

I use Turbo Commander Pro for my serial port driver. This is needed so that the 4 ports on the multi-port serial card can share 1 IRQ. This sofwtare is really cool because it lets you monitor all comm port activity.

I use Voice Assist for voice recognition and Text Assist for text to speech.

The 5 programs that make up Alex are:

  • Alex - main program
  • Alex-IO - Interface to digital IO card
  • Alex-485 - Interface to LCD-Link (RS-485 network)
  • WIX - Windows Interface to X-10
  • MWPhone - Answering machine, caller id announcer, DTMF button detection, and other phone functions


Alex description

Alex is the main program. It basically just "listens" for messages from the other 4 programs and then acts accordingly. Alex does not interface directly with any of the HA hardware. Instead, it sends a message to one of the other programs and then that program accomplishes the task. For example, when the workshop keypad combination is entered a bit changes on DI port 1. The Alex-IO program sees this change and sends a Windows message stating which port changes and what the new byte value is. Alex receives this message, examines the byte to determine what has happened, then sends a message to Alex-IO to set the electric door strike DO bit, sends a message to WIX to send an H2 ON command (workshop lights), then waits 1 second and sends a message to Alex-IO to turn off the electric door strike DO bit.

Alex also has several timers that allow for doing things at regular intervals. And, it monitors the time of day so that various events can be scheduled to occur at certain times.

Alex is the program that I change and re-compile when I want to change/add/delete features. All of the other programs remain unchanged.

Alex-IO description

Alex-IO monitors the digital input ports on the 32 bit DIO card. It is configured to scan each port every 100ms (10 times per second). It also controls the DO port. Alex-IO both sends and receives messages. It sends a message when a DI byte changes. The message includes the port and the byte value. It receives messages in order for Alex to set/clear DO bits and to request the status of the DO and/or DI ports.

Alex-485 description

Alex-485 communicates over the RS-485 network to the LCD-Link. It can be expanded to talk to other devices on the 485 network, but the LCD-Link is the only 485 device I have so far.

The LCD-Link provides an interface to a LCD screen, 4 DI's for push buttons and 3 DO's for LED's.

Alex-485 is configured to poll the LCD-Link every 500ms (1/2 second) in order to get the status of the buttons. The LCD-Link returns the status as a BCD number (each button has a value of 1,2,4 and 8). If the button status is 0 then no buttons were pressed since the last query (polling). If the status is 4 then button 3 was pressed, if the status is 5 then buttons 1 and 3 were pressed.

Once it is determined that a button was pressed, Alex-485 sends a message with the status value.

Alex-485 also receives messages in order to display text and to turn on and off the 3 LED's. Text messages are sent to Alex-485 by sending a pointer to the string that you want to display. This allows Alex to display any string it wants simply by sending a pointer to the string to Alex-485.

Here is a quick overview of how the LCD-Link works and how I use it:

The LCD panel I use is a 4x40 type I bought from an electronics mail order store. It is driven by an LCD-Link board that is part of the HCS-II home automation system from Circuit Cellar Ink. I mounted the LCD panel in a custom enclosure I made myself out of wood and then painted the same color as the kitchen walls - it looks really nice. It is about 3/4 inch thick and mounts right on the wall, it is not recessed. It holds only the LCD panel, LED's and buttons. The electronics are housed in a separate plastic project box that is about 12 inches away and is mounted on the basement stairway wall almost directly behind the LCD enclosure. Here is a drawing of the LCD enclosure.

   |-----------------------------------------------|
   |                                               |
   | L  ----------------------------------------   |
   |    |Monday, Jan 20  9:25              Day |   |
   | L  |            LCD Panel  (4x40)         |   |
   |    |                                      |   |
   | L  |Menu 1   HOME/away  bed/AWAKE  Play   |   | 
   |    ----------------------------------------   |
   |         B1      B2        B3       B4         |
   |-----------------------------------------------|

The L's are LED's and the B's are buttons. The top row displays the date and time and the current mode - Day or Night. The middle 2 rows are used to display status info. The bottom row displays the menu. I have shown Menu 1, or the Main Menu. It defines what function the button directly below each menu item will perform. If I push B4 then messages will be played from my voice mail program. If I push B3 then bed mode will be initiated (turning off lights, etc. and the menu for B3 will change to 'BED/awake' (capitalization change) to show that the mode is now BED. Pressing B1 changes its caption to 'Menu 2' and displays new captions for B2 B3 and B4. It goes up to menu 4 and then it cycles back around to menu 1.

The LCD-Link interface is really easy. It has a unique ID on the network of 'TERM0'. I think the protocol supports up to 4 lCD-links, but I'm not sure. Every .5 seconds (I could go faster) I send out a command 'TERM0 Q' which is a query command for the button status. If no button was pressed then a zero is returned. Each button has a value of 1,2,4 or 8, so it is easy to tell which button(s) was pressed. If I get a value back of 1 then I know the menu button was pressed and I update a variable in my software so I know which menu is active and then I send the following string:

TERM0 S="Menu 2    Caption 1   Caption 2   Caption 3   Caption4"

which updates the text on the LCD to the menu 2 text. Thus, my software keeps track of which menu is active and then takes a different action for each button press depending on the active menu. There is another simple command to turn on and off the LED's.

I did use a trick to get the LCD-Link to talk to my 4x40 display, since the LCD-Link is only meant to support a 2x40 or 4x20 (80 characters max) display. I basically use a DO from my digital output card to decide which part of my LCD is active - top 2 rows or bottom 2 rows. Then each command I send (TERM0 S="some text") only goes to the selectd half of the display. The LCD-Link also supports cursor positioning commands so you can put the text wherever you want.

A simpler solution would be to use the new AnswerMan chip or the Basic Stamp to implement something similar, but neither was available when I made this. The AnswerMan can be found at Micromint and there was an article on it in the Jan '97 issue of Circuit Cellar INK.

The HCS-II HA system has many other devices that are compatible with this 485 network and can all be a node.

WIX description

WIX stands for Windows Interface to X-10. WIX's job is to interface to the LynX-10 card. The LynX-10 card provides an interface between a pc, via a serial port, and a TW523 interface module. The LynX-10 is constantly listening for X-10 commands. When it "hears" one, it sends a message over the serial port to the pc. This in turn generates a Windows message that tells WIX to read the serial port and then decypher the command.

Once WIX has de-coded the X-10 command, it sends a global Windows message indicating the house code, unit code and command.

WIX also receives messages in order to send X-10 commands.

MWPhone description

MWPhone stands for MWave Phone. MWPhone currently functions as an answering machine, a caller id logger and announcer, and it reports various phone related events. However, MWPhone is under development and only the caller id function is presently used all the time.

The caller id function displays each caller's name and number and time of call in a listbox. This also serves to keep a history of the most recent callers (set to 50 for now). Each caller is also announced by playing a WAV file with the callers name. If the caller's number is not found in the database, then a WAV file saying "stranger" is played. WAV files saying "blocked" and "unavailable" are also played for those 2 types of calls.

The sound WAV file is distributed around the house by sending the line level speaker output from the ACE 5000 to amplified speakers on the HA pc, to a Radio Shack pocket amplifier in the kitchen and to the Ramsey FM transmitter. The FM transmitter allows me to use any FM radio to listen to caller id info, if I'm going to be out of hearing range of one of the speakers.

MWPhone sends messages to indicate ringing, on/off-hook, button presses, caller id info and more. It also receives messages so that Alex can control various phone functions. For example, a button on the LCD-Link acts as the PLAY button. Pressing it causes MWPhone to play all the messages you got while you were out.

Eventually MWPhone will be able to screen calls and play different messages depending on who is calling. It will also be able to weed out the junk calls we all get offering us credit cards, new long distance service, asking for money, etc. It will also allow you to control your house from any phone in the world.


Functionality

  • All first floor lights, outside lights, garage lights and lights in my workshop are X-10 controlled.
  • The LCD-Link is mounted on the kitchen wall for easy access to all home automation functions.
  • Outside lights come on in the evening.
  • Outside lights go off in the morning.
  • During the day, X-10 OFF commands are sent to outside lights every hour. This is because I have 2 sons who like to push buttons.
  • During the night, X-10 ON commands are sent to outside lights every hour.
  • A motion detector in the kitchen is used to turn on the light over the island whenever motion is detected between 8pm and midnight. The light is then turned off after 5 minutes of no motion.
  • If motion in the kitchen is detected between midinght and 6am, then only the little light over the sink is turned on so that you are not blinded when you walk into the kitchen in the middle of the night.
  • When you push the button on the LCD-Link to enter BED mode, the light at the bottom of the steps turns on (so you can see where you are going) and then all first floor lights turn off. Two minutes later, the light at the bottom of the steps is turned off. Alex also sends commands to make sure the outside lights are on and the garage and workshop lights are off.
  • My workshop door is locked always and is accessed via a keypad and electric door strike. The kaypad is a Radio Shack model intended for their alarm systems. When the correct combination is entered, a DI is activated, which in turn causes a DO to be set for 1 second that energizes a relay that supplies the AC voltage to the door strike. This also causes the workshop lights to be turned on. This is just like being "buzzed in" in an apartment building. In case of a power failure that lasts longer than 35 minutes (UPS, remember), a key can be used to unlock the door.
  • When someone calls, a WAV file is played between the second and third rings announcing the caller. For example, if my in-laws call, Alex says "Mom and Dad". If my friends, Gene and Laura call, Alex says "Gene and Laura". Alex says "Blocked" and "Unavailable" for blocked and out-of-area calls, respectively. If the caller's number is received, but not found in the database, then Alex says "stranger".
  • The baby monitor transmitter and receiver are plugged into appliance modules so that the whole system can easily be turned on and off. An X-10 wall switch is used to turn on and off each unit at the same time.
  • An X-10 wall switch turns on the family room lights and then dims them to a pre-set level.
  • Another wall switch turns on and off the table lamps on each side of the couch. Each lamp is plugged into the same lamp module.
  • Finally, yet another wall switch turns off every light downstairs, except for lights in the family room. This is great when my kids have left every light on in the house and I don't feel like walking around to turn them off.
  • My One-for-All 6 remote control controls the TV, VCR, cable box, stereo receiver, cd player and HA functions.
  • My Casio watch can control the TV, VCR, cable box and a few HA functions.
  • The middle button on my Sears garage door opener in my car activates a DI to Alex. This in turn causes several WAV files to be played that indicate the status of the house. Since the sound card output is attached to the FM transmitter, this info is available on my car radio as I am pulling up to my house. This allows me to determine if any doors or windows were opened while I was away, or anything else I want to know.

Features under construction

  • Voice recognition - I actually already had this working in kind of a kludge a year ago. But, I am finally ready to incorporate it in a more elegant way. I have mounted a microphone in my family room and am working on recognition from anywhere in the room. It works pretty well if I get my 3 kids and wife out of the house (or I gag 'em).
  • Text to speech - This, too, has been working before. It uses Text Assist and a SB16 ASP sound card. I have also just started trying out a software only text-to-speech program and development kit called Eloquence. Anyone know of any other software only text to speech program? If so, drop me a quick e-mail and let me know what it is, where it is, how much it is, etc.
  • Phone control of everything. I have the schematic of what I am going to use. I just need to build it.
  • Caller ID screening out of unwanted callers.
  • Re-write all code in Visual Basic for ease of programming, portabilty, etc.
  • Network access to all HA functions and status. Once all code is in VB, I have a VBX that will allow me to use either TCP or UDP protocols. I would like for any pc on the network to be able to get status info and to send commands to Alex.