HOME/LECTURE HALL AUTOMATION AMMAR BIN ADZMAN

Similar documents
AUTOMATIC NIGHT LAMP WITH MORNING ALARM USING MICROPROCESSOR

HOME SECURITY SENSOR SYSTEM USING ATMEL AVR MICROCONTROLLER LIM BOON HOI

HELP DESK SYSTEM IZZAT HAFIFI BIN AHMAD ARIZA

Programming Logic controllers

FRONT DESK CUSTOMER SERVICE FOR QUEUE MANAGEMENT SYSTEM MOHAMAD FAZLI BIN ALIAS

EXPERIMENT 2 TRAFFIC LIGHT CONTROL SYSTEM FOR AN INTERSECTION USING S7-300 PLC

2.0 Command and Data Handling Subsystem

Controlling a Dot Matrix LED Display with a Microcontroller

LIGHTNING AS A NEW RENEWABLE ENERGY SOURCE SARAVANA KUMAR A/L ARPUTHASAMY UNIVERSITI TEKNOLOGI MALAYSIA

An Introduction to MPLAB Integrated Development Environment

ACTIVE INFRARED MOTION DETECTOR FOR HOUSE SECURITY SYSTEM MIOR MOHAMMAD HAFIIZH BIN ABD. RANI UNIVERSITI MALAYSIA PAHANG

Programming PIC Microcontrollers in PicBasic Pro Lesson 1 Cornerstone Electronics Technology and Robotics II

MODELING AND SIMULATION OF SINGLE PHASE INVERTER WITH PWM USING MATLAB/SIMULINK AZUAN BIN ALIAS

8051 MICROCONTROLLER COURSE

Intelligent Home Automation and Security System

DEVELOP AND DESIGN SHEMATIC DIAGRAM AND MECHANISM ON ONE SEATER DRAG BUGGY MUHAMMAD IBRAHIM B MD NUJID

GUI DEVELOPMENT FOR DC MOTOR APPLICATION IN MATLAB NAZARIHA BINTI MAT SALLEH

Car Rental Management System (CRMS) Lee Chen Yong

STRESS EFFECT STUDY ON 6 DIFFERENT PATTERN OF TYRES FOR SIZE 175/70 R13 SYAHRIL AZEEM ONG BIN HAJI MALIKI ONG. for the award of the degree of

Wireless Security Camera

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 1 Introducing Hardware

Programmable Logic Controller PLC

Chapter 13. PIC Family Microcontroller

PRODUCTIVITY IMPROVEMENT VIA SIMULATION METHOD (MANUFACTURING INDUSTRY) HASBULLAH BIN MAT ISA

Parts of a Computer. Preparation. Objectives. Standards. Materials Micron Technology Foundation, Inc. All Rights Reserved

Design And Implementation Of Bank Locker Security System Based On Fingerprint Sensing Circuit And RFID Reader

Remote PLC system using GSM network with application to home security system

Programming A PLC. Standard Instructions

Invisible EYE for Security System

BISKUT RAYA INVENTORY MANAGEMENT SYSTEM (BRIMS) NURUL AMIRAH BINTI ROSLAN THESIS SUBMITTED IN FULFILLMENT OF THE DEGREE OF COMPUTER SCIENCE

Palaparthi.Jagadeesh Chand. Associate Professor in ECE Department, Nimra Institute of Science & Technology, Vijayawada, A.P.

ALARM SYSTEM USING BODY DETECTOR UMMI KALSOM BINTI NOOR DIN

Hardware and Logic Implementation of Multiple Alarm System for GSM BTS Rooms

TABLE OF CONTENTS. SUPERVISOR S DECLARATION ii STUDENT S DECLARATION iii DEDICATION ACKNOWLEDGEMENTS v ABSTRACT LIST OF TABLES

The Programming Interface

Development of Low Cost Private Office Access Control System(OACS)

GSM Based Electrical Control System for Smart Home Application

Switch board datasheet EB

DIRECT CURRENT MOTOR CONTROL LED BY MICROCONTROLLER CREATED PWM THINESH A/L KUNASEGERAN. Thesis submitted in fulfillment of the requirements

Microcontrollers Figure 26-1 Objectives Key Words and Terms 26.1 OVERVIEW OF THE MICROCONTROLLER microcontroller

Programmable Logic Controllers Definition. Programmable Logic Controllers History

UPS PIco. to be used with. Raspberry Pi B+, A+, B, and A. HAT Compliant. Raspberry Pi is a trademark of the Raspberry Pi Foundation

HOME AUTOMATION SYSTEM USING POWER LINE COMMUNICATION DARLENE BINTI MOHAMAD DOUGLAS

IMPROVING SERVICE REUSABILITY USING ENTERPRISE SERVICE BUS AND BUSINESS PROCESS EXECUTION LANGUAGE AKO ABUBAKR JAAFAR

JOB AGENT MANAGEMENT SYSTEM LU CHUN LING. A thesis submitted in partial fulfillment of. the requirements for the award of the degree of

MICROCONTROLLER BASED SMART HOME WITH SECURITY USING GSM TECHNOLOGY

DESIGN OF SMS ENABLED CAR SECURITY SYSTEM

SPAM FILTERING USING BAYESIAN TECHNIQUE BASED ON INDEPENDENT FEATURE SELECTION MASURAH BINTI MOHAMAD

Accurate Measurement of the Mains Electricity Frequency

Home Security System

If an occupancy of room is zero, i.e. room is empty then light source will be switched off automatically

Chapter 2 Logic Gates and Introduction to Computer Architecture

MICROPROCESSOR AND MICROCOMPUTER BASICS

Location-Aware and Safer Cards: Enhancing RFID Security and Privacy

Embedded Systems on ARM Cortex-M3 (4weeks/45hrs)

SMART SUN TRACKING WITH AUTOMATED CLEANING SYSTEM FOR PV MODULES AMIRAH AFIQAH BINTI AHMED

Analog Inputs and Outputs

UNIVERSITI TEKNOLOGI MARA SOFTWARE DESIGN AND DEVELOPMENT FOR AUTOMOTIVE ONLINE MONITORING SYSTEM

DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING Question Bank Subject Name: EC Microprocessor & Microcontroller Year/Sem : II/IV

A 5 Degree Feedback Control Robotic Arm (Haptic Arm)

Sigma Control PC INSIDE. 97 psi 187 F R on load

EXPERIMENTAL ANALYSIS OF PASSIVE BANDWIDTH ESTIMATION TOOL FOR MULTIPLE HOP WIRELESS NETWORKS NURUL AMIRAH BINTI ABDULLAH

CLIENT SERVER APPLICATION FOR SERVER FARM PERFORMANCE MONITORING ABDIRASHID HASSAN ABDI

Programming Flash Microcontrollers through the Controller Area Network (CAN) Interface

HOME AUTOMATION USING X-10 TECHNOLOGY MOHAMAD RIDHWAN BIN MOHAMED RODZI UNIVERSITY MALAYSIA PAHANG

PLC Based Liquid Filling and Mixing

Fingerprint Based Biometric Attendance System

Analog-to-Digital Converters

ET-BASE AVR ATmega64/128

STEPPER MOTOR SPEED AND POSITION CONTROL

INTRODUCTION: ABSTRACT:

Smart Home System Using Android Application

UPiS - Uninterruptible Power intelligent Supply

VEHICLE TRACKING AND SPEED ESTIMATION SYSTEM CHAN CHIA YIK. Report submitted in partial fulfillment of the requirements

Sensor network infrastructure for intelligent building monitoring and management system

An overview of Computerised Numeric Control (C.N.C.) and Programmable Logic Control (P.L.C.) in machine automation

GPS & GSM BASED REAL-TIME VEHICLE TRACKING SYSTEM.

Surveillance System Using Wireless Sensor Networks

Lab Experiment 1: The LPC 2148 Education Board

Smart Thermostat page 1

Efficient Authorized Access Security System Control Using ATMEL 89C55 & Mobile Bluetooth

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

Lecture N -1- PHYS Microcontrollers

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

AND8336. Design Examples of On Board Dual Supply Voltage Logic Translators. Prepared by: Jim Lepkowski ON Semiconductor.

ADVANCED FIRE ALARMING SYSTEM THROUGH MOBILE PHONE

CPU systron S S S 250c. systron S S S 250c. CPUs to the process modules. Stand-alone PLC

A Review of Security System for Smart Home Applications

Note monitors controlled by analog signals CRT monitors are controlled by analog voltage. i. e. the level of analog signal delivered through the

Microcontrollers in Practice

INTEGRATING CONSUMER TRUST IN BUILDING AN E-COMMERCE WEBSITE NUR ZAILAN BIN OTHMAN

Programmable Logic Controllers

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

Web Streamed SDR s in Service at GB2RHQ Hack Green Bunker

Design and Implementation of an Accidental Fall Detection System for Elderly

DS1104 R&D Controller Board

S7 for Windows S7-300/400

TEST CHAPTERS 1 & 2 OPERATING SYSTEMS

AUTOMATIC AIR CONDITIONAL CONTROL SYSTEM MOHD NOR IDRUS BIN MAT SHARIFF

Transcription:

HOME/LECTURE HALL AUTOMATION AMMAR BIN ADZMAN This thesis is submitted as partial fulfillment of the requirements for the award of the Bachelor of Electrical Engineering (Power Systems) Faculty of Electrical & Electronics Engineering Universiti Malaysia Pahang MAY, 2009

I hereby acknowledge that the scope and quality of this thesis is qualified for the award of the Bachelor Degree of Electrical Engineering (Power Systems) Signature : Name : NURUL HAZLINA BINTI NOORDIN Date : 13 MAY 2009

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 : AMMAR BIN ADZMAN Date : 13 MAY 2009

ACKNOWLEDGEMENT In the name of Allah, The Most Loving and The Most Compassionate Alhamdulillah, the highest thank to allah because of His Willingness I possible to complete the final year project. I also would like to take this opportunity to extend my deepest gratitude to the following persons who helped me a lot in this project, which enabled me to complete my research project in time as a partial of the requirement for the Bachelor of Electrical Engineering (Power Systems). In particular, I wish to express my sincere appreciation to my main thesis supervisor, Pn. Nurul Hazlina binti Noordin, for encouragement, guidance, continuous patience, critics and supervision given throughout the project. I also would like to thank my colleagues and others who give me support and provided assistance at various occations. Their views and support are useful indeed. Unfortunately, it is no possible to list all of them in this limited space. Last but not least, I am grateful to my parent members for their continuous support and advice from the early stage of my studies.

ABSTRACT Nowdays, automation system becomes the best solution to overcome human problem which is always forget to switch off the electrical appliances. As we know, there are a lot of types of the automation system which is to expensive and difficult to use.for that reason, an automation system at low cost is built where, user can also program the automated system by their own. The purpose of this project is to design an automation system that can be used to switch ON and OFF the electrical appliances automatically. This project focusing developing a automation system with ultrasonic motion detector which is controlled by programmable interface controller (PIC16F877A). This overall project is divided into two parts. The first part is concern on the hardware development where all electronic component are connected on a single board. A limit switch and ultrasonic motion detector are the input component while flourescent lamp and fan are the output component where it s all controlled by controller circuit. The second part is base on software programming to operate the hardware structure. Program for automation system is base on PIC16F877A pic basic language. The pic basic language assemble using microcode studio software to get the hex file. The hex file loaded into PIC memory using PIC burner. The process of downloading and execute the hex file using WinPic800 Downloader. In order to achieve better automation system, the security system can be added to this project where more sensor and load can be connected to the PIC serial port. As the result, the PIC capable to control the whole operation of this automation system.

ABSTRAK Dewasa ini, sistem automatik telah menjadi penyelesaian terbaik bagi mengatasi masalah manusia iaitu selalu terlupa untuk mematikan pekakas elektrik yang telah digunakan apabila meninggalkan sesebuah bilik. Seperti yang kita ketahui, terdapat banyak sistem automatik dipasaran tetapi harganya terlalu mahal dan sukar digunakan. Oleh yang demikian, satu sistem automatik telah dibangunkan pada kos yang rendah dan mesra pengguna. Tujuan projek ini dilaksanakan adalah untuk membangunkan satu sistem yang boleh menghidupkan dan mematikan pekakas elektrik secara automatik. Projek ini tertumpu kepada membangunkan sistem automatik menggunakan pengesan pergerakan ultrasonik yang dikawal oleh PIC16F877A. Projek ini terbahagi kepada dua bahagian. Bahagian pertama ialah tertumpu kepada pembangunan litar elektronik dimana kesemua komponenkomponen elektronik disambung berdasarkan gambar rajah litar yang dilukis. Bahagian kedua pula tertumpu kepada program untuk mengoperasikan litar elektronik yang telah dibina. Program sistem automatik yang telah disemak dan ditukar kepada kod nombor dipindahkan menggunakan alat PIC Burner melalui software WinPicDownloader. Bagi menambah baik sistem automatik ini, lebih banyak sensor boleh disambungkan kepada sistem ini bagi mengawal lebih banyak pekakas elektrik dan boleh digunakan dalam tempat yang lebih luas. Pada kesimpulannya, PIC dapat mengawal kesemua operasi sistem automatik yang telah dibangunkan.

TABLE OF CONTENTS CHAPTER TITLE PAGE TITLE PAGE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK TABLE OF CONTENTS LIST OF TABLES LIST OF FIGURES LIST OF ABBREVIATIONS LIST OF SYMBOLS LIST OF APPENDICES i ii iii iv v vi vii x xi xii xiii xiv 1 INTRODUCTION 1 1.1 Background 1 1.2 Overview of Home/Lecture Hall Automation 1 Project 1.3 Objective 5 1.4 Scope of Project 5 1.5 Outline of Thesis 6

2 THEORY AND LITERATURE REVIEW 7 2.1 Peripheral Interface Controller (PIC) 7 2.1.1 Microcontroller (PIC16F877A) 7 2.1.2 Programmer PIC 12 2.2 Sensor 13 2.2.1 Definition of Sensor 13 2.2.2 Ultrasonic 14 2.2.3 Motion Detector 15 2.3 Relay 16 2.3.1 Introduction 16 2.3.2 Protection Diodes for Relays 17 2.3.3 Relays and Transistor Compared 18 2.4 Darlington 19 2.4.1 Introduction 19 2.4.2 Functional Model of an NPN Transistor 20 2.4.3 Darlington Pair 21 2.5 MicroCode Studio 23 3 METHODOLOGY AND DESIGN 24 3.1 Background 24 3.2 System Design 25 3.3 Hardware development 26 3.3.1 First Stage: Dual Power Supply 27 3.3.2 Second Stage: 16F877A Connection Circuit 28 3.3.3 Third Stage: Darlington and Relay Circuit 30 3.3.4 Fourth Stage: Ultrasonic Motion Detector 31 4 RESULTS AND ANALYSIS 33 4.1 Introduction 33 4.2 Analysis Using Software 33 4.2.1 Rectifier Circuit 34 4.3 Result Obtained 36 4.4 Discussion and Summary 37

5 CONCLUSION AND RECOMMENDATIONS 38 5.1 Conclusion 38 5.2 Future recommendations 39 5.3 Costing 40 5.4 Commercialization 41 REFERENCES 43 Appendices A - E 45-71

LIST OF TABLES TABLE NO. TITLE PAGE 1 Project Costing 40

LIST OF FIGURES FIGURE NO. TITLE PAGE 1 PIC16F877A 8 2 PIC Schematic 9 3 Clock/instruction Cycle 11 4 Example of Simple Program 12 5 Circuit symbol for a relay and example of relay 16 6 Protection diodes for relays 18 7 Transistor circuit symbols 19 8 Functional model of an NPN transistor 21 9 Darlington pair 22 10 From upper view of automated system 25 11 Block Diagram of Hardware Development 26 12 5volt and 12volt DC Power Supply 27 13 Dual power transformer 28 14 Schemetic of PIC 16F877A 28 15 PIC16F877A Connection Circuit 29 16 Darlington and relay 12V connection 30 17 Ultrasonic Motion Detector 31 18 Basic principle of ultrasonic motion detector 31 19 9Vdc step down to 5Vdc simulation circuit 34 20 18Vdc step down to 12Vdc simulation circuit 35 21 Power supply circuit 35 22 Result of the project 36

LIST OF ABBREVIATIONS AC - Alternate Current ADC - Analog Digital Converter CCD - Charge-Coupled Device CPU - Central Processing Unit DC - Direct Current EEPROM - Electrically Erasable Programmable Read-Only Memory EPROM - Erasable Read Only Memory GND - Ground OSC - Oscillator I/O - Input/Output PC - Personal Computer PCB - Printed Circuit Board PIC - Peripheral Interface Controller PIR - Passive Infrared Sensors PLC - Programmable Logic Controller RAM - Random Access Memory RISC - Reduced Instruction Set Computing ROM - Read Only Memory TON/TOF - Turn On Delay/Turn Off Delay UART - Universal Asynchronous Receiver/Transmitter

LIST OF SYMBOLS μ - Micro K - Kilo khz - Kilo Hertz V - Volts dc - Direct Current ac - Alternate Current A - Ampere

LIST OF APPENDICES APPENDIX TITLE PAGE A PIC PROGRAMMING 45 B PIC 16F877A DATASHEET 47 C DARLINGTON ULN2004A DATASHEET 57 D VOLTAGE REGULATOR DATASHEET 65 E BR106 DATASHEET 69

CHAPTER 1 INTRODUCTION 1.1 Background This chapter explains briefly about home/lecture hall automation and its operation. This chapter also explains the overview of project objectives, scopes and thesis outline. 1.2 Overview of Home/Lecture Hall Automation Project Home automation (also called domotics) is a field within building automation, specializing in the specific automation requirements of private homes and in the application of automation techniques for the comfort and security of its residents. Although many techniques used in building automation (such as light and climate control, control of doors and window shutters, security and surveillance systems, etc.) are also used in home automation, additional functions in home automation can include the control of multi-media home entertainment systems, automatic plant watering and pet feeding, automatic scenes for dinners and parties, and a more userfriendly control interface.

When home automation is installed during construction of a new home, usually control wires are added before the interior walls are installed. These control wires run to a controller, which will then control the environment. System The elements of a domotics system are: controllers sensors actuators Architecture From the point of view of where the intelligence of the domotic system resides, there are three different architectures: Centralized Architecture: a centralized controller receives information of multiple sensors and, once processed, generates the opportune orders for the actuators. Distributed Architecture: all the intelligence of the system is distributed by all the modules that are sensors or actuators. Usually it is typical of the systems of wiring in bus. Mixed Architecture: systems with decentralized architecture as far as which they have several small devices able to acquire and to process the information of multiple sensors and to transmit them to the rest of devices distributed by the house. Motion detection is the action of sensing physical movement in a given area. Motion can be detected by measuring change in speed or vector of an object or objects in the field of view. This can be achieved either by mechanical devices that physically interact with the field or by electronic devices that quantifies and measures changes in the given environment.

Mechanical devices A tripwire is a simple form of motion detection. If a moving objects steps into the tripwire's field of view then a simple sound device like bells may alert the user. A glass filled to the brim so that surface tension causes a convex meniscus can be placed on top of an object to detect if the object has moved. Mechanical motion detection devices can be simple to implement, but at the same time, they can be defeated easily by interrupting the devices' mechanics (by "cutting the wire" or "drinking the water"). Electronic motion sensing devices, such as motion detectors, can prevent such mechanical intervention. Electronic devices The principal methods by which motion can be electronically identified are optical detection and acoustical detection. Infrared light or laser technology may be used for optical detection. Motion detection devices, such as motion detectors, have sensors that detect movement and send a signal to a sound device that produces an alarm or switch on an image recording device. There are motion detectors which employ cameras connected to a computer which stores and manages captured images to be viewed later or viewed over a computer network. The chief applications for such detection are detection of unauthorized entry, detection of cessation of occupancy of an area to extinguish lighting, and detection of a moving object which triggers a camera to record subsequent events. The motion detector is thus a lynchpin of electronic

security systems, but is also a valuable tool in preventing the illumination of unoccupied spaces. A simple algorithm for motion detection by a fixed camera compares the current image with a reference image and simply counts the number of different pixels. Since images will naturally differ due to factors such as varying lighting, camera flicker, and CCD dark currents, pre-processing is useful to reduce the number of false positive alarms. More complex algorithms are necessary to detect motion when the camera itself is moving, or when the motion of a specific object must be detected in a field containing other movement which can be ignored. An example might be a painting surrounded by visitors in an art gallery. Most of the design,using one or minimum controller in which users need to install different controllers for certain usage. This project called to apply Programmable Interfere Controller (PIC) to enable the controls which is compressed under single controller. With this project, users are no more worried about to switch off light and air-conditoner anymore because the light and air-conditioner will off and on automatically. Automation can make life more convenient and it can also save considerable energy. A PIC microcontroller chip combines the function of microprocessor, ROM program memory, some RAM memory and input/output interface in one single package which is economical and easy to use. The PIC-Logicator system is designed to be used to program a range of 8, 18, 28 pin reprogrammable PIC microcontrollers which provide a variety of output, digital input and analogue input option to suit school project uses.

1.3 Objective The main fundamental of this project is to automatically control light switching and air-conditioner for lecture hall by using microcontroller. 1.4 Scope of Project The scopes of the project are to develop a model using microcontroller for UMP lecture hall. In order to achieve the objective of the project, there are several scope had been outlined. To develop the whole project, it covered on two methods which are the electrical structure, and software programming. The scope of this project includes using Microcode studio to program microcontroller PIC16F877A and build hardware for the system. For electrical structure, it consist of sensor which are the ultrasonic motion detector and the PIC microcontroller will control the whole system. It contains on the program as an interaction to activate the electrical structure. 1.5 Outline of Thesis This thesis consist four chapters. In the first chapter, it discuss about the overview, objective and scope of this project. While in chapter 2 will discuss more on theory and literature review that have been done. It well discuss on the type of ultrasonic motion detector and automation system.

In chapter 3, the discussion will be on the methodology hardware and the software implementation in this project. Result and discusssion will presented in chapter 4. Last but not least, chapter 5 will discusses the conclusion and further development of the project that can be added into the system for improving. CHAPTER 2 THEORY AND LITERATURE REVIEW 2.1 Peripheral Interface Controller (PIC) 2.1.1 Microcontroller (PIC 16F877A)

PIC is a family of Harvard architecture microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument's Microelectronics Division. PICs are popular with developers due to their low cost, wide availability, large user base, extensive collection of application notes, availability of low cost or free development tools, and serial programming (and re-programming with flash memory) capability [1]. Figure 1: PIC16F877A The original PIC was built to be used with GI's new 16-bit CPU, the CP1600. While generally a good CPU, the CP1600 had poor I/O performance, and the 8-bit PIC was developed in 1975 to improve performance of the overall system by offloading I/O tasks from the CPU. The PIC used simple microcode stored in ROM to perform its tasks, and although the term wasn't used at the time, it is a RISC design that runs one instruction per cycle (4 oscillator cycles) [1].

Figure 2: PIC Schematic In 1985 General Instruments spun off their microelectronics division, and the new ownership cancelled almost everything which by this time was mostly out-of-date. The PIC, however, was upgraded with EPROM to produce a programmable channel controller, and today a huge variety of PICs are available with various on-board peripherals (serial communication modules, UARTs, motor control kernels, etc.) and program memory from 512 words to 32k words and more (a "word" is one assembly language instruction, varying from 12, 14 or 16 bits depending on the specific PIC micro family) [1]. Microchip Technology does not use PIC as an acronym; in fact the brand name is PICmicro. It is generally regarded that PIC stands for Peripheral Interface Controller, although General Instruments' original acronym for the PIC1650 was "Programmable Intelligent Computer" [1]. Generally, PIC microprocessor divides to 6 parts. Those are program memory, EEPROM, RAM, PORTA and PORTB, free-run timer and central

processing unit. For more detailed explained, we specified the function of each part below. (i) Program memory (FLASH) - for storing a written program [2]. Using flash technology, the memory can be programmed and cleared more than once. It makes this microcontroller suitable for device development. (ii) EEPROM - data memory that needs to be saved when there is no supply [2]. It is usually used for storing important data that must not be lost if power supply suddenly stops. For instance, one such data is an assigned temperature in temperature regulators. If during a loss of power supply this data was lost, we would have to make the adjustment once again upon return of supply. Thus our device looses on self-reliance. (iii) RAM - data memory used by a program during its execution [2]. In RAM, it are stored all inter-results or temporary data during runtime. (iv) PORTA and PORTB are physical connections between the microcontroller and the outside world. Port A has five, and port B has eight pins [2]. (v) FREE-RUN TIMER is an 8-bit register inside a microcontroller that works independently of the program. On every fourth clock of the oscillator it increments its value until it reaches the maximum (255), and then it starts counting over again from zero. As we know the exact timing between each two increments of the timer contents, timer can be used for measuring time which is very useful with some devices [2]. (vi) CENTRAL PROCESSING UNIT has a role of connective element between other blocks in the microcontroller. It coordinates the work of other blocks and executes the user program [2].

Same as other microcontroller, the main starter for PIC microcontroller is the clock or instruction cycle. It is attached to the PIC microcontroller as an external component called as oscillator. We connect the oscillator with the pin OSC1 and clock will enter the microcontroller where the clock will be divided by the internal circuit of a microcontroller into four even clock Q1, Q2, Q3, Q4 which do not overlap. These four clocks make up one instruction cycle (also called machine cycle) during which one instruction is executed [12]. Execution of instruction starts by calling an instruction that is next in string. Instruction is called from program memory on every Q1 and is written in instruction register on Q4. Decoding and execution of instruction are done between the next Q1 and Q4 cycles. On the following diagram we can see the relationship between instruction cycle and clock of the oscillator (OSC1) as well as that of internal clocks Q1-Q4. Program counter (PC) holds information about the address of the next instruction. 2.1.2 Programmer PIC Figure 3: Clock/instruction Cycle There is much method use to program the PIC. One of those methods is using ladder logic diagram (LDmicro). The LDmicro generates native

code for certain Microchip PIC16 and Atmel AVR microcontrollers. Usually software for these microcontrollers is written in a programming language like assembler, C, or BASIC. A program in one of these languages comprises a list of statements [3]. These languages are powerful and wellsuited to the architecture of the processor, which internally executes a list of instructions. PLCs, on the other hand, are often programmed in `ladder logic.' A simple program might look like this [3]: Figure 4: Example of Simple Program TON is a turn-on delay; TOF is a turn-off delay. The --] [--statements are inputs, which behave sort of like the contacts on a relay. The --( )-- statements are outputs, which behave sort of like the coil of a relay [3].

2.2 Sensor 2.2.1 Definition of Sensor A device that measures or detects a real-world condition, such as motion, heat or light and converts the condition into an analog or digital representation. An optical sensor detects the intensity or brightness of light, or the intensity of red, green and blue for color systems [4]. Also means any electronic devices in nature and designed to send a voltage signal to an onboard computer; some sensors may operate as a simple on/off switch or they may provide a variable voltage signal (like a potentiometer) as conditions or measured parameters change [5] Sensors are normally components of some larger electronic system such as a computer control and/or measurement system. Analog sensors most often produce a voltage proportional to the measured quantity [6]. The signal must be converted to digital form with a {ADC} before the CPU can process it. Digital sensors most often use serial communication such as {EIA-232} to return information directly to the controller or computer through a {serial port} [6].