X-10 Home Automation - Content
X-10 Home Automation - Content
X-10 Home Automation - Content
CONTENTS
1. INTRODUCTION............................................................................................................................................5
1.1 HOME WIRING HISTORY............................................................................................................................6
HISTORY
1.2 OVERVIEW AND BENEFITS.........................................................................................................................7
BENEFITS
1.3 STANDARDS AND BRIDGES........................................................................................................................8
BRIDGES
1.4 SOME HOME AUTOMATION STANDARDS.................................................................................................9
STANDARDS
1.5 THE ELEMENTS OF A DOMOTICS SYSTEM ARE:.......................................................................................11
ARE:
1.6 ARCHITECTURE........................................................................................................................................11
ARCHITECTURE
1.6.1 CENTRALIZED ARCHITECTURE...........................................................................................................11
1.6.2 DISTRIBUTED ARCHITECTURE...........................................................................................................11
1.6.3 MIXED ARCHITECTURE.....................................................................................................................11
1.7 INTERCONNECTION.................................................................................................................................11
INTERCONNECTION
1.7.1 BY WIRE:..........................................................................................................................................11
1.7.2 WIRELESS:........................................................................................................................................12
1.7.3 BOTH WIRELESS AND WIRE...............................................................................................................12
1.8 CLASSIFICATIONS OF DOMESTIC NETWORK TECHNOLOGIES..................................................................12
TECHNOLOGIES
1.8.1 DEVICE INTERCONNECTION:.............................................................................................................12
1.8.2 CONTROL AND AUTOMATION NETS:...................................................................................................12
1.8.3 DATA NETS:......................................................................................................................................13
1.9 TASKS......................................................................................................................................................13
TASKS
1.9.1 HVAC..............................................................................................................................................13
HVAC
1.9.2 LIGHTING.........................................................................................................................................13
1.9.3 NATURAL LIGHTING..........................................................................................................................14
1.9.4 AUDIO..............................................................................................................................................14
1.9.5 VIDEO..............................................................................................................................................14
1.9.6 SECURITY.........................................................................................................................................14
1.9.7 DETECTION OF POSSIBLE INTRUSION.................................................................................................15
1.9.8 INTERCOMS.......................................................................................................................................15
1.9.9 ROBOTICS.........................................................................................................................................15
1.9.10 OTHER SYSTEMS...............................................................................................................................15
1.10 COSTS......................................................................................................................................................16
COSTS
1.11 SMART GRID............................................................................................................................................16
GRID
MANI PRINCE SUBROTO SWAPAN KUMAR (06EC019)
PATEL JIGAR MANUBHAI (06EC030) 8th
L D R P I n s ti t u t e o f T e c h n o l o g y & R e s e a r c h ,
Gandhinagar SEM
Page |2
X10 HOME AUTOMATION SYSTEM Gujarat
University
1. INTRODUCTION
Typically, it is easier to more fully outfit a house during construction due to the
accessibility of the walls, outlets, and storage rooms, and the ability to make design
changes specifically to accommodate certain technologies. Wireless systems are
commonly installed when outfitting a pre-existing house, as they obviate the need to
make major structural changes. These communicate via radio or infrared signals with a
central controller.
BACnet
INSTEON
X10
KNX (Standard)
LonWorks
C-Bus
SCS BUS with OpenWebNet
Universal Powerline bus (UPB)
ZigBee
Z-Wave
Some standards use additional communication and control wiring, some embed
signals in the existing power circuit of the house, some use radio frequency (RF) signals,
and some use a combination of several methods. Control wiring is hardest to retrofit into
an existing house. Some appliances include USB that is used to control it and connect it
to a domotics network. Bridges translate information from one standard to another (eg.
from X10 to European Installation Bus).
Maximum
Technology Transmission medium Transmission speed distance to
the device
Ethernet {IEEE 802.3}
Optical fiber 1 Gbit/s – 10 Gbit/s 2 km – 15 km
Table: 1.1
1.6 ARCHITECTURE
From the point of view of where the intelligence of the domotic system resides,
there are three different architectures:
1.7 INTERCONNECTION
1.7.1 BY WIRE:
Optical fiber
Cable (coaxial and twisted pair), including : xDSL
Powerline, including : INSTEON
X10
1.7.2 WIRELESS:
Radio frequency, including: INSTEON
Wi-Fi
GPRS and UMTS
Bluetooth
DECT
ZigBee
Z-Wave
ONE-NET
EnOcean
Infra-red, including : Consumer IR
ZigBee
EnOcean
SCS BUS - OpenWebNet
1.9 TASKS
1.9.1 HVAC
Heating, Ventilation and Air Conditioning (HVAC) solutions include temperature
and humidity control. This is generally one of the most important aspects to a
homeowner. An Internet-controlled thermostat, for example, can both save money and
help the environment, by allowing the homeowner to control the building's heating and
air conditioning systems remotely.
1.9.2 LIGHTING
Lighting control systems can be used to control household electric lights in a
variety of ways:
1.9.4 AUDIO
This category includes audio switching and distribution. Audio switching
determines the selection of an audio source. Audio distribution allows an audio source to
be heard in one or more rooms. This feature is often referred to as 'multi-zone' audio.
There are three major components that allow listen to audio throughout your
home, or business:
1.9.5 VIDEO
This includes video switching and distribution, allowing a video source to be
viewed on multiple TVs. This feature is often referred to as 'multi-zone' video.
Integration of the intercom to the telephone, or of the video door entry system to the
television set, allowing the residents to view the door camera automatically.
1.9.6 SECURITY
With Home Automation, the consumer can select and watch cameras live from an
Internet source to their home or business. Security cameras can be controlled, allowing
the user to observe activity around a house or business right from a Monitor or touch
panel. Security systems can include motion sensors that will detect any kind of
unauthorized movement and notify the user through the security system or via cell
phone.
1.9.8 INTERCOMS
An intercom system allows communication via a microphone and loud speaker
between multiple rooms. Ubiquity in the external control as much internal, remote
control from the Internet, PC, wireless controls (eg. PDA with WiFi), electrical
equipment.
Transmission of alarms.
Intercommunications.
1.9.9 ROBOTICS
Control of home robots, using if necessary domotic electric beacon.
Home robot communication (i.e. using WiFi) with the domotic network and other home
robots.
Including:
Coffee pot
Garage door
Pet feeding and watering
Plant watering
Pool pump(s) and heater, Hot tub and Spa
Sump Pump
1.10 COSTS
An automated home can be a very simple grouping of controls, or it can be heavily
automated where any appliance that is plugged into electrical power is remotely
controlled. Costs mainly include equipment, components, furniture, and custom
installation.
Home automation technologies like Zigbee, INSTEON and Zwave are viewed as
integral additions to the Smart Grid. The ability to control lighting, appliances, HVAC as
well as Smart Grid applications (load shedding, demand response, real-time power usage
and price reporting) will become vital as Smart Grid initiatives are rolled out.
The digital data consists of an address and a command sent from a controller to a
controlled device. More advanced controllers can also query equally advanced devices to
respond with their status. This status may be as simple as "off" or "on", or the current
dim level, or even the temperature or other sensor reading. Devices usually plug into the
wall where a lamp, television, or other household appliance plugs in; however some
built-in controllers are also available for wall switches and ceiling fixtures.
It may also be desirable to block X10 signals from leaving the local area so, for
example, the X10 controls in one house don't interfere with the X10 controls in a
neighboring house. In this situation, inductive filters can be used to attenuate the X10
signals coming into or going out of the local area.
The protocol may transmit a message that says "select code A3", followed by "turn
on", which commands unit "A3" to turn on its device. Several units can be addressed
before giving the command, allowing a command to affect several units simultaneously.
For example, "select A3", "select A15", "select A4", and finally, "turn on", causes units
A3, A4, and A15 to all turn on.
Note 1: These 120 kHz carrier bursts are timed to coincide with the zero-crossing of the
other phases, when implemented.
A complete X-10 message is composed of a start code (1110), followed by a house code,
followed by a key code. The key code may be either a unit address or a function code,
depending on whether the message is an address or a command. Table 1 and Table 2
show the possible values of the house and key codes.
When transmitting the codes in Table 1 and Table 2, two zero-crossings are used to
transmit each bit as complementary bit pairs (i.e., a zero is represented by 0-1, and a one
is represented by 1-0). For example, in order to send the house code A, the four-bit code
in Table A-1 is 0110, and the code transmitted as complimentary bit pairs is 01101001.
Since house and key codes are sent using the complimentary format, the start code is the
only place where the pattern 1110 will appear in an X-10 data stream.
The key code, which is 5-bits long in Table 2, takes 10 bits to represent in the
complimentary format. Because the last bit of the key code is always zero for a unit
address and one for a function code, the last bit of the key code can be treated as a suffix
MANI PRINCE SUBROTO SWAPAN KUMAR (06EC019)
th
PATEL JIGAR MANUBHAI (06EC030) 8
L D R P I n s ti t u t e o f T e c h n o l o g y & R e s e a r c h ,
Gandhinagar SEM
P a g e | 22
X10 HOME AUTOMATION SYSTEM Gujarat
University
that denotes whether the key code is a unit address or function code. A complete block of
data consists of the start code, house code, key code and suffix. Each data block is sent
twice, with 3 power line cycles, or six zero-crossings, between each pair of data blocks.
For example, to turn on an X-10 module assigned to house code A, unit 2, the following
data stream would be sent on the power line, one bit per zero-crossing.
000000
Lastly, wait for three cycles (six zero-crossings) before sending the next block:
000000
There are exceptions to this format. For example, the bright and dim codes do not require
the 3-cycle wait between consecutive dim commands or consecutive bright commands.
0000 All units off Switch off all devices with the house code indicated in the message
0001 All lights on Switches on all lighting devices (with the ability to control brightness)
1000 Hail request Requests a response from the device(s) with the house code indicated in the message
101x Pre-set dim Allows the selection of two predefined levels of light intensity
1101 Status is on Response to the Status Request indicating that the device is switched on
1110 Status is off Response indicating that the device is switched off
In order to provide a predictable start point, every data frame transmitted always
begin with a start code of 1110. Immediately after the start code, a house code (A–P)
appears, and after the letter code comes afunction code. Function codes may specify a
unit number code (1–16) or a command code, the selection between the two modes being
determined by the last bit where 0=unit number and 1=command. One start code, one
letter code, and one function code is known as an X10 frame and represent the minimum
components of a valid X10 data packet.
Each frame is sent twice in succession to make sure the receivers understand it
over any power line noise for purposes of redundancy, reliability, and to accommodate
line repeaters.
Whenever the data changes from one address to another address, from an address
to a command, or from one command to another command, the data frames must be
separated by at least 6 clear zero crossings (or "000000"). The sequence of six zeros
resets the device decoder hardware.
2.8 CONTROLLERS
X10 controllers range from extremely simple to
very sophisticated.
Unit 1 on/off
Unit 2 on/off
Unit 3 on/off
Unit 4 on/off
Brighten/dim (last selected unit)
All lights on/all units off
More sophisticated controllers can control more units and/or incorporate timers
that perform preprogrammed functions at specific times each day. Units are also
available that use passive infrared motion detectors or photocells to turn lights on and off
based on external conditions. Finally, very sophisticated units are available that can be
fully programmed or, like the X10 Firecracker, use a program running in an external
computer. These systems can execute many different timed events, respond to external
sensors, and execute, with the press of a single button, an entire scene, turning lights on,
establishing brightness levels, and so on. Control programs are available for computers
running Microsoft Windows, Apple's Macintosh, Linux and FreeBSD operating systems.
Burglar alarm systems are also available. In these systems, the controller uses X10
protocols or ordinary wiring to interrogate a number of remote sensors that may monitor
doors, windows, and other access points. The controller may then use X10 protocols to
activate lights, sirens, etc.
MANI PRINCE SUBROTO SWAPAN KUMAR (06EC019)
PATEL JIGAR MANUBHAI (06EC030) 8th
L D R P I n s ti t u t e o f T e c h n o l o g y & R e s e a r c h ,
Gandhinagar SEM
P a g e | 29
X10 HOME AUTOMATION SYSTEM Gujarat
University
Hail Request is transmitted to see if there are any X10 transmitters within listening
range. This allows the O.E.M. to assign a different Housecode if a "Hail Acknowledge"
is received. In a Pre-Set Dim instruction, the D8 bit represents the Most Significant Bit
of the level and H1, H2, H4 and H8 bits represent the Least Significant Bits.
The Extended Data code is followed by 8 bit bytes which can represent Analog
Data (after A to D conversion). There should be no gaps between the Extended Data
code and the actual data, and no gaps between data bytes. The first 8 bit byte can be used
to say how many bytes of data will follow. If gaps are left between data bytes, these
codes could be received by X10 modules causing erroneous operation.
Extended Code is similar to Extended Data: 8 Bit bytes which follow Extended
Code (with no gaps) can represent additional codes. This allows the designer to expand
beyond the 256 codes presently available.
NOTE 2. The TW523 Two-Way Power Line Interface cannot receive Extended
Code or Extended Data because these codes have no gaps between them. The TW523
can only receive standard "pairs" of 11 bit X10 codes with 3 power line cycle gaps
between each pair.
NOTE 3. The TW523 can receive dim and bright codes but the output will
represent the first dim or bright code received, followed by every third code received. i.e.
the output from the TW523 will not be a continuous stream of dim and bright codes like
the codes which are transmitted.
High for 1 ms. coincident with zero crossing represents a binary "1" and gates the
120 kHz oscillator through to the output drive circuit thus transmitting 120 kHz onto the
AC power line for 1 ms.
The "X10 received" output from the TW523 coincides with the second half of
each X10 transmission. This output is the envelope of the bursts of 120 kHz received.
Only the envelope corresponding to the first burst of each group of 3 bursts is available
at the output of the TW523. See Figures 6, 7 and 8.
3. HARDWARE
T he home controller application described in this application note allows the user to
program on and off times for up to sixteen devices, using a 2 x 16 liquid crystal
display and five push buttons. A built-in light sensor can be used to turn on lights at
dusk, and turn them off at dawn. The home controller is designed to facilitate
experimentation with home automation using the PIC16F877A. In addition to the
PIC16F877A, the board will accept any other PIC MCU that shares the same pinout,
such as the PIC18F452. Therefore, experimenters may expand on the application using
the higher performance of the PIC18 family of parts without changing the hardware.
With care, engineers and home control enthusiasts can experiment with home automation
using the MPLAB ICD 3 development tool. However, proper circuit isolation
precautions must be taken to avoid damage to your computer or development tools.
The hardware functionality of X-10 circuitry can be divided into four functional
blocks:
Zero-crossing detector
120 kHz carrier detector
120 kHz signal generator
Transformer less power supply
There are several application functions that are not directly associated with the X-
10 interface. User interface functions are accomplished with an LCD display and five
push buttons. A real-time clock is created using Timer1 and an external 32 kHz
oscillator. User modified control data, such as unit on and off times, are stored in the PIC
MCU’s built-in EEPROM. A light sensor and load switch are also used in this
application.
MANI PRINCE SUBROTO SWAPAN KUMAR (06EC019)
PATEL JIGAR MANUBHAI (06EC030) 8th
L D R P I n s ti t u t e o f T e c h n o l o g y & R e s e a r c h ,
Gandhinagar SEM
P a g e | 36
X10 HOME AUTOMATION SYSTEM Gujarat
University
Memory usage for the entire home controller application is summarized in Table below
V = Vpk*sin(2*π*f*t),
where Vpk = 165Vand f = 60 Hz On a rising edge, RB0 will go high about 64 μs after
the zero-crossing, and on a falling
edge, it will go low about 16 μs before
the zero-crossing. More information on
interfacing PIC MCUs to AC power
lines can be found in the application
note AN521, “Interfacing to AC Power Lines”, which is available for download from the
Microchip web site.
A zero crossing detector literally detects the transition of a signal waveform from
positive and negative, ideally providing a narrow pulse that coincides exactly with the
zero voltage condition. At first glance, this would appear to be an easy enough task, but
in fact it is quite complex, especially where high frequencies are involved. In this
instance, even 1 kHz starts to present a real challenge if extreme accuracy is needed.
The not so humble comparator plays a vital role - without it, most precision zero crossing
detectors would not work, and we'd be without digital audio, PWM and a multitude of
other applications taken for granted.
The circuit is also sensitive to level, and for acceptable performance the AC
waveform needs to be of reasonably high amplitude. 12-15V AC is typical. If the voltage
is too low, the pulse width will increase. The arrangement shown actually gives better
performance than the version shown in Project 62 and elsewhere on the Net. In case you
were wondering, R1 is there to ensure that the voltage falls to zero - stray capacitance is
sufficient to stop the circuit from working without it. The pulse width of this circuit (at
50Hz) is typically around 600us (0.6ms) which sounds fast enough. The problem is that
at 50Hz each half cycle takes only 10ms (8.33ms at 60Hz), so the pulse width is over 5%
of the total period. This is why most dimmers can only claim a range of 10%-90% - the
zero crossing pulse lasts too long to allow more range. While this is not a problem with
the average dimmer, it is not acceptable for precision applications. For a tone burst
generator (either the cosine burst or a 'conventional' tone burst generator), any
inaccuracy will cause the switched waveform to contain glitches. The seriousness of this
depends on the application. Precision zero crossing detectors come in a fairly wide range
of topologies, some interesting, others not. One of the most common is shown in Project
58, and is commonly used for this application. The exclusive OR (or XOR) gate makes
an excellent edge detector, as shown
There is no doubt that the circuit shown above is more than capable of excellent
results up to quite respectable frequencies. The upper frequency is limited only by the
speed of the device used, and with a 74HC86 it has a propagation delay of only 11ns [1],
so operation at 100 kHz or above is achievable.
The XOR gate is a special case in logic. It will output a 1 only when the inputs are
different (i.e. one input must be at logic high (1) and the other at logic low (0v). The
resistor and cap form a delay so that when an edge is presented (either rising or falling),
the delayed input holds its previous value for a short time. In the example shown, the
pulse width is 50ns. The signal is delayed by the propagation time of the device itself
(around 11ns), so a small phase error has been introduced. The rise and fall time of the
squarewave signal applied was 50ns, and this adds some more phase shift.
There is a pattern emerging in this article - the biggest limitation is speed, even for
relatively slow signals. While digital logic can operate at very high speeds, we have well
reached the point where the signals can no longer be referred to as '1' and '0' - digital
signals are back into the analogue domain, specifically RF technology.
The next challenge we face is converting the input waveform (we will assume a
sinewave) into sharply defined edges so the XOR can work its magic. Another terribly
under-rated building block is the comparator. While opamps can be used for low speed
operation (and depending on the application), extreme speed is needed for accurate
digitisation of an analogue signal. It may not appear so at first glance, but a zero crossing
detector is a special purpose analogue to digital converter (ADC).
3.5.1 COMPARATORS
The comparator used for a high speed zero crossing detector, a PWM converter or
conventional ADC is critical. Low propagation delay and extremely fast operation are
not only desirable, they are essential. Comparators may be the most underrated and
under utilised monolithic linear component. This is unfortunate because comparators are
one of the most flexible and universally applicable components available. In large
measure the lack of recognition is due to the IC Opamp, whose versatility allows it to
dominate the analog design world. Comparators are frequently perceived as devices that
crudely express analog signals in digital form - a 1-bit A/D converter. Strictly speaking,
this viewpoint is correct. It is also wastefully constrictive in its outlook. Comparators
don't “just compare” in the same way that opamps don't "just amplify". The above quote
was so perfect that I just had to include it. Comparators are indeed underrated as a
building block, and they have two chief requirements ... low input offset and speed. For
the application at hand (a zero crossing detector), both of these factors will determine the
final accuracy of the circuit. The XOR has been demonstrated to give a precise and
repeatable pulse, but its accuracy depends upon the exact time it 'sees' the transition of
the AC waveform across zero. This task belongs to the comparator.
In Figure of previoua page we see a typical comparator used for this application.
The output is a square wave, which is then sent to a circuit such as that in Figure 2. This
will create a single pulse for each square wave transition, and this equates to the zero
crossings of the input signal. It is assumed for this application that the input waveform is
referenced to zero volts, so swings equally above and below zero.
Figure above shows how the comparator can mess with our signal, causing the
transition to be displaced in time, thereby causing an error. The significance of the error
depends entirely on our expectations - there is no point trying to get an error of less than
10ns for a dimmer, for example.
The LM339 comparator that was used for the simulation is a very basic type
indeed, and with a quoted response time of 300ns it is much too slow to be usable in this
application. This is made a great deal worse by the propagation delay, which (as
simulated) is 1.5us. In general, the lower the power dissipation of a comparator, the
slower it will be, although modern IC techniques have overcome this to some extent.
You can see that the zero crossing of the sine wave (shown in green) occurs well
before the output (red) transition - the cursor positions are set for the exact zero crossing
of each signal. The output transition starts as the input passes through zero, but because
of device delays, the output transition is almost 5us later. Most of this delay is caused by
the rather leisurely pace at which the output changes - in this case, about 5us for the total
7V peak to peak swing. That gives us a slew rate of 1.4V/us which is useless for
anything above 100Hz or so.
One of the critical factors with the comparator is its supply voltage. Ideally, this
should be as low as possible, typically with no more than ±5V. The higher the supply
voltage, the further the output voltage has to swing to get from maximum negative to
maximum positive and vice versa. While a slew rate of 100V/us may seem high, that is
much too slow for an accurate ADC, pulse width modulator or zero crossing detector.
At 100V/us and a total supply voltage of 10V (±5V), it will take 0.1us (100ns) for
the output to swing from one extreme to the other. To get that into the realm of what we
need, the slew rate would need to be 1kV/us, giving a 10ns transition time. Working
from Figure 3, you can see that even then there is an additional timing error of 5ns - not
large, and in reality probably as good as we can expect.
The problem is that the output doesn't even start to change until the input voltage
passes through the reference point (usually ground). If there is any delay caused by slew
rate limiting, by the time the output voltage passes through zero volts, it is already many
nanoseconds late. Extremely high slew rates are possible, and Reference 2 has details of
a comparator that is faster than a TTL inverter! Very careful board layout and attention
to bypassing is essential at such speeds, or the performance will be worse than woeful.
described in the next section. Since the 120 kHz carrier frequency is much higher than
the 60 Hz power line frequency, it is straightforward to design an RC filter that will pass
the 120 kHz signal and completely attenuate the 60 Hz. For a simple high-pass filter, the
-3 db breakpoint is: ƒ3 db = 1/(2*π*R*C). For C = 150 pF and R = 33 kΩ, ƒ3 db =
1/(2*π*150 pF *33 kΩ) = 32 kHz. This ƒ3 db point assures that the 60 Hz signal is
completely attenuated, while the 120 kHz signal is passed through to the amplifier
stages. Next, the 120 kHz signal is amplified using a series of inverters configured as
high gain amplifiers. The first two stages are tuned amplifiers with peak response at 120
kHz. The next two stages provide additional amplification. The amplified 120 kHz signal
is passed through an envelope detector, formed with a diode, capacitor, and resistor. The
envelope detector output is buffered through an inverter and presented to an input pin
(RC3) of the PIC16F877A. Upon each zero-crossing interrupt, RC3 is simply checked
within the 1 ms transmission envelope to see whether or not the carrier is present.
MANI PRINCE SUBROTO SWAPAN KUMAR (06EC019)
th
PATEL JIGAR MANUBHAI (06EC030) 8
L D R P I n s ti t u t e o f T e c h n o l o g y & R e s e a r c h ,
Gandhinagar SEM
P a g e | 47
X10 HOME AUTOMATION SYSTEM Gujarat
University
The CCP1 module is used in PWM mode to produce a 120 kHz square-wave with
a duty cycle of 50%. Because X-10 specifies the carrier frequency at 120 kHz (+/- 2
kHz), the system oscillator is chosen to be 7.680 MHz, in order for the CCP to generate
precisely 120 kHz. Calculations for setting the PWM period and duty cycle are shown in
the code listing comments for the function InitPWM. After initialization, CCP1 is
continuously enabled, and the TRISC bit for the pin is used to gate the PWM output.
When the TRISC bit is set, the pin is an input and the 120 kHz signal is not
presented to the pin. When the TRISC bit is clear, the pin becomes an output and the 120
kHz signal is coupled to the AC power line through a transistor amplifier and capacitor.
Since the impedance of a capacitor is Zc = 1/(2*π*f*C), a 0.1 ΜF capacitor presents a
low impedance to the 120 kHz carrier frequency, but a high impedance to the 60 Hz
power line frequency. This high-pass filter allows the 120 kHz signal to be safely
coupled to the 60 Hz power line, and it doubles as the first stage of the 120 kHz carrier
detector, described in the previous section.
To be compatible with other X-10 receivers, the maximum delay from the zero-
crossing to the beginning of the X-10 envelope should be about 300 Μs. Since the zero-
crossing detector has a maximum delay of approximately 64 μs, the firmware must take
less than 236 μs after detection of the zero-crossing to begin transmission of the 120 kHz
envelope.
To protect the circuit from spikes on the AC power line, a 130V VDR (voltage
dependent resistor) is connected between Line and Neutral. The 47Ω resistor limits
current into the circuit, and the 1 MΩ resistor provides a discharge path for the voltage
left on the capacitor when the circuit is unplugged from the wall. Two diodes rectify the
voltage across the 1000 ΜF capacitor and 5.1V Zener diode to produce a 5V supply. The
reader may wish to refer to the application note AN954, “Transformer-less Power.
A Teccor® L4008L6 Triac was selected because it has a sensitive gate that can be
directly controlled from the logic level output of the PIC MCU I/O pin. The sensitive
gate Triac can control AC current in both directions through the device, even though the
PIC MCU can provide only positive voltages to the gate. A variable dimmer is created
by including a delay between the time of each zero-crossing and the time that the trigger
current is provided to the Triac from the PIC MCU. The design and control of a lamp
dimmer using a PIC MCU is discussed in detail in PICREF-4 Reference Design,
“PICDIM Lamp Dimmer for the PIC12C508”.
equals one tick, seconds are incremented every 40 ticks. Minutes and hours are
incremented in a similar fashion.
A signal in blue and the magnitude of its analytic signal in red, showing the
envelope effect
In the case of AM, φ(t), the phase component of the signal, is constant and can be
ignored, so all the information in the signal is in R(t). R(t) is called theenvelope of the
signal. Hence an AM signal is given by the equation
3.16.4 DRAWBACKS
The envelope detector has several drawbacks:
The input to the detector must be band-pass filtered around the desired signal, or else the
detector will simultaneously demodulate several signals. The filtering can be done with a
tunable filter or, more practically, a superheterodyne receiver
Most of these drawbacks are relatively minor and are usually acceptable tradeoffs
for the simplicity and low cost of using an envelope detector.
3.16.6 AUDIO
An envelope detector is sometimes referred to as an envelope
follower in musical environments. It is still used to detect the amplitude variations of an
incoming signal to produce a control signal that resembles those variations. However, in
this case the input signal is made up of audible frequencies.
Because this filter is active, it may have non-unity passband gain. That is, high-
frequency signals are inverted and amplified by R2/R1.
From the circuit in Figure 1 above, according to Kirchoff's Laws and the definition
of capacitance:
where Qc(t) is the charge stored in the capacitor at time t. Substituting Equation (Q) into
Equation (I) and then Equation (I) into Equation (V) gives:
This equation can be discretized. For simplicity, assume that samples of the input
and output are taken at evenly-spaced points in time separated by ΔT time. Let the
samples of Vin be represented by the sequence , and let Vout be
If α = 0.5, then the RC time constant equal to the sampling period. If ,
then RC is significantly smaller than the sampling interval, and
5. SOFTWARE
Detailed descriptions of operation can be found in the comments within the code
listing.
To use the library, a user need only understand the function of the macros defined
in x10lib.inc. The macros greatly simplify the use of the library by eliminating the need
for the user to understand every X-10 function in x10lib.asm. Examples of how the
macros are used are included in the file x10demo.asm.
InitX10
This macro is used to initialize the peripherals that provide X-10 functionality. It
must be called in the application program before any of the below macros will work. It is
used as follows:
InitX10
5.2.1 SKIPIFTXREADY
Before sending an X-10 message, it is necessary tomake sure that another message
is not already being sent, which is signified by the X10TxFlag being set. This macro
simply checks that flag and skips the next instruction if it is okay to begin a new
transmission. Otherwise, there is a chance that a new transmission will interrupt an
ongoing transmission. It is used as follows:
SkipIfTxDone
5.2.3 SENDX10ADDRESSVAR
This macro is used to send an X-10 address, defined by variables rather than
constants. To send an address contained in the user variables MyHouse and MyUnit, the
following sequence would be applied:
SendX10AddressVar
5.2.5 SENDX10COMMANDVAR
This macro is used to send an X-10 command, defined by a variable rather than a
constant. To use this macro to send the command stored in the user variable
MyCommand to all units at MyHouse, one types:
SendX10CommandVar
5.2.6 SKIPIFRXDONE
Before reading an X-10 message, it is necessary to make sure that a complete
message has been received. This is signified by the X10RxFlag being set. This macro
simply checks that flag and skips the next instruction if a new X-10 message has been
received. It is used as follows:
SkipIfRxDone
5.2.7 SKIPIFADDRESSRCVD
It may be necessary to make sure that an address was received by using this
macro, which checks to see if the RxCommandFlag is clear. It is used as follows:
SkipIfAddressRcvd
SkipIfCommandRcvd
ReadX10Message
A project manager.
A make facility.
Tool configuration.
Editor.
A powerful debugger.
is selected from the Device Database™ all-special options are set automatically.
Default memory model settings are optimal for most applications.
Select Project - Rebuild all target files or Build target
To create a new project, simply start Micro Vision and select
“Project”=>”New Project” from the pull–down menus. In the file dialog that appears,
choose a name and base directory for the project. It is recommended that a new
directory be created for each project, as several files will be generated. Once the project
has been named, the dialog shown in the figure below will appear, prompting the user
to select a target device. In this lab, the chip being used is the “AT89S52,” which is
listed under the heading “Atmel
Next, Micro Vision must be instructed to generate a HEX file upon program
compilation. A HEX file is a standard file format for storing executable code that is to
be loaded onto the microcontroller. In the “Project Workspace” pane at the left, right–
click on “Target 1” and select “Options for ‘Target 1’ ”.Under the “Output” tab of the
resulting options dialog, ensure that both the “Create Executable” and “Create HEX
MANI PRINCE SUBROTO SWAPAN KUMAR (06EC019)
PATEL JIGAR MANUBHAI (06EC030) 8th
L D R P I n s ti t u t e o f T e c h n o l o g y & R e s e a r c h ,
Gandhinagar SEM
P a g e | 74
X10 HOME AUTOMATION SYSTEM Gujarat
University
File” options are checked. Then click “OK” as shown in the two figures below.
At the left side of the debugger window, a table is displayed containing several
key parameters about the simulated microcontroller, most notably the elapsed time
(circled in the figure below). Just above that, there are several buttons that control code
execution. The “Run” button will cause the program to run continuously until a
breakpoint is reached, whereas the “Step Into” button will execute the next line of code
and then pause (the current position in the program is indicated by a yellow arrow to
the left of the code).
Breakpoints can be set by double–clicking on the grey bar on the left edge of the
window containing the program code. A breakpoint is indicated by a red box next to the
line of code.
The current state of the pins on each I/O port on the simulated microcontroller
can also be displayed. To view the state of a port, select “Peripherals”=>”I/O
Ports”=>”Port n” from the pull–down menus, where n is the port number. A checked
box in the port window indicates a high (1) pin, and an empty box indicates a low (0)
pin. Both the I/O port data and the data at the left side of the screen are updated
whenever the program is paused.
The debugger will help eliminate many programming errors, however the
simulation is not perfect and code that executes properly in simulation may not always
work on the actual microcontroller.
5.8 PROGRAMMER
The programmer used is a powerful programmer for the Atmel 89 series of
microcontrollers that includes 89C51/52/55, 89S51/52/55 and many more.
It is simple to use & low cost, yet powerful flash microcontroller programmer for the
Atmel 89 series. It will Program, Read and Verify Code Data, Write Lock Bits, Erase
and Blank Check. All fuse and lock bits are programmable. This programmer has
intelligent onboard firmware and connects to the serial port. It can be used with any
type of computer and requires no special hardware. All that is needed is a serial
communication port which all computers have.
All devices also have a number of lock bits to provide various levels of software
and programming protection. These lock bits are fully programmable using this
programmer. Lock bits are useful to protect the program to be read back from
microcontroller only allowing erase to reprogram the microcontroller.
Major parts of this programmer are Serial Port, Power Supply and Firmware
microcontroller. Serial data is sent and received from 9 pin connector and converted
to/from TTL logic/RS232 signal levels by MAX232 chip. A Male to Female serial
port cable, connects to the 9 pin connector of hardware and another side connects to
back of computer.
All the programming ‘intelligence’ is built into the programmer so you do not
need any special hardware to run it. Programmer comes with window based software
for easy programming of the devices.
Programming window
WELCOME SCREEN
Other problems: TVs or wireless devices may cause spurious off or on signals.
Noise filtering (as installed on computers as well as many modern appliances) may help
keep external noise out of X10 signals, but noise filters not designed for X10 may also
filter out X10 signals traveling on the branch circuit to which the appliance is
connected.
Also, certain types of power supplies used in modern electronic equipment (such
as computers, television sets, and satellite receivers) "eat" passing X10 signals by
providing a low impedance path to high frequency signals. Typically, the capacitors
used on the inputs to these power supplies short the X10 signal from line to neutral,
suppressing any hope of X10 control on the circuit near that device. Filters are
available that will block the X10 signals from ever reaching such devices; plugging
offending devices into such filters can cure mysterious X10 intermittent failures.
Some X10 controllers may not work well or at all with low power devices (below 50
watts) or devices like fluorescent bulbs that do not present resistive loads. Use of an
appliance module rather than a lamp module may resolve this problem.
7.6 BRIDGES
8. ADVANTAGE
It is estimated that X10 compatible products can be found in over 10 million American
homes. This is because it has so many advantages over other types of remote control
products and systems:
Inexpensive
No new wiring is required -- perfect for retrofit
Simple to install
100's of compatible products
Control up to 256 lights and appliances
Time proven
9. CONCLUSION
The PIC MCU is well-suited to X-10 applications. With its plethora of on-chip
peripherals and a few external components, a PIC MCU can be used to implement an
X-10 system that can transmit and receive messages over the AC power line wiring.
The small code size of the X-10 library leaves ample space for the user to create
application specific code. PIC MCUs, such as the PIC16F877A, have plenty of
additional resources for creating more complex X-10 applications, while smaller PIC
MCUs can be selected for economical use in simpler X-10 applications.
In case of a system hang-up condition, the reset button in the vicinity of the
Microcontroller can be used to revive the system.