The X-10 and IR Node
This node actually combines four functions in one very busy
I call it my node0 because it is the first and probably most important
box in my system. Each function is actually a logically seperate
module. In this manner, it is possible to split it away from this
node, and put it into another one. All messages are sent equally to
The serial interface
The PIC16C74 has one hardware UART. This is assigned to the 485 port on
this box. A software UART is implemented and connected to the 232 port.
All characters are echoed from one port to the other, and then used
to decode network messages.
The LCD panel
I use a 2x16 line LCD panel from EPSON. This uses the industry standard
Sharp 44780 Controller, and code examples exists in several places. It
was difficult at first getting the timing right, but the result have
successful. The network address of the LCD module is 'L'. The 'data'
of the network message will be displayed in the LCD window, allowing
node to display a message on the window. For example, sending the
message over the network:
This displays "Hello" on the LCD screen, then the LCD sends an ACK
By the way, the address of the sender of the message above is 'C',
is the central controller or PC.
The Infra Red interface
The PIC controls a oscillator and driver that flashes an IR led via a
on the box's rear panel. There is also a Sharp IR cube that demodulates
the raw IR signal to TTL level pulses. The software module has been
to send and receive the Sony SIRCS protocol. The IR module's address is 'I', and it can accept commands or
for sampled IR data. For example, the network command:
This causes the software module to respond with the most recently
IR command. The network command:
Causes the module to send a function code 17 to device code 1,
return an ACK. This command turns up the volume on my TV.
Scope shot of Sony TV "Volume Up" command.
of several protocol formats shows a pattern that is very common.
In the section below 'high' means presence of light (modulated to
38 - 40 kHz), and 'low' means no light. A '1' means a logic high
for the transmitted data, and '0' is a logic low.
- First, the packet starts with a long high period and a low period. This is what I call the start bit.
- Then follows the data bits. A '1' is a long period (high or low), while a '0' is a short period.
example, in the Sony scope shot above, the 'low' periods are all the
same and the data is transmitted via the high periods. A long
high period is a '1', and short high is a '0'.
- Some manufacturers do the opposite, such as for example from my ViewEra TV.
Here, the data is transmitted during the low periods as they have
different lengths. The highs are all the same duration.
data bits are then sent serially. For example, for the Sony
command above, there are 12 bits. For the ViewEra example, there
are 32 bits. For the Sony command above, the bits are
"010010010000". From others we know (see link below) that the
bits need to be reversed to understand the pattern, and that produces:
00001 0010010. The first five bits are the device code (1 is the
Sony TV), and the rest (18 decimal) is the button code, which is
It seems possible to develop a PIC based IR
decoder that will take any command and reduce it to about a dozen bytes
that has all these decoded (not just a raw sample).
Sony SIRCS protocol
A really big depository
of IR data
The X-10 interface
This software module is connected to an X-10 TW523 module; its address
is 'X'. For example, the following network command:
May cause the software module to return:
This means that the oldest received X-10 command is A-1. The
buffers up 30 X-10 commands in a fifo, sending the oldest one first.
way the main controller can query the X-10 interface at its
and messages will not be lost.
Home Automation Main Page