HTINews Article
- Feb98 -
[HTI Home Page]

[Click Message To Learn More]

The Complete Home Automation Controller - Programming
by Jeff Vogel

"This article contains the complete plans and instructions for a controller kit capable of IR, Hardwired and X-10 device control using QUICKBASIC programming."

Programming:

The CHAC can be programmed to pulse and flash the outputs described in the output section according to the following protocol:

P{field1} <CR>

Valid values for field 1 are:

Infra-Red

Learning types of Remote Control receivers faded out in the late '80s because they were not reliable and repeatable. Also, there was always a signal which couldn't be trained. Therefore, for this project, the author deemed it necessary to reverse engineer the output from a Universal Remote Control emulating an existing brand of CD player to eliminate the need to train the system. This has proven to be the most reliable for reception of signals from every Universal Infra-Red remote control the author has tried. (One For All remotes, Any Radio Shack Remote with an AUX button, Memorex, etc.) On all One For All remotes and Radio Shack 4 in 1, the code is CD 164. If you are not using one of these remote controls, look for the code on your remote control that would control Emerson, Genexxa, Realistic, or Scott CD players. One of those codes will also work for the Complete Home Automation Controller.

Now, simply point your remote control at the IR detector Module U2, and examine the terminal screen. The action/response protocol is as follows:

Button on Remote CHAC Response Button on Remote CHAC Response

1

R1

9

R9

2

R2

0

R0

3

R3

CH up

R+

4

R4

Ch dn

R-

5

R5

Rew

RB

6

R6

Play

RL

7

R7

Fast F

RF

8

R8

Stop

RS

Pause*

RP

Enter*

RE

*Pause and Enter are decoded from some Remotes only.

Testing IR Transmit

Connect your OFA 5 remote to the CHAC (prefabricated cables are available from the supplier in the source list). There are 43 serial OFA 5 commands to perform various functions. The CHAC uses mostly control characters to transmit the necessary signals to the OFA 5. Therefore, you need a terminal program (such as Windows 3.1 Terminal) that is capable of sending Control Characters to the RS-232 port when you press the <CTRL> key and another key. Or, if you wish to write a program in basic, you can simply use the decimal equivalent to the character with the CHR$(nnn) command. (See example.)

Program the OFA 5 remote to control one of your devices. After establishing communications with the CHAC, send a 'Qn<CR>' where n is the ASCII character corresponding to the CHAC protocol below: If using basic, you would send a string built as such: "Q" = CHR$(m) + CHR$(13). CHR$(13) is a carriage return (Note that Microsoft Quickbasic sends CHR$(13) automatically with the PRINT statement). The protocol to allow the CHAC to control the OFA is listed in Table 1:

Upon sending the command to the CHAC, you should see the LED on the OFA 5 remote blink once for every command you send, and then blink quickly twice when the CHAC places the remote back into 'Normal' mode.

OFA 5 button CHAC Protocol n CHAC protocol m OFA Function CHAC Protocol n CHAC protocol m

A

^A

1

9

^W

23

B

^B

2

SCAN

^X

24

C

^C

3

A/B

^Y

25

POWER

^D

4

PLAY

^Z

26

1

^E

5

AUDIO

^\

28

2

^F

6

ENTER

^]

29

3

^G

7

0

^^

30

VOL+

^H

8

RECALL

^_

31

AUX1

^I

9

CH UP

{space}

32

VCR

^J

10

REWIND

!

33

TV

^K

11

PAUSE

"

34

CABLE

^L

12

FF

#

35

4

^M

13

MAGIC

$

36

5

^N

14

CH DOWN

(

40

6

^O

15

SHIFT

)

41

VOL-

^P

16

STOP

*

42

AUX2

^Q

17

VIDEO

'

44

AMP

^R

18

DISPLAY

1

49

TUNER

^S

19

RECORD

2

50

CD

^T

20

PROGRAM

3

51

7

^U

21

MUTE

4

52

8

^V

22



Table 1 -- CHAC Protocol for Infra-Red Transmission

Checkout X-10

After establishing communications, you should start by checking out that the powerline is functional for normal X-10 transmission. The CHAC listens for X-10 conversation on the powerline upon Reset. Using an X-10 transmitter, attempt to activate any X-10 device. If the device responds, we have verified that the CHAC and TW-523 is not interfering with normal PLC communication. If the device does not respond, we have a problem. Try it again but this time, disconnect the RJ-11 cable from the TW-523 and the CHAC. Try the transmission again. If it responds, there is a problem with the transmit section of the CHAC. Review the construction portion of the CHAC. If it does not respond, try it again with the TW-523 unplugged. If your device responds now, the TW-523 you have is not functioning properly. If pin 1 on Ctr2 is asserted to ground, the TW-523 will constantly assert a 120 kHz signal on the powerline thereby jamming the powerline for any communications. The most probable cause would be that Dx10_1, Dx10_2, or Qx10_1 have been installed improperly.

CHAC Protocol for X-10 Transmission and reception

X-10 Reception

The CHAC will respond to X-10 signals received according to the following format:

Xnm

Where n is the House code ASCII Character and m is the Key/Function Code ASCII character per the CHAC X-10 Protocol table

X-10 Transmission

The CHAC will build and send X-10 signals in a 'string' form as requested by the user. Request strings are limited to 16 characters. The format is as follows:

Wnm<CR>

However, the user can send a command string according to the following format:

Wnmnmnm...<CR> limited to 16 characters.

For example, to turn on House code A, unit 1, the user would send:

WA1AJ<CR> which consists of 6 characters.

Using the Dimming Functions:

The dimming function takes the first character after the dimming function (L or M) and sets the level to 1 of 16 levels. ASCII characters 0-9 correspond to the first 10 dimming levels; ASCII characters A-F correspond to dim levels 10-16.

For example: Dim House Code A, Units 3 and 4 to 50%:

'WA3A4AL8<CR>'

CHAC X-10 Protocol Table

House Code ASCII Character
n
Key Code ASCII Character
m

A

A

1

1

B

B

2

2

C

C

3

3

D

D

4

4

E

E

5

5

F

F

6

6

G

G

7

7

H

H

8

8

I

I

9

9

J

J

10

A

K

K

11

B

L

L

12

C

M

M

13

D

N

N

14

E

O

O

15

F

P

P

16

G

Functions:

Received Function ASCII Character
m
Received Function ASCII Character
m

All Units Off

H

Hail Request

P

All Lights On

I

Hail Acknlg

Q

On

J

Preset Dim

R

Off

K

Extended Data

S

Dim

L

Status = On

T

Bright

M

Status = Off

U

All Lights Off

N

Status Request

V

Extended Code

O


 

Construction / Testing / Programming Examples / Parts List