Rabi Al Thani 1433 Al-H. Rashme 2711 K. ... to control a Gas. Reduction System automatically through a GUI and from remote location by ...... Dr.Ahmad Tarik Sadiq. Assist. Prof. ..... [20] Muhammad Ali Mazidi and Janice Gillispe Mazidi, âThe 8051 ... [33] Mohd. Shahruddin Bin Harun, âDesign Switch mode Power Supply.
Kurdistan Region-Iraq Ministry of High Education and Scientific Research Salahaddin University-Erbil
GUI Based Remote Control of (Gas Reduction System) using PIC Microcontroller
A Thesis Submitted to the Council of the College of Engineering at Salahaddin University-Erbil in Partial Fulfillment of the Requirements for the Degree of Master in Software Engineering
By Essa Faiq Abdallh, B.Sc. in Computer Engineering- Al-Mustansuria University- 2006
Supervised by Asst. Prof. Dr. Ayad Ghany Ismaeel
Asst. Prof. Dr. Raghad Zuhair Yousif
February 2012 A.D.
Rabi Al Thani 1433 Al-H.
Rashme 2711 K.
—\2¬G·]iàÄÑÁ“:Í€ˇË ÑÌ ‚ 8âfi\Ü:ÎÏÊÌ flËÉˇË Áh:Ê:˚ ]d:ÍfiÅflˇË Á|:ÍhÏÑ\ÜÏÊ ÖˇÈ÷ÊÌ ‚G‡ËÄÄÌ t˜Ì à:ΡÁ”fi\Ü
:‘ ˇÈ÷ı�1fiˆ“:Ífi]flˇÈ‚Ñ]“Ì d:Ì d:Ü]∆:Í€ÈiâÈà:ÑÌ àÌ d:ÎÑÊÊÄ:Ì d:ÑÊÊÄ:Í÷ı1fiˆ“ ›\ÖöıÖl :ˆd:ˇÎÜ]âd
:‘ ˇÈåÌ d:’ ÏÊ:ÖˇÈ÷ÊÌ ‚ :–:‡ËÄÄÌ t˜Ì à:ΡÁ”fi\Ü:Ì ÷:ÏÊ\Ö“:ÎÑ]ËÜ\ÅfiÌ Ò:ÎÉÈ÷ˇÁ“:ÍfiÌ ⁄Áß Ì Ò:ÍåÌ ”çˇÈl :Ì “Ì ËÌ ⁄]fi ÎÜ]à:›\ÖöˇÊ�Ö l :ÎÑ]ËÜ\ÅfiÌ Ò:Ì ÷:ÑÌ ià]⁄:ÎÌ ◊l :Ífi]flˇÈ‚:jàÏÄÌ d:Ífi]“Ì ÈiâËÊ\ÅˇÈl :Ì ÷
·Ì ˘:Ì ÷ :::\Å∆Ì d :GÌ ÈËÖâfiÌ iàÁ⁄:ΡÁ”fi\Ü:G:ÎÜ]à:›\ÖöˇÊ�Ö l :Ê:ÖËÊÄÑ]‚ :ÎÑ]ËÜ\ÅfiÌ Ò:Ì ÷:ãˇÁËÑˇÁ÷]“Ì d:F ! \Åe¬:–Ò] :ÓâȬ
2006
8åÑÌ l ÑÌ àÌ d
رﻏد زھﯾر ﯾوﺳف:HÄ:HÎ:Ho
:ÿȬ]3\:9∆:Ä]Ë^:HÄ:HÎ:Ho : :
:ÓflË:\Ü:2012:F k]dÁå::::::::::::::::::::::::::::ÓîˇÁ“:1433:F :›ÏÊÊÄ:Í√ÈdÏÑ:::::::::::::: :::::: :ÔÄÑÁ“:2711:F ::ˇÍ⁄Ì åÏÑ
إﻗﻠﯿﻢ ﻛﻮردﺳﺘﺎن – اﻟﻌﺮاق وزارة اﻟﺘﻌﻠﯿﻢ اﻟﻌﺎﻟﻲ واﻟﺒﺤﺚ اﻟﻌﻠﻤﻲ ﺟﺎﻣﻌﺔ ﺻﻼح اﻟﺪﯾﻦ – أرﺑﯿﻞ
اﻟﺘﺤﻜﻢ ﻋﻦ ﺑﻌﺪ ﺑﻤﻨﻈﻮﻣﺔ ﻏﺎزﯾﺔ ﺑﺈﺳﺘﺨﺪام ﻣﺘﺤﻜﻢ ﻗﺎﺑﻞ ﻟﻠﺒﺮﻣﺠﺔ
رﺳﺎﻟﺔ ﻣﻘﺪﻣﺔ إﻟﻰ ﻛﻠﯿﺔ اﻟﮭﻨﺪﺳﺔ ﻓﻲ ﺟﺎﻣﻌﺔ ﺻﻼح اﻟﺪﯾﻦ – أرﺑﯿﻞ ﻛﺠﺰء ﻣﻦ ﻣﺘﻄﻠﺒﺎت ﻧﯿﻞ ﺷﮭﺎدة اﻟﻤﺎﺟﺴﺘﯿﺮ ﻓﻲ ھﻨﺪﺳﺔ اﻟﺒﺮاﻣﺠﯿﺎت
ﻣﻦ ﻗﺒﻞ ﻋﯿﺴﻰ ﻓﺎﺋﻖ ﻋﺒﺪﷲ ،ﺑﻜﺎﻟﻮرﯾﻮس ﻓﻲ ھﻨﺪﺳﺔاﻟﺤﺎﺳﺒﺎت و اﻟﺒﺮاﻣﺠﯿﺎت – اﻟﺠﺎﻣﻌﺔ اﻟﻤﺴﺘﻨﺼﺮﯾﺔ – ﺑﻐﺪاد 2006
ﺑﺈﺷﺮاف أ .م .د .اﯾﺎد ﻏﻨﻲ اﺳﻤﺎﻋﯿﻞ
أ .م .د .رﻏﺪ زھﯿﺮ ﯾﻮﺳﻒ
رﺷﻤﻲ 2711 ،ﻛﺮدي
رﺑﯿﻊ اﻟﺜﺎﻧﻲ 1433 ،ھﺠﺮي
ﺷﺒﺎط 2012 ،ﻣﯿﻼدي
Chapter One Introduction
Chapter One
Introduction
Chapter One Introduction 1.1 Motivation The controlling and monitoring machines from remote location are very important in these days due to increasing the factories and plants. The automation systems and embedded control system are used when the accurate and quick decision required, and when the human life being in hazard for doing some jobs inside electrical power stations and chemical plants. The purpose of this thesis is to design and implement a complete embedded automation software system that can be used to control a Gas Reduction System automatically through a GUI and from remote location by using programmable interface controller (PIC16F877A). The GRS (Gas Reduction System) is one of the units in a power station, which is responsible on controlling gas pressure and gas temperature. The main problem in GRS is that ,all operations of monitoring and controlling of GRS is handled by technician (human driven control) who has some experience and certain level of skill in the status that might the GRS machine undergoes ,hence this type of monitoring may subjected to human fault due to inaccuracy of human driven control which involves taking wrong decisions or late response to certain critical events ,taken in consideration that the monitoring and control processes of GRS are done from far location (about 150m) from GRS and control room. The microcontrollers are widely used because microcontrollers are easy to embed into larger electronic circuit designs. Their ability to store and run unique programs makes them extremely versatile. For instance, one can program a microcontroller to make decisions and perform functions based on situations (I/O line logic) and events. The math and logic functions allow the microcontroller to mimic sophisticated logic and electronic circuits. A Microcontroller is an inexpensive single-chip computer; it means that the entire computer system lies within the confines of the (Interacted Circuit Chip). The microcontroller is capable of storing and executing programs (its most important feature). the microcontroller contains a CPU (Central Processing Unit), RAM (Random Access Memory) ROM (Read Only Memory), I/O (Input/Output), lines , Serial and parallel ports ,Timers and some times A/D (Analog-to-Digital) and D/A (Digital-to-Analog) Converters [1].
۲
Chapter One
Introduction
The PIC16F877A is useful as a reference device because it has a minimal instruction set but a full range of peripheral features. The general approach to microcontroller application design in this thesis is to develop a design using a chip that has spare capacity, and then later select a related device that has the set of features most closely matching the application requirements. The proposed system architecture, considering both the hardware and software elements involved is essential in this new era. Automation and remote control systems have been introduced to help and protect workers from hazardous working environments [2]. The proposed system technology could be used as a cost effective and more flexible way of monitoring and controlling GRS machine. The PIC microcontroller can perform all functions and activities of the original system. The block diagram of proposed system shown in figure (1.1), in which the signals to/from GRS are exchanged with the PIC through I/O interfacing circuits .Thus the PIC executes the instructions come from GUI and generate control signals to control the proposed machine.
Figure (1.1) the block diagram of proposed system
In order to reduce the size, weight and power consumption of the system, the PIC 16F877A (single chip Reduced Instruction Set Computer (RISC) based architecture microcontroller) was chosen. The final proposed system integrates both H/W and S/W sub-systems aiming to convert all operations which were done manually by human to full computerized operation from remote location through a special GUI.
۳
Chapter One
Introduction
1.2 Introduction to GRS machine The GRS is a Gas Reduction System which is designed to receive the natural gas from the incoming gas pipeline, treat and condition the gas to meet the operating conditions specified by the manufacturer of the gas consumers. The GRS works in power station, the power station use the output of GRS as a fuel to operate the power station.
1.2.1 Elements of GRS Machine The GRS consist of the following elements: 1. Separator System The main purpose of the fuel gas filter/separator removes solid contaminants and liquid (condensed gas constituents) from the incoming gas flow. The filter elements are designed for continuous operation with max. 60°C. 2. Boilers The purpose of boilers is used to providing the desired heating for the water system. 3. Pressure Regulating The pressure of Gas can be regulate through adjusting valve into desired value. 4. Hot Water System The hot water system produces hot water for the gas heating system. 5. Local Control Panel The local control panel receives all status and alarm signals from the fuel gas supply system.
1.2.2 GRS Functional Description To heat up the fuel gas for the power station, a hot water system is used as a heat transfer medium. The hot water circuit is designed for a flow temperature of 90°C and a return temperature of 70°C. Natural fuel gas is applied as heating medium. The heat is generated by means of a hot water heater and a forced draft burner. The flue gas is conducted to a chimney. The hot water is circulated by an electrically driven pump, while the gas pressure is regulate through mechanical adjusting valve.
1.3 Embedded Software System Technique Embedded systems are finding widespread application including communication systems, factory automation, graphics and imaging systems, medical equipment and even household appliances. With the increasing emergence of mixed hardware/software systems, it is important to ensure the correctness of such a system formally, particularly for real-time and safety critical applications. The embedded system is regarded as a product which contains a microprocessor programmed to carry out some control functions but which is not a computer [3]. An embedded system encompasses a broad class ٤
Chapter One
Introduction
of systems, ranging, in principle, from a simple microprocessor based apparatus to complex systems controlling large plants, aircrafts and the like, in general the embedded is [4]: (1) An embedded system is an electronic system embedded within a given plant or external process. The external process comprises both a physical system (usually consisting of different subsystems) and also humans performing some supervising or parameter setting tasks. (2) Most embedded systems must fulfill stringent reliability requirements, usually detailed according to a set of functions to be performed.
1.4 Difference between Microprocessor and Microcontroller Essentially these two devices are similar, but with a little bit of difference. A CPU which is the heart of these devices needs a host of external devices to make it communicate with real-world. A typical system would need a system to read the inputs from keyboard, and write outputs to a terminal, store intermediate processing data into some memory, and to keep permanent information into some safe place [5]. These devices which are independent circuits, work in harmony with the CPU, to make one system. In a typical Personal Computer these devices are attached to the CPU, using hard-wired connections. This makes the system more flexible that means it can add more memory, change capacity of hard drives, sound cards etc. A microcontroller on the other hand is made up of most of these devices built exactly within the same package. The microcontroller will therefore contain, the CPU, RAM, ROM, Timers, I/O etc. all packed within one integrated circuit. This facilitates the development process, as well as reduces the requirements of external components; however this also means the ability of changing, the number and type of integrated devices. The applications where a microcontroller will be used vary. They are usually quite simple, and do not require as much processing power as a PC does, so the microcontrollers with varying amounts of RAM, ROM, I/O lines and timers etc have been made available. Essentially all are almost same, and they only vary in the number of resources available on them. So for a particular application that chose a microcontroller, not the one which has maximum resources, but the one which has just enough to do the job. Figure (1.2) shows the microprocessor and the microcontroller [6].
٥
Chapter One
Introduction
Figure (2.1) the microprocessor and microcontroller
Figure (1.2) microprocessor and the microcontroller Thus a microcontroller is a complete, small scale computer with all the necessary devices on-board. All needed is the external hardware, which can be used to drive, like sensors and motors etc.
1.5 Literature Survey • Rajesh Luharuka, Robert X. Gao, Sundar Krishnamurty [7] have discussed a microcontroller-based portable data logger for physiological sensing. The device is configured to receive skin conductance data from a commercial instrument, store them on its on-board memory, and relay them to a computer via the RS-232 serial port. The focus of the design is on portability and low power consumption for battery-driven ambulatory applications. A PIC microcontroller was used as the central control unit for the data flow coordination. • Mohd Suhaimi B. Sulaiman [8] developed GUI Based Remote On/Off Control and Monitoring Single lamp Phase. The proposed system developed by a PIC 16F877 microcontroller. The software uses Visual Basic to monitor and control the lamps. This project explain how to develop and design an asynchronous serial data communication link
٦
Chapter One
Introduction
between the site and central station using a microcontroller and to build a low cost GUI based remote on/off control. • Mohd Noor [9] Proposed a method for monitoring the Water Level and Temperature Status by utilized the PIC16F877 and MPLAB IDE software for programming. The project was designed to detect level and temperature of the water in a pool. The system functions when the level of water and the temperature in pool exceed the desired limits. •
Lock K.A [10] developed a system that controls a switch for lamp, door and alarm system using Visual Basic software. Visual Basic was chosen because it can easily communicate between computer and mobile phone. The system used computer and mobile phone to send and receive the text messages.
• Ea Ai Choon [11] showed the DC motor speed control system by using microcontroller PIC 16F877A. It is a real time control system. A program in Visual Basic 6.0 is developed to provide a graphic user interface (GUI) for the user to enter desired speed at computer ,also the system shows a graph of motor speed versus time to let the user monitor the performance of the system easily. • Herdawatie A. Kadir [12] investigated the GSM-based one of the main source of power of energy to operate control home appliances for smart home such as light, air conditioner etc. The system was integrated with PIC16F877A, the microcontroller unit automatically controls the electrical home appliances by switching ON or OFF the device according to the user order. • R. Garrido and R. Miranda [13] proposed a new method for closed loop identification of position controlled dc servomechanisms. The loop around the servo is closed using a Proportional Derivative (PD) controller. A model of the servo is simultaneously controlled using a second PD controller. Properties of the identification scheme are studied using Lyapunov stability theory. • W. Aung [14] described the analysis on modeling and simulink of DC motor and its driving system, hardware and software. For DC Motor Modeling, it can be analyzed with control techniques of Step response, Impulse response and Bode plot by using MATLAB Simulink. All data based on the internal circuit of a simple DC Motor and its features can be analyzed both by Control System design calculation and by MATLAB software.
۷
Chapter One
Introduction
• Hanafi et al., [15] presented an active axis controller for a conventional CNC machine. To develop the system, a two-stage approach has been taken. In stage one; a generic external axis controller is designed to bring the machine under the real-time control of an external computer. Stage two is the design of the active axis controller. To achieve this, a sensor feedback loop is added to the external controller to enable visual servoing. • Konar and A.K. Mandal [16] had given a microprocessor based automatic position control scheme. They had designed for controlling the azimuth angle of an optimally tilted photovoltaic flat type solar panel or a cylindrical parabolic reflector to get the illuminating surface appropriately positioned for the collection of maximum solar irradiance. The proposed system resulted in saving of energy. • Zeroual et al. [17] had designed an automatic sun-tracker system for optimum solar energy collection. The system used the electro-optical sensors for sun finding and a microcontroller unit for data processing and for control of the mechanical drive system. This system allowed solar energy collectors to follow the sun position for optimum efficiency. The system had been tested for a long period in variable illumination. The result showed that it operated satisfactorily with high accuracy. • Dogan Ibrahim. [18] had developed a Microcontroller-Based Temperature Monitoring the Control system involved the use of microcontrollers in measurement and control systems .The system implemented by using a GUI based on visual basic and programming the PIC16F877A using the C-language. • Theerawut Jinayim et al. [19] proposed an efficient low power consumption tracking solar cells for white LED-based lighting system in 2007. In this system, they used the dc power generated by fixed solar cells module to energize white LED light sources that were operated by directly connected white LED with current limitation resistors. • Craig Steiner [20] discussed about the 8051 family of microcontrollers. In addition to the types of memory, special function registers, basic registers, basic registers, addressing modes discussed in this tutorial additional features including introduction to 8052 and timers are also described.
۸
Chapter One
Introduction
1.6 Aim of Thesis The aim of the work is to design and implement a remote control system that works from PC based on Windows platform, performed successfully transmitting and receiving the data between the computer and the PIC microcontroller, through GUI for controlling and monitoring the GRS machine to satisfy the following goals:
1. Convert all the manually control operations of GRS machine into computerized operations. 2. Monitoring and controlling of the GRS machine from remote location through GUI. 3. Limiting the probability of Fault and error in the system. 4. Add automatic operation mode as a command Push button to the GRS machine in the GUI which allow automatic operations without human interactions. 5. Simulate the local manual control panel of GRS machine in to similar view but in software package form as a GUI for the system operator. 6. Designing and implementing an integration software and hardware proposal system.
1.7 Thesis Outline This thesis is organized in five chapters. The contents of the following chapters are briefly reviewed here as follows:
Chapter two: This chapter devoted to preliminary work required for implementation of the GUI Based Remote Control of (Gas Reduction System) using PIC Microcontroller and embedded software system that accessed and automated by a prorate GUI by using a PIC microcontroller, Several hardware and software related issues are customizing tools and devices for implementation are treated in this chapter.
Chapter three: provides details for the implementation of the final integration hardware and dual software programming techniques, also this chapter describes the steps of design and implementation step by step which lead to implement a proposed intelligent system that able to convert the manual operations of GRS which were done by human manually into full computerize operations, and from remote location.
۹
Chapter One
Introduction
Chapter four: presents the system experimental test and results , this chapter illustrates the real implementation and testing performed by connecting the final integration H/W and S/W with the GRS machine to replace the manual traditional operations of GRS machine, also in this chapter the oscilloscope waveforms of the input and the output signals have been presented.
Chapter five: The final conclusions have been made from the design stages test and system results. Finally some highlights on some future works have been presented.
Appendix A: The data sheet for PIC 16F877A Appendix B: The data sheet for PIC Programmer Appendix C: The data sheet for transistor type (2N3904)
۱۰
Chapter Two Hardware and Software Components for Controlling GRS
Chapter Two
Hardware and Software Components for Controlling GRS
Chapter Two Hardware and Software Components for Controlling GRS 2.1 Introduction The GRS system is a unit in electrical power station which is responsible on controlling gas pressure and temperature. This chapter focuses on some key devices and tools (H/W and S/W) used for monitoring & controlling The (GRS) unit. A detailed description is presented for (PIC16F877A) Microcontroller which is the core of proposal embedded system for implementing a full computerize control from remote location that is compatible with aspects of a (GRS) .Finally the embedded software system is accessed and automated by a prorate GUI ,this GUI(built in Visual Basic) is presented and explained in details.
2.2 Overview of GRS System The GRS is a Gas Reduction System which is used to control the gas pressure and the gas temperature, the GRS works in Erbil power station, the power station uses the output of GRS as a fuel to operate the power station, the GRS system is shown in figure (2.1)
Figure (2.1) view of GRS system 12
Chapter Two
Hardware and Software Components for Controlling GRS
The GRS system contains boilers for heating inlet gas into desired set point. Figure (2.2) shows the local control panel inside GRS system. The GRS control panel contains two types of digital signals the first one involves LED Light Emitting Diodes as a signals indicators while the second type involves the ON-OFF switches. There are three types of LED indicators; Green LEDs refer to the normal operations, Red LEDs to indicate fault or alarm cases, and Yellow LEDs for event of proper operation. Whereas, the ON-OFF switches consist of two types of switches the push buttons switches, and mode selector switches.
Figure (2.2) local control panel of GRS
13
Chapter Two
Hardware and Software Components for Controlling GRS
The main problem in GRS is that ,all operations of monitoring and controlling of GRS are handled by technician (human driven control) who has some experience and certain level of skill in controlling GRS machine ,this type of monitoring may subjected to human fault due to inaccuracy of human driven control which may include wrong decisions or late response to certain critical events ,taken in consideration that the monitoring and control processes of GRS are done from far off location about(150m) from GRS and control room. Hence the computer driven control for GRS system is achieved by using dual software programming techniques, each techniques works in a different software level of proposed system, the first level of software programming technique is the embedded software which used for programming the PIC microcontroller by using C-language that default software debugs environment of the PIC manufactory cooperation. The second level of software programming technique include designing special graphical interfacing GUI by using Visual Basic which enables remote controlling and monitoring of GRS because of the final GUI is similar to the real control board panel of GRS , so the operator will not find it strange from the panel he used to work on with added facilities like automatic control mode which is derived from the idea of the auto-pilot navigation system presented in aircraft that enables the pilot to suspend manual control and activate automatic control. In the presented controller, this mode is activated by clicking special push button (Automatic System mode) that allows automatic operation of GRS system. Hence, this interactive interfacing media for the operator (human) facilitate the controlling of GRS and reduce the faults and errors space in the system operation. The final system integrates both of H/W and S/W system to convert all operations which were done manually by human to full computerize operation and from remote location.
2.3 GRS System Control Status The sequences of events for GRS are described in the flow chart depicted in figure (2.3). The initial status represent the last events happened in the GRS system, the system saves the recent status unless the system status changed by the operator.
14
Chapter Two
Hardware and Software Components for Controlling GRS
The following flow chart in figure (2.3) depicts the manual control operations of GRS by classifying these operations to the following actions: starting, resetting, checking, monitoring operation.
Initial status
Energized main power Manually
Reset Fault
NO
Boiler Ready to start ?
Yes Starting Sequence of Events
NO Boiler started? Yes Assign certain Set Point(SP)
Boiler tempretureSP
Boiler temp>2*SP NO
NO
NO
Actual Tempreture