DESIGN AND DEVELOPMENT OF HOME AUTOMATION SOFTWARE USING ASSEMBLY AND JAVA PROGRAMMING LANGUAGES FOR PC AND CELLULAR PHONE
RANCANG BANGUN PERANGKAT LUNAK SISTEM OTOMASI RUMAH SEDERHANA MENGGUNAKAN BAHASA PEMROGRAMAN ASSEMBLY DAN BAHASA PEMROGRAMAN JAVA UNTUK PC DAN TELPON GENGGAM
Nama
: Erik Sentosa
Tempat/ tanggal lahir : Denpasar / 15 Desember 1983 NIM
:10203073
Alamat
: Jl. By Pass Ngurah Rai 96 Tohpati, Sanur, Denpasar, Bali
Nomer HP/Telpon
: 081910581861/(022)76233726/(0361)462480 (Denpasar)
Kelompok keahlian
: Instrumentasi
Hari/tanggal
: Kamis/26 Juni 2008
Waktu
: Pukul 13.30
Tempat
: Ruang Staf Lama Fisika
Pembimbing
: Dr. Eng Khairurrijal
Penguji
: - Dr. Maman Budiman - Dr. Freddy Haryanto
Abstract Automation system is an outcome of research that related to modern technology. As it is a branch of modern technology that brought ease and pleasure to human being, research in this field has been advanced in a very varied way. One of these is automation field is home automation, which put automation system in household appliances and electrical devices. These devices are designed to assist the owner spend only small amount of time in taking care the house. This concept was adopted to be the research objective in this thesis, which is building an
PDF created with pdfFactory trial version www.pdffactory.com
automation system that is controllable remotely using PC, cell phones and microcontroller. The data were collected from internet, literatures and experiments, which were occurred in Laboratorium Instrumentasi Fisika, Institut Teknologi Bandung. The experiment results concluded that the system design was implementable for a remote home automation control design. Still, the system cannot perform two way communications that realizes the expected system specifications. Keywords: Java Programming Language, J2SE, J2ME, Assembly Programming Language, PC, cell phone, microcontroller Abstrak Sistem otomasi adalah salah satu hasil riset yang berkaitan dengan teknologi modern. Sebagai salah satu cabang teknologi modern yang memberikan kenyamanan dan kemudahan, riset pada bidang ini telah dispesialisasikan pada berbagai bidang. Salah satunya adalah sistem otomasi rumah, yang menitikberatkan sistem otomasi pada alat-alat rumah tangga dan alat-alat listrik. Alat-alat ini didesain untuk membantu pemiliknya mengurus pekerjaan rumah tangga dengan menghabiskan waktu sesingkat mungkin. Konsep ini dijadikan tujuan dalam makalah ini, yaitu membangun sistem otomasi yang dapat dikendalikan dari jarak jauh dengan mengunakan PC, telpon genggam dan mikrokontroler. Data yang diambil untuk karya ini berasal dari studi literatur, internet dan eksperimen yang dilakukan. Eksperimen dilakukan di Laboratorium Elektronika Fisika ITB. Dari hasil percobaan dapat disimpulkan bahwa desain sistem ini dapat diimplementasikan dalam pengendalian sistem otomasi rumah jarak jauh. Namun sistem belum bisa melakukan komunikasi dua arah seperti yang diharapkan. Kata kunci: Bahasa Pemrograman Java, J2SE, J2ME, Bahasa pemrograman Assembly, PC, telpon genggam, mikrokontroler
PDF created with pdfFactory trial version www.pdffactory.com
Preface
This work began as an effort of bringing dream into realization when I was learning Java Programming Language in PC and cell phone. My interest in architecture has brought an idea to bring home in more interactive way, which was accommodated by home automation concept. The concept then revisited by adding a remote controllable features in reasonable cost by using cell phone as the controller. I tried to achieve the good security system and automation level in building the system. The less time-spending in home-related operation also a thing tried to realize. Yet, I expect the system can be a stepping stone to build a sophisticated affordable home automation system. The expectation of creating a thesis with the involvement of latest technology and the passion of architecture has motivate me to finish this home automation system. However, the difficulties I had when building the system was understanding the complex Java Programming Language and implementing it in the system, though there are plenty of sources on the internet about Java Programming Language concept. The innovative ideas inside the system could be potentials in this final project report, whereas depthless descriptions could be a negative side of this final project report.
v
PDF created with pdfFactory trial version www.pdffactory.com
vi
I accepted so many academic and motivational supports in finishing this final project report. Therefore I would thank to: 1. God. 2. Dr. Eng. Khairurrijal, as my supervisor who guided and helped me directed me in completing this final project. 3. Dithya Prayudithama, as a colleague who helped me in understanding the Java Programming Language. 4. Vidyapati, as a colleague who helped me in understanding Java Programming Language. 5. Ferdy Perdana Kusumah, as a colleague who helped in understanding the analog device interfacing process. 6. Arif Surachman, as a colleague who helped in understanding Assembly Programming Language. 7. Mom, who always motivated me to finish my final project without gave me too much pressure.
Bandung, June 2008 Erik Sentosa
PDF created with pdfFactory trial version www.pdffactory.com
CONTENTS
ABSTRACT
iii
PREFACE CONTENTS
v vii
FIGURE LIST
x
TABLE LIST
xi
CHAPTER I INTRODUCTION
1
1.1 Motivation, Background and Problem Statement
1
1.1.1 Motivation and Background
1
1.1.2 Problem Statements
2
1.2 Studied Aspects
3
1.3 Writing Objectives
3
1.4 Writing Method and Data Acquisition Technique
4
1.4.1 Writing Method
4
1.4.2 Data Acquisition Technique
4
1.5 Writing Systematization
4
CHAPTER II METHODOLOGY
6
2.1 Methodology
6
vii PDF created with pdfFactory trial version www.pdffactory.com
viii
2.2 Java Platform 2 Standard Edition
6
2.3 Java Platform 2 Micro Edition
8
2.4 Assembly Programming Language
10
2.5 The J2SE API
12
2.5.1 Java Communication API
12
2.5.2 Java Database Connectivity
13
2.6 Gammu GSM
13
2.7 MySQL
14
2.8 Analog Devices
14
2.8.1 AT89S52 Microcontroller
14
2.8.2 L293D Driver
16
CHAPTER III DESIGN AND IMPLEMENTATION
18
3.1 Home Automation System
18
3.2 Java 2 Platform Standard Edition
19
3.3 Java 2 Platform Micro Edition
22
3.4 Asembly Programming Language and Microcontroller
26
3.5 Java Communication API
30
3.6 Database Management with MySQL and JDBC
32
3.7 Gammu GSM Daemon
34
3.8 Analog Devices
35
3.8.1 The Function and Installment Specification of L293D Driver
35
PDF created with pdfFactory trial version www.pdffactory.com
viiii
3.8.2 The interrupt activation by infra red sensor receiver
36
CHAPTER IV CONCLUSIONS AND SUGGESTIONS
37
4.1 Conclusions
37
4.2 Suggestions
38
APPENDIX A OPERATION SEQUENCE DIAGRAMS
40
APPENDIX B OPERATION FLOWCHARTS
42
APPENDIX C PROGRAM CODES
46
REFERENCES
xii
PDF created with pdfFactory trial version www.pdffactory.com
TABLE LIST
TABLE 3-1. Characters those were sent by PC in interfacing process
27
TABLE 3-2 Feedback characters in interfacing process
28
xi PDF created with pdfFactory trial version www.pdffactory.com
FIGURE LIST
FIGURE 2-1. Java SE platform at a glance
7
FIGURE 2-2. Components of J2ME in relations with other Java technology
9
FIGURE 2-3. AT89S52 block diagram
15
FIGURE 2-4 AT89S52 pin configuration
15
FIGURE 2-5. L293D driver block diagram
16
FIGURE 2-6. L293D driver pin configuration
17
FIGURE 3-1. The Home Automation System design
18
FIGURE 3-2. The main program GUI
20
FIGURE 3-3. Flowchart of the client phone’s program
23
FIGURE 3-4. Client phone’s password field shown with Java WTK 2.5.2 emulator 23 FIGURE 3-5. Client phone’s list program shown with Java WTK 2.5.2 emulator
24
FIGURE 3-6. The AT89S52 planted in Elkahfi MCS-51 Microtrainer Kit
26
FIGURE 3-7. The flowchart of interfacing program of microcontroller
29
FIGURE 3-8. “inbox” table shown in EMS MySQL Manager Lite
33
FIGURE 3-9. “home_automation_log” table shown in EMS MySQL Manager Lite 34 FIGURE 3-10. Analog devices to microcontroller installation
x PDF created with pdfFactory trial version www.pdffactory.com
35