Home Control System III

The integrated system is controlled by a central controller running a custom application written in C/C++.  It unifies the network of hardware distributed throughout the home to provide the inhabitants with an integrated system that appears to perform intelligent actions automatically.  This describes the third generation home control program (set up in 2003).  For a write-up of the previous version, see here.

A bit of history

In 1991, I purchased a PCjr for $40 and wrote a Borland DOS C++ application to communicate with a TW523 (X-10's powerline interface).  This allowed me to send and receive power line commands to control and monitor the house. After a while, I outgrew that configuration and found a third party parallel interface port, and constructed a DTMF decoder and IR interface.  I could now receive touch tone commands from the phone, and send IR commands to my Audio/Video system.  I built a niche into the wall of my kitchen, and housed the system in there for a built-in look.

The first PCjr-based home control system. Installed in 1991.
The status of the units are in the left part of the screen, and events are shown on the right.
More on the Jr here.

I could view the Jr's screen on any TV in the house, and it would do somewhat intelligent actions such as mute the Audio/Video system when a call came in.  As the years went by, I had to replace the floppy drive, as the Jr has no hard disk.  This made me realize that I had to upgrade to a conventional PC, or I would one day be dead in the water with the old hardware.  I had also wanted to add more I/O, and thought that a network of PIC microprocessors would give me all the expansion room that I would need.  The network of PIC idea came from an existing home control system called HCS.

In 1996, I purchased a 200 MHz Pentium computer, and rewrote the user interface with Borland's TurboVision GUI libraries.  The RS485 network allowed me to add many more features such as a weather node, complete phone interface, a power monitor node, etc.  It still ran as a 16-bit DOS application under Windows 95 (and later '98).  Since '95 was not very stable, I left open the option of booting up in DOS only, and run in a dedicated mode if I needed more than a few weeks of reliable operation.

The second generation system using a Pentium computer.
The home control program was augmented with a GUI interface.
See here for more, and here for a screenshot.  Note the PIC modules on top of the
monitor, they are connected by the RS485 network.

Upgrade for the future

In January 2003, the Pentium died, and I had to run out and get another PC at Best Buy.  This time it came preloaded with Windows XP, and it would not run the 16-bit DOS based application properly (I was getting tons of RS485 network errors and time-outs).  I was able to boot up the new PC with my old hard disk running Windows 98, and continue operation basically the same as before, but I knew I had to move with the times, and upgrade the home control program to a 'real' Windows application.

I started to write the new home control system, called G3 (Generation III), in March 2003.  This time, I used the Borland Builder C++ environment, a compiler I have used successfully for other projects at work.  It allows you to build a Windows GUI application using the Visual based concept, and it has been very dependable for me.  Although I did not intend to, the new program is a complete rewrite, using only a few dozens lines of code from the old system.  Before G3, parts of the code that ran on the Pentium was from the original source that came with the TW523 more than ten years ago (!).  Since the DOS application ran in a continuous loop, it loaded down the PC very much, and other tasks such as web browsing were always very slow.  Time delays were implemented with CPU-eating delay loops.  In the Windows way of programming, one uses events to fire actions, and when the home control program is not doing anything, it frees Windows to do other tasks.  Timers fire at 1msec interval to perform the background polling of the PIC network.  As a result, Windows indicates that the CPU is used less than 2% of the time when running only G3.  This means web browsing is now smooth, and I can even play a video with the DSL connection without disruption of the home control program or the video.

The new G3 program was put into service only two months after I started to write it.  Several new features made the one-day trail run successful, and I had only some minor tweaks before it was left permanently running.  One significant feature is 'monitor mode'.  This causes the home control computer to not control the RS485 bus that it is attached to, but listen and decode all the messages.  In this manner, the new program could gather all the sensor readings and update the user interface and perform as usual, except the original home control program is running the home.  This greatly avoided downtime of the system, a nice feature as we have grown accustomed to its benefits.

Main control screen
Main screen of the new home control program called G3.  Although only four house codes are visible
at one time, the state of any unit can be determined by changing a selection on the GUI.
Note the forecast for today is shown.  It shows a mostly cloudy prospect, with a high of 53F.

Feature List

Here are some of the features of the system.  The new ones are noted.

Monitor mode (here shown as 'passive') causes G3 to process network
traffic on the RS485 line, but it does not generate any.  An update has added an
'auto' feature to the irrigation control depending on the rain gauge.

The user can select from a wide range of options in order to connect to the RS485 network,
including if it is made available on the TCP/IP network.

The forecast dialog box.  Weatherforecasts for the next 7 days are downloaded and displayed in textual form.
POP means 'Probability Of Percentage'.

All X-10 unit names can now be edited at run-time.  Compare to screen shot of the
main screen above.   Units not marked as 'Light' do not show dim/bright on
the Home Status window.

The user can customize the Internet options such as e-mail and pager settings.
Some of the settings here are fictitious.

Example of a Translator rule.  If the front door is closed (S4-OFF) and it is at
night (G12-ON), send an OFF command to the entry way light (D15) after a delay of 2 minutes.  On the event window, the exchange will be documented by the contents of the Comment box.  This very complex structure allows great flexibility in defining Translator rules.  If the user needs help, each edit box will pop up a hint if the user pauses the mouse cursor over it.

Charts of gathered data

The last set of features to be completed are the charting functions.  Before I go into this section, I just want to mention that I like looking at charts and graphs.  I do a lot of it at work, and discovering trends and relationships in the data is something I find fun.  This charting feature existed to a limited extent in the G2 version, but I have decided to chart all the analog data that G3 gathers (using the 'TeeChart' component from Borland Builder C++).  Examples are ambient temperatures and power line status.  This screenful can be switched to if the user selects that function.  The horizontal axis of the chart is the time during which the sample was taken.  The chart autoscales the vertical axis depending on the max and min values of all the graphs shown.  A user can select either the left or right vertical axis for a data series by clicking on a series of checkboxes on the left.  If the user needs help on what a particular check box does, he/she can pause the mouse over it, and a hint will pop-up with the name of the corresponding graph.  Alternately, by clicking on the 'Legend' button, a legend will appear next to each pair of checkboxes along with the color of the graph for the most complete assistance.
For the user's convenience, a series of preset configurations have been hardcoded, and can be cycled through to quickly show commonly needed graphs.  Alternately, the user can just click on the appropriate checkbox to enable a graph.

Example of a set of charts showing temperatures around the home.  Here is another chart.

In the example chart above, certain temperatures around the home are charted.  As the user moves the mouse over the chart, a faint vertical line snaps to its position.  Where it intersects with data, the value and name are displayed along with the time on the horizontal axis.  In this example, at 2:39 pm, the temperature in the attic was 113.9 F, while the outside temperature was 94.4 F, etc.  The checkboxes on the left turn a particular chart on and off, i.e. if the left box is clicked, the graph's axis will be the left one.
One can make some observations on these graphs:

All these temperature change events have their corresponding change in the power use of the home, which can be seen on another preset configuration.  The user can also turn that trace on by clicking on its corresponding check box.  Combined with a trace that shows temperature rise or fall through the heating/cooling unit, one can tell how well they are working, or if service is needed (by comparing the delta T vs power usage).

Long term update

Next level up

Back Home