Home_automation_using_powerline_communication.pdf

April 15, 2018 | Author: Zeeshan Niazi | Category: Modulation, Frequency Modulation, Relay, Switch, Transmission Line
Share Embed Donate


Short Description

Download Home_automation_using_powerline_communication.pdf...

Description

HOME AUTOMATION USING POWER LINE COMMUNICATION

Final Year Design Project Report

Submitted by M. Karim Shah Muhammad ul Haque Muhammad Umair Zeeshan Sikandar Niazi

Advisor Mr. Muhammad Umar Khan

Faculty of Electronic Engineering Ghulam Ishaq Khan Institute of Engineering Sciences and Technology. April 2010 1|Page

CERTIFICATE OF APPROVAL

This is to certify that the work in this thesis entitled “Home Automation Using Powerline Communication” Carried out by Muhammad Karim Shah, Muhmmad ul Haque, Muhammad Umair and Zeeshan Sikandar Niazi under the supervision of Mr. Muhammad Umar Khan in partial fulfullment of the requirement for the degree of Bachelor of Science in Electronic Engineering at Ghulam Ishaq Khan Institute of Engineering Sciences and Technology, Topi.

Certified by,

Mr. Muhammad Umar Khan Project Advisor

2|Page

ACKNOWLEDGEMENTS

We would like to thank our advisor, Mr. Muhammad Umar Khan for being our personal navigator who aided us whenever we needed assistance and whose knowledge, approach and professionalism has always inspired us and helped us understand, analyze and solve problems in a practical manner.

We would also like to express our gratitude to all the Faculty members of Electronic Engineering who provided us with all the support we needed.

We would also like to thank Mr. Muhammad Zubair and Dr. Nouman Khan for their guidance.

3|Page

ABSTRACT

Powerline communication is a progressing technology that utilizes electric power lines for efficient, instantaneous transmission of data. The objective of our project was to design and implement a power line communication network capable of controlling and monitoring multiple devices from a single node. Exacting matters were the design of a suitable coupling circuit to connect multiple slave units onto the already existent and extensive power line network.

4|Page

CONTENTS CHAPTER 1 INTRODUCTION ……………………………………………...............................1 1.1Overview……………………………………………………………………………………….1 1.2 Project Aim…………………………………………………………………………………....2 1.3 Project Modules…………………………….…………………………………………………3 CHAPTER 2 POWERLINE COMMUNICATION………………………...…………………….5 2.1 Background……...…………………………………………………………………………….5 2.2 Power line carrier challenges...............………………………………………………………..6 2.2.1 Noise………………………………………………...............................................................6 2.2.2 Attenuation………………….……………………………………………….………………8 2.2.3 Signal-to-Noise Ratio………………………………...…………………….………………10 2.3 Relevant Regulatory Standards……………………………………………………………...11 CHAPTER 3 MODULATION………………………………………………………….……….14 3.1 Need for Modulation and Techniques…..................................................................................14 3.2 Digital Modulation………………………………………….…………………………….….16 3.2.1 Amplitude shift keying (ASK)……………………………………………….... ………….16 3.2.2 Phase Shift Keying (PSK) …………………………………………………..………….….17 3.2.3 Frequency Shift Keying (FSK) ……………………………………………………..…...18

CHAPTER 4 COUPLING CIRCUITRY ………………………………………………..…….19 4.1 Coupling Transformer ……………………………………………………………...............20 4.2 Coupling Capacitors ………………………………………………………………………...21 CHAPTER 5 HARDWARE IMPLEMENTATION ………………………………………..…22 5.1 The Implementation of FSK.................................................................................................. 22 5.1.1 The FSK Modulator ............................................................................................................23 5.1.2 The FSK Demodulator ........................................................................................................23 5.2 The coupling circuitry.............................................................................................................24 5.3 The relay ................................................................................................................................25 CHAPTER 6 PROGRAMMING MASTER/SLAVE ................................................................28 6.1 Master Unit ............................................................................................................................29 6.1.1 Transmission Protocol ........................................................................................................29 6.1.2 User Interface ......................................................................................................................30 6.1.3 Sample Code (Transmission) ..............................................................................................30 6.2 Slave Unit ...............................................................................................................................31 6.2.1 Sample Code (Receiving End) .............................................................................................31 REFERENCES and Bibliography…………………….………………………………………….33 5|Page

APPENDIX ……………………………………….……………………………………………..35 APPENDIX A Schematics….........................................................................................................35 APPENDIX B Datasheets ……………………………….……………………………………..37

6|Page

CHAPTER 1 INTRODUCTION

1.1 Overview Power line communications is a novel idea of communication which may help in bridging the gap existing between the electrical and communication network. It is basically the utilization of an extensive power line network and the connection of multiple devices to this network that could communicate over this intricate system allowing a multitude of devices to be accessed at any point throughout an office or residential unit. It also offers the prospect of being able to construct intelligent buildings, which would maintain themselves by the use of multiple sensors that would monitor parameters such as temperature and sunshine, and then communicate to any device on the power grid, through the power grid itself.

Extensive research is being conducted in powerline communications so as to explore the new businees opportunties in indoor communications. If it would be possible to supply this kind of network communication over the power-line, the utilities could also become communication providers, a rapidly growing market. Nowadays research is mainly focused on increasing the efficiency of such systems and allowing more coverage.

The various concerns facing this medium are that unlike power related applications, network communications require very high bit rates and in some cases real-time responses are needed. This complicates the design of a

7|Page

communication system but has been the focus of many researchers during the last years. Systems under trial exist today that claim a bit rate of 1 Mb/s, but most commercially available systems use low bit rates. The power-line was initially designed to distribute power in an efficient way, a high power low frequency signal. The communication signal tends to be a low power high frequency one which is one hurdle to overcome. Additional challenges are the fact that the power lines are contaminated by noise and signal attenuation through runs of power line get higher as the frequency of operation increases. Uncertainty and variance in levels of channel impedance also present problems. Power line networks are usually made of a variety of conductor types and cross sections joined almost at random. Therefore a wide variety of characteristic impedances are encountered in the network. This imposes interesting difficulties in designing the filters for these communication networks. Hence advanced communication techniques are to be used for efficient transmission and receiving.

1.2 Project Aim The project aims to understand and explore the theoretical and practical aspects of power line communication techniques. This would lead to subsequent design and implementation of a power line communications system that connected two microcontrollers and the transmission of command signals over the power line to switch on/off an electrical device. The microcontrollers would be able to transfer data using the power lines as their only link of communication.

8|Page

1.3 Project Modules Modulator/Demodulator: The modulating circuitry would produce a specified high frequency signal, that would be transmitted over the channel and then subsequently be demodulated at the reciever to be decoded by the slave unit to activate/decactivate the appropriate devices.

User Interface: The user interface for the control of units is implemented by an LCD for display of options and a keypad to choose the option of choice. This was connected to the master microcontroller which would generate a unique bit pattern for each device, which would be decoded at the slave unit.

Coupling: This is the most essential module that couples the device to the power line. It must isolate the system from the high power network and also act as a high pass filter so that noise at lower frequencies may be filtered out and allowing the communication signal through, without much attenuation.

Device activation: The devices are to be activated using relays as they require high power which cannot be provided by the microcontroller port. Each port is input to a latch which is essential as it provides isolation to the microcontroller from the relay activation mechanism. Without this latch the voltage level at the output port is not sufficient

9|Page

to energize the coil in the relay. After latching a BJT is used as a switching device so that the high power signal is throughput to the N.O. of the relay which is connected to the electrical device.

10 | P a g e

CHAPTER 2 POWERLINE COMMUNICATION

2.1 Background The technology was initiated back in the 1940s and has been used ever since in low bitrate applications such as telemetering and control of electrical applicances and devices in close proximity. Latest advancements are the attainment of higher bandwidth and integration of outdoor applications which is evident from the fact that broadband over power lines has been achieved in many western countries. A number of protocols exist, which differ in the modulation techniques employed, the frequency band utilized and the channel access mechanisms that are used.

The X-10 for example is one of the oldest protocols. It uses amplitude shift keying and was initially used for simplex communication. The presence or absence of a 120kHz signal is used to detect the transmission of „1‟ or „0‟ bits respectively. Each module is assigned an address and the transmission signal would typically contain start bits, house address, device address and function code. This protocol had its speed limitations and also the fact that multiple devices could be transmitting signals simultaneously so collision resolution was to be attained later on by protocols such as the CEBus.

The CEBus Protocol uses p2p communication model and employs Carrier Sensed Multiple Access to avoid collisions. Power line physical layer of the CEBus is based on spread spectrum technology which employs a frequency sweep from

11 | P a g e

100-400kHz. This allows for synchronisation as an instantaneous frequency is used as referance and it also aids in collision resolution. The „1‟ and „0‟ are resolved by the time duration of the chirp with 100microseconds for a „1‟ and 200microseconds for „0‟.

Further protocols are progressively more efficient and employ techniques for the integration of greater number of devices with sufficient reliance on the system to function appropriately, as well as improving data rates to increase the applicability of this technology.

2.3 Power line carrier challenges 2.3.1 Noise Switching mode power supplies, light dimmers, computer networking systems, poor connections that arc, and other "accidental transmitters" that either switch or spark can create considerable RF energy on wiring. It is helpful, when attempting to reduce such noise, that we understand how the noise travels from the source into the receiving system. This noise can be classified as: Corona Noise Corona noise is the most common noise associated with transmission lines and is heard as a crackling or hissing sound. Corona is the breakdown of air into charged particles caused by the electrical field at the surface of conductors. This type of noise varies with both weather and voltage of the line, and most often occurs in conditions of heavy rain and high humidity (typically >80%). An electric field surrounds power lines and causes implosion of ionized water droplets in the air, which produces the sound.

12 | P a g e

During relatively dry conditions, corona noise typically results in continuous noise levels of 40 to 50 dBA in close proximity to the transmission line, such as at the edge of the right-of-way. In many locations, this noise level is similar to ambient noise conditions in the environment. During wet or high humidity conditions, corona noise levels typically increase. Depending on conditions, wet weather corona noise levels could increase to 50 to 60 dBA and could even increase to over 60 dBA under some conditions. Corona noise levels are not consistent from location to location because conductor surface defects, damage, dust, and other inconsistencies can influence the corona effect. Insulator noise Insulator noise is similar to corona noise but it is not dependent on weather. It is caused by dirty, nicked, or cracked insulators, and is mainly a problem with older ceramic or glass insulators. New polymer insulators minimize this type of noise. 50 Hz periodic noise Noise synchronous to the sinusoidal power line carrier can be found on the line. The sources of this noise tend to be silicon-controlled rectifiers (SCRs) that switch at a certain angle in the 50Hz cycle, placing a voltage spike on the line. This category of noise has line spectra at multiples of 50 Hz. Single-event impulse noise Lightning strikes, ignition sparks and lights being turned on or off produce singleevent impulses which result in noise throughout the spectrum. Capacitor banks switched in and out create impulse noise as well. Periodic impulsive noise Devices such as the triac-controlled dimmers on lights are the most common source of indoor noise as they introduce impluses whenever they connect the lamp

13 | P a g e

to the AC line part way through each AC cycle. These impulses occur at twice the AC line frequency as this process is repeated every ½ AC cycle. Continuous Impulsive noise Continuous impulsive noise is the most severe of all the noise sources as this kind of noise is produced by a variety of series wound AC motors which are present in multiple devices such as found in vacuum cleaners, drillers, electric shavers and many common kitchen appliances. Commutator arcing from these motors produces impulses at repetition rates in the several kilohertz range. Non-synchronous periodic noise This type of noise has line spectra uncorrelated with 50 Hz sinusoidal carriers. Television sets generate noise synchronous to their 15734 Hz horizontal scanning frequency. Multiples of this frequency must be avoided when designing a communications transceiver.

It is found that noise levels in a closed residential environment fluctuate greatly as measured from different locations in the building. Noise levels tend to decrease in power level as the frequency increases; in other words, spectrum density of power line noise tends to concentrate at lower frequencies. This implies that a communications carrier frequency would compete with less noise if its frequency were higher.

14 | P a g e

2.3.2 Attenuation Attenuation is the loss of signal strength as the signal travels over distance. For a transmission line the input impedance depends on the type of line, its length and the termination at the far end. The characteristic impedance of a transmission line (Zo) is the impedance measured at the input of this line when its length is infinite. Under these conditions the type of termination at the far end has no effect. A standard distributed parameter model can obtain the characteristic impedance of an unloaded power cable, and it is given by

At the frequencies of interest for PLC communications (the high frequency range), this approximates to

where L and C are the line impedance and capacitance per length. High frequency signals can be injected on to the power line by using an appropriately designed high pass filter. Maximum signal power will be received when the impedance of the transmitter, power line and the receiver are matched. Power line networks are usually made of a variety of conductor types and cross sections joined almost at random. Therefore a wide variety of characteristic impedances are encountered in the network. Unfortunately, a uniform distributed line is not a suitable model for PLC communications, since the power line has a number of loads (appliances) of differing impedances connected to it for variable

15 | P a g e

amounts of time. Channel impedance is a strongly fluctuating variable that is difficult to predict. The overall impedance of the low voltage network results from a parallel connection of all the network‟s loads. so the small impedances will play a dominant role in determining overall impedance. Overall network impedances are not easy to predict either. The most typical coaxial cable impedances used are 50 and 75-ohm coaxial cables and measured 7dB attenuation for a 50 meter run with a 10 ohm termination. A twisted pair of gauge-22wire with reasonable insulation on the wires measures at about 120 ohms. Clearly, channel impedance is low. This presents significant challenges when designing a coupling network for PLC communications. Maximum power transfer theory states that the transmitter and channel impedance must be matched for maximum power transfer. With strongly varying channel impedance, this is tough. We need to design the transmitter

and

receiver

with sufficiently

low output/input

impedance

(respectively) to approximately match channel impedance in the majority of expected situations.

2.3.3 Signal-to-Noise Ratio As the name suggests, this parameter is an essential performance estimator and must be considered for this medium of communication as well. The higher SNR the better the communication as the signal is more dominant.

For indoor environments there are multiple noise sources as discussed earlier and as seen from the attenuation in a power line channel it is apparent that the SNR is majorly hampered. Improvements can be made by, for example, installing filters at each household to block the noise generated from entering the grid and 16 | P a g e

decreasing noise from the outdoor grid as well. This will mean higher costs. Another test for locating noise sources is to go to the main breaker panel or fuse box. Check the presence of the noise with a battery-powered radio. If the noise is present, shut off all power to the premises by turning off the MAIN circuit breaker or by pulling the MAIN fuses or meter. If the noise on the AM radio stops while the power is off, the source of the interference is within the residence. If the noise continues, you can assume it is coming from a point external to the customer's home. Restore the main circuit breaker or fuses or meter. If the noise stopped while the power was off, locate the circuit supplying the power to the noise source using an AM radio as before, and de-energize the individual circuit breakers one at a time until the noise stops. Next, determine what is on the circuit by going from room to room to isolate outlets, appliances and lights until the offending device is found.

2.4 Relevant Regulatory Standards Frequencies used by the devices communicating over the power line are restricted by the limitations imposed by the regulatory agencies. These regulations are developed to ensure harmonious coexistence of various electromagnetic devices in the same environment. The frequency restrictions imposed by FCC and CENELEC are shown in figures 2.1 and 2.2. Federal Communications Commission (FCC) and European Committee for Electro technical Standardization (CENELEC) govern regulatory rules in North America and Europe respectively. In North America frequency band from 0 to 500 KHz can be used for power line communications. However the regulatory rules in Europe are more stringent.

17 | P a g e

Here, the CENELEC standard only allows frequencies between 3 kHz and 148.5 kHz. This puts a hard restriction on power line communications and might not be enough to support high bit rate applications, such as real-time video, depending on the performance needed. According to this standard the spectrum is divided into five bands based on the regulations. They are

 3 – 9 KHz: The use of this frequency band is limited to energy provides;  9 – 95 KHz: The use of this frequency band is limited to the energy providers and their concession-holders. This frequency band is often referred as the "A-Band".  95 – 125 KHz: The use of this frequency band is limited to the energy provider‟s costumers; no access protocol is defined for this frequency band. This frequency band is often referred as the "B-Band".  125 – 140 KHz: The use of this frequency band is limited to the energy providers‟ customers; in order to make simultaneous operation of several systems within this frequency band possible, a carrier sense multiple access protocol using center frequency of 132.5 KHz was defined. This frequency band is often referred to as the "C-Band".  140 – 148.5 KHz: The use of this frequency band is limited to the energy provider‟s customers; no access protocol is defined for this frequency band. This frequency band is often referred to as the "D-Band".

Thus in Europe power line communications is restricted to operate in the frequency range from 95 – 148.5 KHz. Apart from band allocation, regulatory bodies also impose limits on the radiations that may be emitted by these devices.

18 | P a g e

These reflect as restrictions on the transmitted power in each of these frequency bands. Bandwidth is proportional to bit rate, in order to increase the bit rate, larger bandwidth may be needed. Recent research has suggested the use of frequencies in the interval between 1 and 20 MHz. If this range could be used, it would make an enormous increase in bandwidth and would perhaps allow high bit rate applications on the power-line. An important problem is that parts of this frequency band is assigned to other communication system and must not be disturbed. Other communication systems using these frequencies might also disturb the communication on the power-line.

Figure 2.1: CENELEC frequency band allocation

Figure

19 | P a g e

2.2:

FCC

frequency

band

allocation

CHAPTER 3 MODULATION

3.1 Need for Modulation and Techniques When data is transmitted over long distance there should be some mechanism of coding so that the data can easily be distinguished from noise and other signals being transmitted in the same channel and decoded. Modulation is the used to transmit signal over long distances. modulation is the process of varying one or more properties of high frequency periodic waveform, called the carrier signal, with respect to a modulating signal. In modulation the signal to be transmitted, called the carrier signal, is modulated by some high frequency signal and transmitted and at the receiving end the signal is received and demodulated to recover the original signal. An analogue signal is mathematically expressed as

There are only three characteristics of a signal that can be changed over time: amplitude, phase, or frequency. However, phase and frequency are just different ways to view or measure the same signal change. So, we have three parameter which can be altered The amplitude of the signal (A) The frequency of the signal (w)

20 | P a g e

And the phase of the signal ( ) And based on these three parameters there are three different types of modulations 1. Amplitude modulation (AM) 2. Frequency modulation (FM) 3. Phase modulation (PM)

In AM, the amplitude of a high-frequency carrier signal is varied in proportion to the instantaneous amplitude of the modulating message signal. Frequency Modulation (FM) is the most popular analog modulation technique used in mobile communications systems. In FM, the amplitude of the modulating carrier is kept constant while its frequency is varied by the modulating message signal and in phase modulation the phase of the carrier signal is varied with the amplitude of the modulating signal while amplitude and frequency is kept constant. There are three basic purposes of modulation in general: 1. To reduce the wavelength for efficient transmission and reception. A typical audio frequency of 3000 Hz will have a wavelength of 100 km and would need an effective antenna length of 25 km! By comparison, a typical carrier for FM is 100 MHz, with a wavelength of 3 m, and could use an antenna only 80 cm long. 2. To allow simultaneous use of the same channel, called multiplexing. Each unique signal can be assigned a different carrier frequency (like radio stations) and still share the same channel. 21 | P a g e

3. Modulation also serves as a source of coding mechanism. 3.2 Digital Modulation Types of digital modulation Amplitude shift keying (ASK) Frequency shift keying (FSK) Phase shift keying (PSK) In FSK, the frequency of the carrier is changed as a function of the modulating signal (data) being transmitted. Amplitude remains unchanged. In binary FSK a “1” is represented by one frequency and a “0” is represented by another frequency. Now all these three are discussed in detail. 3.2.1 Amplitude shift keying (ASK) In ASK, the amplitude of the carrier is changed in response to information and frequency and phase are kept constant. Bit 1 is transmitted by a carrier of one particular frequency and to transmit bit 0, the amplitude is changed keeping the other two parameters constant. ON=OFF keying is a special form of ASK, where one of the amplitude is zero. A binary amplitude-shift keying (BASK) signal can be defined by

Where, 22 | P a g e

A is the amplitude m(t) is the digital data is the carrier frequency m(t) is either „0‟ or „1‟. For „1‟

and for m(t) = 0

Which implies that the carrier signal is present when the digital signal is at logic high absent when it is at low level. Since the amplitude of the signal is varied corresponding to the instantaneous change in the amplitude of the carrier signal and noise is always present. During the transmission of the signal it is amplified at different locations (before sending on the power line and after receiving the signal before demodulation). As a result the noise will also be amplified. This is one of the drawback due to which we avoided using Ask as our modulation scheme.

3.2.2 Phase Shift Keying (PSK) In PSK, we change the phase of the carrier signal to indicate the information. Phase in this context is the starting angle at which the carrier signal (sinusoid) starts. To transmit 0, we shift the phase of the sinusoid by 180 0 . Phase shift represent the change in the state of the information.

23 | P a g e

for logic level 1 for logic level 0 Where, A is a constant m(t) is the digital signal either +1 or -1 is the carrier frequency

3.2.3 Frequency Shift Keying (FSK) In FSK, we change the frequency of the carrier signal in response to the information signal, one particular frequency for logic 1 and another frequency for logic level 0. Mathemathically.

for logic level 1 for logic level 0

FSK is the most favorable scheme of modulation for power line communication since the carrier frequency is always present and we can recover the original filter easily because the amplitude is not important anymore so the effect of noise is reduced as compared to the other modulation schemes. 24 | P a g e

CHAPTER 4 COUPLING CIRCUITRY

One of the most critical components of any Power Line Communication system is its interface circuit (or coupling circuit) with the power distribution network. This is by no means a simple unit considering the challenging characteristics of the PLC channel. Due to high voltages, varying impedances, high amplitudes and time dependent disturbances, coupling circuits need to be carefully designed to provide both the specific signal transmission with the appropriate bandwidth, and the safety level required by the applicable domestic or international standard. A coupling circuit in a power line communications system is actually used for coupling an information signal from a transmitter unit to a power line and decoupling that signal from the power line to a receiver unit. The coupling circuit includes: (a) a ferrite core inductive coupler for isolating the transmitter unit and the receiver unit from a power line and for coupling information signals from the transmitter unit to the power line and from the power line to the receiver unit, (b) a high pass filter (capacitive coupler) which not only blocks random noise from entering into the modem but also suppresses 50Hz power signal. Hence it is the core part of Power Line Communication which isolates the modem from high voltages and allows only the information signal to pass through unattenuated.

25 | P a g e

4.1 Coupling Transformer Coupling transformer is used for two reasons (a)To attain galvanic isolation (b) For impedance matching. Coupling transformer used here should be designed as a high frequency transformer, as our information signal is a high frequency signal. The power signal tends to have a saturating influence on the magnetic core and in the order of atleast 105 time more as compared to the communication signal. This means that the transformer must be placed after the capacitive coupler so as to prevent the power signal from saturating the core, and hence deforming the communication signal. Another consideration regarding the transformer is its frequency response. Operating at lower frequencies and high power ratings, most power transformers have transfer functions which do not allow for the communication signal to get through. In the inductive coupling, PLC signal current is injected into the power distribution lines. This is achieved through an inductive transformer coupler using appropriate high-frequency ferrites. The inductive injection method is most effective when the mains impedance is low at the signal injection point. This is typically the case when injecting the signal into a bus network where several power cables are connected together. Connecting several power cables to a single point or bus effectively results in a parallel connection of the individual cable impedances. This results in low input impedance. The inductive coupling is often the preferred method for coupling due to its better performance in low impedance situations, lower radiation from power mains and its simplicity to use.

26 | P a g e

4.2 Coupling Capacitors A high pass passive filter is needed to remove noise coming from the power line and to act as a capacitive coupling circuit, blocking 50Hz power signal. The requirements and essential characteristics of coupling capacitors have been standardized in ANSI C93.1-1972. All filter components need to be able to with stand voltage surges and must have high power ratings.

Capacitive coupling can be used as a standalone isolation circuit provided we employ perfect grounds at the transmitting and receiving side. This provides a proper referance for the communication signal allowing a 0.6V signal to be detected at a distance of 20m with an input signal of 3.6V.

27 | P a g e

CHAPTER 5 HARDWARE IMPLEMENTATION

5.1 The Implementation of FSK In this project we are using HEF4046B IC for modulation and demodulation. The internal circuitry is shown

Figure 5.1 Functional Diagram

This IC contains VCO as well as the PLL which are used for modulation and demodulation respectively. There are two phase comparators. Phase comparator 1 is the exclusive OR gate. This comparator has the feature that it does not only lock on to the fundamental frequency but also at its harmonics which is undesired for us as we do not want to lock the PLL at the harmonics which might be any noise 28 | P a g e

on the power line (there is always noise at different frequencies on the power line). Phase comparator 2 locks only at the fundamental frequency so we will be using this comparator in our project. The VCO gives both square or triangular signal of particular frequency set by the external Resistors (R1 and R2) and capacitor (C1).

5.1.1 The FSK Modulator We are using 190KHz for logic level 1 and 150KHz for logic level 0. For these frequencies we will find the external components as follow. Step 1 Since we have fmax = 190KHZ and fmin = 150KHZ Given fmin use fig.8 (all these graphs are in the data sheet of 4046 at the appendix) to determine R2 and C1 Step 2

Use to determine the ratio

with fig.9 Figure 5.2 Modulator Biasing to obtain R1

From the first step we get R2 =10KΩ (for Vcc = 10V) and C1 = 5nf And from step 2 we get R2 = 10KΩ 29 | P a g e

5.1.2 The FSK Demodulator The values of R1, R2 and C1 for the demodulator are the same as for the modulator since we want to recover the original signal. The

low

pass

filter

at

the

comparator output is required to eliminate the small flotation in the output wave form. The values for this filter are calculated as: The cutoff frequency of the low

Figure 5.3 Demodulator Biasing

pass filter should be:

and fserial in our system is very low. fmin = 150kHz so we will choose the cutoff frequency as fc = 100zHz now using

for fc =100KHZ and C2 = 1nf

R3 =1.5KHz

5.2 The coupling circuitry 30 | P a g e

According to the standard used for isolation of the low voltage circuitry from the high voltage power line, an isolation transformer and coupling capacitors are used. The transformer serves two purposes, first it serves as an isolating device and secondly it also helps in impedance matching. The transformer should be of high frequency. Since we are using 190KHZ and 150KHZ for logic high and low respectively, the frequency ratings of the transformer should also be in this frequency ranges. But due to the unavailability of such a high frequency transformer we modified the coupling circuitry at the cost of impedance mismatch. The coupling circuitry which we are using is an RC second order high pass filter. Keeping in view the high voltage, the resistors used are of 10watts and the capacitors are of high voltage rating (800V). and the cutoff frequency of the filter is calculated from

With R = 1KΩ and C = 2.2nF the cutoff frequency was calculated as fc = 72.3KHZ This helps to suppress the 50HZ high voltage signal and the noise below this frequency ranges is also suppressed. (To further minimize noise the signal is passed through band pass filter before demodulation).

5.3 The relay Relays are electro-magnetically activated switches. Literally, there is an electromagnet inside the relay, and energizing that electromagnet causes the switch to change position by pulling the movable parts of the switch mechanism to a different position. To the greatest extent possible, the electromagnet is made to be electrically isolated from the signal path. 31 | P a g e

There are two main classes of relays - latching and non-latching. Non-latching relays are the simplest kind. In a non-latching relay, the electromagnet pulls on a switch that is spring-loaded to one side, which is called the "normal" or "reset" side. Whenever the electromagnet's coil carries enough current (called the pull-in current), it makes enough ampere-turns of magnetic force to pull the switch to the "energized" or "set" position. The switch stays in the energized position as long as the current in the coil is enough to make the electromagnet overcome the force of the spring. As soon as the current drops below the holding current, the spring pulls the switch back to the non-energized condition. Because of the way magnetic attraction works, it takes less magnetic force - and therefore less current in the coil - to hold the relay set than it did to move it there in the first place, so the holding current is less than the pull-in current.

The nonlatching relay is shown schematically on left hand corner of fig below. The switch portion of the basic relay is shown as a switch that consists of a pole which can be switched to one of two throws. The throw that the pole connects to when no current flows in the coil is called the normally closed (NC) throw. The normally open (NO) contact is - well, normally open. A spring holds the switch in this position. The pole and throws are the only signal connections on the relay. The coil is only used to control the relay, not to

32 | P a g e

conduct signal

currents.

Figure 5.4 Two types of relays one employing a spring (L) and one using a magnet (R)

On the right hand side of the figure above, we see the other major kind of relay, the latching relay. If we have no spring, but make the swinging arm a magnet (indicated by the n and s poles), then the swinging arm will be made to be attracted to the closest of the two iron coil cores. It will stay in that position forever unless something makes it move. We can make it move by briefly connecting the switch and battery to make the two electromagnets energize in a way that repels the magnet in the swing arm away from its current position. If the polarity of the battery is such that the iron core attracts the swinging arm, the arm stays right where it is and nothing happens. Only if the polarity of the battery is such that the iron core repels the swinging arm, and the other iron core attracts the swinging arm, will the swinging arm will flip to the other side and stay there. By proper winding and connections, this forms a magnetically latching relay. This particular kind is called a "single coil" latching relay. You make it change states by putting a reverse pulse into the single coil. To flip it back, you have to invert the coil polarities again. The switch in the above figure is practically replaced in the Power Line Communication system by a BJT transistor. The base of the transistor is 33 | P a g e

connected to the output of the latch IC. As the output current of the microcontroller is too small and cannot provide the sufficient base current for the transistor, it is first latched and then connected to the base. The relay is connected to the emitter and VCC is applied at the collector. The transistor turns ON and OFF in response to the microcontroller.

Figure 5.5 System Block Diagram

34 | P a g e

CHAPTER 6 PROGRAMMING MASTER/SLAVE

Language Assembly Language

Microcontroller Atmel AT89C51

Software MIDE-51

6.1 Master Unit Microcontroller sends the digital data at data rate of 5kb/s which is fed into the FSK modulator thus we have 190Khz frequency burst for „1‟ and 140Khz frequency burst for „0‟. Serial port of the microconroller is not used for the data communication because of synchornization problem between transmitter and receiver due to high baud rate, instead P1.7 of the master microcontroller is manually used for transmitting the data serially.

6.1.1 Transmission Protocol First two bits are the starting bits which tells the slave unit to take the next byte as a data byte. Microcontroller concatenates a pair of ones before the address of the corresponding device.

1

1

Figure 6.1 Transmission Protocol 6.1.2 Address Mapping

35 | P a g e

DATA (8 Bits )

Each device which is to be controlled is mapped with a unique address. So when a device is to be activated/deactivated microcontroller transmits the binary of that address. Address mapping is as follows:

Device

Address (decimal)

Binary

A

1

00000001

B

2

00000010

C

3

00000011

.

.

.

Z

.

.

Table 6.1 Address mapping

6.1.3 User Interface At the control side user is provided with an interface which includes LCD display and a numeric keypad. LCD is used for visual purpose and user guidance where keypad is used to intake the data or corresponding address of the device to be switched on/off. The detail Pin configuration of LCD and working of keypad is described in Appendix A.

Fi gure 6.2 Block diagram of GUI

36 | P a g e

6.1.4 Sample Code (Transmission)

TRANS:MOV R4,#8 SETB P2.1 ACALL DELAY3

;Starting bits

ACALL DELAY3 UNT: RRC A

;Address fed by user

MOV P1.7,C

;Transmitting serially

ACALL DELAY3

;Setting specified baud rate

DJNZ R4,UNT ACALL DELAY1

;Ending bits

ACALL DELAY1 ACALL DELAY1 LJMP START

;Jump for next data byte

6.2 Slave Unit At the receving end slave unit takes in the serial data through P2.1 and after processing the address activates/deactivates the corresponding device through a latching and relay circuitry.

6.2.1 Sample Code (Receving End) START:MOV A,#0H JNB P2.1,START ACALL DELAY3

37 | P a g e

;Check for first starting bit

JNB P2.1,START

;Check for Second starting bit

MOV R4,#8 JMP DAT DAT: DJNZ R4,NEXT JMP ACTIV NEXT: JB P2.1,ADD1 JNB P2.1,ADD2 ADD1: RL A

;Activate the corresponding device ;Detecting „1‟ ;Detecting „0‟ ;Retreiving address

ADD A,#0H ACALL DELAY3 JMP DAT ADD2: RL A ADD A,#01H ACALL DELAY3 JMP DAT

38 | P a g e

;Retreiving address

REFERENCES

I. Muhammad Ali Mazidi, and Janice Cillisie Mazidi. “The 8051 Microcontroller and Embedded Systems”, pg 236-237

II. M Zubair M Atif Siddiqui, Wajahat Ali Shah, M Rashid, “Power Line Communication Network”, BS Final Year, July 2009 III. B. A. Mork,

D. Ishchenko, X. Wang, A.D. Yerrabelli, R.P. Quest, C.P.

Kinne, ”Power Line Carrier Communications System Modeling” IV. http://www.merl.com/projects/SCP/ , Simple Control Protocol for Power Line Communications. V. Niovi Pavlidou, A. J. Han Vinck, Javad Yazdani and Bahram Honary, “Power Line Communications:

State of the Art and Future Trends”, IEEE Communications

Magazine, Vol.41 No. 4 pp. 34-39, April 2003. VI. Echelon Corporation, A Power Line Communication Tutorial – Challenges and Technologies. VII. Transmission Theory for X10 Technology, http://www.x10.com/technology1.htm. VIII. P K DALELA , M V S N PRASAD , ANAND MOHAN, “A new concept of digital power line carrier communication for rural applications”

IX. IEEEJ OURNAL ON SELECTED AREAS IN COMMUNICATIONS,VOL.24,NO.7, Masaaki Katayama, “A Mathematical Model of Noise in Narrowband Power Line Communication Systems”, JULY2006, X. http://www.tpub.com/neets/book2/5i.htm XI. http://www.oas.org/en/citel/infocitel/2006/noviembre/bpl_e.asp

39 | P a g e

APPENDIX A

PROGRAMMING CODE

TRANSMITTING END

ORG 0h START:

MOV DPTR,#COM1

HERE1:

CLR A

MOVC A,@A+DPTR JZ PRINT15 ACALL COMWRT ACALL DELAY1 INC DPTR SJMP HERE1 PRINT15:MOV DPTR,#DATA1 PRINT1:

CLR A

MOVC A,@A+DPTR JZ COMM2 ACALL DATAWRT ACALL DELAY1 INC DPTR SJMP PRINT1 COMM2:

MOV DPTR,#COM2

HERE6:

CLR A

MOVC A,@A+DPTR JZ DAT2

40 | P a g e

ACALL COMWRT ACALL DELAY1 INC DPTR SJMP HERE6 DAT2: MOV DPTR,#DATA2 PRINT2:

CLR A

MOVC A,@A+DPTR JZ START1 ACALL DATAWRT ACALL DELAY1 INC DPTR SJMP PRINT2 START1:

ACALL DELAY3

MOV DPTR,#COM3 HERE7:

CLR A

MOVC A,@A+DPTR JZ START2 ACALL COMWRT ACALL DELAY1 INC DPTR SJMP HERE7 START2:

MOV DPTR,#MENUE1

PRINT3:

CLR A

MOVC A,@A+DPTR JZ CNTRL

41 | P a g e

ACALL DATAWRT ACALL DELAY1 INC DPTR SJMP PRINT3 START3:

MOV A,#0C0H

ACALL COMWRT ACALL DELAY1 ;

MOV DPTR,#MENUE2

PRINT4:

CLR A

MOVC A,@A+DPTR JZ CNTRL ACALL DATAWRT ACALL DELAY1 INC DPTR SJMP PRINT4 KEYCHK: K1:

MOV P2,#0FFH

MOV P1,#0 MOV A,P2 ANL A,#00000111B CJNE A,#00000111B,K1

K2:

ACALL DELAY1 MOV A,P2 ANL A,#00000111B CJNE A,#00000111B,OVER SJMP K2

42 | P a g e

OVER:

ACALL DELAY1 MOV A,P2 ANL A,#00000111B CJNE A,#00000111B,OVER1 SJMP K2

OVER1:

MOV P1,#11111110B

MOV A,P2 ANL A,#00000111B CJNE A,#00000111B,ROW0 MOV P1,#11111101B MOV A,P2 ANL A,#00000111B CJNE A,#00000111B,ROW1 MOV P1,#11111011B MOV A,P2 ANL A,#00001111B CJNE A,#00001111B,ROW2 LJMP K2 ROW0:

MOV DPTR,#KCODE0

SJMP FIND ROW1:

MOV DPTR,#KCODE1

SJMP FIND ROW2:

MOV DPTR,#KCODE2

SJMP FIND ROW3:

43 | P a g e

MOV DPTR,#KCODE3

FIND: RRC A JNC MATCH INC DPTR SJMP FIND MATCH:

CLR A

MOVC A,@A+DPTR RET

CNTRL:

ACALL KEYCHK

MOV R6,A XRL A,#1 JZ STATUS MOV A,R6 XRL A,#2 JZ OF SJMP CNTRL OF:

MOV DPTR,#COM3

HERE9:

CLR A

MOVC A,@A+DPTR JZ OFPRINT ACALL COMWRT ACALL DELAY1 INC DPTR SJMP HERE9 OFPRINT:MOV DPTR,#STAT1

44 | P a g e

PRINT6:

CLR A

MOVC A,@A+DPTR JZ ADDRESS1 ACALL DATAWRT ACALL DELAY1 INC DPTR SJMP PRINT6 STATUS:

MOV DPTR,#COM3

HERE8:

CLR A

MOVC A,@A+DPTR JZ STPRINT ACALL COMWRT ACALL DELAY1 INC DPTR SJMP HERE8 STPRINT:MOV DPTR,#STAT1 PRINT5:

CLR A

MOVC A,@A+DPTR JZ ADDRESS1 ACALL DATAWRT ACALL DELAY1 INC DPTR SJMP PRINT5 ADDRESS1:ACALL KEYCHK JMP TRANS

45 | P a g e

TRANS:

MOV R4,#8

SETB P2.1 ACALL DELAY3 ;STARTING BITS ACALL DELAY3 UNT: MOV R5 MOV B,#2

;CHECKING EVEN PARITY

RRC A INC R5 MOV P2.1,C ACALL DELAY3 DJNZ R4,UNT MOV A,R5 DIV AB MOV A,B JZ PARITY SETB P2.1 JMP FIN PARITY:

CLR P2.1

ACALL DELAY3 FIN:

ACALL DELAY1 ACALL DELAY1 ACALL DELAY1 LJMP START

COMWRT:

MOV P0,A

CLR P3.0 ;RS

46 | P a g e

CLR P3.1 ;R/W SETB P3.2 ;E=1 ACALL DELAY1 CLR P3.2 ;E=2 RET DATAWRT:MOV P0,A SETB P3.0 ;RS=1 CLR P3.1 ;R/W=0 SETB P3.2 ;E=1 ACALL DELAY1 CLR P3.2 ;E=0 RET DELAY2:

MOV R1,#80

HERE5:

MOV R2,#255

HERE4:

MOV R0,#255

HERE3:

DJNZ R0,HERE3

DJNZ R2,HERE4 DJNZ R1,HERE5 RET DELAY3:

MOV R1,#08

HERE13:

MOV R2,#255

HERE12:

MOV R0,#255

HERE11:

DJNZ R0,HERE11

DJNZ R2,HERE12 DJNZ R1,HERE13

47 | P a g e

RET DELAY1:

MOV R1,#20

X:

MOV R0,#145

ST:

DJNZ R0,ST DJNZ R1,X RET

COM1:

DB 38H,0EH,01,06,81H,0

;Commands for initializing

LCD COM3:

DB 1,80H,0

COM2:

DB 0C2H,0

DATA1:

DB "WELCOME TO",0

DATA2:

DB "CONTROL PANEL",0

MENUE1:

DB "1 O/F:",0

STAT1:

DB "ADDRESS:",0

KCODE0:

DB 1,2,3

KCODE1:

DB 4,5,6

KCODE2:

DB 7,8,9

KCODE3:

DB 10,11,12

END

48 | P a g e

;Starting up

;Press 1 for switching

RECEIVING END

ORG 00H SETB P2.1 START:

MOV A,#0H

JNB P2.1,START ACALL DELAY3 ;CHECK FOR 1ST STARTING BITS JNB P2.1,START ;CHECK FOR 2ND STARTING BITS MOV R4,#5 JMP DAT DAT: DJNZ R4,NEXT JMP ACTIV ;ACTIVATE THE CORESSPONDING DEVICE NEXT: JB P2.1,ADD1 JNB P2.1,ADD2 ADD1: RL A ADD A,#0H ACALL DELAY3 JMP DAT ADD2: RL A ADD A,#01H ACALL DELAY3 JMP DAT ACTIV:

XRL A,#1

JZ ONE XRL A,#2 JZ TWO 49 | P a g e

XRL A,#3 JZ THREE XRL A,#4 JZ FOUR XRL A,#5 JZ FIVE XRL A,#6 JZ SIX XRL A,#7 JZ SEVEN XRL A,#8 JZ EIGHT XRL A,#9 JZ NINE ONE: CPL P1.0 LJMP START TWO: CPL P1.1 LJMP START THREE:

CPL P1.2

LJMP START FOUR: CPL P1.3 LJMP START FIVE: CPL P1.4 LJMP START SIX:

CPL P1.5

50 | P a g e

LJMP START SEVEN:

CPL P1.6

LJMP START EIGHT:

CPL P1.7

LJMP START NINE: CPL P2.1 LJMP START DELAY3:

MOV R1,#08

HERE13:

MOV R2,#255

HERE12:

MOV R0,#255

HERE11:

DJNZ R0,HERE11

DJNZ R2,HERE12 DJNZ R1,HERE13 RET

END

51 | P a g e

APPENDIX B

SCHEMATIC DIAGRAMS

TRANSMITTING END

52 | P a g e

RECEIVING END

53 | P a g e

APPENDIX C

DATASHEETS

74HC4046 (PLL) LF351CN( J-FET Op-amp)

54 | P a g e

55 | P a g e

56 | P a g e

57 | P a g e

58 | P a g e

59 | P a g e

60 | P a g e

61 | P a g e

62 | P a g e

63 | P a g e

64 | P a g e

65 | P a g e

66 | P a g e

67 | P a g e

68 | P a g e

69 | P a g e

70 | P a g e

71 | P a g e

72 | P a g e

73 | P a g e

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF