Professional Documents
Culture Documents
Automation Using PLC For Engineers
Automation Using PLC For Engineers
Prabhakaran Ashwin V
Sadhnani Tarun I
Shah Aesha A
Thakrani Manish G
UNDER GUIDANCE OF
PROJECT REPORT ON
AUTOMATION USING POWER LINE
COMMUNICATION
Submitted in partial fulfilment of requirements for the degree course of
BACHELOR OF ENGINEERING IN ELECTRONICS AND
TELECOMMUNICATION [EXTC]
By
Prabhakaran Ashwin V
Sadhnani Tarun I
Shah Aesha A
Thakrani Manish G
Worli.
ACKNOWLEDGEMENT
We acknowledge with sincere gratitude, the whole hearted support
both technically and morally that we have received from our HOD,
PROF. (MRS.) SUNITA SHARMA.
We would like to thank for the sincere appreciation and
encouragement that we have received during the launching of this
project from our GUIDE, Mr. T.R PAUL. We also thank the lab
technician MISHRA SIR and other non teaching staff of our
EXTC department for their help during the development of this
project.
We are thankful to our colleagues and all those who helped us
knowingly or unknowingly to make our project a success.
We have realized that the efficiency of team work is indeed more
than an individual effort. The guidance of our guide motivated us to
work harder under all circumstances.
SUBMITTED BY:
Prabhakaran Ashwin V
Sadhnani Tarun I
Shah Aesha A
Thakrani Manish G
TABLE OF CONTENS
1.
2.
3.
4.
5.
6.
7.
8.
9.
Introduction.
1.1 Power Line Communication.
1.2 Modern Applications and Prospects.
1.3 Project Aim.
Protocols.
2.1 Existing Industry Protocols used in PLC
2.2 X10
2.2.1 Overview.
2.2.2 Protocol.
2.2.3 Sequence of Signals.
2.2.4 Disadvantages.
2.3 MODBUS
2.3.1 Overview.
2.3.2 MODBUS Message Structure.
2.3.3 MODBUS Serial Transmission Modes.
2.3.4 MODBUS Addressing.
2.3.5 MODBUS Function Codes.
2.3.6 Disadvantages.
Circuit Design
3.1 Power line as Communication Channel.
3.2 Digital Modulation.
3.3 Transmitter Structure.
3.4 Power Line Interface (Isolation Circuit):
3.5 Receiver Structure.
System Implementation - The Transmitter.
4.1 Hardware.
4.2 Software.
System Implementation - The Receiver.
5.1 Hardware
5.2 Software
Cost of Project.
Conclusion.
Bibliography
Appendix.
11
22
26
34
42
43
44
45
List of Figures
Figure 1: Electric power transmission scheme
Figure 2: Power Line Waveform with Zero Crossing for trans-receiving X10 data
Figure 3: Receiver Sensing Zero Crossing Figure 5: Start Code.
Figure 4: Zero crossing
Figure 5: Start Code.
Figure 6: Letter Code.
Figure 7: Number Code.
Figure 8: Transmission of Address Data.
Figure 9: Address Code and Command Code separation.
Figure 10: Power Line Phases and X-10 pulse.
Figure 11: MODBUS message structure.
Figure 13: Device and MODBUS address ranges
Figure 14: MODBUS Function Codes
Figure 15: Power Line Communication Channel
Figure 16: Binary Amplitude Shift Keying Waveform
Figure 17: A BFSK waveform derived from a Binary message.
Figure 18: The Transmitter Circuit diagram
Figure 19: The Receiver Circuit Diagram
Figure 20: The Power Line Communication System
Abstract
In this project tilted power line communication we discuss how the existing power line
network operating at 230V (50 Hz) can be used for digital data transfer. The transmitter
microcontroller is used to generate the digital carrier and the binary codes which control
which devices are actuated at the receiving end. The receiver microcontroller receives the
binary codes and controls the appropriate devices. The coupling circuitry and the
isolation mechanism used at high voltages are also specified. Finally the applications of
the project and the future scope of the technology are specified.
1. INTRODUCTION
1. INTRODUCTION
Establishing an efficient and rapid means of communication between devices constituting
a network has remained the main research initiative of communication engineers for a
long time now. The concept initially started with an aim of establishing a communication
link between two devices .Slowly the devices constituting the network multiplied until we
faced the task of interfacing thousands of devices together to a common communication
channel. As the frequencies to be used changed and the cost of establishing network links
increased, researchers began the work of finding new media and new technologies which
could enable communication in a network at high speeds and low cost.
Initially when devices were connected dedicated communication lines were laid down for
communication. Miles and miles of wire were laid to enable communication over longer
distances. Hence the cost continued to remain a concern. Hence scientists came up with
the idea of using already established networks, such as the one carrying AC power to our
household, as a communication pathway. This eliminated the need to establish separate
dedicated networks and hence resulted in reduced costs.
1.1 Power Line Communication : Power Line Communications (PLC) is the use of
existing electrical cables to transport data. It is a scheme in which data is transmitted over
a conductor used for electric power transmission. Here a modulated carrier signal is
superimposed on the wiring system. Electrical power is transmitted over high voltage
transmission lines, distributed over medium voltage, and used inside buildings at lower
voltages. Power line communications can be applied at each stage.
Different types of power line communications use different frequency bands, depending
on the signal transmission characteristics of the power wiring used. Since the power
wiring system was originally intended for transmission of AC power, in conventional use,
the power wire circuits have only a limited ability to carry higher frequencies. The
propagation problem is a limiting factor for each type of power line communications.
1.2 Modern Applications & Prospects
Power Line Communications (PLC) has been around for a very long time. In this section
we would also like to discuss some major applications driving the Power Line
Communication (PLC) technology. They are:
Automatic Meter Reading (AMR) For the readings of Electricity, Water, Gas
or any other meters in the customer premises to be transmitted to a central base station for
further processing, billing etc. With tens of millions of meters to be read periodically and
regularly, this alone represents an enormous market.
To use the design and implement a power line carrier communications system that
connects two microprocessor/micro-controller kits as also two personal computers. The
devices should be able to transfer data using the power lines as their only link of
communication.
2. PROTOCOLS
2. PROTOCOLS
10
Format of the data packet as sent by the transmitter should be understood by the
receiver
Transmitters and receivers should use compatible coding and decoding schemes
respectively
Both the transmitter and receiver should use the same error detection algorithm
Some of the most commonly used automation protocols used in the industry today for
wired communication are given below:
X 10
MODBUS
C-Bus
KNX
INSTEON
We give a detailed description of the X10 and MODBUS protocols along with a
comparison of their features in the following section.
2.2 X10
2.2.1 Overview: X10 is an international and open industry standard
for communication among electronic devices used for home automation, also known
as domotics. It primarily uses power line wiring for signaling and control, where the
signals involve brief radio frequency bursts representing digital information.
11
Household electrical wiring the same which powers lights and appliances is used to
send digital data between X10 devices.
2.2.2 Protocol: This digital data is encoded onto a power line carrier which is transmitted
as bursts during the relatively quiet zero crossings of the AC alternating
current waveform. One bit is transmitted at each zero crossing.
Figure 2: Power Line Waveform with Zero Crossing for trans-receving X10 data
A receiver opens its receive "window" twice each sine wave i.e. 120 times each
second.
12
13
14
15
5. 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.
(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
16
also filter out X10 signals traveling on the branch circuit to which the
appliance is connected.
X10 signals can only be transmitted one command at a time, first by
addressing the device to control, and then sending an operation for that device
to perform. If two X10 signals are transmitted at the same time they
may collide or interleave, leading to commands that either cannot be decoded
or that trigger incorrect operations.
2.3 MODBUS
2.3.1 Overview: The MODBUS communication interface is built around messages. The
format of these MODBUS messages is independent of the type of physical interface used.
This gives the MODBUS interface definition a very long lifetime. The same protocol can
be used regardless of the connection type. Because of this, MODBUS gives the possibility
to easily upgrade the hardware structure of an industrial network, without the need for
large changes in the software. A device can also communicate with several MODBUS
nodes at once, even if they are connected with different interface types, without the need
to use a different protocol for every connection.
2.3.2 MODBUS Message Structure: Each MODBUS message has the same structure.
Four basic elements are present in each message. The sequence of these elements is the
same for all messages, to make it easy to parse the content of the MODBUS message. A
conversation is always started by a master in the MODBUS network. A MODBUS master
sends a message anddepending of the contents of the messagea slave takes action and
responds to it. There can be more masters in a MODBUS network. Addressing in the
message header is used to define which device should respond to a message. All other
nodes on the MODBUS network ignore the message if the address field doesn't match
their own address.
Description
Error check
MODBUS/RTU
Characters
Binary 0...255
Error check
Frame start
character ':'
Frame end
characters CR/LF
Gaps in
message
1 sec
Start bit
Data bits
Parity
even/odd
none
even/odd
none
Stop bits
MODBUS address
1...10000* address 1
Description
Coils (outputs)
Inputs
Holding registers
Description
01
02
03
04
05
06
07
15
16
17
Report slave ID
2.3.6 Disadvantages:
MODBUS is restricted to addressing 247 devices on one data link, which limits
the number of field devices that may be connected to a master station.
21
3. CIRCUIT DESIGN
22
3. CIRCUIT DESIGN
As stated earlier, the project aims at developing a system that uses the AC power lines as
the communication channel/medium to transmit and receive information. In this chapter
we shall study the various circuits that form the basis of the power line communication
system. We would come across the actual system implementation in the next chapter. Let
us first start with describing the power line as a communication channel
3.1 The Communication Channel: The low-voltage power grid that is used to supply
electric power to houses consists of many channels each with its own characteristics and
quality. Figure below shows a communication system using the power-line as a
communication channel. The transmitter is shown to the left and the receiver to the right.
Important parameters of the communication system are the output impedance, Zt, of the
transmitter and the input impedance, Zi, of the receiver.
23
3.2 Transmitter: The transmitter in the PLC system provides the necessary signal which
is to be transmitted through the channel. The signal generated is digital in nature (Binary
0s & 1s or a sequence of 0s n 1s). A microcontroller is programmed by software to
generate the necessary digital signal.
The transmitter needs to make sure it provides the necessary signal without being affected
by external parameters. The digital signal is modulated in proper form to make the signal
more noise free, efficient, and immune to stray signals. Let us now study the various
digital modulation schemes.
3.3 Modulation Schemes: The transmitter (a Microcontroller in our case) is the source of
digital signal for communication purpose. The source signals are generally referred to as
Base-band signals. The low-frequency signal is often frequency-translated to a higher
frequency range for efficient transmission. The process is called modulation. In the
modulation process, the base-band signals constitute the modulating signal and the highfrequency carrier signal is a sinusoidal waveform.
There are three basic ways of modulating a sine wave carrier. They are
Binary Amplitude-Shift keying (BASK).
Binary Frequency-Shift keying (BFSK).
Binary Phase-Shift Keying (BPSK).
3.2.1 Binary Amplitude shift keying (BASK) - In the context of digital communications,
BASK is a modulation process, which imparts to a sinusoid two or more discrete
amplitude levels. These are related to the number of levels adopted by the digital message.
Mathematically it can be expressed as
v(t) = A* b(t) * cos(wo t)
Where, A = amplitude
wo = carrier frequency
b(t ) = Uni-polar digital data
24
When b(t ) = 1
When b(t ) = 0
This implies that the carrier frequency is present when data is at high logic level and there
is no
carrier at all when the data is at logic low level.
For a binary message sequence there are two levels, one of which is typically zero. Thus
the modulated waveform consists of bursts of a sinusoid. Figure illustrates a binary ASK
signal, together with the binary sequence which initiated it
3.2.2 Binary Frequency Shift Keying (BFSK): Its the most common form of digital
modulation in the high-frequency radio spectrum. Binary FSK (usually referred to simply
as FSK) is a modulation scheme typically used to send digital information between digital
equipment such as tele-printers and computers. Data is transmitted by shifting the
frequency of a continuous carrier in a binary manner to one or the other of two discrete
frequencies. Mathematically it can be expressed as
v(t) = A* cos[wot + d (t ) *W* t]
Where A = amplitude
wo = center frequency
W = frequency deviation
And hence two analog waves of different frequencies are obtained. The waveforms for
BFSK are shown below.
3.3. Power Line Interface (Isolation Circuit): One of the most important parts of our
power line transmitter and receiver is the Power Line Interface. Because our circuit has to
connect to the 230V, 50 Hz power line, without careful isolation, the rest of the circuit will
be easily damaged. The idea is to superimpose the data signal onto the 230V, 50 Hz power
waveform, and extract it afterwards at the receiving end. The ideal isolation circuit should
completely block the 50Hz signal, and pass the information signal. The information signal
in our case is the frequency modulated signal.
3.4. Receiver: The signal generated by the transmitted is sufficiently amplified and passed
through the isolation and coupling circuitry onto the A.C power lines. The high frequency
digital signal gets superimposed over the low (50Hz) power lines. The signal thus passes
over the power lines. This superimposed signal reaches the receiver. The receiver is
designed to perform the following actions.
Filtering and Isolation: The received signal is passed through a high pass (RC) filter
which is designed specifically to filter out the 50 Hz power line signal. The powerful A.C
signal should be prevented from entering the receiver peripherals as it can cause damage
to the components. Thus the foremost function of the receiver must be to filter out this
signal. Thereafter careful isolation from the 230V must be provided to the receiver
components as it can also cause sufficient damage. At the output of this portion of the
receiver circuit we get the transmitted high frequency digital signal.
Wave Shaping: The digital signal recovered from the transmitted signal can be affected
by noise introduced during its travel through the power lines. Any stray noise pulses can
cause unwanted action at the receiver. Therefore the receiver should wave shape the
recovered digital signal to take care of the unwanted stray pulses.
26
Control Action: The recovered digital signal is then used by the microcontroller in the
receiver to perform the necessary control action on the devices connected to the receiver.
The receiver should thus differentiate between the different signals for the respective
devices and the take the necessary controlling action.
27
28
The chapters discussed earlier described the various design methodologies used in
building a power line communication system. We now study the actual circuit of the
transmitter and the receiver of the Power Line Communication system in chapter 4 & 5.
29
4.1 Hardware:
The heart of the transmitter is the microcontroller. The system deploys the 8052
microcontroller because the timer2 in the 8052 can be programmed to generate a
fixed frequency digital pulse train which can be used as a carrier in the amplitude
shift keying modulation process.
30
The opto-coupler is used for the isolation of the microcontroller and other allied
low voltage circuitry from the high voltage power line. The output of the optocoupler is capacitor coupled to the high voltage power line as shown in the figure.
31
32
33
4.2 Software
The carrier frequency of 100 KHz is generated using the Timer2 of the 8052
microcontroller in the Programmable Clock Out mode. Here the timer2 is used
to generate a continuous pulse train of 50% duty cycle having frequency of 100
KHz on pin P1.0.
These bytes are sent depending on the status of the pins 2.0, 2.1, 2.2, 2.3. The
status of these pins is manipulated using four switches connected to these pins.
35
include reg_52.pdf
cseg
at
00h
SJMP
CSEG
AT
MAIN
03H
AJMP
cseg
at
ZCD_INT
23h
AJMP
UART_INT
BSEG
AT
SEND_DATA_NOW:
DBIT
01
KEY_DTCT_1:
DBIT
01
KEY_DTCT_2:
DBIT
01
KEY_DTCT_3:
DBIT
01
KEY_DTCT_4:
DBIT
01
DSEG
AT
25H
DST_REP_COUNT:
DS
01
KEY1
EQU
KEY2
EQU
KEY3
EQU
KEY4
EQU
CSEG
AT
30H
MAIN:
MOV
T2CON,#04H
MOV
T2MOD,#02H
MOV
SCON,#50h
MOV
TMOD,#20h
MOV
TH1,#0f4h
MOV
TL1,#0f4h
SETB
TR1
SETB
ES
SETB
EX0
SETB
;2400 Baud-rate
IT0
SETB
EA
MOV
RCAP2H,#0FFH
MOV
RCAP2L,#0E2
JBC
SEND_DATA_NOW,SEND_DATA
JB
KEY_DTCT_1,CHK_KEY2
JB
KEY1,CHK_KEY2
SETB
KEY_DTCT_1
MOV
DST_REP_COUNT,#2
HERE:
CHK_KEY2:
JB
KEY_DTCT_2,CHK_KEY3
37
JB
KEY2,CHK_KEY3
SETB
KEY_DTCT_2
MOV
DST_REP_COUNT,#2
CHK_KEY3:
JB
KEY_DTCT_3,CHK_KEY4
JB
KEY3,CHK_KEY4
SETB
KEY_DTCT_3
MOV
DST_REP_COUNT,#2
CHK_KEY4:
JB
KEY_DTCT_4,HERE
JB
KEY4,HERE
SETB
KEY_DTCT_4
MOV
DST_REP_COUNT,#2
SJMP
HERE
SEND_DATA:
JB
KEY_DTCT_1,SEND_55
JB
KEY_DTCT_2,SEND_AA
JB
KEY_DTCT_3,SEND_5A
JB
KEY_DTCT_4,SEND_A5
SJMP
HERE
SEND_55:
MOV
SBUF,#55H
38
DJNZ
DST_REP_COUNT,HERE
CLR
KEY_DTCT_1
SJMP
HERE
MOV
SBUF,#0AAH
DJNZ
DST_REP_COUNT,HERE
CLR
KEY_DTCT_2
SJMP
HERE
MOV
SBUF,#5AH
DJNZ
DST_REP_COUNT,HERE
CLR
KEY_DTCT_3
SJMP
HERE
MOV
SBUF,#0A5H
DJNZ
DST_REP_COUNT,HERE
CLR
KEY_DTCT_4
SJMP
HERE
SEND_AA:
SEND_5A:
SEND_A5:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
UART_INT:
39
JBC
TI,EXIT_UART
JBC
RI,EXIT_UART
EXIT_UART:
RETI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ZCD_INT:
SETB SEND_DATA_NOW
RETI
END
40
41
42
The input at the receiving end is a 50 Hz power line signal superimposed with the
100 hz signal frequency. This composite signal is passed through a high pass RC
filter to remove the 50 Hz component and pass the 100 KHz component(data
signal).
The signal is then amplified and fed to the input of the opto-coupler. The optocoupler isolates the low voltage microcontroller section from the high voltage
section consisting of the power line.
The output of the opto-coupler is again amplified and fed to the microcontroller
where necessary processing takes place.
43
44
5.2 Software
45
46
include reg_52.pdf
cseg
at
00h
SJMP
CSEG
AT
MAIN
13H
SJMP
CSEG
AT
EXT_1
0BH
SJMP
cseg
at
TMR_0
23h
SJMP
UART_INT
DSEG
AT
25H
SR_DATA:
DS
01
BSEG
AT
00
F_T_FLAG:
DBIT
01
VALID_DATA:
DBIT
01
OP1
EQU
P2.0
OP2
EQU
P2.1
47
CSEG
AT
30H
MAIN:
CLR
OP1
CLR
OP2
CLR
P1.3
MOV
SCON,#50h
MOV
TMOD,#22h
MOV
TH1,#0f4h
MOV
TL1,#0f4h
SETB
TR1
SETB
ES
SETB
ET0
SETB
EX1
SETB
TR0
SETB
IT1
MOV
IP,#04H
SETB
EA
JBC
VALID_DATA,PROC_SR_DATA
SJMP
HERE
;2400 Baud-rate
HERE:
PROC_SR_DATA:
MOV
A,SR_DATA
CJNE
A,#55H,CHK_4_AA
48
SETB
OP1
SJMP
HERE
CJNE
A,#0AAH,CHK_4_5A
CLR
OP1
SJMP
HERE
CJNE
A,#5AH,CHK_4_A5
SETB
OP2
SJMP
HERE
CJNE
A,#0A5H,HERE
CLR
OP2
SJMP
HERE
CHK_4_AA:
CHK_4_5A:
CHK_4_A5:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EXT_1:
JB
F_T_FLAG,CONT_EXT_1
SETB
F_T_FLAG
SJMP
CONT_EXT_2
CONT_EXT_1:
SETB
P1.3
49
CONT_EXT_2:
MOV
TL0,#220
SETB
TR0
RETI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TMR_0:
CLR
P1.3
CLR
F_T_FLAG
CLR
TR0
RETI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
UART_INT:
JBC
TI,EXIT_UART
JBC
RI,CHK_RCV_DATA
EXIT_UART:
RETI
CHK_RCV_DATA:
50
MOV
A,SBUF
CJNE
A,#0,CHK_4_FF
RETI
CHK_4_FF:
CJNE
A,#0FFH,GO_VALID_DATA
RETI
GO_VALID_DATA:
MOV
SR_DATA,A
SETB
VALID_DATA
RETI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
51
52
6.
Cost of Project
53
Sr no:
Components
Price(Rs)
Quantity
Total
1
2
PCB
Microcontrollers 89C52
50
40
2
2
100
80
3
4
MCT2E
PC817
7.5
3
2
3
15
9
5
6
Box caps
BC548
7
6
3
1
21
6
7
8
LED
LM2940
1
35
2
2
2
70
Capacitor 1000uF
10
10
11
Capacitor 220uF
Capacitor 0.1uF
3
.25
2
3
6
.75
12
13
Capacitor 0.33pF
Crystal
.25
3
4
2
1
6
14
Resistor Network
15
Bridge rectifier
10
16
Capacitor 10uF
17
Bus ship
18
Slide Switch
19
Sockets
18
20
AND gate
21
Adapter
100
300
22
23
Resistors
Switches
1
4
10
4
10
16
24
Transformers
200
200
25
Diode
.25
.25
26
Wires
20
20
Grand Total
7. Conclusion
54
Rs.918
The devices connected to the designed power line communication system can be
increased by making minute changes in the underlying hardware and software. The
system can be used for a number of applications such as home automation, automatic
meter reading etc.
The implications of power line communication are farfetched and varied. The
technology can be used for controlling appliances in a household as well as for
remotely controlling vast industrial establishments. The technology is highly cost
effective since it uses the already established power line network for data
communications.
In spite of its numerous advantages, the communication is limited to low data rates
and hampered by high power line noise. Research advances in these areas will further
lead to improvements in the technology.
55
8. Bibliography
www.hometoys.com
www.lammertbies.nl.
Design of Power-Line Communication System (PLC) Using a PIC Microcontroller, Q.
Al-Zobi, I. Al-Tawil, K. Gharaibeh and I. S. Al-Kofahi.
ITU Press Release: New global standard for fully networked home.
IEEE P1901 Press Release.
Modicon MODBUS Protocol Reference Guide.
Tech note-X-10 Communications Protocol and Power Line Interface.
56
57
9. APPENDIX
58
59
60
61
62
63
64
65
66
67
68
69