0% found this document useful (0 votes)
121 views0 pages

X-10 Compatible Appliance Module

This document describes in detail the design of an X-10 compatible appliance module that may be constructed as-is or customised by a competent home constructor. The module was designed not for financial gain but for the authors own use. It was designed without the knowledge or co-operation of the X-10 company but used information contained within their TW523 documentation.

Uploaded by

burdinski
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views0 pages

X-10 Compatible Appliance Module

This document describes in detail the design of an X-10 compatible appliance module that may be constructed as-is or customised by a competent home constructor. The module was designed not for financial gain but for the authors own use. It was designed without the knowledge or co-operation of the X-10 company but used information contained within their TW523 documentation.

Uploaded by

burdinski
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1

X-10 Compatible Appliance Module


Philip C. Plunkett
[email protected]
ABACUS ELECTRICS
10 Barley Mow Passage
Chiswick, London, W4 4PH, U.K.
Document Revision 1.0 - May 1997
Source Code Revision 1.28 - August 1996
Introduction
This document describes in detail the design of an X-10 compatible appliance module that may be
constructed as-is or customised by a competent home constructor. All functionality is supplied by a
PIC16C54 micro-controller at the heart of the module. Schematic, circuit description, printed circuit
board design and full source code are provided.
Disclaimers
The module was designed not for financial gain but for the authors own use. It was designed without
the knowledge or co-operation of the X-10 company but used information contained within their
TW523 documentation. The author does not intend to profit from the design and will not supply
assembled units or parts. Certain aspects of X-10 power-line communication have been protected by
patent. No liability will be accepted by the author for any legal action taken by the X-10 company
against constructors or vendors who chose to sell modules or programmed PICs based upon this
design. In practice it is not possible to save money by making X-10 modules. Mass production, low
cost parts, Far East labour costs and keen marketing ensure the X-10 brand product will be
significantly cheaper than a home-made product. Home constructors will be interested in customising
the module in some way; adding features that are unavailable in a ready-made product.
Construction of the 'clone' appliance module should only be undertaken by an experienced constructor
with access to test equipment. In use and during test the circuit is 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 this design.
Enough of the disclaimers.
General
X-10 has never caught on in the UK. Available only from a handful of mail order suppliers the cost of
modules was typically twice that in the USA. In 1996 the technical requirements for RF emission and
susceptibility (EMC) became more stringent and passed into European law. Electrical goods had to be
labelled with the CE mark to indicate their compatibility with the regulations. X-10 equipment was
not so marked and rather than risk fines a number of the suppliers ceased stocking
Having a modest investment in X-10 modules and needing more the choice was to either to import or
to design. As the requirement was for something specific and non-standard to design seemed the best
(and more interesting) option. The need was for a number of 240 volt hard-wired appliance modules
switching loads up to 500 watts. They had to be built into waterproof housings and work reliably
outside in all weathers. The actual application was to switch lighting, pumps and fountains in the
authors garden.
The cheapness of micro-controllers such as the Microchip PIC mean that they are ideally suited to
applications such as the X-10 compatible appliance module. The micro-controller ROM, RAM and
speed are more than adequate for the limited requirements of the module. The PIC must control a load
switch, detect power-line zero-crossings, detect the 120kHz X-10 carrier, read house and unit address
switches and sense a manual on-off push-button. Twelve I/O pins are needed in total; one output and
eleven inputs. A PIC16C54 fits the bill perfectly.
2
Load Switch
To control a mains rated load there are two options; either to use a relay or a triac. A relay is
appropriate for very high power loads, very low power loads, isolated loads and where only relatively
slow toggling rates are needed. A triac is suitable for switching non-isolated medium power loads and
where rapid control (i.e. dimming) may be required. The author wished to switch lighting, pumps and
fountains in his garden so a triac was chosen.
The triac is a cheap three-terminal device designed to switch high voltage AC supplies and is used
extensively in lamp dimmers and motor speed controllers. The two 'Main Terminals' MT1 and MT2
are wired in series with the load and block current to it. When a small 'trigger' current is allowed to
flow between the Gate terminal and MT1 conduction occurs between MT2 and MT1. Once the triac
has switched on the load current will continue to flow even if the gate current is removed - providing
that the load current exceeds the 'latching value,. To switch the load off the load current must be
reduced below the 'holding current'. Latching and holding currents are specified by the triac
manufacturer . As we are considering an AC supply the load current will automatically switch off at
the end of the next 50Hz (60Hz) half-cycle.
To sustain load current beyond a single half-cycle of the AC supply then either the triac must be re-
triggered each half-cycle or the gate current must be maintained continuously. Pulse triggering has
the advantage that lower average current is required from the DC supply. Typically the trigger pulse
will occur shortly after the supply zero-crossing in order to minimise the generation of radio frequency
interference. At this point the load current will be low and increasing. The duration of the trigger
pulse must be long enough for the load current to reach the latching current. This delay will be
dependant upon the value (watts) and nature (resistance/inductance) of the load. For simplicity,
continuous gate drive was used in this design.
A TIC206D triac was chosen as is requires a low gate current to trigger. A 4 amp device, it will
comfortably switch a 500 watt load with a 240 volt AC supply. A 115 volt supply would require a
higher current triac to switch similar load power. Higher current triacs usually require a higher gate
drive which can not be supplied without modifying this design. High sensitivity triacs such as the
TICF225M or BTA10-600CW could perhaps be used but have not been tried.
Power Supply
The PIC16C54 and associated circuitry require a low voltage supply, typically 5 volts. A conventional
approach would be to use a small step-down transformer along with a rectifier, smoothing capacitor
and regulator. The transformer would also provide safety isolation from the power-line. As the PIC
will be driving the gate of the triac load switch it will inevitably be connected directly to the power-
line and so the isolation provided by the transformer is irrelevant. As the current required is not great
a 'wattless' or capacitor power supply is suitable.
In our design the supply is formed by capacitors C1 and C2 along with diodes D1 and D2. C1 is non-
polar and must be of high quality and adequate voltage rating as it carries the full power-line voltage.
On the power-line half-cycle when neutral is negative with respect to live then current flows through
C1 and D2 to develop the 5.6 volt 'zener voltage' across D2. D1 will conduct and its forward voltage
drop subtracted from the zener voltage will result in approximately 5 volts being developed across C2,
the supply reservoir capacitor. On the power-line half-cycle when neutral is positive with respect to
live then current flows through C1 and D2 however D2 will forward conduct. D1 will be reverse
biased and will prevent discharge of the reservoir capacitor, C2. We thus have a half-wave rectified,
smoothed 5 volt supply, the positive terminal of which is connected to the power-line live conductor.
The amount of current available is determined by the power-line voltage and the reactance of capacitor
C1 at the power-line frequency. With a 240 volt AC supply and a 0.47uF capacitor approximately
14mA is available. For a 115 volt power-line voltage C1 should be 1.0uF.
To reduce inrush current when power is connected to the module a low value resistor R1 is placed in
series with C1. If the module is disconnected from the power-line capacitors C1 and C3 could remain
charged and give a shock. To prevent this a high value resistor R2 provides a discharge path. A 275
volt varistor VDR1 is connected directly across the power-line to protect the module from any
transient voltage spikes. For a 115 volt power-line voltage a 130 volt varistor should be used.
3
120kHz Tuned Amplifier/Signal Conditioner
The X-10 signal consists of a pattern of 1msec bursts of a 120kHz carrier superimposed on the power-
line and synchronised to the power-line frequency (50Hz/60Hz) zero-crossings. Transported over the
house wiring the carrier may be only tens or hundreds of millivolts at the receiving module. This
carrier must be amplified, limited, and the envelope converted to a logic level signal that the
PIC16C54 can detect. The amplification must be highly selective in order to reject interfering signals
also present on the power-line. The power-line frequency, hugely greater in magnitude than the
carrier signal, can easily be rejected as the frequency difference is so great. Power-line harmonics
from lamp dimmers and other carriers from baby monitors are not so easily rejected.
A very economical way of obtaining a lot of amplification is to use a 4069UB. This CMOS logic chip
nominally contains six unbuffered inverters. By connecting negative feedback from the output to the
input of a gate and biasing the output to sit roughly at half the supply rail it becomes a linear amplifier
(we are not talking hi-fi here). With six such gates there is a lot of gain available.
The input stage of the amplifier comprises a transformer tuned to the 120kHz carrier frequency. The
primary of the transformer, in series with capacitor C3, is directly across the power-line. Capacitor C3
presents a low impedance at the carrier frequency but a high impedance at the power-line frequency.
The carrier signal is passed but excessive 50Hz (60Hz) currents are blocked. Back-to-back zener
diodes D3 and D4 provide some overload protection for the 4069UB input and C5, R3 and R4 provide
a little extra high-pass filtering.
The first two stages of amplification provided by the 4069UB gates are tuned. Small axial inductors
with parallel capacitors peak the response at 120kHz. The next two stages are untuned but provide
sufficient amplification to produce an output voltage swing from rail-to-rail at the carrier frequency.
Diode D5 along with R9 and C14 form a demodulator, the output of which represents the envelope of
the 120kHz carrier. The fifth 4069UB gate buffers the demodulator (envelope detector) output and
feeds it to an input pin on the PIC micro-controller. Typically a carrier signal level of 20mV produces
reliable logic level transitions at the PIC input.
PIC Micro-controller
The heart (or more accurately the brains) of the appliance module is the PIC micro-controller. At a
hardware level its function is to check for the presence of the 120kHz carrier, check for key-presses on
the manual on-off push-button, read the house/unit address switch, detect power-line zero-crossings,
and drive the triac load switch. Almost any member of the PIC family could have been selected. The
PIC16C54 was chosen simply because it was cheap, available, and had sufficient input/output pins.
Although precision timing was not needed a crystal was used for the processor clock. Despite
reservations the modules worked reliably at sub-zero temperatures.
To detect the 120kHz carrier it is only necessary to read the high/low state of the RA2 input pin as the
4069UB amplifier has done the hard work and delivers a logic level signal. Reading the status of the
manual on-off switch is similarly trivial. R10 provides a pull-up voltage to input RA3; pressing the
momentary push-button SW1 takes the input low. Toggling the load on and off using a single
momentary switch is achieved in software.
An X-10 house address can have sixteen possible values, designated A to P. The unit address can also
have sixteen values, designated 1 to 16. Each of these two values can be represented by a four-bit
binary number, 0000b to 1111b (0 to 15). Ideally two four-bit binary coded switches would be used,
one labelled A to P and the other 1 to 16. Unfortunately such switches are not available, though
miniature rotary binary-coded switches labelled 0 to F (hexadecimal) can be found. As the clone
appliance module was not designed to be placed on the market the convenience of these switches was
deemed unnecessary and a simple 8-pole single-throw DIP switch was used. Multiplexing was not
used and so eight input pins (RB0 to RB7) are needed to read these switches.
To detect zero-crossings the power line is connected to the RA1 input of the PIC via a current limiting
resistor. All PIC input/output pins are fitted with static protection circuitry and this clamps any
overvoltage to within 0.6 volts of the supply rails. Resistor R11 limits the current into the RA1 input
pin to approximately 70uA.
4
Construction
If the X-10 compatible appliance module is assembled and connected to a load and the power-line it
may work first time. However, range and reliability will be improved if the tuning of the 120kHz
amplifier is optimised. To set up the appliance module it is advisable to have available a voltmeter,
signal generator, lab power supply, oscilloscope and frequency meter.
As the module attaches directly to the power-line connecting test equipment can be hazardous. For
this reason as much of the circuitry as possible should be tested before connecting to the power-line.
When needed a low voltage lab supply can be used to provide the power. Unless very confident it is a
good idea to leave out the PIC16C54 until the rest of the circuitry has been verified.
Tuned transformer TX1 is designed to resonate at 125kHz when used with the specified 33nF
capacitor (C4). The X-10 carrier frequency is nominally 120kHz. Connect the signal generator,
accurately set to 120kHz, to the power input terminals. With an oscilloscope monitoring the
transformer secondary tune the core for maximum output.
The tuned amplifier can also be set up without connecting the module to the power-line. Set the lab
power supply to 5volts and connect it across reservoir capacitor C2. The output pins of the 4069UB
gates used in the amplifier should sit at approximately 2.5 volts. The signal generator, connected to
the power input terminals, should be swept in frequency around 120kHz With the values shown for
C7 to C10 the output at U1E should peak at 120kHz falling off steeply either side. Component
tolerances may produce a resonant peak offset from 120kHz and so it may be necessary to select C7
and C9.
Once the tuned amplifier is set the lab supply can be disconnected and the module plugged into the
power-line. Check with a voltmeter that 5 volts is developed across C2. If all is well then inserting
the PIC16C54 should produce a functional module.
Source Code
The source code is commented and so will not be explained in detail here. The source will assemble
correctly using version 1.30 of the Microchip MPASM assembler. A single file has been used without
any processor-specific include files. Macros have been used where they improve clarity.
The PIC16C54 does not support hardware interrupts and so once the inputs, outputs, and variables
have been initialised the program flow is arranged in a loop. The manual push-button switch and
zero-cross detector are regularly polled. Sampling the 120kHz carrier after each power-line zero-
crossing the X-10 start sequence 1110 is tested for. If found then subsequent cycles are sampled to
extract the X-10 data.
The X-10 raw data was read from an MC563 mini-controller, an MT522 mini-timer, and an
SH624/ND561 RF remote/security console. (These modules are 240 volt versions produced for the UK
market). It was found that the data stream produced by the ND561 security console differed slightly in
that an extra blank cycle was produced in the gap between the house/unit and house/function data
sequence. The software was written to overlook this difference by re-synchronising with the data half
way through.
The X-10 data stream is highly redundant, all addresses and commands being duplicated. This could
be used for error checking however reliable communication was found to be possible without this
software overhead. The entire sequence for a single command is shown below. The first house and
unit addresses are captured, then, after re-synchronising with the start code following the gap, the first
function code is read.
start house unit start house unit gap start house function start house function
code addr addr code addr addr code addr code addr
1110 8bit 10bit 1110 8bit 10bit 1110 8bit 10bit 1110 8bit 10bit
The house address is transmitted as an eight-bit sequence. Each pair of transmitted bits corresponds to
one bit of the actual house code. A 01 sequence transmitted corresponds to a 0 and a 10 sequence
corresponds to a 1. For example, house code C is actually 0010 but would be transmitted as
01011001. As there is no actual need to convert the 8-bit sequence to the 4-bit code the 8-bit
sequence is stored as-is.
5
The unit address and function codes are transmitted as 10-bit sequences. However the last two bits are
always 01 for a unit address code and always 10 for a function code. Being invariant they can be
ignored so only the first eight bits of the sequence are stored.
Having captured the house address, unit address and function code from the data stream the
transmitted address is compared to the setting of the house/unit address switches. If they match then
the transmitted function can then be acted upon.
Look-up tables are used to convert the bit pattern read from the address switches to the bit pattern
corresponding to the transmitted data sequence. When designing the printed circuit board artwork it
was found that an easier lay-out could be achieved by scrambling the order of the unit address switch
connections. Un-scrambling is achieved in the unit address look-up table.
In this implementation only the on and off function codes are acted upon. The All Units Off
function is ignored although to add it in should be trivial.
For manual load switching a single push-button was used. Push-on push-off functionality is
achieved in software by maintaining the current on-off status. While waiting for the X-10 start
sequence to be transmitted the push-button is polled. If pressed then after a delay for de-bouncing the
push-button is checked again. If still pressed then the load status is toggled. An additional delay
prevents the load from being switched on and off rapidly if the push-button is held closed.
Improvements and further Ideas
It seems to be the nature of engineering that it always possible to improve upon a design. Looking
back a year this project is no exception. In commercial designs development time spent reducing parts
count and parts cost is usually time well spent. For low quantity home projects design effort usually
stops once the circuitry works reliably.
The present design requires two X2 quality capacitors, one in the power supply and one feeding the
tuned transformer. It should be feasible to combine these two circuits so that only one of these bulky
expensive capacitors is required. A possible problem with this idea is that the primary of the tuned
transformer will pass higher current at the power-line frequency. Unfortunately no data was available
for the tuned transformer to know if this would be acceptable.
The 120kHz tuned amplifier would be much simpler to trim if adjustable inductors were used for L1
and L2.
If the author were to redesign the printed circuit board layout then PCB mounted clips for a fuse would
probably be incorporated. At the same time the earth connections on the power in and power out
terminal block would be removed. If a safety earth connection is required by the load then it is better
not to take it via circuit board traces, however thick.
One point of building an X-10 module is so that it can be modified to include some feature that X-10
Inc. did not think of. A few years ago authors of certain articles in hobbyist magazines used to say
applications are limited only by the imagination of the reader. No applications would then be given.
This used to irritate this author no end leading him to suspect that the writer might have one of those
limited imaginations alluded to. So, here are ten suggestions for X-10 type projects that can build on
the circuitry and code of this clone appliance module:
1 Phase Control
An obvious enhancement would be to add phase control for dimming lamp loads. This can be
achieved with the present design purely by modifying the software. Variable lamp brightness in triac
controlled dimmers is achieved by switching the lamp on every half cycle at a particular point in time
in that half cycle. If the lamp is switched on almost immediately after the zero-crossing point then the
lamp brightness will be at maximum. The longer the delay into the half cycle before the load is
switched on the less power that is delivered to the load; i.e. the lamp is dimmer.
2 Burst Fire Control
Another technique of controlling power to the load is known as burst fire. This method switches the
load on and off for entire power-line half-cycles. For example, switching the load on for two half-
cycles then off for one would result in 2/3 of maximum power to the load. This method is unsuitable
6
for lamp dimming as is results in unacceptable flicker. It is, however, suitable for heating applications
where time-constants are long compared to the power-line frequency.
3 Local I ntelligence #1
X-10 modules are commonly controlled by some central intelligence. This may be a PC running an
environmental control program hooked into the power-line via a TW523 interface. In the authors case
the central intelligence is slumped in an armchair clutching a remote control handset. Remote
control rather than home automation. As a micro-controller is built into the appliance module it could
be used to think for itself. Using a digital temperature sensor such as the DS1621 the PIC16C54 can
measure temperature. Using the burst fire load control above we have the makings of a temperature
control system for a plant propagator, greenhouse etc. By using a TW523 to transmit X-10 extended-
data commands we could even remotely set the target temperature.
4 Local I ntelligence #2
Day/night detection can easily be achieved using a photo-sensor. An ORP-12 light dependant resistor
with a 47kohm pull-up resistor works well (in UK daylight). By slowly sampling the ambient light
and looking for an unbroken sequence it is possible to ignore momentary effects such as car headlights
at night or clouds passing during the day. Knowing if it is day or night would allow the module to
make decisions. For example, a module controlling a flood lamp could ignore on commands during
daylight or automatically switch itself off at dawn.
5 Local I ntelligence #3
By counting power-line cycles quite precise timing is possible. A module could be switched on by a
power-line command but switch itself off automatically a fixed time later. This may be appropriate for
a slave floodlight tied in with a PIR intruder alarm. In the UK certain local authorities only permit
burglar alarms to sound for 20 minutes. Acting as an alarm sounder the module could switch itself off
after the permitted time. For accurate timing the PIC processor should determine if it is in a 50Hz or
60Hz country. During initialisation, using the internal timer, it could measure the time between two
power-line zero crossings. In practice it is probably adequate to hardcode either 100 or 120 zero
crossings per second.
6 Cat Scarer
With the cost of vet bills soaring cat fights are best avoided. Clear the neighbours cats out your garden
before letting your prize pet out for his exercise. A harmless ultrasonic shriek will usually see off the
unwanted visitors. An ultrasonic transducer of the sort used in intruder detectors can be driven with
tens of volts peak-to-peak with the circuit shown. Piezo-horn tweeters have also been used
successfully driven at around 25kHz. The tuned circuit is pulsed at resonance, usually in bursts as this
seems more effective than a continuous tone.
+5V
RA2
1
RA3
2
RTCC
3
/MCLR
4
VSS (GND)
5
RBO
6
RB1
7
RB2
8
RB3
9
RB4
10
RB5
11
RB6
12
RB7
13
VDD
14
OSC2/CLKOUT
15
OSC1
16
RA0
17
RA1
18
U2
PIC16C54A
0V 0V
40kHz
Ultrasonic
Sounder
7
For this design a transformer power supply should be used as the wattless capacitor supply will not
be able to provide sufficient current.
7 I ncreased I /O #1
A number of circuit modifications may require additional I/O pins which could be obtained by using
the larger PIC16C55 processor. Alternatively, by using eight diodes, the house and unit address
switches can be multiplexed onto the same four input pins. Using the circuit below when output RB2
is low and output RB3 is high switches 5-8 (house address) can be read on inputs RB4-RB7. When
output RB3 is low and output RB2 is high switches 1-4 (unit address) can be read on inputs RB4-RB7.
Now unused, I/O pins RB0 and RB1 are available.

RA2
1
RA3
2
RTCC
3
/MCLR
4
VSS (GND)
5
RBO
6
RB1
7
RB2
8
RB3
9
RB4
10
RB5
11
RB6
12
RB7
13
VDD
14
OSC2/CLKOUT
15
OSC1
16
RA0
17
RA1
18
U2
PIC16C54A
Vcc
1
2 3 4 5 6 7 8 9
RP1
100k
1 2 3 4 5 6 7 8
1
6
1
5
1
4
1
3
1
2
1
1
1
0 9
SW2
Applications such as garage door or window blind openers require limit switches. The extra I/O pins
available could be used as switch inputs to sense when the door/blind had fully opened/closed and
switch the motor off.
8 I ncreased I /O #2
Another way to increase I/O is to hard code the X-10 house/unit address into the PIC16C54 firmware.
The eight pins used to read the address switch become available. Many modules once installed are
never moved and so the inflexibility of a fixed address may not be a problem. The cost of PIC
processors is quite low so the expense of replacing the processor is not prohibitive should the system
ever be changed. Having dispensed with the address switch the processor could then be replaced by
one of the new eight-pin PIC12C508 devices and still have two I/O pins spare!
9 Non-Standard Data Formats (X-10 heresy)
The power-line transmitter in the TW523 is quite unintelligent and relies on a control driver for all the
X-10 data coding and timing. The driver may be a micro-processor (PL-Link, Marrick etc.) or
software on a PC. In the later case there is no reason why the control driver code can not be modified
to send non X-10 data. By changing the coding system a personal super-set of commands can be
created. For example, the number of unit addresses could be increased. Security would be improved
as non-standard coding would ensure that appliances would not respond to a neighbour trying all the
codes on his new mini-controller or RF remote.
8
10 Raw X-10 Data Monitor
In developing the appliance module it was necessary to monitor the raw X-10 data on the power-line.
Instead of driving a triac a prototype of the appliance module drove an opto-isolator with RS-232 data.
At each zero crossing either an ASCII 0 or 1 was transmitted to indicate the absence or presence of
the 120kHz carrier. Fed into a PC running a terminal program (Procomm) the resulting raw X-10
data was displayed and captured.
Useful Articles
The X-10 FAQ
periodically posted to comp.home.automation newsgroup
or from: ftp://ftp.scruz.net/users/cichlid/public/x10faq
or from: http://www.homation.com.
X-10 Powerhouse - Technical Note:
The X-10 Powerhouse Power Line Interface Model # PL513 and
Two-Way Power Line Interface #TW523
Revision 2.4 Dave Rye
SGS-Thomson ST6210/ST6215/ST6220/ST6225 data book
Application Note:
Micro-controller and Triacs on the 110/240V Mains
Electronics Today International - March 1996
Driving Triacs with the PIC Micro-controller - Bart Trepak
Everyday with Practical Electronics - February 1995
Transformerless Power Supplies - Andy Flind
Everyday Electronics - May 1989
Pet Scarer - Mark Stuart
9
Parts List
Quantity
Semiconductors
1
1
1
1
1
2
2
Capacitors
1
1
1
1
2
2
2
1
2
1
2
1
Resistors
1
1
1
1
1
1
1
1
1
1
1
1
1
Switches
1
1
Connectors
2
Miscellaneous
1
1
1
2
1
1
Reference
U1
U2
Q1
D1
D2
D3,D4
D5,D6
C1
C2
C3
C4
C5,C6
C7,C9
C8,C10
C11
C12,C13
C14
C15,C16
C17
R1
R2
R3
R4
R5
R6
R7
R8
R9
R10
R11
R12
RP1
SW2
SW1
J1,J2
X1
VDR1
TX1
L1,L2
P.C.B.
Enclosure
Part
4069UB
PIC16C54
TIC206D
1N4007
C5V6 1.3W zener
C6V8 400mW zener
1N4148
0.47u, 275V X2 rated
470u, 25V
0.1u, 275V X2 rated
33n
150p, disc ceramic
3n3
4n7
100p, disc ceramic
10p, disc ceramic
10n
22p, disc ceramic
0.1u, disc ceramic
100, 0.5W
1M, 0.25W
10k, 0.25W
33k, 0.25W
10M, 0.25W
470k, 0.25W
220k, 0.25W
47k, 0.25W
100k, 0.25W
22k, 0.25W
4M7, 0.25W
330, 0.25W
100k, 9-pin SIL R-pack
8PST DIP switch
2-pin header to push-button
switch , momentary make.
3-way terminal block
4MHz crystal
275V varistor
Tuned transformer
220uH axial inductor
As artwork
As required
Comments
1.0u for 110VAC operation
2M2 for 110VAC operation
130V for 110VAC operation
Toko 707VXA042YUK
10
Component Sourcing
Most components should not prove difficult to source. Suppliers of some of the less common parts are
given below. The author designed the circuit board to mount inside a specific waterproof
polycarbonate enclosure and the manual on-off push-button chosen was similarly rugged/expensive. If
outdoor use is not required or the printed circuit board layout provided is not to be used then
alternative components may be more appropriate. All suppliers listed are UK companies.
Item
IP65 Enclosure
IP67 Push-button switch
Tuned transformer, Toko
type 707VXA042YUK
220uH axial inductor
Reference
SW1
TX1
L1,L2
Supplier
RS Components Ltd.
RS Components Ltd.
MPS Maplin Professional or
B.E.C. Distribution Ltd. or
Cirkit Distribution Ltd.
RS Components Ltd. or
Cirkit Distribution Ltd.
Stock Number
580-360
321-234
FT55K
380042
35-70742
240-539
35-71224
B.E.C. Distribution Ltd.
12 Elder Way, Langley Business Park, Slough, Berks. SL3 6EP.
Tel. 01753 549502; Fax 01753 543812
Cirkit Distribution Ltd.
Park Lane, Broxbourne, Herts. EN10 7NQ
Tel 01992 448899; Fax 01992 471314.
MPS Maplin Professional
P.O. Box 777, Rayleigh, Essex, SS6 8LU
Tel. 01702 554000; Fax 01702 554001; http://www.maplin.co.uk
RS Components Ltd. (Not to be confused with Radio Shack)
P.O. Box 99, Corby, Northants, NN17 9RS.
Tel. 01536 201201; Fax 01536 201501; http://www.rs-components.com/rs
11
Source Code Listing
; X-10 Receiver
; Copyright Philip Charles Plunkett ABACUS ELECTRICS 1996
; Client: In House
; File Name: X10RX128.ASM
; File Date: 16 August 1996
; Target Device: PIC 16C54A
; Clock Type: 4MHz Xtal, 1uS Instruction Cycle
; Watchdog: On
; Code Protection: Off
; Customer ID Code: 'ABAC'
; Assembler: MPASM version 1.30
; Code Revision: 1.28 First released version
TITLE "X-10 Receiver"
LIST P = 16C54
; Generic Definitions
W EQU H'0000' ; Result Destination = W Register
F EQU H'0001' ; Result Destination = F Register
; Standard Register Files
INDF EQU H'0000' ; Indirect Addressing Register
RTCC EQU H'0001' ; Counter
PC EQU H'0002' ; Program Counter
STATUS EQU H'0003' ; Status Register
FSR EQU H'0004' ; File Select Register
PORT_A EQU H'0005' ; Port A Input/Output Port
PORT_B EQU H'0006' ; Port B Input/Output Port
; STATUS Register Bits
#define CARRY STATUS, 0 ; Carry Bit
#define DIGCARRY STATUS, 1 ; Digit Carry Bit
#define ZERO STATUS, 2 ; Zero Bit
#define NOT_PD STATUS, 3 ; Power Down Bit
#define NOT_TO STATUS, 4 ; Watchdog TimeOut Bit
#define PA0 STATUS, 5 ; Page Preselect
#define PA1 STATUS, 6 ; Page Preselect
#define PA2 STATUS, 7 ; Future use
; OPTION Register Bits
PS0 EQU H'0000' ; Prescaler divide ratio Eight divide ratios:
PS1 EQU H'0001' ; Prescaler divide ratio WDT 1:1 to 1:128
PS2 EQU H'0002' ; Prescaler divide ratio RTCC 1:2 to 1:256
PSA EQU H'0003' ; Prescaler Assignment 0=RTCC 1=WDT
RTE EQU H'0004' ; RTCC Pin Signal Edge 0=Rising 1=Falling
RTS EQU H'0005' ; RTCC SIgnal Source 0=Clock 1=RTCC Pin
12
; Fuse Definitions and Configurations
_CP_ON EQU H'0FF7'
_CP_OFF EQU H'0FFF'
_WDT_ON EQU H'0FFF'
_WDT_OFF EQU H'0FFB'
_LP_OSC EQU H'0FFC' ; 32kHz
_XT_OSC EQU H'0FFD' ; 100kHz - 4MHz
_HS_OSC EQU H'0FFE' ; 4MHz - 20MHz
_RC_OSC EQU H'0FFF' ; 100KhZ - 4MHz
__FUSES _CP_OFF&_WDT_ON&_XT_OSC
__IDLOCS H'ABAC'
__MAXRAM H'01F'
; Input/Output Port Assignments
#define TRIAC PORT_A, 0 ; Triac Gate Drive
#define ZEROX PORT_A, 1 ; Zero-Crossing Detector Input
#define CARRIER PORT_A, 2 ; Mains Carrier Detect
#define BUTTON PORT_A, 3 ; Push Button Input
#define UNIT3 PORT_B, 0 ; Unit/Function Code 3
#define UNIT2 PORT_B, 1 ; Unit/Function Code 2
#define UNIT1 PORT_B, 2 ; Unit/Function Code 1
#define UNIT0 PORT_B, 3 ; Unit/Function Code 0
#define HOUSE0 PORT_B, 4 ; House Code 0 \
#define HOUSE1 PORT_B, 5 ; House Code 1 | 0 to 15
#define HOUSE2 PORT_B, 6 ; House Code 2 | re-assigned as
#define HOUSE3 PORT_B, 7 ; House Code 3 / A to O
; Register File Variables
FLAGS EQU H'0008' ; Bits used as status flags
COUNT EQU H'0009' ; Counter used by Wait routines
HOUSE EQU H'000A' ; House code, 0 - 15 == A - P
UNIT EQU H'000B' ; Unit code, 0 - 15 == 1 - 16
RXHOUSE EQU H'000C' ; Received House code, 0 - 15 == A - P
RXUNIT EQU H'000D' ; Received Unit code, 0 - 15 == 1 - 16
RXFUNC EQU H'000E' ; Received Unit code, 0 - 15 == 1 - 16
#define LOAD FLAGS, 0 ; 0=Load is off, 1=Load is on
; Define Macros
TriacOn macro
BCF TRIAC
endm
TriacOff macro
BSF TRIAC
endm
GetBit macro locn
CALL ReadBit
RLF locn, F
endm
13
;X-10 COMMAND FORMAT
;
; start unit house gap house start function
; house start unit start function house
;
;NB: Total of 94 zero-crossings used, 95 with ND561 (*)
; Control console/RF remote produce one extra blank half-cycle;
; (7 instead of 6) in gap:
;
;Control console ND561 via SH624 RF remote; sending A1 ON:
; (*)
; 1110 01101001 0110100101 1110 01101001 0110100101 0000000>continued
; 0 1 1 0 0 1 1 0 0 0 1 1 0 0 1 1 0 0 >
; S A 1 S A 1 GAP >
;
; >1110 01101001 0101100110 1110 01101001 0101100110
; > 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1
; >S A ON S A ON DONE
;
;
;Mini-Controller MC563 or Mini-Timer MT522; sending C1 ON:
;
; 1110 01011001 0110100101 1110 01011001 0110100101 000000>
; 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 1 0 0 >continued
; S C 1 S C 1 GAP >
;
; >1110 01011001 0101100110 1110 01011001 0101100110
; >0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1
; >S C ON S C ON DONE
;
ORG 00H
; Program starting point
Start
MOVLW B'00001110'
TRIS PORT_A ; Set Port A as Inputs & Outputs
MOVLW B'11111111'
TRIS PORT_B ; Set Port B as Inputs
TriacOff ; Set Load off
CLRF FLAGS
CLRF HOUSE
CLRF UNIT
CLRF RXHOUSE
CLRF RXUNIT
CLRF COUNT
MOVLW B'00000111' ; RTCC Prescaler, divide by 256
OPTION ; gives 256uS per count
14
MainLoop
CALL Wait500mSec
Wait1110A
CLRWDT
BTFSS LOAD ; Continuously re-assert load status
TriacOff
BTFSC LOAD
TriacOn
BTFSS BUTTON ; Check if manual button pressed,
GOTO Manual ; if so do manual routines
CALL ReadBit ; Wait for Start Sequence 1110
BTFSS CARRY ; 1
GOTO Wait1110A
CALL ReadBit
BTFSS CARRY ; 1
GOTO Wait1110A
CALL ReadBit
BTFSS CARRY ; 1
GOTO Wait1110A
CALL ReadBit
BTFSC CARRY ; 0
GOTO Wait1110A
GetBit RXHOUSE ; Read first house address
GetBit RXHOUSE
GetBit RXHOUSE
GetBit RXHOUSE
GetBit RXHOUSE
GetBit RXHOUSE
GetBit RXHOUSE
GetBit RXHOUSE
GetBit RXUNIT ; Read first unit address
GetBit RXUNIT
GetBit RXUNIT
GetBit RXUNIT
GetBit RXUNIT
GetBit RXUNIT
GetBit RXUNIT ; ignore last two bits
GetBit RXUNIT ; as always 0 1 == 0
MOVLW D'0024' ; wait 24 zero-crossings, ie
MOVWF COUNT ; to start of 'gap'
BitCount1
CALL ReadBit
DECFSZ COUNT, F
GOTO BitCount1
MOVLW D'0011' ; wait a maximum of 10 zero-crossings
MOVWF COUNT ; for next start sequence
Wait1110B
DECFSZ COUNT, F
GOTO W1110B
GOTO MainLoop ; Abort as problem with data sequence
15
W1110B
CLRWDT
CALL ReadBit ; Re-synchronise with pre-function
BTFSS CARRY ; 1 start sequence
GOTO Wait1110B
CALL ReadBit
BTFSS CARRY ; 1 Can not just count bits as gap
GOTO Wait1110B ; length varies with transmitter type
CALL ReadBit
BTFSS CARRY ; 1
GOTO Wait1110B
CALL ReadBit
BTFSC CARRY ; 0
GOTO Wait1110B
MOVLW D'0008' ; ignore next 8 bits =
MOVWF COUNT ; house address again
BitCount2
CALL ReadBit
DECFSZ COUNT, F
GOTO BitCount2
GetBit RXFUNC ; Read command function
GetBit RXFUNC
GetBit RXFUNC
GetBit RXFUNC
GetBit RXFUNC ; ignore last two bits of function
GetBit RXFUNC ; as always 1 0 == 1
GetBit RXFUNC
GetBit RXFUNC ; and ignore rest of data (22 bits)
CALL ReadDIPSwitches
MOVF HOUSE, W
SUBWF RXHOUSE, W
XORLW 0
BZ GoodHouse
GOTO MainLoop
GoodHouse
MOVF UNIT, W ; Received House code matches DIP switch
SUBWF RXUNIT, W
XORLW 0
BZ GoodUnit
GOTO MainLoop
GoodUnit ; Received Unit code matches DIP switch
MOVLW B'01011001' ; On function 0010 1
SUBWF RXFUNC, W
XORLW 0
BZ PowerOn1
MOVLW B'01011010' ; Off function 0011 1
SUBWF RXFUNC, W
XORLW 0
BZ PowerOff1
GOTO MainLoop
PowerOn1
TriacOn
BSF LOAD
GOTO MainLoop
PowerOff1
TriacOff
BCF LOAD
GOTO MainLoop
16
Manual ; Manual operation, de-bounce switch
CALL Wait100mSec ; by reading again after a delay.
BTFSC BUTTON ; Re-check if manual button pressed.
GOTO MainLoop
BTFSS LOAD
GOTO PowerOn2
Poweroff2
CLRWDT
TriacOff ; Manual switch load off
BCF LOAD ; Clear 'load on' flag
BTFSS BUTTON ; Wait here until button released
GOTO Poweroff2
GOTO MainLoop
PowerOn2
CLRWDT
TriacOn ; Manual switch load on
BSF LOAD ; Set 'load on' flag
BTFSS BUTTON ; Wait here until button released
GOTO PowerOn2
GOTO MainLoop
ReadBit
CALL ZeroCross ; Call & return after zero crossing
CALL Wait250uSec ; Wait so sample into carrier burst
BTFSS CARRIER ; Check for presence of 120kHz carrier
GOTO GB1
BSF CARRY ; Carrier present so set carry flag
RETLW 0
GB1
BCF CARRY ; Carrier absent so clear carry flag
RETLW 0
ZeroCross
BTFSC ZEROX ; Check present +ve/-ve status of 50Hz
GOTO Z1 ; power then wait for it to change
Z0
CLRWDT ; Is low
BTFSS ZEROX ; Loop until goes high
GOTO Z0
RETLW 0
Z1
CLRWDT ; Is high
BTFSC ZEROX ; Loop until goes low
GOTO Z1
RETLW 0
Wait100mSec
MOVLW D'0006' ; 6 x 16.384msec = 98.304msec
MOVWF COUNT
GOTO WaitLoop
Wait500mSec
MOVLW D'0030' ; 30 x 16.384msec = 491.52msec
MOVWF COUNT
WaitLoop
MOVLW D'0192' ; 256-64=192, 64 x 256usec = 16.384msec
MOVWF RTCC ; Time delay inner loop
Wait16
CLRWDT
MOVF RTCC, W
BNZ Wait16
DECFSZ COUNT, F
GOTO WaitLoop
RETLW 0
Wait250uSec
CLRF RTCC
W0
CLRWDT ; Measured at about 273uSecs
MOVF RTCC, W
BZ W0
RETLW 0
17
ReadDIPSwitches
SWAPF PORT_B, W ; Read DIP switch high nibble = house address
MOVWF HOUSE ; and complement for true-logic
COMF HOUSE, W ; Save in HOUSE variable
ANDLW H'000F' ; 0 -> 15 == A -> P
CALL HouseTable ; Look up bit pattern
MOVWF HOUSE
MOVF PORT_B, W ; Read DIP switch low nibble = unit address
ANDLW H'000F' ; Unscramble bits and complement for true-logic
CALL UnitTable ; Look up bit pattern & save in UNIT variable
MOVWF UNIT ; 0 -> 15 == 1 -> 16
RETLW 0
HouseTable
ADDWF PC, F ; House Code Look-up table:
RETLW B'01101001' ; A = 0110
RETLW B'10101001' ; B = 1110
RETLW B'01011001' ; C = 0010
RETLW B'10011001' ; D = 1010
RETLW B'01010110' ; E = 0001
RETLW B'10010110' ; F = 1001
RETLW B'01100110' ; G = 0101
RETLW B'10100110' ; H = 1101
RETLW B'01101010' ; I = 0111
RETLW B'10101010' ; J = 1111
RETLW B'01011010' ; K = 0011
RETLW B'10011010' ; L = 1011
RETLW B'01010101' ; M = 0000
RETLW B'10010101' ; N = 1000
RETLW B'01100101' ; O = 0100
RETLW B'10100101' ; P = 1100
UnitTable
ADDWF PC, F ; Unit Code Look-up table:
RETLW B'10100101' ;0>0>F = 16 = 1100 0 Flips bits 0 with 3,
RETLW B'10100110' ;1>8>7 = 8 = 1101 0 and 1 with 2 and
RETLW B'10011010' ;2>4>B = 12 = 1011 0 then complements result.
RETLW B'10011001' ;3>C>3 = 4 = 1010 0 Bits must be twisted
RETLW B'10010101' ;4>2>D = 14 = 1000 0 to undo twisting
RETLW B'10010110' ;5>A>5 = 6 = 1001 0 on PCB layout.
RETLW B'10101010' ;6>6>9 = 10 = 1111 0
RETLW B'10101001' ;7>E>1 = 2 = 1110 0
RETLW B'01100101' ;8>1>E = 15 = 0100 0
RETLW B'01100110' ;9>9>6 = 7 = 0101 0
RETLW B'01011010' ;A>5>A = 11 = 0011 0
RETLW B'01011001' ;B>D>2 = 3 = 0010 0
RETLW B'01010101' ;C>3>C = 13 = 0000 0
RETLW B'01010110' ;D>B>4 = 5 = 0001 0
RETLW B'01101010' ;E>7>8 = 9 = 0111 0
RETLW B'01101001' ;F>F>0 = 1 = 0110 0
ORG 1FFH
GOTO Start ; RESET vector
END
D6
1N4148
Q1
TIC206D
R12
330
1
2 3 4 5 6 7 8 9
Power Out
L N E
1 2 3
J2
Power In
230 VAC
L N E
1 2 3
J1
Note:
For 115 VAC Operation
VDR1 = 130 V
C1 = 1u
R11 = 2M2
275 V
VDR1
RP1
100k
R11
4M7
RA2
1
RA3
2
RTCC
3
/MCLR
4
VSS (GND)
5
RBO
6
RB1
7
RB2
8
RB3
9
RB4
10
RB5
11
RB6
12
RB7
13
VDD
14
OSC2/CLKOUT
15
OSC1
16
RA0
17
RA1
18
U2
PIC16C54A
R10
22k
1 2
U1A
R6
470k
R5
10M
C1
.47u
X2
rated
275VAC
C3
.1u
R2
1M
X2
rated
275VAC
C17
.1u
1
2
3
4
5
6
7
8
16
15
14
13
12
11
10
9 L1 220uH
(*)
(*)
C8
4n7
C7
3n3
C9
3n3
L2 220uH
C10
4n7
SW2
Poles 5/6/7/8
= House address
Poles 4/3/2/1
= Unit address
11 10
U1E
13 12
U1F
4069UB
C5
150p
C6
150p
C4
33n
R3
10k
TX1
R1
100
D2
C5V6
C2
470u
D3
C6V8
D4
C6V8
25V
R4
33k
C11
100p
SW1
On/Off
toggle
X1
4MHz
D1
1N4007
Unlabelled diodes = 1N4148
TX1 = TOKO 707VXA042YUK (125kHz) tuned to 120kHz
(*)
C7 and C9 may need to be selected
for circuit resonance at 120kHz
9 8
U1D
R7 220k
3 4
U1B
R8 47k
C15
22p
C16
22p
C14
10n
key
R9
100k
C13
10p
C12
10p
D5
1N4148
5 6
U1C
Date: August 29, 1996 Sheet 1 of 1
Size Document Number REV
A X10RX2.SCH
B
Title
Clone X-10 Appliance Module - Schematic
ABACUS ELECTRICS (C) 1996

You might also like