home automation using powerline

24
HOME AUTOMATION SYSTEM USING POWER LINE COMMUNICATION DARLENE BINTI MOHAMAD DOUGLAS A report submitted as partial fulfillment of the requirements for the award of the Degree of Bachelor of Electrical Engineering (Electronics) Faculty of Electrical & Electronics Engineering Universiti Malaysia Pahang NOVEMBER 2008

Upload: sa29ras

Post on 13-Apr-2015

119 views

Category:

Documents


1 download

DESCRIPTION

Automation

TRANSCRIPT

Page 1: Home Automation Using Powerline

HOME AUTOMATION SYSTEM USING POWER LINE COMMUNICATION

DARLENE BINTI MOHAMAD DOUGLAS

A report submitted as partial fulfillment of the requirements for the award of the

Degree of Bachelor of Electrical Engineering (Electronics)

Faculty of Electrical & Electronics Engineering

Universiti Malaysia Pahang

NOVEMBER 2008

Page 2: Home Automation Using Powerline

UNIVERSITI MALAYSIA PAHANG

BORANG PENGESAHAN STATUS TESIS

JUDUL:

SESI PENGAJIAN:________________

Saya ________________________________________________________________(HURUF BESAR)

mengaku membenarkan tesis (Sarjana Muda/Sarjana /Doktor Falsafah)* ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut:

1. Tesis adalah hakmilik Kolej Universiti Kejuruteraan & Teknologi Malaysia. 2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.3. Perpustakaan dibenarkan membuat salinan tesis ini sebagai bahan pertukaran antara institusi

pengajian tinggi.4. **Sila tandakan ( )

(Mengandungi maklumat yang berdarjah keselamatan SULIT atau kepentingan Malaysia seperti yang termaktub

di dalam AKTA RAHSIA RASMI 1972)

TERHAD (Mengandungi maklumat TERHAD yang telah ditentukan oleh organisasi/badan di mana penyelidikan dijalankan)

TIDAK TERHAD

Disahkan oleh:

___________________________ ___________________________ (TANDATANGAN PENULIS) (TANDATANGAN PENYELIA)

Alamat Tetap:

NO.4, LRG DESA DAHLIA 1/6, ROSMADI BIN ABDULLAHTMN. DESA DAHLIA, SENAWANG,

70450 SEREMBAN, N. SEMBILAN. ( Nama Penyelia )

Tarikh: 17 NOVEMBER 2008 Tarikh: : 17 NOVEMBER 2008

CATATAN: * Potong yang tidak berkenaan.** Jika tesis ini SULIT atau TERHAD, sila lampirkan surat daripada pihak berkuasa/organisasi berkenaan dengan menyatakan sekali tempoh tesis ini perlu dikelaskan sebagai atau TERHAD. Tesis dimaksudkan sebagai tesis bagi Ijazah doktor Falsafah dan Sarjana secara

Penyelidikan, atau disertasi bagi pengajian secara kerja kursus dan penyelidikan, atau Laporan Projek Sarjana Muda (PSM).

2008/2009

DARLENE BINTI MOHAMAD DOUGLAS ( 861031-59-5268 )

HOME AUTOMATION SYSTEM USING POWER LINE COMMUNICATION

Page 3: Home Automation Using Powerline

“I hereby acknowledge that the scope and quality of this thesis is qualified for the

award of the Bachelor Degree of Electrical Engineering (Electronics)”

Signature : _________________________

Name : ROSMADI BIN ABDULLAH

Date : 17 NOVEMBER 2008

Page 4: Home Automation Using Powerline

ii

“All the trademark and copyrights use herein are property of their respective owner.

References of information from other sources are quoted accordingly; otherwise the

information presented in this report is solely work of the author.”

Signature : ____________________________________

Author : DARLENE BINTI MOHAMAD DOUGLAS

Date : 17 NOVEMBER 2008

Page 5: Home Automation Using Powerline

iii

Specially dedicated to my beloved parents, Mohamad Douglas Bin Abdullah and Che Minah Binti Daik who’s been with me through all the years, my precious friends and those people who have guided and inspired me throughout my journey of education.

Page 6: Home Automation Using Powerline

iv

ACKNOWLEDGEMENT

In the name of Allah, invocation and greetings to adoration of Nabi Muhammad

(S.A.W.), thanks to God because giving me strength and patience in finishing this Final

Year Project (Projek Sarjana Muda). Alhamdulillah.

In particular, I wish to express my sincere appreciation to my supervisor, Mr.

Rosmadi Bin Abdullah, for encouragement, guidance, critics and friendship. My fellow

friends under the same supervisor should also be recognized for their support and ideas.

In addition, my sincere appreciation also extends to all my colleagues and others

who have provided assistance at various occasions. Their views and tips are useful

indeed. I would also like to thank to all UMP’s lecturers and electrical technicians whom

had helped directly or indirectly. Unfortunately, it is not possible to list all of them in

this limited space. I sincerely appreciated all of the efforts and precious time to be spent

together in making this final year project educational, enjoyable and memorable. Not to

be forgotten, my deepest thanks to my parents for all the support and blessings.

The great cooperation and kindheartedness to share worth experiences that have

been shown by them will be always appreciated and treasured by me, thank you.

Page 7: Home Automation Using Powerline

v

ABSTRACT

In recent years, for its convenient installation and low cost, the power line

increasingly become a popular transmission medium in creating residential network. In

houses, lamp switches normally located at a high location and it is hard to reach for the

switches without help for kids and disable person including people who unable to move

a lot due to accident cases. These problems can be overcome by using the Home

Automation System Using Power Line Communication (PLC) at home which is user

friendly and cost efficient. It requires only electricity to run the system. Hence this

system is very simple and cheap. The objective of this project is to build a home

automation system using a PLC modem and applying PIC microcontroller to control and

automate lamps and gates. A simple home automation system using power line

communication (PLC) which is convenient for people with disabilities and elderly to

control lamps and gates using a computer at home is showed in this paper. The computer

operates as a host station, connecting to the PLC modem serially using Recommended

Standard 232 (RS232) and a transceiver MAX232. User will automate the home

appliance based on the Graphical User Interface (GUI) by selecting the button appeared

on their computer screen. The buttons are designed using the Visual Basic 6.0. The PLC

modem (TDA5051A) operates by modulating in a carrier wave of between 20-200 kHz

into the household wiring at the transmitter. This modem is plugged into regular power

outlet. The carrier is modulated by digital signals (Amplitude Shift Keying). The

receiver demodulates the carrier wave and sends the signal to the micro controller which

is the PIC16F877. The receiver has an address and can be commanded by the signals

transmitted over the household wiring and decoded at the receiver. The PIC controls the

home appliances to function. In this project, the home appliance specified is the gate and

the lamp.

Page 8: Home Automation Using Powerline

vi

ABSTRAK

Talian elektrik telah menjadi semakin popular sebagai medium pemancar

dalam mewujudkan rangkaian perumahan. Dalam sesebuah rumah, suis lampu biasanya

terletak pada paras yang sukar dicapai oleh kanak-kanak dan golongan orang kurang

upaya termasuklah golongan yang menghadapi kesukaran untuk bergerak akibat

kemalangan. Masalah ini boleh diselesaikan dengan menggunakan Sistem Automasi

Kediaman yang menggunakan komunikasi talian elektrik (PLC) yang mudah digunakan

dan kos efisien. Sistem ini hanya memerlukan bekalan elektrik untuk menjalankannya.

Maka, sistem ini sangat mudah dan murah. Objektif projek ini adalah untuk membina

satu sistem automasi kediaman menggunakan modem PLC dan mengaplikasikan

pengawal mikro PIC untuk mengawal dan mengautomasikan lampu dan pagar rumah.

Satu sistem automasi kediaman mudah yang menggunakan PLC yang sesuai untuk

golongan kurang upaya dan warga emas untuk mengawal lampu dan pagar dengan

menggunakan computer di rumah ditunjukkan. Komputer berfungsi sebagai stesen

utama, menghubungkan modem PLC secara siri dengan menggunakan RS232 dan

MAX232. Pengguna akan mengautomasi peralatan elektrik di rumah berasaskan

Antaramuka Pengguna Bergrafik (GUI) dengan menekan butang pada skrin computer.

Butang-butang ini direka dengan menggunakan Visual Basic 6.0. Modem PLC

(TDA5051A) berfungsi dengan mengubahsuaikan gelombang pembawa diantara 20-200

kHz pada pemancar ke pendawaian di kediaman. Gelombang pembawa ini diubahsuai

oleh isyarat digital (ASK). Penerima pula mendapat alamat dan boleh diarahkan oleh

isyarat yang telah dipanncarkan ke pendawaian dan kod ditafsir pada penerima.

Pengawal mikro mengawal peralatan elektrik untuk berfungsi.

Page 9: Home Automation Using Powerline

vii

TABLE OF CONTENTS

CHAPTER TITLE PAGE

DECLARATION ii

DEDICATION iii

ACKNOWLEDGEMENT iv

ABSTRACT v

ABSTRAK vi

TABLE OF CONTENTS vii

LIST OF FIGURES x

LIST OF TABLES xii

LIST OF SYMBOLS xiii

LIST OF ABBREVIATIONS xiv

LIST OF APPENDICES xvi

1 INTRODUCTION 1

1.1 Introduction 1

1.2 Objective 2

1.3 Scopes of Project 2

1.4 Problem Statement 3

1.5 Thesis Overview 3

2 LITERATURE REVIEW 5

2.1 Power-line Communication in Home Automation 5

2.2 PLC Modem 6

2.3 Amplitude Shift Keying (ASK) 8

2.4 Microcontroller 8

Page 10: Home Automation Using Powerline

viii

2.4.1 PIC 16F877 9

2.5 Graphical user interface (GUI) 11

2.5.1 Visual Basic 11

2.6 RS232 12

3 METHODOLOGY 13

3.1 Block Diagram of the System 13

3.2 General Description of the System 14

3.3 Hardware Development 14

3.3.1 PIC Module 14

3.3.1.1 PIC16F877 14

3.3.1.2 PIC LED Test 15

3.3.2 Modem Module 16

3.3.2.1 TDA5051A 16

3.3.2.2 “Bug” Problem 19

3.3.3 Transmitter Module 21

3.3.3.1 Transmission mode of TDA5051A 21

3.3.3.2 Metal Oxide Varistor (MOV) 22

3.3.3.3 Voltage Regulator 22

3.3.3.4 Coupler circuit 23

3.3.3.5 Dual D Flip Flop CD74HCT74 23

3.3.4 Receiver Module 24

3.3.4.1 Reception mode of TDA5051A 24

3.3.4.2 Improve sensitivity circuit 24

3.4 Software Development 25

3.4.1 PIC Programming 25

3.4.1.1 LED Test 25

3.4.1.2 Serial Test 28

3.4.2 GUI 28

3.4.1.1 Visual Basic Design 28

3.4.1.2 Visual Basic Programming 31

3.4.1.2.1 VBCom parameter setting 31

3.4.1.2.2 VBCom port setting 31

Page 11: Home Automation Using Powerline

ix

4 RESULT AND DISCUSSIONS 32

4.1 PIC Module 32

4.1.1 LED Test 33

4.1.2 Serial Test 33

4.2 Transmitter Module 35

4.3 Receiver Module 38

4.4 Modem Module 39

4.5 GUI 42

5 CONCLUSION AND FUTURE DEVELOPMENT 45

5.1 Conclusion 45

5.2 Future Development 46

5.3 Coasting and Commercialization 46

5.3.1 Project Coasting 46

5.3.2 Commercialization 48

REFERENCES 49

APPENDICES A - K 52-93

Page 12: Home Automation Using Powerline

x

LIST OF FIGURE

FIGURE NO. TITLE PAGE

2.1 A binary ASK signal (lower), together with the binary

sequence which initiated it (upper)

8

2.2 PIC16F877 10

3.1 Block diagram of the transmitter circuit 13

3.2 Block diagram of the receiver circuit 13

3.3 Pin configuration of PIC16F877 15

3.4 Block Diagram TDA5051A 17

3.5 Typical Configuration for on-chip clock circuit 17

3.6 Pin Configuration 18

3.7 Cases when DATAIN signal being completely

asynchronous with the digital clock

19

3.8 Normal behavior (left) and the missing information of

the modulated wave (right)

20

3.9 The usage of same clock for microcontroller or modem 21

3.10 The usage of an external D-Latch 21

3.11 Parts of the coupler circuit 23

3.12 Parts of the improved sensitivity 25

3.13 Microcode Studio 26

3.14 meProg Configuration 26

3.15 meProg Program Downloader 27

3.16 meLabs U2 programmer (hardware) 27

3.17 meLabs U2 programmer hardware 27

3.18 Serial-In Program 28

Page 13: Home Automation Using Powerline

xi

3.19 Test RS232.exe 29

3.20 Lamp controller.exe 30

3.21 VBCom parameter setting 30

3.22 VBCom port setting 31

4.1 PCB layout of PIC module 32

4.2 LED test 33

4.3 Serial test 34

4.4 Transmitter module 35

4.5 Measurement at 1D CD74HCT74 36

4.6 Measurement at 1Q CD74HCT74 36

4.7 Measurement at TXOUT TDA5051A 36

4.8 Measurement at TXOUT before sending a character 37

4.9 Measurement at TXOUT while sending a character 37

4.10 PCB layout of transmitter module 37

4.11 Measurement at RXIN TDA5051A 38

4.12 Measurement at DATAOUT TDA5051A 38

4.13 PCB layout of receiver module 39

4.14 PCB layout of modem module 40

4.15 TDA5051A 40

4.16 Measurement of the CLKOUT TDA5051A 40

4.17 Lamp control icon 42

4.18 VBCom parameter setting 43

4.19 Comport setting 44

4.20 A green light indicator shown after the COM is ON 44

Page 14: Home Automation Using Powerline

xii

LIST OF TABLE

TABLE NO. TITLE PAGE

3.1 Pin Configuration 18

4.1 Calculation of parameter depending on the clock

frequency

41

5.1 The cost of components 46

Page 15: Home Automation Using Powerline

xiii

LIST OF SYMBOLS

Hz - Hertz

s - Seconds

m - Meters

Ω - Ohms

dB - Decibel

V - Volts

F - Farad

H - Henry

A - Ampere

W - Watt

m - mili

k - kilo

M - Mega

µ - Micro

p - Pico

n - Nano

f - frequency

Page 16: Home Automation Using Powerline

xiv

LIST OF ABBREVIATIONS

PLC - Power Line Communication

PIC - Peripheral Interface Controller

GUI - Graphical User Interface

VB - Visual Basic

ASK - Amplitude Shift Keying

AGC - Automatic Gain Control

DAM - Digital Amplitude Modulation

RKE - Remote Keyless Entry

TPM - Tire Pressure Monitoring

I/O - Input/Output

LCD - Liquid Crystal Display

IC - Integrated Circuit

RAM - Random Access Memory

CPU - Central Processing Unit

RAD - Rapid Application Development

TTL - Transistor-transistor Logic

CMOS - Complementary-metal-oxide Semiconductor

PC - Personal Computer

TX - Transmit

RX - Receive

ROM - Read Only Memory

NRZ - Non-Return-to-Zero

TDH - Total Harmonic Distortion

PCB - Printed Circuit Board

Page 17: Home Automation Using Powerline

xv

ADC - Analog to Digital

DC - Direct Current

AC - Alternating Current

LED - Light Emitting Diode

VPP - Peak to peak Voltage

RMS - Root Mean Square

Page 18: Home Automation Using Powerline

xvi

LIST OF APPENDICES

APPENDIX TITLE PAGE

A PIC LED Blinking Test Schematic Circuit 52

B PIC Serial Communication Test Schematic Circuit 54

C PIC Module Schematic Circuit 56

D Transmitter Module Schematic Circuit 58

E Receiver Module Schematic Circuit 60

F Lamp Control Schematic Circuit 62

G Motor Control Schematic Circuit 64

H Source Code for PIC LED Blinking 66

I Source Code for PIC Serial Communication 68

J Source Code for VB parameter setting 70

K Source Code for VB Port Setting 87

Page 19: Home Automation Using Powerline

1

CHAPTER 1

INTRODUCTION

1.1 Introduction

In houses, lamp switches normally located at a high location and it is hard to

reach for the switches without help for kids and disable person including people who

unable to move a lot due to accident cases. For example; paralyzed and wheeled

chaired person. Furthermore, closing gates might be a problem for disable people,

elders and it might be dangerous for kids or ladies for social problems like

kidnapping and rape cases in this country increases. These problems can be

overcome by using the Home Automation System Using Power Line Communication

(PLC) at home which is user friendly and cost efficient. It requires only electricity to

run the system. Hence this system is very simple and cheap.

Nowadays, most houses already installed the automatic gate system using

remote control. With this additional installation of this Home Automation System

Using PLC to the original automatic gate system, user can control the gates by using

their personal computer at home besides the remote control. Hence, the remote

control can be leaved in the car while during at home, user can automate the gate

using the computer. Besides the gate, user can also automate the lamps around the

house.

Basically the project is about using the Power Line Communication (PLC) in

a home automation system and applying PIC in the system to control and automate

Page 20: Home Automation Using Powerline

2

lamps and gates to make life easy at home where users control the systems only by

using the computer.

1.2 Objectives

The objective of this project is to build a home automation system using a

PLC modem and applying PIC microcontroller to control and automate variable

home appliances (lamps and gates).

1.3 Scopes of Project

Several scopes proposed in this project are:

i) To design and fabricate a transmitter module using TDA5051A modem.

ii) To design and fabricate a receiver module using TDA5051A modem.

iii) To design a controller system using PIC16F877.

iv) To design the Graphical User Interface (GUI) using Visual Basic 6.0.

v) To integrate the GUI with the hardware by using power line

communication.

Page 21: Home Automation Using Powerline

3

1.4 Problem Statement

In houses, lamp switches normally located at a high location and it is hard to

reach for the switches without help for kids and disable person including people who

unable to move a lot due to accident cases such as being paralyzed or wheeled

chaired. Furthermore, closing gates might be a problem for a disable people, elders

and also might be dangerous for kids and women as we heard lots of kidnapping

cases happened in this country these years.

A home automation system using power line communication is proposed to

solve these problems. The system is friendly user and required only electricity to

drive the system therefore it is a low cost type of system.

1.5 Thesis Overview

The Home Automation System using Power line Communication thesis is a

combination of 5 chapters that contains and elaborates specific topics such as the

Introduction, Literature Review, Methodology, Results and Discussions, Conclusion

and Further Development that can be applied in this project.

Chapter 1: Introduction of the project.

Chapter 2: Literature review for the development of the Home

Automation System Using Power Line Communication.

Chapter 3: Methodology of the project.

Chapter 4: Results obtained, the limitation of the project based on the

performance of the modules fabricated, the costing and the

commercialization of the project.

Page 22: Home Automation Using Powerline

4

Chapter 5: Conclusion and further development of the project.

Page 23: Home Automation Using Powerline

5

CHAPTER 2

LITERATURE REVIEW

2.1 Power-line Communication in Home Automation

Home automation, also referred to as home control, smart home, smart

house, or intelligent home is actually a collection of devices, systems, and

subsystems which have the ability to interact with one another or function

independently [1]. Power Line Communication (PLC) is called power-line carrier

or a mains communication. PLC uses electric power lines to carry information over

the power line. It is a technique used in home automation for remote control as it

can use the household electrical power wiring as a transmission medium. PLC has

been a very important interdisciplinary topic for power, communications, industrial,

and automation engineers and researchers since the 1980s. PLC promises to be an

enabling home network technology due to its ability to deliver data over existing

power lines in homes. Similar to RF, the power line is a shared medium that exists

in a noisy environment, although the respective noise sources differ markedly.

Motors, switch-mode power supplies, fluorescent ballasts, and other impairments,

which generate substantial impulse and wideband noise share power lines [15].

Recently, with the explosive growth of the Internet and telecom technology

home automation experience an accelerating growth based on different kinds of

residential network. At the present there are several kinds of transmission medium

in residential network, such as coaxial-cable, radio, microwave, millimeter wave,

power line and fiber optics. Compared with other kinds of transmission medium,

power line has distinct advantage in setting up a network without additional line

Page 24: Home Automation Using Powerline

6

installation and existing digital devices, including home appliances and information

devices, at a very low cost [2].

Many applications are operating at high speed and a fixed connection is

often preferred. If the power utilities could supply communication over the power-

line to the customers it could make a tremendous breakthrough in communication.

Every household would be connected at any time and services being provided at

real time. Using the power line as a communication medium could also be a cost

effective way compared to other system because it uses an existing infrastructure,

wire exists to every household connected to the power line network [3]. On the

other hand, device power in home automation still can be supplied by power line

itself. So PLC rapidly becomes a popular solution to set up residential network [2].

Concerning the former, one should consider that the targets are conventional

houses, adapted when users have an accident leading to disability or when they get

older [4].

Signal strength or signal attenuation in home electrical line is important for

design of home automation communications circuits. PLC communication signals

via main power lines are transmitted from a part of the home and received at the

other side. Measurements are carried out between general divisions of a home such

as kitchen, bedrooms, living room, hall, and bathroom, etc. Connectors are used to

deliver power lines in the divisions of homes. Connectors are placed at the wall

between two neighbor divisions at home. So power is delivered via these

connectors to every division. Connectors are induced an additional attenuation.

Power-line distances measured for signal attenuations given are between 6–30 m

[15].

2.2 PLC Modem

At the other extreme, we have had the X-10 format power line-based

technology but in this project, the modem will fabricate using the TDA5051A

manufactured by PHILIPS. The TDA5051T was the first chip version, featuring a