X-10 Data-Stream Monitor Philip C. Plunkett pplunkett@cix.co.uk ABACUS ELECTRICS 10 Barley Mow Passage Chiswick, London, W4 4PH, U.K. Document Revision 1.01- January 2002 Source Code Revision 1.20 - August 1996 http://www.cix.co.uk/~pplunkett/x10.htm Introduction This document describes how the author’s X-10 compatible appliance module may be used as a simple X-10 data-stream monitor. Raw X-10 data on the power-line is converted into RS232 data that may be monitored on a PC running a terminal program. In fact the ‘monitor’ was designed before the appliance module when it became necessary to fully understand the data format as generated by various X-10 power-line controllers. This ‘earlier work’ is published now at the request of some constructors. Hopefully it will also aid in analysing problems encountered when building the appliance modules. It should be read in conjunction with the earlier design article (distributed as X10AM1.ZIP). Disclaimer Construction of the X-10 power-line equipment should only be undertaken by an experienced constructor with access to test equipment. In use and during test the circuits are connected directly to the power-line and so danger is involved. The author accepts no liability for the health and safety of the constructor assembling or modifying his designs. Description The data-stream monitor uses the same circuit board as the appliance module. The PIC16C54A micro-controller contains a different program so that instead of interpreting the X-10 data and switching a triac the PIC drives an opto-isolator with RS-232 data. The PIC16C54A does not interpret the data in any way. At each power-line zero crossing either an ASCII ‘0’ or ‘1’ is transmitted to indicate the absence or presence of the 120kHz carrier. PC Software The PC should run a terminal program set to the correct COM port, 4800 baud, and 8N1 format (eight data bits, no parity, 1 stop bit). The author used Procomm+ for DOS however Windows Hyperterminal could probably serve. Data pours out of the monitor so a terminal program that can freeze the display or capture the data to a file for examination later is most useful. 1 PC Interface On the author’s appliance modules the manual on/off switch is wired to the circuit board via a two-pin connector. These two pins provide a simple connection point for the RS232 data output. The monitor software in the PIC16C54A configures the RA3 port to be an output and drives the LED inside the opto-isolator. The COM port TXD and DTR lines from the PC are used to power the opto-isolator output circuit. As the PC only listens and does not transmit, the TXD line stays in the idle state and acts as a negative supply. The DTR line is normally set positive when the PC opens the COM port. It is used as a positive supply. R10 U2 22k 1 RA1 RA3 RA0 17 3 RTCC OSC1 16 4 R101 P101 9-pin Female 'D' 5 RXD 4 DTR 2 U101 4N25 14 6 RBO RB7 13 RB1 RB6 RB2 RB5 RB3 RB4 9 On/Off toggle key R102 15k SW1 2 15 VDD 8 TXD OSC2/CLKOUT VSS (GND) 7 1 /MCLR 5 220 1 6 2 7 3 8 4 9 5 18 RA2 2 PIC16C54A 12 11 10 PIC Object Code The object code is provided in two versions, the first for the PIC16C54A micro-controller and the second for the PIC16F84A micro-controller The object code below should first be cut and pasted into a text file called, for example, X10DSM2.HEX and then programmed into a PIC16C54A micro-controller. The code sets the clock to ‘XT’, the watchdog on, and code protection off. :10000000060C0500FF0C0600050568006A006B0081 :100010006C006D006900070C0200480956093009A0 :100020000307140A18090E0A16090E0A300C190AD9 :10003000310C2F00080C2E0065052A092F03030739 :100040006505030665042A09EE021E0A65042A09ED :100050002A090008320C29000000E9022C0A0008D5 :10006000380956094507360A030500080304000845 :1000700025063E0A040025073A0A00080400250662 :100080003E0A0008060C29004D0A0F0C29004D0AF3 :100090001E0C29004D0A3D0C2900C00C2100040053 :1000A000010243074F0AE9024D0A000861000400FB :0800B00001024306570A000893 :0203FE00000AF3 :080400000A000B000A000C00C9 :021FFE00FD0FD5 :00000001FF The object code below should first be cut and pasted into a text file called, for example, X10DSMB1.HEX and then programmed into a PIC16F84A micro-controller. The code sets the clock to ‘XT’, the watchdog on, and code protection off. :1000000006306500FF3066000514900192019301EF :10001000940195019101073062004820562030205C :10002000031C142818200E2816200E2830301928FA :10003000313097000830960085152A20970C031C54 :100040008515031885112A20960B1E2885112A2054 :100050002A200034323091000000910B2C2800340B :1000600038205620051D36280314003403100034B0 :1000700085183E286400851C3A28003464008518E1 :100080003E280034063091004D280F3091004D2855 :100090001E3091004D283D309100C0308100640039 :1000A0000108031D4F28910B4D2800348101640085 :0800B000010803195728003470 :0203FE000028D5 :084000000A000B000A000C008D :02400E00FD3F74 :00000001FF 3 PC Terminal Display The power-line data-stream below was captured on a PC running Procomm Plus for DOS. A nearby X-10 Mini-controller was used to generate the data by pressing in sequence, A1 on, A1 off, A2 on, A2 off, A1 on and then dim was held down for a few seconds. 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000011100110100101101001011110011010010110100101 00000011100110100101011001101110011010010101100110000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000111001101001011010010111100110100101101001010000001110011 01001010110101011100110100101011010100000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000011100110100110101001011110011010011010 10010100000011100110100101011001101110011010010101100110000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000011100110100110101001011110011010011 01010010100000011110111100101011010101110011010010101101010000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000111001101001011010010111100110100101101001010000 00111001101001010110011011100110100101011001100000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000011100110100101100101101110011 01001011001011011100110100101100101101110011010010110010110111001101001011001011 01110011010010110010110111001101001011001011011100110100101100101101110011010010 11001011011100110100101100101101110011010010110010110111001101001011001011011100 11010010110010110111001101001011001011011100110100101100101101110011010010110010 11011100110100101100101101110011010010110010110111001101001011001011011100110100 10110010110111001101001011001011011100110100101100101101110011010010110010110111 00110100101100101101110011010010110010110111001101001011001011011100110100101100 10110111001101001011001011011100110100101100101101110011010010110010110111001101 00101100101101110011010010110010110111001101001011001011011100110100101100101101 11001101001011001011011100110100101100101100000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000 4 A1 on A1 off A2 on A2 off A1 on dim