A Virtual 'Wireless' PC-Controlled Automation System

Introduction

In this cyber age, we all know what virtual reality means. All those computer animations and electronic games appear so alive that we practically believe that they are 'real'! The concept of virtual wireless control in this article is very similar in nature. The ease of control commands (a few keystrokes on the telephone keypad) and the absence of physical wiring installations virtually render our project scheme 'wireless'. It feels like wireless. But in reality, it isn't. The fact is that we simply exploit the existing wiring systems in our working plan that are already installed in-house, namely the telephone network and the A.C. lines. In essence, we send our control signals in DTMF codes through the telephone line, decode the instructions by the Telecontroller, pass the information to the computer, and broadcast X-10 commands over the AC lines to operate corresponding appliances via the CM11A Interface. Before we go into details of our scheme, a review of the fundamentals in DTMF and X-10 signals is in order.

DTMF Decoder

Modern telephone equipment now employs unique electronic tone-pairs to represent telephone dialling numbers known as DualTone Multi-Frequencies (DTMFs) and are now standards in the field of telecommunications. There are many IC chips in the market that capture DTMF signals and convert them into binary codes. MT8870 DTMF decoder chip by Mitel used in the Telecontroller is a complete DTMF receiver which accepts DTMF tone pairs and digitizes them into 4-bit codes. The chip works seamlessly with the computer. It validates incoming DTMF signals and passes them in bits to the computer via the parallel input port. A cross reference table of DTMF dialling and 4-bit codes is given in TABLE 1.

K# 1 2 3 4 5 6 7 8 9 0
Q1 1 0 1 0 1 0 1 0 1 0
Q2 0 1 1 0 0 1 1 0 0 1
Q3 0 0 0 1 1 1 1 0 0 0
Q4 0 0 0 0 0 0 0 1 1 1
Table 1: Functional Decode Table for Mitel MT8870 chip.

X-10

X-10 signals are device controlling codes superimposed on the AC lines. These signals ride on the AC power waveform as the carrier and travel down the AC lines to reach the controlled devices. The X-10 Home Control System was first introduced in 1978.

Table 2 Housecodes and Device Codes.
The housecodes and device codes range from A to P and 1 to 16 respectively although they do not follow a binary sequence. The encoding format for these codes is as follows
Housecode Device Code Binary Value Hex Value
A 1 0110 06
B 2 1110 0E
C 3 0010 02
D 4 1010 0A
E 5 0001 01
F 6 1001 09
G 7 0101 05
H 8 1101 0D
I 9 0111 07
J 10 1111 0F
K 11 0011 03
L 12 1011 0B
M 13 0000 00
N 14 1000 08
O 15 0100 06
P 16 1100 0C

Table 3 Function Codes.
Function Binary Value Hex Value
On 0010 02
Off 0011 03

Since then, X-10 has developed and manufactured convenient home automation modules with the patented X-10 standard. All these modules are essentially transceiver appliance controllers that are capable of transmitting/receiving X-10 signals via the in-house AC power lines. The attractive feature of X-10 modules is that all of these units are plug-ins to the common AC outlets and therefore require practically no extra installation and wiring work. There are 2 dials on each module that could be set to identify itself unique within a controlled system. The two settings which represent the housecodes and device codes (Table 2), offer a total of 16x16 possible controlled devices for a given system.

Safety Comes First

This project makes use of the phone and AC lines as the media of communication. Before you start to work on the project, you must be aware that you are subjected to high working voltages. The ringing signals across the phone lines could be as high as 130 Vac and DC operating voltage is between 45 to 105V. Nominal voltage across the AC lines in North America is 120Vac. Transients caused by induction, lightning or electrical faults could create even hazardous overvoltages. Therefore exercise extreme caution when you work on the project.

How the scheme works

The overall home "wireless" automation project is illustrated in Figure 1. The Telecontroller together with the CM11A Interface works neatly alongside with the computer. While the former enables the PC to talk to the phone line via the parallel port, the latter helps the computer to communicate with the X-10 controlled devices through the serial port. After the Telecontroller answers the phone and validates the security codes in the form of DTMF signals, the PC in turn instructs the CM11A Interface to talk to the corresponding controlled devices. Here is the scenario. Before I leave my office heading home, I would turn on my air-conditioner to cool down the house to a comfortable level in the summer. When I get around my street corner, I would like to open the garage door, turn the porch light on if it is dark, and disarm my home security. These could all be achieved with a few keystrokes on my mobile phone! The beauty of the present scheme using X-10 modules is its high degree of expandability and flexibility. Any changes of the system configuration involve only minor software modifications. Practically no physical installations and wirings are necessary because the X-10 modules use existing AC lines in communication. The Telecontroller is a telephone interface to the PC. It basically interprets ringing and DTMF signals in the phone line and digitizes them into binary levels for the PC to read. Refer to the Telecontroller project in the main page.

How the Interface works

The CM11A Interface communicates with a PC in Serial Mode. The serial parameters are Baud Rate (4,800bps), Parity (None), Data Bits (8), and Stop Bits (1). The interconnecting cable comes with the Interface package. The DB9 connector end goes into the serial PC port and a RJ11 phone jack connector to the Interface side. In its elementary form, a standard X-10 transmission proceeds as in the following:
1) PC sends 2 bytes (header:code) to the Interface about the address of the controlled unit and/or its operation function;
For defining controlled device address information, header-code bytes would be :
Header (8 bits) Code (8 bits)
<0 0 0 0 0 1 0 0>(Hex 04) (housecode>(devicecode> (4 bits) (4 bits)
(refer to Table 2)
For sending controlled unit operation function, header-code bytes would be:
Header (8 bits) Code (8 bits)
<0 0 0 0 0 1 1 0>(Hex 06) (housecode>(function> (4 bits) (4 bits)
(refer to Tables 2&3)
2) interface sends back 1 byte (the checksum of the received 2 bytes) for PC to validate;
3) PC returns 1 byte (Hex 00) to the Interface to acknowledge correct transmission;
4) the Interface sends 1 byte (Hex 55) to the PC indicating that it is ready to receive instructions again.
As an illustrative example, let's say that we would like to turn device A1 on, the conversation between the PC and Interface, in hexadecimal, will be as follows:
PC Interface Comments
04 - header for device address
66 - device A1
- 6A checksum (04+66)&FF
00 - transmission OK
- 55 interface ready
06 - header for device function
62 - device A (defined previously) ON
- 68 checksum (06+62)&FF
00 - transmission OK
- 55 interface ready

How the program works

The program, written in BASIC, follows the logic depicted by the flow chart shown in Figure 4. The program is first initiated by an incoming ringing signal. The program will answer the phone after 3 rings are detected within 10-15 seconds. Once the phone line is in an answer mode, the program will monitor the St bit at the decoder. When the bit gets high, it indicates a valid incoming DTMF signal. In sequence the registered decoder data are then read via the input port and compared with the stored 4-word security code. Upon invalid passwords, or if the adjacent key inputs are not done with 5-10 seconds, the phone is put back on-hook condition waiting for another call. If everything matches, the PC will interpret subsequent key-in instructions and exchange X-10 operation codes through the CM11A interface to the corresponding controlled modules as outlined in the previous section until a terminating command is issued.

Conclusion

It could not be a better time to start on this project than at the turn of the century. For sure, the millennium will be an era in vigorous pursuit of wireless comfort. We could get right into this growing technology with our project. Unlike most commercial packages where softwares and configurations are rigidly defined, this project adopts a do-it-yourself approach. The project is so simple that you could easily write your own program and tailor-make your configurations to suit your preferences and applications. The beauty of the "wireless" scheme is that you could make changes to your system any time at will without worrying much about wiring and installation work. It is simply a matter of changing the parameters in your program and plug N play units. More importantly this project keeps you in touch of the state-of-the-art technology of the decade!



Email Contact
keensd@hotmail.com











1