Otomatisasi Sistem Penerangan dan Sistem Keamanan pada Gedung Perkuliahan Menggunakan Modul Mikrokontroler Arduino Disusun Oleh: Nama : Otniel Rinaldo NRP : 0822041 Jurusan Teknik Elektro, Fakultas Teknik, Universitas Kristen Maranatha, Jl. Prof. Drg. Suria Sumantri, MPH no. 65, Bandung, Indonesia Surel :
[email protected]
ABSTRAK Pemakaian energi listrik di gedung perkuliahan seringkali dijumpai tidak efisien, misalnya pada suatu area yang mempunyai penerangan cukup, lampu tetap dinyalakan. Dari aspek keamanan, terutama pada malam hari, penerangan pada posisi yang tepat dapat memudahkan petugas keamanan untuk mengamankan keamanan gedung perkuliahan. Dalam tugas akhir ini, dirancang otomatisasi sistem penerangan dan sistem keamanan gedung perkuliahan. Sistem ini dirancang dengan tujuan menghemat pemakaian daya dalam sistem penerangan dan sistem keamanan gedung perkuliahan. Otomatisasi
sistem
yang
direalisasikan
menggunakan
pengontrol
mikrokontroler ATMega 1280 dalam bentuk modul Arduino. Otomatisasi sistem penerangan dibedakan menjadi 2 sistem utama : sistem penerangan ruangan kelas dan sistem penerangan koridor. Sistem penerangan ruangan kelas menggunakan Radio Frequency Identification (RFID) sebagai penanda hak akses masuk ke dalam kelas, sementara nyala – matinya lampu kelas akan dikontrol berdasarkan pembacaan intensitas cahaya kelas oleh sensor cahaya
i
Universitas Kristen Maranatha
(LDR). Sistem penerangan koridor dibagi ke dalam dua waktu, siang dan malam hari. Pada siang hari nyala – matinya lampu koridor bergantung pada pembacaan sensor cahaya (LDR). Sementara pada malam hari, nyala – matinya lampu koridor bergantung pada pembacaan sensor gerak (infra red) terhadap aktivitas yang terdapat di suatu daerah. Otomatisasi sistem keamanan menggunakan Passive Infrared Sensor (PIR) untuk mendeteksi keberadaan manusia di dalam ruangan kelas. Apabila PIR mendeteksi adanya manusia di dalam kelas tanpa hak akses dari RFID, alarm akan dibunyikan. Hasil dari percobaan menunjukkan sistem otomatisasi ini dapat menghemat pemakaian energi listrik sebanyak 16% sampai 27% tergantung pada kondisi penerangan dari matahari. Sistem otomatisasi ini juga dapat menyalakan alarm ketika adanya keberadaan manusia di dalam kelas tanpa hak akses masuk melalui RFID. Kata kunci: otomatisasi, penerangan, keamanan, pemantauan.
ii
Universitas Kristen Maranatha
Automation Lighting and Security System at College Building Using Microcontroller in Arduino Module Disusun Oleh: Nama : Otniel Rinaldo NRP : 0822041 Jurusan Teknik Elektro, Fakultas Teknik, Universitas Kristen Maranatha, Jl. Prof. Drg. Suria Sumantri, MPH no. 65, Bandung, Indonesia Surel :
[email protected]
ABSTRACT Inefficient electrical energy consumptions in college building are often found, for example turning on lamps in bright areas. From security aspects, especially at nights, illumination in good places will ease the burden of security guards to ensure the security of the college building . In this final project, an automation of lighting and security system is designed. This design has aims for sparing electrical energy in lighting and security system. Automation system is using microcontroller ATMega 1280 in Arduino Module. Automation lighting system is
differ into 2 main system : class’
lighting system and corridor’s lighting system. Class’ lighting system is using Radio Frequency Identification for authrization to get into the class, while class’ lamp activation is controlled depends on the reading of light sensor (LDR). Corridor’s lighting system is divided into 2 term, afternoon and night. In the afternoon, corridor’s lamp activation depends on the reading of light sensor (LDR). While in the night, corridor’s lamp activation will depends on the reading of motion sensor (infra red) against activity on the area.
iii
Universitas Kristen Maranatha
Automation security system is using Passive Infrared Sensor (PIR) for detecting human’s presence in the class. If PIR detects human’s presence in the class without RFID authorization, alarm will be turned on. The result of the experiment shows that automation system will spare electrical energy consumption from 16% to 27% depends on the lighting condition from the sun. This automation system manages to turn on the alarm when human is present in the class without RFID authorization.
Key word: automation, illumination, security, monitoring.
iv
Universitas Kristen Maranatha
DAFTAR ISI ABSTRAK ................................................................................................................. i ABSTRACT ............................................................................................................... iii DAFTAR ISI ............................................................................................................. v DAFTAR TABEL ................................................................................................... vii DAFTAR GAMBAR ................................................................................................ x
BAB I PENDAHULUAN .......................................................................................... 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7
Latar Belakang............................................................................................. 1 Rumusan Masalah ....................................................................................... 2 Tujuan .......................................................................................................... 2 Batasan Masalah .......................................................................................... 3 Metodologi .................................................................................................. 3 Spesifikasi Alat Yang Digunakan ............................................................... 3 Sistematika Penulisan .................................................................................. 4
BAB II LANDASAN TEORI .................................................................................... 5 2.1 Arduino ........................................................................................................ 5 2.1.1 Deskripsi dan Pengenalan Arduino ...................................................... 5 2.1.2 Software - Arduino Development Environment .................................. 7 2.1.3 Hardware - Arduino Board................................................................... 8 2.2 Passive Infrared Sensor ............................................................................... 9 2.3 Radio Frequency Identification ................................................................. 10 2.3.1 Tag RFID ........................................................................................... 11 2.3.2 Reader RFID ...................................................................................... 12 2.4 Serial Real Time Clock .............................................................................. 14 2.5 IC NE555 (Timer) ..................................................................................... 15 2.6. LDR ........................................................................................................... 17 2.7 Microsoft Visual Basic.NET ..................................................................... 18 2.8. Microsoft Access 2007 .............................................................................. 19 2.9. Unified Modeling Language (UML) ......................................................... 21 2.9.1 Use Case Diagram .............................................................................. 22 2.9.2 Statechart Diagram ............................................................................. 23
v
Universitas Kristen Maranatha
BAB III PERANCANGAN DAN REALISASI .......................................................... 24 3.1 Perancangan Hardware ................................................................................... 24 3.1.1 Perancangan Program Penerangan Kelas ........................................... 24 3.1.2 Perancangan Program Penerangan Koridor ....................................... 26 3.1.3 Perancangan Prototype / Maket ......................................................... 29 3.1.4 Sensor Cahaya .................................................................................... 31 3.1.5 PIR ..................................................................................................... 32 3.1.6 Sensor Infra red ................................................................................. 33 3.1.7 Lampu ................................................................................................ 35 3.1.8 Perancangan Sensor Daya .................................................................. 36 3.1.9 Timer .................................................................................................. 41 3.1.10 Saklar .................................................................................................. 42 3.1.11 RFID ................................................................................................... 42 3.1.12 RTC ..................................................................................................... 43 3.1.13 Pengkabelan Keseluruhan Sistem ...................................................... 44 3.2 Perancangan Perangkat Lunak ....................................................................... 49 3.2.1 Flowchart Keseluruhan Sistem .......................................................... 49 3.2.2 Flowchart Subrutin Koridor............................................................... 50 3.2.3 Flowchart Subrutin Kelas .................................................................. 53 3.2.3 Perancangan program mikrokontroler................................................ 56 3.2.5 Perancangan Database Server............................................................ 62 3.2.6 Perancangan perangkat lunak sistem monitoring ............................... 64 3.2.6.1 UML ................................................................................................. 64 3.2.6.1.1 Use Case Diagram ..................................................................... 64 3.2.6.1.2 Statechart Diagram................................................................... 65 3.2.6.2 Rancangan GUI ................................................................................ 66 3.2.6.3 Kode program perangkat lunak sistem monitoring............................... 68 BAB IV DATA PENGAMATAN DAN ANALISA ............................................... 78 4.1 Pengujian perangkat keras ......................................................................... 78 4.1.1 Sensor cahaya ..................................................................................... 78 4.1.2 PIR ..................................................................................................... 78 4.1.3 Sensor Infra red ................................................................................. 79 4.1.4 Sensor Daya ....................................................................................... 80 4.2 Pengujian perangkat lunak ........................................................................ 82 4.2.1 Membaca Tag RFID ........................................................................... 82 4.2.2 Login System ...................................................................................... 83 4.2.3 Penyimpanan database ...................................................................... 84 4.2.3.1 Backup Only ............................................................................... 85 vi
Universitas Kristen Maranatha
4.2.3.2 Backup And Wipe ....................................................................... 85 4.2.4 Pengamatan program penerangan kelas ............................................. 87 4.2.5 Pengamatan program penerangan koridor ......................................... 91 4.2.6 Pengamatan program keamanan kelas ............................................... 95 4.2.7 Pengamatan Daya ............................................................................... 96 4.2.8 Analisis Pengamatan Daya ............................................................. 114 BAB V KESIMPULAN DAN SARAN ................................................................. 117 5.1 5.2
Kesimpulan .............................................................................................. 117 Saran ........................................................................................................ 117
DAFTAR PUSTAKA ............................................................................................ 119
LAMPIRAN A : Kode Program LAMPIRAN B : Datasheet
vii
Universitas Kristen Maranatha
DAFTAR TABEL Tabel 2. 1 Toolbar button pada software Arduino ..................................................... 7 Tabel 2. 2 Band Frekuensi RFID ............................................................................. 10
Tabel 3. 1 Tabel prioritas sensor di kelas sebelum RFID memberikan hak akses ... 25 Tabel 3. 2 Tabel prioritas sensor di kelas setelah RFID memberikan hak akses ..... 26 Tabel 3. 3 Tabel prioritas sensor di koridor (Siang Hari) ........................................ 27 Tabel 3. 4 Tabel prioritas sensor di koridor (malam hari) ....................................... 28 Tabel 3. 5 List I/O yang digunakan .......................................................................... 31 Tabel 3. 6 Arus sistem maximum menurut teori ...................................................... 37 Tabel 3. 7 Hasil pembacaan sensor daya ................................................................. 39 Tabel 3. 8 Penjelasan kode program Arduino – Deklarasi library dan variabel ...... 56 Tabel 3. 9 Penjelasan kode program Arduino – Inisialisasi awal ............................ 57 Tabel 3. 10 Penjelasan kode program Arduino – Baca EEPROM dan Sensor Analog ................................................................................................... 57 Tabel 3. 11 Penjelasan kode program Arduino – Program penerangan koridor ...... 58 Tabel 3. 12 Penjelasan kode program Arduino – Program RFID ............................ 59 Tabel 3. 13 Penjelasan kode program Arduino – Program penerangan kelas ......... 60 Tabel 3. 14 Penjelasan kode program Arduino – Tulis EEPROM dan kirim data serial ...................................................................................................... 61 Tabel 3. 15 Penjelasan kode program Arduino - Subrutin ....................................... 61 Tabel 3. 16 Field pada tabel daya ............................................................................ 63 Tabel 3. 17 Field pada tabel account ....................................................................... 63 Tabel 3. 18 Field pada tabel kelas ............................................................................ 63 Tabel 3. 19 Field pada tabel login ............................................................................ 64 Tabel 4. 1 Perbandingan jarak dengan tegangan keluaran photodiode .................... 80 Tabel 4. 2 Perbandingan pembacaan arus dengan sensor dan multimeter ............... 81 Tabel 4. 3 Kondisi pengamatan daya ....................................................................... 96 Tabel 4. 4 Daya mikrokontroler dan sensor ............................................................. 97 Tabel 4. 5 Daya yang digunakan sistem pada kondisi 2 .......................................... 98 Tabel 4. 6 Daya yang digunakan sistem pada kondisi 3 .......................................... 99 Tabel 4. 7 Daya yang digunakan sistem pada kondisi 4 ........................................ 101 Tabel 4. 8 Daya yang digunakan sistem pada kondisi 5 ........................................ 103 Tabel 4. 9 Daya yang digunakan sistem pada kondisi 6 ........................................ 105 Tabel 4. 10 Daya yang digunakan sistem pada kondisi 7 ...................................... 107 Tabel 4. 11 Daya yang digunakan sistem pada kondisi 8 ...................................... 109 viii
Universitas Kristen Maranatha
Tabel 4. 12 Daya yang digunakan sistem pada kondisi 9 ...................................... 111 Tabel 4. 13 Daya yang digunakan sistem pada kondisi 10 .................................... 113 Tabel 4. 14 Rangkuman pengamatan daya ............................................................ 114 Tabel 4. 15 Rangkuman pengamatan daya lampu dan perbandingan dengan teori114 Tabel 4. 16 Persentase penghematan daya yang digunakan untuk lampu pada setiap kondisi ....................................................................................... 115
ix
Universitas Kristen Maranatha
DAFTAR GAMBAR Gambar 2. 1 Tampilan dari Arduino Development Environment.............................. 7 Gambar 2. 2 Arduino MEGA ..................................................................................... 8 Gambar 2. 3 Bentuk Passive Infrared Sensor............................................................. 9 Gambar 2. 4 Rangkaian sederhana PIR...................................................................... 9 Gambar 2. 5 (a) Tag Pasif. (b) Tag Semipasif. (c) Tag Aktif .................................. 12 Gambar 2. 6 Bentuk RFID Reader........................................................................... 13 Gambar 2. 7 Blok Diagram DS1307 dan RTC DS1307 .......................................... 14 Gambar 2. 8 Konfigurasi dan penjelasan tiap pin .................................................... 14 Gambar 2. 9 Konfigurasi pin IC NE555 .................................................................. 15 Gambar 2. 10 Bentuk LDR ...................................................................................... 17 Gambar 2. 11 Hubungan resistansi LDR dengan intensitas cahaya......................... 17 Gambar 2. 12 Visual Basic di dalam Microsoft Visual Studio 2010 ....................... 18 Gambar 2. 13 Tampilan Microsoft Office Access 2007 .......................................... 19 Gambar 2. 14 Actor .................................................................................................. 22 Gambar 2. 15 Use Case Diagram ............................................................................ 22 Gambar 2. 16 Statechart Diagram ........................................................................... 23
Gambar 3. 1 Diagram block sistem.......................................................................... 24 Gambar 3. 2 Empat macam konfigurasi nyala – padam lampu ruangan kelas ........ 25 Gambar 3. 3 (A)Lampu koridor padam saat penerangan cukup (B) Lampu Koridor yang dianggap penting menyala saat penerangan kurang ..... 28 Gambar 3. 4 Nyala - padam lampu koridor pada malam hari .................................. 29 Gambar 3. 5 Keterangan untuk denah maket ........................................................... 29 Gambar 3. 6 Desain maket ....................................................................................... 30 Gambar 3. 7 Perancangan sensor cahaya ................................................................. 32 Gambar 3. 8 Pengkabelan PIR ................................................................................. 33 Gambar 3. 9 Rangkaian Sensor Infra Red ................................................................ 34 Gambar 3. 10 Rangkaian lampu ............................................................................... 35 Gambar 3. 11 Rangkaian sensor daya ...................................................................... 36 Gambar 3. 12 Kurva perbandingan pembacaan arus menggunakan sensor dengan multimeter......................................................................................... 40 Gambar 3. 13 Rangkaian Timer Delay NE555 ........................................................ 41 Gambar 3. 14 Output dari timer delay IC NE555 .................................................... 41 Gambar 3. 15 Saklar A (on–off–on) dan Saklar B (on–off) .................................... 42 Gambar 3. 16 Pengkabelan RFID – Arduino ........................................................... 43 Gambar 3. 17 Pengkabelan RTC .............................................................................. 43 Gambar 3. 18 Skematik keseluruhan sistem ............................................................ 44 x
Universitas Kristen Maranatha
Gambar 3. 19 Pengkabelan ke Arduino – Subskema A ................................................ 45 Gambar 3. 20 Pengkabelan ke Arduino – Subskema B ................................................ 46 Gambar 3. 21 Pengkabelan ke Arduino – Subskema C ................................................ 47 Gambar 3. 22 Pengkabelan ke Arduino – Subskema D ................................................ 48 Gambar 3. 23 Flowchart keseluruhan sistem................................................................ 49 Gambar 3. 24 Flowchart sistem penerangan koridor .................................................... 50 Gambar 3. 25 Flowchart implementasi pada program penerangan koridor ................. 51 Gambar 3. 26 Flowchart sistem penerangan kelas ....................................................... 53 Gambar 3. 27 Flowchart implementasi pada program penerangan kelas ..................... 54 Gambar 3. 28 Use Case diagram sistem monitoring .................................................... 64 Gambar 3. 29 Statechart diagram sistem monitoring ................................................... 65 Gambar 3. 30 Tab page 1 – Monitoring lantai 1 gedung A .......................................... 66 Gambar 3. 31 Tab page 2 – Monitoring lantai 1 gedung B .......................................... 66 Gambar 3. 32 Tab page 3 – Monitoring lantai 2 gedung B .......................................... 67 Gambar 3. 33 Tab page 4 – Monitoring daya ............................................................... 67 Gambar 3. 34 Tab page 5 dan Tab page 6 – Tampilan database kelas ........................ 67 Gambar 3. 35 Hasil pengiriman data serial oleh mikrokontroler dan penjelasannya ........................................................................................ 68
Gambar 4. 1 Hasil pembacaan sensor cahaya ............................................................... 78 Gambar 4. 2 Hasil pembacaan PIR ............................................................................... 79 Gambar 4. 3 Hasil pembacaan sensor infra merah ........................................................ 79 Gambar 4. 4 Hasil pembacaan tag RFID (sebelum lampu menyala) pada aplikasi ...... 82 Gambar 4. 5 Hasil pembacaan tag RFID (setelah lampu menyala) pada aplikasi ........ 83 Gambar 4. 6 Panel login dan Tabel login ...................................................................... 83 Gambar 4. 7 Login gagal ............................................................................................... 83 Gambar 4. 8 Login berhasil ........................................................................................... 84 Gambar 4. 9 Alamat tujuan penyimpanan database ..................................................... 84 Gambar 4. 10 Tampilan aplikasi dan database setelah tombol Backup Only ditekan ................................................................................................... 85 Gambar 4. 11 Tampilan aplikasi dan database setelah tombol Backup and Wipe ditekan ................................................................................................... 86 Gambar 4. 12 Hasil pengamatan program penerangan kelas kondisi 1 ........................ 87 Gambar 4. 13 Hasil pengamatan program penerangan kelas kondisi 2 ........................ 88 Gambar 4. 14 Hasil pengamatan program penerangan kelas kondisi 3 ........................ 88 Gambar 4. 15 Hasil pengamatan program penerangan kelas kondisi 4 ........................ 89 Gambar 4. 16 Hasil pengamatan program penerangan kondisi 5 ................................. 90 Gambar 4. 17 Hasil pengamatan program penerangan kelas kondisi 6 ........................ 90
xi
Universitas Kristen Maranatha
Gambar 4. 18 Hasil pengamatan program penerangan koridor kondisi 1..................... 91 Gambar 4. 19 Hasil pengamatan program penerangan koridor kondisi 2..................... 92 Gambar 4. 20 Hasil pengamatan program penerangan koridor kondisi 3..................... 93 Gambar 4. 21 Hasil pengamatan program penerangan koridor kondisi 4..................... 93 Gambar 4. 22 Hasil pengamatan program penerangan koridor kondisi 5..................... 94 Gambar 4. 23 Tampilan aplikasi waktu alarm berbunyi ............................................... 95 Gambar 4. 24 Tampilan aplikasi setelah alarm dideaktifkan ........................................ 95 Gambar 4. 25 Arah lampu sorot dalam kondisi 4-9 ...................................................... 96 Gambar 4. 26 Lumens pada kondisi 4 ......................................................................... 100 Gambar 4. 27 Konfigurasi lampu kelas dan koridor kondisi 4 ................................... 100 Gambar 4. 28 Lumens pada kondisi 5 ......................................................................... 102 Gambar 4. 29 Konfigurasi lampu kelas dan koridor kondisi 5 ................................... 102 Gambar 4. 30 Lumens pada kondisi 6 ......................................................................... 104 Gambar 4. 31 Konfigurasi lampu kelas dan koridor kondisi 6 ................................... 104 Gambar 4. 32 Lumens pada kondisi 7 ......................................................................... 106 Gambar 4. 33 Konfigurasi lampu kelas dan koridor kondisi 7 ................................... 106 Gambar 4. 34 Lumens pada kondisi 8 ......................................................................... 108 Gambar 4. 35 Konfigurasi lampu kelas dan koridor kondisi 8 ................................... 108 Gambar 4. 36 Lumens pada kondisi 9 ......................................................................... 110 Gambar 4. 37 Konfigurasi lampu kelas dan koridor kondisi 9 ................................... 110 Gambar 4. 38 Lampu koridor yang menyala pada kondisi 10 .................................... 112
xii
Universitas Kristen Maranatha