smartphone activated door lock using wifi

24
SMARTPHONE ACTIVATED DOOR LOCK USING WIFI NURULFARAH AFIQAH BINTI MOHAMMAD AZMI B071110033 UNIVERSITI TEKNIKAL MALAYSIA MELAKA 2015

Upload: ngokhuong

Post on 27-Jan-2017

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

NURULFARAH AFIQAH BINTI MOHAMMAD AZMI

B071110033

UNIVERSITI TEKNIKAL MALAYSIA MELAKA

2015

Page 2: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

UNIVERSITI TEKNIKAL MALAYSIA MELAKA

SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

This report submitted in accordance with requirement of the Universiti Teknikal

Malaysia Melaka (UTeM) for the Bachelor Degree of Engineering Technology

(Electronics Telecommunications) (Hons.)

by

NURULFARAH AFIQAH BINTI MOHAMMAD AZMI

B071110033

901113-06-5280

FACULTY OF ENGINEERING TECHNOLOGY

2015

Page 3: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

UNIVERSITI TEKNIKAL MALAYSIA MELAKA

BORANG PENGESAHAN STATUS LAPORAN PROJEK SARJANA MUDA

TAJUK: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

SESI PENGAJIAN: 2014/15 Semester 2 Saya NURULFARAH AFIQAH BINTI MOHAMMAD AZMI mengaku membenarkan Laporan PSM ini disimpan di Perpustakaan Universiti Teknikal Malaysia Melaka (UTeM) dengan syarat-syarat kegunaan seperti berikut:

1. Laporan PSM adalah hak milik Universiti Teknikal Malaysia Melaka dan penulis. 2. Perpustakaan Universiti Teknikal Malaysia Melaka dibenarkan membuat salinan

untuk tujuan pengajian sahaja dengan izin penulis. 3. Perpustakaan dibenarkan membuat salinan laporan PSM ini sebagai bahan

pertukaran antara institusi pengajian tinggi.

4. **Sila tandakan ( )

SULIT

TERHAD

TIDAK TERHAD

(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia sebagaimana yang termaktub dalam AKTA RAHSIA RASMI 1972)

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

Alamat Tetap:

Lot 10486, Jalan Balok Sejahtera,

Kampung Balok, 26100 Kuantan,

Pahang Darul Makmur

Tarikh: ________________________

Disahkan oleh:

Cop Rasmi: Tarikh: _______________________

** Jika Laporan PSM ini SULIT atau TERHAD, sila lampirkan surat daripada pihak berkuasa/organisasi berkenaan dengan menyatakan sekali sebab dan tempoh laporan PSM ini perlu dikelaskan sebagai SULIT atau TERHAD.

Page 4: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

DECLARATION

I hereby, declared this report entitled “Smartphone Activated Door Lock using

WiFi” is the results of my own research except as cited in references.

Signature : ………………………………………….

Author’s Name : NURULFARAH AFIQAH BINTI

MOHAMMAD AZMI

Date : …………………………………………

Page 5: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

APPROVAL

This report is submitted to the Faculty of Engineering Technology of UTeM as a

partial fulfillment of the requirements for the degree of Bachelor of Engineering

Technology (Electronics Telecommunications) (Hons.). The member of the

supervisory is as follow:

………………………………

(MRS NORLEZAH BINTI HASHIM)

Page 6: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

i

ABSTRAK

Telefon pintar mempunyai pelbagai kegunaan dan menjadi salah satu peranti yang

boleh membantu untuk mengawal dalam pelbagai aspek. Memandangkan kurang

pengawasan terhadap sistem penguncian pintu, peranti yang dicadangkan dalam

projek ini akan membantu untuk menyelesaikan masalah ini. Bagi projek ini, telefon

pintar akan mengaktifkan penguncian pintu secara automatik dan membuka kunci

pintu dengan menggunakan “Wireless Fidelity (WiFi)”. Dengan menggunakan

perisian Android, telefon pintar boleh membuka kunci pintu dalam jarak tertentu.

Penghantaran data akan dilaksanakan dengan menggunakan teknologi WiFi. Oleh

yang demikian, pengguna tidak perlu bimbang samada pintu telah dikunci ataupun

tidak kerana pengguna boleh mengawalnya dengan menggunakan telefon pintar

dalam jarak tertentu. Pengguna juga tidak perlu bimbang terhadap kehilangan kunci

pintu. Projek ini terdiri daripada pembinaan perkakasan dan perisian. Selepas

menjalani beberapa kajian, keputusan yang dianggarkan untuk projek ini adalah

pengguna boleh mengawal operasi penguncian pintu secara automatik dan membuka

kunci pintu dalam jarak WiFi tertentu dengan menggunakan telefon pintar. Selain

daripada itu, sistem penguncian pintu boleh berfungsi dengan cekap. Persediaan

eksperimen telah dilakukan untuk menguji prestasi sistem yang direka. Keputusan

daripada analisis menunjukkan bahawa ketika didalam rumah, sambungan antara

telefon pintar dan WiFi telah hilang selepas 40m manakala diluar rumah, sambungan

antara telefon pintar dan WiFi telah hilang selepas 150m. Ini membuktikan bahawa

untuk kedua-dua keadaan, apabila jarak semakin meningkat maka penangguhan juga

meningkat.

Page 7: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

ii

ABSTRACT

Smartphone have variety of uses and becomes one of the devices that can help to

monitor in any aspects. Since less awareness concern on door locking system, the

device proposed in this project will help to solve the problem. For this project,

smartphone will activate the door lock using Wireless Fidelity (WiFi). By using

Android software, the smartphone can activate the door lock automatically and

unlock the door within a specific range. Data transmission will be done using WiFi

technology. So, the user does not have to worry whether the door is lock or not

because user can control it by using their smartphone within a specific range. The

user also does not have to worry about the losing of the door key. The project that

will build consists of hardware and software development. After doing some

research, the result expectation for this project is the user can control the operation of

a door lock automatically and unlock the door within a specific range of WiFi using a

smartphone. Besides that, the door locking system must be function efficiently.

Experiment setup was done in order to test the performance of the designed system.

Results from analysis shows that when inside home, the connection between

smartphone and WiFi was lost after 40m while outside home, the connection

between smartphone and WiFi was lost after 150m. This proof that both situations,

as the distance is increasing, the delays are increased as well.

Page 8: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

iii

DEDICATION

To my beloved mother and father who are always there for me

Tenku Ruzita Binti Tengku Mahmud and Mohammad Azmi Bin Ab Rahman

To my siblings

Nur-Fatihah Asyikin Binti Mohammad Azmi

Muhammad Fahmi Affandi Bin Mohammad Azmi

Mohammad Firdaus Aisy Bin Mohammad Azmi

To my lecturer and supervisor, for their guidance and encouragement

Mrs. Norlezah Binti Hashim

To my friends, for their unconditionally support

Page 9: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

iv

ACKNOWLEDGEMENT

First and foremost, I would like to take this opportunity to express my deepest

grateful appreciation to all persons who have continuously giving me support,

advices, knowledge, understanding and contribution towards the successful in

completing of this Bachelor Degree Project.

In particular, I would like to express my sincere appreciation to my supervisor,

Mrs. Norlezah Binti Hashim for encouragement, guidance, advices, suggestion and

motivation in developing this project. Besides that, I would like to thanks to

Al Hafiz Bin Riwayat for contributing towards my understanding and thoughts.

My sincere appreciation extends to all my undergraduate friends especially BETT

member of batch 2011-2015 who have helped me and shared brilliant ideas

throughout the whole year.

Last but not least, I would like to express my sincerest gratitude and deepest

thankfulness to my parent Mohammad Azmi Bin Ab Rahman and Tenku Ruzita

Binti Tengku Mahmud for their love, support and encouragement that they had given

to me.

Page 10: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

v

TABLE OF CONTENT

Abstrak i

Abstract ii

Dedication iii

Acknowledgement iv

Table of Content v

List of Tables viii

List of Figures ix

List Abbreviations, Symbols and Nomenclatures xi

CHAPTER 1: INTRODUCTION 1

1.1 Introduction 1

1.2 Background 1

1.3 Problem Statement 2

1.4 Objective 3

1.5 Scope 3

1.5.1 Software 4

1.5.2 Hardware 4

1.6 Project Significant 4

1.7 Conclusion 5

CHAPTER 2: LITERATURE REVIEW 6

2.1 Introduction 6

2.2 Existing Devices 6

2.2.1 Lockitron 7

2.2.2 Unikey Kevo 8

2.2.3 August Smart Lock 9

2.2.4 Goji Smart Lock 10

2.3 Door Lock 11

2.3.1 Overview of Solenoid Lock 11

Page 11: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

vi

2.3.2 Pull-type Solenoid Lock Construction 12

2.3.3 Locking System 14

2.3.3.1 Relay 14

2.4 Wireless Fidelity (WiFi) 15

2.4.1 Advantages of Wireless Fidelity (WiFi) 18

2.5 Android 19

2.5.1 Architecture of Android 19

2.5.2 Android Programming Basics 20

2.5.3 Android Version 20

2.6 Component Used 21

2.6.1 Peripheral Interface Circuit (PIC) Microcontroller 21

2.6.1.1 PIC16F877A Microcontroller 22

2.6.1.2 Advantages of Microcontroller 23

2.6.2 Xbee WiFi Wire Antenna 23

2.7 Conclusion 24

CHAPTER 3: METHODOLOGY 25

3.1 Project Implementation 25

3.1.1 Planning 28

3.1.1.1 Data Collection 28

3.1.1.2 Hardware and Software Requirement 29

3.1.1.2.1 Hardware Requirement 29

3.1.1.2.2 Software Requirement 29

3.1.2 Implementing 30

3.1.2.1 Printed Circuit Board (PCB) 30

3.1.2.2 Components 30

3.1.3 Checking 30

3.1.4 Testing 31

3.1.5 Analysis 31

3.2 Project Flowchart 31

3.3 Project Block Diagram 33

3.4 Expected Result 33

3.5 Conclusion 34

Page 12: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

vii

CHAPTER 4: RESULT & DISCUSSION 35

4.1 Software Implementation 35

4.1.1 Programming in PCWH Compiler 35

4.1.2 Circuit Design in Proteus 8 38

4.1.3 Android Application in Eclipse Java 41

4.2 Hardware Implementation 43

4.3 Analysis of WiFi Performance 43

4.3.1 Inside Home 44

4.3.2 Outside Home 45

4.3.3 Comparison WiFi Performance 46

4.4 Circuit Performance 47

4.4.1 PIC16F877A 47

4.4.2 Relay 48

4.4.3 Pull-type Solenoid Lock 49

4.4.4 Xbee WiFi 50

4.5 Conclusion 50

CHAPTER 5: CONCLUSION & FUTURE WORK 51

5.1 Conclusion 51

5.2 Future Work 52

REFERENCES 53

APPENDICES

A Source Code of PIC16F877A

Page 13: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

viii

LIST OF TABLES

2.1 Comparison between ZigBee, WiFi and Bluetooth 16

2.2 Popular IEEE WiFi standards 17

4.1 WiFi performance inside home 44

4.2 WiFi performance outside home 45

Page 14: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

ix

LIST OF FIGURES

1.1 WiFi system drawing 4

2.1 Lockitron 7

2.2 Unikey Kevo 8

2.3

2.4

August Smart Lock

Goji Smart Lock

9

10

2.5

2.6

2.7

2.8

2.9

2.10

2.11

Solenoid lock

Pull-type solenoid lock construction

Magnetic field produced by a coil

Relay

Main parts in relay

Basic design relay

WiFi access point

11

13

13

14

15

15

16

2.12 Android system architecture 19

2.13 Android version 20

2.14 Microcontroller structure 21

2.15

2.16

3.1

Pin diagrams

Xbee WiFi Wire Antenna

Flowchart of the methodology

22

23

26

3.2

3.3

3.4

4.1

4.2

4.3

4.4

4.5

Step of methodology

Flowchart of the project

Project block diagram

Program header

I/O setting

Output pin description

WiFi data detected

Push button pressed

27

32

33

36

36

36

37

38

Page 15: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

x

4.6 Schematic diagram 39

4.7 Double-sided PCB layout 39

4.8 Bottom side PCB layout 40

4.9 Top side PCB layout 41

4.10 Main configuration 42

4.11 Control interface 42

4.12 Circuit on PCB board 43

4.13 WiFi performance inside home 44

4.14 WiFi performance outside home 45

4.15 WiFi performance for indoor and outdoor 46

4.16 Input voltage of PIC 47

4.17 Relay performance when the door locked 48

4.18 Relay performance when the door unlocked 48

4.19 Solenoid performance when the door locked 49

4.20 Solenoid performance when the door unlocked 49

4.21 Xbee WiFi performance 50

Page 16: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

xi

LIST OF ABBREVIATIONS, SYMBOLS AND

NOMENCLATURE

CPU - Central Processing Unit

dBm - Decibel-milliwatts

GND - Ground

IDE - Integrated Development Environment

iOS - iPhone Operating System

IP - Internet Protocol

LED - Light Emitting Diode

M - Meter

mA - MilliAmpere

Mbps - Mega bit per second

NC - Normally Closed

NFC - Near Field Communication

NO - Normally Open

PCB - Printed Circuit Board

PIC - Peripheral Interface Controller

PWR - Power

RAM - Random Access Memory

RFID - Radio Frequency Identification

ROM - Read Only Memory

RX - Receiver

SDK - Software Development Kit

Sec - Seconds

SPDT - Single Pole Double Throw

SPI - Serial Peripheral Interface

SSR - Solid State Relay

TX - Transmitter

UART - Universal Asynchronous Receiver/Transmitter

Page 17: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

xii

V - Volt

VDC - Voltage Direct Current

VLSI - Very Large Scale Intergration

WiFi - Wireless Fidelity

Page 18: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

1

1.1 Introduction

Smartphone activated door lock using WiFi is designed for those who are forgetting

in locking the door. The system consists of solenoid lock and Android application.

People who have always losing the door key and forgetting to lock the door would

use this system to reduce the using of key to lock automatically and unlock the door

by using smartphone. The purpose of this project is to simplify the tasks of locking

and unlocking the door. The locking mechanism in the door can be activated

automatically and deactivated by smartphone using WiFi technology within specific

range.

1.2 Background

Nowadays, smartphone has variety of uses and have been designed to be used as

pocket-sized personal computers. Smartphone have utilizes many tool and service

which are Bluetooth, Wireless Fidelity (WiFi) and Near Field Communication

(NFC). Today, WiFi is provided in many smartphones. This has allows an

electronic device to exchange data or connect to the internet wirelessly. Internets are

playing an important role in everyday environment. Many devices can be connected

to the internet such as smartphone.

INTRODUCTION

CHAPTER 1

Page 19: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

2

As technology develops, smartphone becomes one of the devices that can help to

monitor in any aspects. Since less awareness concern on door lock system, this

device will help in solving the problem. This project is a development for the home

system entry. This project will contribute more secure and advance technology

compatible to the latest invention and technology. Other than that, it will increase

the security technology of the home.

For this project, the locking system will activate automatically. By using Android

software, the smartphone can unlock the door within a specific range. Data

transmission will be done using WiFi technology. WiFi technology can locate a

signal almost anywhere. So, the user does not have to worry whether the door is lock

or not because it is automatically lock and they can control unlock the door by using

their smartphone within a specific range. The user also does not have to worry about

the losing of the door key.

1.3 Problem Statement

Most people always in the urgency situation. This might be causing the problems

such as forgetting to lock the door of their home. Sometimes, they might lose the

key of the door. Other than that, there is less security on the door lock which the

burglar can break the door.

Page 20: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

3

1.4 Objective

The smartphone activated door lock using WiFi is one of the tools that can be used at

home. This project aims to create an alternative method for those who are always

forgetting to lock the door. Besides that, this project also helps for those who worry

about losing the door key. This project has several objectives which are:

(a) to create an application that would work from a smartphone and communicate

through WiFi network.

(b) to analyze the system design in term of detectable range and delay.

1.5 Scope

This project will concentrate at the Android application in order to unlock the door.

The smartphone that activated the unlocking system need to be identify in order to

connect with the microcontroller. Besides that, this project also designing the

circuits for locking the door automatically.

The scope of this project also will reveal about the testing of the project. This project

will be examined on how far the progress of the smartphone activated the unlocking

system of the door. Besides that, the range of the transmission channel also will be

evaluated and considered in order to achieve the objectives of this project. This

project will have software and hardware implementation.

Page 21: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

4

1.5.1 Software

In order to work with this project, the software implementation needs to be

identified. The preliminary works for software searching are learning the usage of

the assembly language. Then, the software that used to load the program into the

chip need to be identified. The software used in this project is Java for Android

application and C language for Peripheral Interface Controller (PIC).

1.5.2 Hardware

For the hardware part, there are several works that has been done before proceed to

the project requirements. Firstly, design the door with the suitable lock attached to it

such as solenoid lock. Then, Peripheral Interface Controller (PIC) will be used to

program the PCB design.

1.6 Project Significance

The main reason of this project is to develop security of door lock system where the

owner of home, apartment or building can manage the door lock that activated

automatically and unlock the door that activated by smartphone using WiFi

technology. The door is automatically lock when the magnetic switch become closed

to each other.

Figure 1.1: WiFi system drawing

Page 22: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

5

Figure 1.6.1 shows the overall of the WiFi system. As shown in this figure, the

wireless network device and the microcontroller will be place inside the home,

apartment or building which is placed at the door. The system will be managed

through the application in the smartphone to unlock the door and lock the door

automatically.

This project completely friendly interfacing due to it is lock automatically and can

unlock the door by using smartphone. Since it is friendly interfacing, when the user

at home, they can use the push button instead of using the smartphone. This can ease

the user.

1.7 Conclusion

This project describes the smartphone control the unlocking system and the way to

develop this system, simply install on the door and configure it to communicate with

the wireless network. By using Android, the application software will created for

smartphone to control the operation of unlock the door. The data transmission for

this project is using the WiFi technology. The door locking system also needs to

design for more secure which is automatically lock when the magnetic switch closed

to each other.

Page 23: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

6

2.1 Introduction

Lock is a mechanical or electronic fastening device that is released by a physical

object such as key, keycard, fingerprint, RFID card or others. Locks are highly

important for safety and security of home, apartment or building. There are many

types of door locks that have been used which are passage lockset, privacy lockset,

dummy knob, entry lockset, deadbolt, night latch, keyless lock and mortise lock.

Each of the locks has their benefits and features. However, burglars can break

normal or typical locks with ease. This chapter will explains the existing device that

are on the market, solenoid lock, relay, Wireless Fidelity (WiFi), Android and the

component used in this system.

2.2 Existing Devices

There are many door locks that are out on the market which are Lockitron, Unikey

Kevo, August Smart Lock and Goji Smart Lock. These door lock product have their

functionalities and features.

LITERATURE REVIEW

CHAPTER 2

Page 24: SMARTPHONE ACTIVATED DOOR LOCK USING WIFI

7

2.2.1 Lockitron

Figure 2.1: Lockitron

Lockitron is the product which is likely similar with this project. The first iteration

of Lockitron replaced the deadbolt but the newer iteration which is upgradable

enough compare the previous iteration as shown in Figure 2.1. This door lock is

placed on the door lock from the inside and it can be easily removed and installed

elsewhere. Its batteries can last up to one year and can send a notification when the

door lock is running low.

Lockitron allows the user to lock their door from anywhere in the world through

WiFi. There are applications that provide for both iOS and Android. Besides that, it

also functions with other mobile phones which are through the simple text message.

There are many ways of locking and unlocking the door lock which are through the

internet by using the applications, through Bluetooth 4.0 while walking up to the

door or through NFC (Near Field Communication). Bluetooth 4.0 is only available

for some currently released Android smartphones and the Iphone 4S and 5. This

Lockitron is able to share access with family and friends by using their email address

or phone number. The user also receives notifications when the lock is being used

by someone else.

Lockitron is built upon Arduino which allows it to be open source and easily

modified with extra functions such as having secret knocks that unlock the door.

Lockitron also has integration with the smartwatch that allowing the user to control

the door lock through the watch.