Sie sind auf Seite 1von 95

Automated Light Controller Using Fuzzy Logic

This thesis is presented to the Graduate School In fulfilment of the requirements for Master of Science (Intelligence System) Universiti Utara Malaysia

By

Morad Ali Ambarem Saleh

Copyright Morad Alwerfally, June 2008. All rights reserved.

ABSTRACT
This study describes the implementation of fuzzy logic in designing fuzzy automated light controller. The fuzzy controller controls the number of lamps lighted up based on the number of people inside the room. Its main objective is to demonstrate how fuzzy logic can minimize the number of lamps used and therefore reduce the electricity consumption. In this study, fuzzy logic controller has been implemented and tested to predict the behaviour of the controller under different light conditions by monitoring the membership function parameters. In a conventional light controller, the lamps change according to users specification. The light will remain on if the user forgets to switch off the light. Even if an automated light controller exist, at most the system can only be controlled as on and off without being able to adapt with dynamic inputs. Fuzzy logic offers a better method than conventional control methods, especially in the case of counting the number of people and how much the light intensity is needed. In this study, fuzzy logic has the ability to make decision as to how much the light intensity is needed by controlling the number of lamps in the room according to the number of people who have entered or left the room. On the other hand, the conventional light controller does not have the ability to solve this kind of issues. It would be more practical to let more lamps "on" if the light intensity needed is very bright. A conventional method controller for this decision is difficult to find while fuzzy logic controller simplifies the task. This study has achieved its objective, which is to design a fuzzy logic system integrated with hardware circuit of automated light controller using fuzzy logic to control light intensity in a room. In this study, tests cases have illustrated that fuzzy logic control method could be a suitable alternative method to conventional control methods that could save electricity consumption and offers ease of use to human being.

TABLE OF CONTENTS

Permission to Use . i Abstract (Bahasa Melayu) ii Abstract (English) iii Acknowledgment .... iv Table of Contents v List of Figures ..ix List of Tables .. x List of Abbreviations .. xi

CHAPTER 1: INTRODUCTION

1.0 Background ...1 1.1 Problem Statement ....4 1.2 Objectives of The Study ....5 1.3 Research Question.....5 1.4 Significance of The Study.............5 1.5 Scope of The Study ......6 1.6 Thesis Overview ...6

CHAPTER 2: LITERATURE REVIEW

Fuzzy Logic ............8 3

Decision Support....12 Embedded Systems ...15 Conclusion ....20

CHAPTER 3: METHODOLOGY

3.1 Introduction .21 3.2 Fuzzy Logic Systems...24 3.3 Software Development 26 3.3.1 Fuzzification.27 3.3.2 Fuzzy Inference .29

3.3.3 Defuzzification..31 3.4 Integration of Software ...33 3.4.1 Fuzzy Logic Controller Design.35 3.4.2 System Design..36 3.4.3 Circuit Design...39 3.4.3.1 Microcontroller AT89C52.39 3.4.3.2 Transmitter and Receiver Circuits (TX & RX).41

3.5 Hardware Circuit Development ......44 3.5.1 Hardware Implementation45 3.5.1.1 Personal Computer.46 3.5.1.2 Parallel Port Cable (LPT)...46 3.5.1.3 Infrared Sensor (Receiver & Transmitter).47 3.5.1.4 Transmitter Circuit48 4

3.5.1.5 Reciever Circuit.49 3.5.1.6 Microcontroller Circuit..50 3.6 Interface Microcontroller and Test the design 52 3.6.1 Transmitter Circuit Interface.52 3.6.2 Receiver Circuit52 3.6.3 Receiver and Transmitter Circuits53 3.6.4 Microcontroller Circuit.54 3.6.5 The whole Circuit of Automated Light Controller using Fuzzy Logic54

CHAPTER 4: RESULTS AND DISCUSSION

4.1 4.2 4.3

Fuzzificatoin..55 Fuzzy Inference......62 Defuzzification...66

CHAPTER 5: CONCLUSION AND RECOMMENDATIONS

5.1 Conclusion ..72 5.2 Recommendations ..73

REFERENCES References 74

LIST OF FIGURES

PAGE Figure 3.1 Figure 3.2 Figure 3.3 Figure 3.4 Figure 3.5 Figure 3.6 Figure 3.7 Figure 3.8 Figure 3.9 Figure 3.10 Figure 3.11 Figure 3.12 Figure 3.13 Figure 3.14 Figure 3.15 Figure 3.16 Figure 3.17 Figure 3.18 Figure 3.19 Figure 3.20 Figure 3.21 Figure 3.22 Figure 3.23 Conventional Design and Fuzzy Logic Controller Design...22 The flowchart of the work flow............23 Components of a Fuzzy System ..24 The generic structures of an automated light controller using fuzzy logic...24 The Structure of a Fuzzy and Control System..27 Basic Fuzzy Logic Design for Automated Light Controller using Fuzzy Logic..27 Membership Function of No. of people (Variable 1)...29 Membership Function of Light Intensity (Variable 2)..29 The output of Defuzzification...32 The Defuzzification Code.32 The integrated FL and Hardware for the Automated Light33 The flow of integrated system..34 Fuzzy Logic Control Design.35 Detail FLC System35 Context Diagram...36 Lamps control system...36 No. of people in system37 No. of people out of system..37 Lamps fuzzy system..37 Light control system.38 No. of people in system38 No. of people out of system..39 Light Fuzzy System..39

Figure 3.24 Figure 3.25 Figure 3.26 Figure 3.27 Figure 3.28 Figure 3.29 Figure 3.30 Figure 3.321 Figure 3.32 Figure 3.33 Figure 3.34 Figure 3.35 Figure 3.36 Figure 3.37 Figure 3.38 Figure 3.39 Figure 3.40 Figure 3.41 Figure 3.42 Figure 3.43 Figure 3.44 Figure 3.45 Figure 3.46 Figure 3.7 Figure.4.1: Figure.4.2

Microcontroller System40 :No. of people in system (microcontroller)..40 No. of people out of system (microcontroller).41 TX and RX circuit A System41 TX circuit A..42 RX circuit A..42 TX and RX circuits A Fuzzy System...42 TX and RX circuit B System43 TX circuit B..43 RX circuit B..43 TX and RX circuits B Fuzzy System44 Block Diagram of Fuzzy Control Lighting System.45 Hardware Architecture.45 Structure of LPT...47 Infrared Sensor..47 IR Transmitter Circuit...48 IR Receiver Circuit...49 Microcontroller Circuit Diagram..50 The whole Circuit Diagram..51 Transmitter Circuit Interface....52 Receiver Circuit Interface.....53 Receiver and Transmitter Circuits Interface.53 Microcontroller Circuit Interface..45 The Circuit of Automated Light Controller using Fuzzy Logic Interface ...55 Membership Function graph for No. of People56 Membership Function graph for Light intensity..56

Figure.4.3 Figure.4.4 Figure.4.5 Figure.4.6 Figure.4.7 Figure.4.8 Figure.4.9 Figure.4.10 Figure.4.11 Figure.4.12 Figure.4.13 Figure.4.14 Figure.4.15 Figure.4.16: Figure.4.17 Figure.4.18 Figure.4.19 Figure.4.20 Figure.4.21 Figure.4.22 Figure.4.23 Figure.4.24 Figure.4.25 Figure.4.26 Figure.4.27 Figure.4.28

The Fuzzification Phase57 Fuzzification Test1: NP=3, LI=2.57 Membership Function graph for NP=3.58 Membership Function graph for LI=2.58 Fuzzification Test2: NP = 4, LI = 2..59 Membership Function graph for NP=459 Membership Function graph for LI=2..59 Fuzzification Test3: NP = 4, LI = 4..60 Membership Function graph for NP=4.60 Membership Function graph for LI=4..60 Fuzzification Test4: NP = 6, LI = 6..61 Membership Function graph for NP=6.61 Membership Function graph for LI=6..61 FAM Table Algorithm..63 FAM Table Test1: NP=3, LI=264 FAM Table Test2: NP=4, LI=265 FAM Table Test3: NP=4, LI=465 FAM Table Test4: NP=6, LI=666 The Defuzzification Phase67 Defuzzification Membership Function Test1...67 Defuzzification Test1: LI = 2 = LOW..68 Hardware Design Test1= 2lamps..68 Defuzzification Test2: LI = BRIGHT...69 Hardware Design Test2 = 3lamps.69 Defuzzification Test3: LI = BRIGHT...70 Hardware Design Test3 = 3lamps.70

Figure.4.29 Figure.4.28

Defuzzification Test4: LI = BRIGHT..71 Hardware Design Test3 = 4lamps71

LIST OF TABLES

PAGE Table 3.1 Table 3.2 Table 4.1 Rule Block (FAM Table)...30 Light Intensity (Membership Function Relative Membership)31 FAM Table.62

10

CHAPTER 1 INTRODUCTION

This section briefly presents the background, problem statement, objective, research question, significance and scope of study. The main idea of this study is to implement Fuzzy logic in lighting control and as an alternative method of conventional lighting method.

1.0 BACKGROUND

A control system is a device or set of devices to manage, command, direct or regulate the behavior of other devices or systems. A control system combinations of components (electrical, mechanical, thermal, or hydraulic) that act together to maintain actual system performance close to a desired set of performance specifications. In recent years, control system dependability has received much attention with the increase of situations where the systems that are controlled by computer such as home control systems are used (Izumikawa et al. 2005).Neil (2004) defines control system as an interconnection of components to form a system configuration which will be provided or (supply) the required system response. Control is automatic unless if it is not accomplished by manual (human) effect. One of the most common home control systems is lighting control.

11

Lighting controls, addressing controls for electric lighting, offer desired illuminance at appropriate times while reducing energy use and operating costs of lighting system. Lighting control systems are an important method for reducing energy consumption and moderating peak demand in commercial buildings (Francis et al. 1993). Lighting control systems provide building operators with the means to manage the way lighting energy is used in buildings more efficiently. These systems use various control strategies to reduce wasted hours of lighting in unoccupied spaces, automatically adjust electric light levels in synchrony with available daylight or agerelated changes in luminaries output or selectively shed lighting loads to moderate peak demand (Cziker et al. 2007).

Fuzzy logic is a form of logic used in some expert systems and artificial intelligence applications. Such logic is originated in 1965 by the scientist Lotfi Zadeh from the University of California. Fuzzy logic is much more general than conventional logical systems. The main generality of fuzzy logic is needed to solve the complex problems in the realms of search, question-answering decision and control. It provides a Foundation to develop new tools to deal with natural language and the representation of knowledge. Among these tools are: Computing with Words (CW); Precisiated Natural Language (PNL); Computational Theory of Perceptions (CTP); Proto form Theory (PT); Theory of Hierarchical Definability (THD); Perception-Based Probability Theory (PTp); Unified Theory of Uncertainty (UTU) (Zadeh, 2004).

Fuzzy logic has been applied in different fields, such as the control mechanism and decision support. The fundamental idea in the applications of the fuzzy logic is that people are capable of decision-making using inaccurate or uncertain knowledge, while algorithms of conventional

12

computer require accurate information. Fuzzy logic provides a means representation of human knowledge.

Fuzzy logic has been proved to be very powerful in the disciple of system control such that the controller is defined by collection of fuzzy if-then rules (Cristina et al. 2002). There are many motives that prompted scientists to develop the science of Fuzzy Logic with the evolution of computer and software that can deal with inaccurate information. Fuzzy Logic (FL) is a very powerful technique that has been used successfully in control systems such as automated washing machine, cameras and others. Fuzzy Logic controller (FLC) has proved that it is a suitable alternative to conventional control algorithms such as PID controllers in terms of flexibility and fast reactions, simplest design, and good performance (Philip , 2007). . An automatic lighting control system is used to automatically switch off unneeded lighting. Automatic lighting control systems by turn on and off the lights for a specific time, or will be dimmed depending on some external factors that is aimed to save energy costs and increase lamps life ( Hydro, 1990).

1.1 PROBLEM STATEMENT

13

Conventional control design methods use mathematical models for system development including its input in designing controllers. Fuzzy control refers to the control of process through linguistic descriptions (Tsoukals & Uhrig, 1997). The conventional Fuzzy logic is easy to perform in industry due to its simple control structure, ease of design and inexpensive cost (Wai et al., 2004). Based on Fuzzy logic studies, adaptive Fuzzy logic control given better performance than Fuzzy logic control ((Wang, 1994), (Lin & Yang,200),(Jee & Koren, 2004), (Woo et al, 200)). To control the controller, several adaptive Fuzzy techniques have been suggested such as membership function tuning, output and input scaling factors tuning and linguistic rule tuning (Liang, 2002). In this study, tuning is performed on the membership function.

To investigate the effect of fine tuning of membership function, several electrical equipments have been considered. Designing integrated circuit for the electrical equipments could be very time consuming. Therefore, lighting control has been considered due to its complexity and the time frame given to investigate the problem.

1.2 OBJECTIVE

The objective of this research is to use fuzzy logic system for flexibility and fast reactions result for automated light controller. The specific objectives are:

14

To design the circuit required for implementing automated light controller using fuzzy logic

To test the functionality of fuzzy logic implemented in integrated circuit which designed in chapter 3.

1.3 RESEARCH QUESTION

Based on the research objectives, the research question is:

How does Fuzzy Logic controller circuit design can be implemented and tested the functionality of the integrated circuit?

1.4 SIGNIFICANCE

As the light is automatically controlled, the use of the electricity is also controlled by the engine. In other words, when nobody is around to use the light, the controller will break the electric circuit and therefore the light will be off. This implies that unnecessary use of electricity when nobody is around is somehow produced.

The other advantages offer by the study is that the system assists the human in improving the ease of use of the electrical lighting and indirectly this leads to electricity saving.

15

1.5 SCOPE AND LIMITATION

In this study, the tuning is only graphs. Performed on the membership function the future improvement can be mode on other parameters such as other types of membership function graph.

The number of lamps is limitation to 7 only. This could be further increased based on the complexity of the problem.

The system is only meant for non-wireless application.

1.6 THESIS OVERVIEW

This project presents in detail in the following chapters. The first Chapter is an introduction chapter that explains the background overview, problem statements, objectives, significance of this study and scope. Literature reviews about fuzzy logic, decision support and embedded systems in second chapter. Third chapter discusses methodology in six phases: fuzzy logic system, software development, integration of software and microcontroller hardware, hardware circuit development, and interfacing the PIC with the hardware that will include the testing and evaluation of the system. Fourth chapter will reveal the results of the project discoveries. The conclusion of this project is discussed in chapter 5.

16

CHAPTER 2 LITERETURE REVIEW

This work is derived from existing research in a number of related areas including fuzzy logic, decision support, and embedded systems. This chapter contains relevant review of related literature to the study domain.

2.1 Fuzzy logic

Fuzzy logic is never a new concept, Lotfi Zadeh has introduced fuzzy set theory as far back as 1965 (Yager & Zadeh, 1992). According to Goonatilake and Khebbal (1995), Zadeh developed mathematics of fuzzy logic to provide a tool for reasoning an approximate (imprecise) model rather than exact (precise) one. Despite the fact that fuzzy logic also allows statement to be represented in two states as true of false as in the traditional binary or boolean logic, it is still differs from either the Boolean or binary representation since it uses human understandable linguistics term in expressing the knowledge of the system (Oala, 1994). Fuzzy logic has contributed immensely to the development of artificial intelligence in producing intelligent machines which invariable has gone a long way in promoting the concept of knowledge-driven system ( Friedlob & Sehleifer, 1994).

17

Fuzzy logic is a paradigm for an alternative design methodology, which can be applied in developing both linear and non-linear system for embedded control. By using Fuzzy logic, designer can realize lower development costs, superior features, and better and product performance. Furthermore, products can be brought to market faster and more cost effectively (Aptronix Inc., 1996).

Similarly, in the Zadehs proposed set generalization theory where membership of some elements are more thoroughly defined than others. The degree of membership in a particular set may assume various values ranging from zero to maximum value where zero value denotes complete exclusion and maximum value indicates complete membership. A good example of fuzzy logic application are more prominently found in medical field where expert system is developed for the treatment of certain ailments like collagen disease and pneumonia ( Godo et al., 2000) and Clinical Practice Guidelines (Liu & Shefman, 1996).

The rules used in fuzzy logic found their root from the natural language. The rules are closer to human reasoning. A single fuzzy rule might represent several conventional rules. The fact that fuzzy logic creates a control platform by combining a number of rules and fuzzy variables states, system control can be achieved despite the fact that , the mathematical behaviour of the system is incomplete. The following criteria were set out for the applicability of fuzzy logic ( Gradojevic et al., 2001):

18

The variables involved must be continuous and non-discrete in nature. There must not be a specific mathematical model The relationship between input and output must be non-linear There must be clearly stated rules explaining input-output dependence

The process in fuzzy logic involves formalizing the symbolic processing of fuzzy linguistic terms, like excellent, good, fair and poor, which are associated with differences in an attribute describing a feature (Mandel, 1995). Virtually all decision making processes in the real world takes place in an environment where the goals, the constraints and the consequences of possible actions are not clearly stated. Several linguistic terms can be used at a particular instance of fuzzifying a system. Fuzzy logic intrinsically represent notions of similarity, since good is closer and more similar to excellent that it is to poor (Waston, 1998). Garibaldi (1997) stated that in multi-valued logic, truth values are represented by asingle real number in the interval [0,1] where 0 represents false, 1 represents true and intermediate values between 0 and 1 (i.e 0<value<1) represents partial truth. Whereas in fuzzy logic true and false are represented by fuzzy subsets over the interval [0,1] with arbitrary fuzzy subsets representing other intermediate values.

The conventional control system and fuzzy system are quit alike. The only difference is that a fuzzy system contains a Fuzzifier which converts inputs into Fuzzified variables and a Defuzzifier which converts the output of Fuzzy control process into numerical value output ( Gradojevic et al., 2001). In a Fuzzy system the process of generating the output (control) starts with accepting inputs, fuzzifying the accepted inputs, and finally executing all the rules from the

19

active rules base. The output of the active rules is generated in single form which reproduces a new output after defuzzification.

Information from Aptronix Inc., (1996) revealed that, fuzzy logic has been gaining increasing acceptance in the past few years. There are over two thousand commercially available products developed based on the concept of Fuzzy logic, ranging from washing machines to high-speed trains. Nearly every application has some potential elements of fuzzy logic which contributes to the quality of the product such as performance, simplicity, reduced cost and efficiency. It has become almost impracticable to produce a commercially valuable product without introducing some elements of fuzzy logic. Since invention, fuzzy logic has recorded unprecedented successes. It has proved to be a very useful technique in solving various problems in a diverse domain, though its popularity is very recent. The imprecision features of fuzzy system makes it to be more applicable in decision system; this makes it to be able to accommodate the ambiguity component of human expression, such that the vagueness and uncertainty contained in such an expression can be modeled in the fuzzy sets, and a pseudo-verbal representation, similar to an experts formulation, can be achieved ( Hasilogu et al., 2003). Fuzzy logic avoided the abrupt change from one discrete output state to another when the input is changed only marginally. This is achieved by a quantization of variables into membership functions (Herrmann, 1995).

2.2. Decision Support

20

Fuzzy logic has been practically applied to quite a number of decision-support system. It is particularly suitable for medical decision support system. The knowledge-based expert systems have been developed in medicine after the introduction of Lotfi Zadeh of fuzzy logic; a good example is the MYCIN system. The knowledge-based medical expert systems have witnessed an unprecedented growth shortly after the introduction of MYCIN. Practically each of these systems attempts to deal with unconvinced, by directly applying fuzzy logic. The elements of uncertainty in medical decision-making are fuzzified by the fuzzy logic concept to be able to provide a reliable medical decision-support system through theoretical framework for medical expert systems (Donna & Mauric, 1994).

The intensive care medicine often involves making quick decisions based on a wide variety of information. To make medical decisions, intensive care unit (ICU) doctors often rely on conventional wisdom and personal experience to reach a subjective assessments and judgments. This requires intuitively, or unclear weighting of different factors to achieve an ideal balance between clinical end points that are often competing. Recently there has been concern about the increasing burden of unwanted considerable variation in clinical practice. As a result, physicians are increasingly asked to join the explicit guidelines that were agreed upon by the medical community at large. Consequently, there is growing interest in computer-based decision support tools to automate aspects of medical decision-making taking place in complex clinical areas such as the ICU. However, Fuzzy logic methods are capable of solving this prevailing problem by producing efficient algorithms that can accommodate the uncertainty nature of clinical-decision making (Jason & Michael, 2003).

21

Garibaldi (1999) presented the application of fuzzy expert system technique in interpreting the acid-based balance of the blood in the umbilical cord of new born infants. The Spearman Rank Order Correlation statistics was used to assess and to compare the performance of a commercially available expert system, an initial fuzzy expert system was compared against a tuned fuzzy expert system with experience clinicians. The study revealed that, without tuning, the performance of the crisp system was significantly better (correlation of 0.80) than the fuzzy expert system (correlation of 0.67) the performance of the tuned fuzzy expert system was better than the crisp system and effectively indistinguishable from the clinicians (correlation of 0.93) on training data, and was the best of the expert systems on validation data. This further confirms the suitability of fuzzy logic in building medical decision-support system.

The development of computerized systems in medicine and biology, had faced several obstacles, and one of the most prominent problems was the inherent uncertainty. Life sciences are not amenable computational solutions for the following reasons:

The lack of full understanding of the mechanisms of biological organisms, and the inability to obtain complete information state of the organism.

Lack of precision with ranges of normal physiological parameters and values, and complications arising from the interaction of several physiological systems functioning simultaneously.

The complex nature of human made it extremely difficult to model. There are had been series of effort in the medical field towards developing medical decision-support systems. These systems

22

have taken steps in the modeling of complex problems and producing practical support decisionmaking process (Metin et al., 1997). .

According to Marks et al. (1995) the system of sustainable farming must be considered, in order to meet some standards ranging from economical, environmental and social. The three methods of Multiple Criteria Decision Making (MCDM) are described to represent a range of problems that may arise using conventional MCDM methods. These problems include: (1) the treatment of incommensurate units; (2) the ranking procedure for a solution; and, (3) the degree of discrimination between attribute values. The system of sustainable farming must be considered, some of the economic, environmental and social standards are required to be met in order to have a more profitable farming process.

2.3. Embedded Systems

Fuzzy logic is a powerful problem-solving methodology with a wide range of applications in embedded control and information processing. Fuzzy logic provides a remarkable simple way to

23

drawing conclusion from vague, ambiguous or imprecise information. In a sense, fuzzy logic resembles human decision making with its ability to work from approximate date and find precise solution (Awad, 1996).

Fuzzy logic has been found to be suitable for embedded control applications. Several manufactures in the automotive industry are using Fuzzy technology to improve products quality and reducing development time. In aerospace, Fuzzy enables very complex real time problems to be solved using a simple approach. In consumer electronics, Fuzzy is proven to be unavoidable in increasing equipment efficiency and diagnosing malfunctions (Aptronix Inc., 1996).

According to Ilyas and Yunis (2006) the changes brought to the production methods and process as a result of modernization requires a great flexibility and fast reaction in order to be able to cope with the prevailing challenges. Such challenges trigger the non-linear system behaviour of partly unknown systems, the conventional control methods does not offer good performance. The introduction of fuzzy logic (FL) control has come to play an important role in meeting the requirements to be able to face the new challenges. This is achieved by applying a strategy that supports simplicity of design, based on linguistic information. This makes fuzzy logic (FL) control method to outperform the conventional PID control method most especially in the nonlinear industrial systems.

The technical control of fuzzy logic was applied to improve the efficiency of energy balance of a dimmer light implemented in passive optical fiber daylighting system. In this work, Fuzzy logic (FL) was used as measurement of intensity and occupancy in a room to control both parameters to

24

accomplish a constant level in illuminance in the room. The result is obtained as the energy power savings, this establishes the benefits and value of sunlight in addition to a clean, environment friendly day lighting system. (Sulaiman et al., 2005).

The process of mixing plays a pivotal role in the production of beverages to determine the rate of output of production. Therefore, the inputs proper control it is necessary to be embedded in such a system. The mixture rate of the concentration has been indiscriminate in nature and unstable in the form of a wave, Therefore, a fuzzy logic control is necessary for developing and implementing an effective and efficient mixing process in factory production company bottling (Nigerian Bottling Company Plc as a case study), so that a stable and optimal mixing process is guaranteed (Philip, 2007).

According to (Chuen, 1990) the lack of quantitative data regarding relations of inputs and outputs make the world of industrial processes to become uncontrollable by the conventional control methods. The applications of fuzzy set theory in fuzzy control have attracted several research interests in these applications. The fuzzy logic controller (FLC) based on fuzzy logic offers the possibility of translating a linguistic control strategy based on expert knowledge into an automatic control strategy.

According to Brackney and Shoureshi (2000) in their article titled Fuzzy-Based Self-Organizing Control for Building Systems, a self-organizing controller based on fuzzy set theory is applied to the problem of building temperature and lighting control. Fuzzy sets offering area occupancy,

25

facility cost, and building dynamics are used as inputs to an adaptive fuzzy relation algorithm that generates local controller set points.

It was gathered that, fifty percent energy savings was presented with automatic lighting controls which applied at an office building in the San Francisco Bay Area. This system was used to apply the energy savings and require reduction capabilities lighting control system designed to exploit all the main control strategies, including scheduling, daylighting, and cavity maintenance. In the work, it was indicated that, appropriate lighting controls may represent one of the most effective methods of minimizing in energy use to achieve reduced electricity requirement in buildings (Francis et al. 1993).

According to Mohd. et al. (2003) the development of intelligent lighting management system outgrowing nowadays. The main objective is to make lighting controls easily accessible for residents so as to achieve an optimized lighting design. In the project, ts lighting control was selected since light serves as the backbone of an household electrical appliances. With the system, all the lights in different places within a household can be controlled from one main switch panel. His makes control and monitoring easier, mostly done by only one person at a particular location where the switch panel is installed. Designing lighting management system of a smart house has been successfully achieved.

Ziqiang et al. (2000) developed a closed loop control system incorporating fuzzy logic for solving a class of industrial temperature control problems. A unique fuzzy logic controller (FCL) structure with an efficient realization and a small rule base that can be easily implemented in

26

existing industrial controllers was proposed. It was subjected to both software and hardware test within an industrial setting that, the fuzzy logic control is much more capable that the current temperature controllers. This statement has been confirmed with the following achievements of fuzzy logic controller:

It compensates for mass changes in the system It deals with unknown variables It operates at a very different temperature without re-tuning.

This is achieved by constructing in FLC, a classical control strategy, an adaption mechanism to compensate for the dynamic changes in the system. The proposed FLC was applied to two different temperature processes and significant improvements in the system performance were observed in both cases. Furthermore, the stability of FLC is investigated and a safeguard is established. This research focuses mainly on fuzzy logic control as an alternative strategy to the current proportional integral-derivative (PID) method used widely in the industry.

The temperature is measured by suitable sensory equipment such as Thermocouples, Resistive Thermal Devices (RTDs), Thermistor, or other suitable electronic devices. The signal produced by these devices is converted into a signal acceptable to the controller. The controller compares the temperature signal with the desired temperature standard and actuates the control element. The control element then alters the manipulated variable to change the quantity of heat being added or taken from the process. The controller is purposely to regulate the temperature as close as possible to the set point. To test the new fuzzy logic control algorithms, two temperature regulation processes were used in this research. One used hot and cold water as moderating

27

variable and as the controller element, the other uses electricity as a power source to a heater, actuated by a Solid State relay (SSR). The new algorithms were tested extensively in both the simulation and the hardware test.

According to Cziker et al. (2007) the concept of continual development has attracted a lot of interests since lighting as any daylight concept has been very promising energy-dimming opportunities; depending on some specialists, the possibility of achieving energy savings could exceed 40%. On the other hand, daylight is a dynamic source of lighting, and the skys luminance is not constant, and the changes in daylight can be quite noticeable depending on season, place, latitude, or cloudiness. The lighting control systems are expected to adjust the lighting systems when necessary in order to conform to the changing lighting conditions. Based on continuous dimming the conventional control systems depict several difficulties to adapt their performances to the quick changes in daylight and to preferences of occupants. Fuzzy control systems have been adopted universally alternative to conventional control systems, it has been implemented in the day lighting control systems.

Antonio and Jacobo (2000) designed and developed equipment that permits the development and implementation of fuzzy control applications which are tested on modern home application, water temperature and flow control. Achieving impressive characteristics of, firstly, compact, strong and easy to use fuzzy application development equipment. Secondly the characteristic of reduced hardware cost by utilizing many components which are recovered from old PCs. Thirdly the computational methods uses table as well as integer calculation, achieving a reasonably speed with low memory. Fourthly the characteristic of flexibility as the equipment can be used as a data acquisition system or as any other (non-fuzzy) control application development system. It worked

28

on both slave (computer attached) and stand-alone mode. Finally, the code is written in assembler so it is optimized.

2.3 CONCLUSION

. Fuzzy Logic controller (FLC) has proved to be more suitable than the conventional control

algorithms such as PID controllers in terms of flexibility and fast reactions, simplicity in the design, and good performance. Embedded control Fuzzy Logic (FL) is an example for an alternative design methodology that can be performed to the development of both linear and nonlinear systems. Conventional and a Fuzzy approach have been used to develop a controller.

29

CHAPTER 3 METHODOLOGY

This chapter describes the discussion states well the developing of fuzzy logic system and its developing followed by the methodology used in the study the circuit design and the electronic components. This section is designed to be part of automated controller lighting to control the light intensity according to the number of the persons who entered or left the room. The electronic circuits are defined in three circuits they are Infrared Transmitter, Infrared Receiver, and PIC microcontroller Circuit, detail descriptions of each circuit and component are described in this chapter.

3.1 Introduction

30

Embedded control Fuzzy Logic (FL) is an example for an alternative design methodology that can be performed to the development of both linear and non-linear systems. Conventional and a Fuzzy approach have been used to develop a controller, the sequence of design steps are exhibited in Fig. 1(a), (b) (Joseph, 2006).

Understand Physical System and Control

Understand Physical System and Control

Develop a Linear Model of Plant

Determine a Simplified Controller from

Design the Control for Using Fuzzy Rules

Develop an algorithm for the Controller Simulate, Debug, and Implementation

Simulate, Debug, and Implementation

31

Figure 1 (a) Conventional Design

Figure 1 (b) Fuzzy Logic Controller Design

In order to appreciate why a fuzzy based design methodology is very attractive in embedded control applications let us examine a typical design flow. Figure 1 (a, b) illustrates a sequence of design steps required to develop a controller using a conventional and a Fuzzy approach.

Using the conventional approach our first step is to understand the physical system and its control requirements. Based on this understanding, our second step is to develop a model, which includes the plant, sensors and actuators. The third step is to use linear control theory in order to determine a simplified version of the controller, such as the parameters of a PID controller. The fourth step is to develop an algorithm for the simplified controller. The last step is to simulate the design including the effects of non-linearity, noise, and parameter variations. If the performance is not satisfactory we need to modify our system modeling, re-design the controller, re-write the algorithm and retry Based on Sulaiman et al. (2006), the study of the controller includes several phases, they are: fuzzy logic system, software development, integration of software and microcontroller hardware, hardware circuit development, and interfacing the microcontroller with the hardware that includes the testing and evaluation of the system. Detail descriptions of each phase are shown in Fig. 3.2.

Start
Fuzzy Logic System Software Development

Integration of Software

32
Hardware Circuit Development Interface Microcontroller and Test the System Design

Figure 3.2: The flowchart of the work flow

3.2 Fuzzy Logic System

Fuzzy logic system is a system recognition algorithm for fuzzy control (Cristina et al., 2002). In general, the main structures in FL control system are divided into three categories: fuzzification, inference engine, and defuzzification as shown in Fig. 3.3.

33

Figure 3.3: Components of a Fuzzy System. The integration of fuzzy logic and lighting control to improve the light intensity and for flexibility and fast reaction, FL control can play an important role and can easily be implemented in systems with unknown structure. The generic structures of an automated light controller using fuzzy logic are represented in Fig. 3.4.

No. of people Input Light-Intensity Fuzzification Fuzzy Inference Defuzzification

No. of lamps

Hardware Design

Figure 3.4: The generic structures of an automated light controller using fuzzy logic

The fuzzification is the first stage in FL system computation to translate the real world variables into fuzzy sets; otherwise it is to transform the entered numeric values into fuzzy sets. In this stage, fuzzification used process to convert or control input variables that come from the sensor

34

into fuzzy sets. It is a necessary planning among the inputs to set the values of membership of each fuzzy variable. Furthermore, fuzzification makes input variables in the primacy of the rule coincident with fuzzy set presentation.

Fuzzy logic inference engines use a rule based expert system paradigm to derive new sets of fuzzy linguistic variables (Fuzzy IF-THEN Rules/ Fuzzy Variables/Linguistic Variables). The inference engine depicts a set of IF-THEN rules as a fuzzy expert system to represent the relations between fuzzy sets and to derive the changes that occur in an input sensor. The inference engine process has two steps that are aggregation and composition. Aggregation is a process for computing the values of the IF part of the rules, while composition is a process for computing the values of the THEN part of the rules (Philip, 2007).

The last phase in this methodology is the defuzzification. It is the procedure that translates the fuzzy output from the inference engine into discrete or crisp output value. In general, the fuzzy expert system for this step is the defuzzification of fuzzy set (linguistic variables) of the output value of fuzzy sets into crisp or numeric values. After the fuzzy logic controller evaluates inputs and applies them to the rule base, it must generate a usable output to the system it is controlling. This may mean setting a voltage or current to particular value to control the light intensity of a room as the objective of this project, or it may mean defining the energy efficiency of a dimmer light balance as it nears its target. The fuzzy logic controller must convert its internal fuzzy output variables into crisp values that can actually be used by the controller system. Can perform this portion of the fuzzy control algorithm, known as defuzzification, in several ways. Two of the most common methods are:

35

Maximum defuzzification method. Centroid calculation defuzzification method.

3.3 Software Development

To control the electrical equipment, Assembly language has been used to program the microcontroller. Beside that, all phases involved in developing fuzzy system was coded using Visual Basic language.

The system structure of fuzzy logic is the fuzzy logic inference flow from the input to the output variables. The translation from analog input into fuzzy values can be performed through fuzzification process in the input interfaces. The fuzzy inference can occur in rule blocks, each rule block has linguistic control rule and linguistic variables as outputs. They are converted again into analog variables through defuzzificaton process in the output interfaces. Fig. 4.5, shows the entire fuzzy system structure which contains rule blocks, input and output interfaces.

Fuzzy logic System

Fuzzy program

LPT cable Control System

36

Figure 3. 5: The Structure of a Fuzzy and Control System.

The linguistic variables may not have values of numbers but so called linguistic terms. Tow input variables are defined the study that are number of people to count the number of people and light intensity to define the light intensity.

3.3.1 Fuzzification

For automated light control using fuzzy logic, two input variables have been identified, namely No. of people and Light Intensity as shown in Fig. 3. 6

No. of people Automated Light Controller using Fuzzy Logic Light Intensity

Light Intensity

Figure 3. 6: Basic Fuzzy Logic Design for Automated Light Controller using Fuzzy Logic

37

Input variable Number of people, this input variable is a change of interrupts of user to determine the number of people; as well us counting number of people in the room very accurately. When somebody enters into the room then the counter is incremented by one and the lamps in the room will incremented by one and when any one leaves the room then the counter is decremented by one and lamps will decremented by one, this input presents three variables {few, many, too-many}. The membership function graph of number of people is shown in Fig. 3. 5.The input variables Light Intensity, this input defines the case of lighting room depending on the number of lamps, this input presents three variables {low, bright, very-bright}. The membership function graph of light intensity is shown in Fig.3.7.

The first step in the method of calculating the fuzzy logic is to determine the numerical input values of the membership in relation to the linguistic descriptors. Figures. 3. 7 and 3.8 illustrate the membership functions and map in graphical form the determination of the membership values of the numerical input values with relate to the evaluation terms of the expert. The No. of people of 4 has a membership of 0.5 with relate to the term "Many". The Light Intensity of 2has a membership of 0.5 with relate to the term "Bright".

Few

Many

Too-Many

38

No. of people

Figure 3. 7: Membership Function of No. of people (Variable 1)

Dim

Bright

V-Bright

Light intensity

Figure 3.8: Membership Function of Light Intensity (Variable 2)

3.3.2 Fuzzy Inference

The next step of the calculation in the Fuzzy system is to combine (two descriptions) the evaluations of the input factors. To find cases that belong to one of the terms " Dim", "Bright"

39

and "V-Bright. The expert system rules have been used to combine the of possible factors with positive grades of truth, based on Fuzzy Associative Memory Table (Sulaiman, 2006). Table 3. 1 is the rule blocks that include the control strategy of the fuzzy logic system. Each rule block confines all rules for the same context. A context is defined by the same input and output variables of the rules. As example when the light intensity is Bright and the number of people is Too-Many then the light intensity will be Very-Bright. Table 3.1: Rule Block (FAM Table)

No. of people

Light-Intensity

Dim

Bright

V-Bright

Few

Dim

Dim

Dim

Many

Bright

Bright

Bright

Too-Many

Very-Bright

Very-Bright

Very-Bright

To determine the mapping of output variables to their corresponding output membership functions, the weighted input membership function and corresponding rule base determine the relative membership in the output function. After sensors sense the input values and using the first step in fuzzy logic system inputs are fuzzified and then by implementing the fuzzy rules ifelse the output fuzzy function obtained and using the current value the output for light intensity is obtained. The output variables that identifies to the input variables as shown in Table 3.2

40

Table. 3.2: Light Intensity (Membership Function Relative Membership)

Input Variable

Defining Rule Base if no. of people = many & light

Output Variable

No. of people (many) = 5 Light Intensity = Low

No. of lamps = 4 intensity = low then set no. of lamps to 4 if no. of people = low & light No. of lamps = 2 intensity = bright then set no.

No. of people (low) = 1 Light Intensity = bright

of lamps to 2

3.3.3 Defuzzification

After fuzzified the input factors and combined the evaluated variables result, the last stage is Defuzzification process. Defuzzification is aprocess to translate the Fuzzy output set into a single numerical output value. The linguistic terms of a factor could take the positive values of the membership. The highest membership value with relate to each of the terms is determined for the

41

numerical values of the output factor. The most common methods of calculation in defuzzication is the centroid calculation defuzzification method, where the balance point from the chart below computed as the representative value of the total value of the area. The exact numerical output value is the value of X coordinates of the point of this balance. Fig.3.8 illustrates the fuzzy output set of the light intensity factor, the centre of area from the graph below and numerical output value of 2.28. Dim Bright V-Bright

Light intensity

Figure 3.9: The output of Defuzzification

The algorithm of defuzzification of the system is depicted in Fig. 3. 9

42

Figure 3.10: The Defuzzification Code

3.4 INTEGRATION OF SOFTWARE

To integrate the software with hardware, the input32.Dll has SELECTED to do this task. The advantage of Inpout32.dl is, it can work with all the windows versions and it uses to contact with all the programs that use the printer port to control the ports where installs in C:\WINDOWS\system32\Inpout32.dll. The following code has been used to call the input32.dll in the program which has been written by Visual Basic 6:

Public Declare Function Inp Lib inpout32.dll _ Alias Inp32 (ByVal PortAddress As Integer) As Integer Public Declare Sub Out Lib inpout32.dll _ 43

Alias Out32 (ByVal PortAddress As Integer, ByVal Value As Integer)

Fuzzy Logic system

Knowledge Base
Data base
Input Membership function Rule Table

Rule base
Output Membership function

Fuzzification
Fuzzy

Inference Engine

Defuzzificatio
Fuzzy

No. of people Sensors Light intensity Actuator

Output

Hardware Design

Figure 3.11: The integrated FL and Hardware for the Automated Light

The flow of integrated system is depicted in Fig. 3. 12


Start

All Ls

Yes T T

No

44
Yes T T Yes S

T No T to

Yes Ls

Yes

Note: Ls All lamps, L1 lamp1 T Timer, T1 Timer1, T2 Timer2 S Sensor, S1 Sensor1, S2 Sensor2

45

Figure 3. 12: The flow of integrated system

For completeness, the fuzzy logic light controller and the circuit design are presented in the following subsection:

3.4.1 Fuzzy Logic Controller Design

The Fuzzy System of Automated Light controller receives the input from the sensors and implemented the fuzzy control rules and actions. The general fuzzy logic control design is shown in Fig.3.11. Input Fuzzy System Output/action

Figure 3.13: Fuzzy Logic Control Design

The sensor receives its input from the surrounding environment when new interrupt happened and sends its output to fuzzy control system. As a result, after fuzzy processing, the appropriate value to environment will be sent to make the new action as shown in Fig.3.12.

Input Sensors

Input
Fuzzy Process

Appropriate value

Actions

46

Figure 3.14: Detail FLC System

The Fuzzy Logic Control system for this study consists of 2 inputs: No. of people, and light intensity. The appropriate output created by the Fuzzy Logic Control comprises of appropriate No. of lamps, and appropriate light level (light intensity) as shown in Fig. 3.14.

Fuzzy Logic Automated light controller

Figure 3.15: Context Diagram

3.4.2

System Design

The system design consists a number of lamps control to define the light intensity (light level). The following subsection illustrated the design phase.

Lamps control system

.
People in Sensor detected People out
Amount of people in room

.
Appropriate no. of lamps

Lamps fuzzy system 47 Hardware system

Figure 3.16: Lamps control system

(1.1)

No. of people in/out system people in system

People in
Timer on/add person

Amount of people in room

Lamps fuzzy system

Figure 3.17: No. of people in system

people out of system

People out
Timer off/minus person

Amount of people in room

Lamps fuzzy system

Figure 3.18: No. of people out of system

48

(1.2)

Lamps fuzzy system

Amount people in room Lamps Fuzzy System

Appropriate lamps number

Hardware System

Figure 3.19: Lamps fuzzy system

Light intensity control system

. People in Sensor detected People out


Light fuzzy system
Amount of people in room

.
Appropriate no. of lamps

. Hardware system

Figure 3.20: Light control system

49

(2.1) No. of people in/out system

People in system

People in
Timer on/add person

Amount of people in room

Light fuzzy system

Fig.ure 3.21: No. of people in system

People out of system

People out
Timer off/minus person

Amount of people in room

Light fuzzy system

50

Figure 3.22: No. of people out of system

(2.2) Light fuzzy system

Amount people in room Light Fuzzy System

Appropriate lamps number

Hardware System

Figure 3.23: Light fuzzy system

3.4.3 Circuit Design

Circuit design consists of microcontroller circuit design and transmitter and receiver circuits design. The details of the circuits have been discussed in chapter 3.

3.4.3.1 Microcontroller AT89C52

The microcontroller AT89C52, which used in this project is discussed further since it is the main control system connected to the computer and hardware. It receives its input from Fuzzy system to control the number of lamps depending on its programming which

51

relate with the output of the fuzzy system. These inputs are a 5 or 0 volt considered by the microcontroller as 1 or 0, which means binary value.

Microcontroller system

. Sensor output Fuzzy system


Appropriate no. of lamps

.
Control lamps

Microcontroller system

. Lamps

Figure 3.24: Microcontroller System

(1.1)

No. of people in/out system

People in system

People in
Microcontroller

Control lamps/ add lamp

Lamps

Figure 3.25: No. of people in system (microcontroller)

52

People out of system

People out
Microcontroller

Control lamps/minus lamp

Lamps

Figure 3.26: No. of people out of system (microcontroller)

3.4.3.2 Transmitter and Receiver Circuits (TX & RX)

The details of both circuits have been discussed in chapter 3. The transmitter circuit is beamed across the doorway and the receiver circuit in the other side of the doorway. When the user walks through the doorway that will be triggered and the changeable of event will be happened in receiver circuit. Furthermore, there are two transmitter and receiver circuit which presented in this chapter as A and B. Transmitter circuit A connected with receiver circuit A for determine the number of people which entered the room, and the transmitter circuit B connected with receiver circuit B for determine the number of people which left the room. TX and RX circuits A System

53 Infrared signal
Transmitter circuit A . Receiver circuit A
New action / interrupt

Figure 3.27: TX and RX circuit A System

(1.1)

TX and RX circuits A (people in)

TX circuit A
Infrared signal

Transmitter circuit A

Receiver circuit A

Figure.3.28: TX circuit A

RX circuit A

Infrared signal Receiver circuit A

Appropriate new action

Fuzzy System

Figure 3.29: RX circuit A

54

(1.2) TX and RX circuits A Fuzzy System

New action Fuzzy System

Appropriate new action

Hardware System

Figure 3.30: TX and RX circuits A Fuzzy System

TX and RX circuits B System

.
Infrared signal

Transmitter circuit B

. Receiver circuit B

New action / interrupt

.
Fuzzy System

Figure 3.31: TX and RX circuit B System

(1.1)

TX and RX circuits B (people out of)

55

TX circuit B

Infrared signal

Transmitter circuit B

Receiver circuit B

Figure 3.32: TX circuit B

RX circuit B

Infrared signal Receiver circuit B

Appropriate new action

Fuzzy System

Figure 3.33: RX circuit B

(2.1)

TX and RX circuits B Fuzzy System

New action Fuzzy System

Appropriate new action

Hardware System

Figure 3.34: TX and RX circuits B Fuzzy System

56

3.5 Hardware Circuit Development

Figure 8 shows the block diagram of fuzzy controlling lighting System. The number of people and Light Intensity sensor communicated with microcontroller AT89C52. The sensors 1,3 defined as number of people sensor and the sensors 2,4 defined as Light Intensity sensors. The output from the microcontroller AT89C52 will be depending on the lamps which used in this study. The microcontroller is responsible for control how many lamps will be on or off according to its programming. The transmitter circuit 1 will send a signal by infrared sensor to receiver circuit 1 to increase number of the bright lamps when someone cut this signal in case somebody is entering the room. The transmitter circuit 2 will send a signal by infrared sensor to receiver circuit 1 to decrease number of the bright lamps when someone cut this signal in the case of exiting from the room. The receiver circuits 1,2 send the new cases of entering or exiting of the room to control the light intensity by microcontroller as shown in Fig.3. 8.

Sensor

Sensor

eceiver Circuit Sensor eceiver Circuit

Transmi er Circuit Sensor Transmi er Circuit


elay elay

Lamp Lamp Lamp Lamp

TMEL

elay elay

57

Figure 3.35: Block Diagram of Fuzzy Control Lighting System

3.5.1 Hardware Implementation

The hardware architecture of this project consists of six major components, personal computer, parallel port cable (LPT), infrared sensors, transmitter and receiver electronic circuits, relays, and microcontroller ATMEL AT89C52. The hardware architecture is shown in Fig.3.12.

The Electronic Circuit & Sensors


Personal Computer Microcontroller

Figure 3.36: Hardware Architecture 3.5.1.1 Personal Computer

58

The computer acts as brain of system. It runs the fuzzy logic program that has been done using Visual Basic to make the right decision using information gathered from other components of the architecture. The computer has been connected to hardware design using Parallel Port Cable (LPT).

3.5.1.2 Parallel Port Cable (LPT)

In short, the printer port of a 25 Holes or Pins as a performing, they send 0 in the case Close and 1 in the case of Open, where 1 is a value approaching of 5 volte often. The numbers 1, 14, 16, 17 called control Pins used for the input and output at the same time. The numbers 2 to 9 called Data Pins, they are the most common and the frequently used, in the printing, these outlets were used to transfer data to the printing process in preparation for printing. The numbers 10 to 13, 14 called Statues Pins these ports are used for entering data, and printers were used to enter data from the printer to the computer, such as letters of notice (the papers finished). The numbers 18 to 25 called Ground Pins, like any electrical circuit, there must be a positive pole and negative pole to serve the circuit, the Ground is a negative pole. The Fig.3.10 shows the structure of LPT:

59

Figure 3.37: Structure of LPT

3.5.1.3 Infrared Sensor (Receiver & Transmitter)

The Infrared Sensor used as a source of infrared rays and it can detect these radiations. It has transmitter and receiver feature is called as IR TX-RX pair. In this project the IR TX sends a sequently signal to receive it by IR RX and when somebody interrupt this signal the IR RX will give 0 output. The Fig. 3. 13 shows the infrared receiver and transmitter.

60

Figure 3.38: Infrared Sensor (Transmitter & Receiver)

3.5.1.4 Transmitter Circuit

The transmitter circuit contains of the following components:


IC 555 Resistors Capacitors IR LED (sensor)

The IR infrared light is a sensor considers as the main component in both circuits receiver and transmitting, its the responsible for making a new event when the interrupt happened by cutting the IR signal, it uses to send its signal to the IR Receiver Circuit. The IC 555 is an integrating circuit used to create a stable multivibrator which has two semi-stable states and to generate a square signal; this signal is required to switch ON the IR LED. The transistor BC 548 is used to drive the IR LED. The IR transmitter circuit is shown in the Fig. 3. 14 below:

61

Figure 3.39: IR Transmitter Circuit 3.5.1.5 Receiver Circuit

The receiver circuit contains of the following components:


TSOP1738 (sensor) IC 555 Resistors Capacitors

The second step in the whole circuit after transmitting the signal which has been sent by IR Transmitter Circuit is receiving this signal by Receiver Circuit. The changes of the new event (enter or leave) will be in this section. After the interrupt happened the output of IR sensor momentarily will be a low state (0 volt). The IC 555 receives the output of the IR sensor to create a short pulse and apply this pulse to the microcontroller which we will describe it later. The IR receiver circuit is shown in the Fig. 3. 15

62

Figure 3.40: IR Receiver Circuit

3.5.1.6 Microcontroller Circuit

In this circuit the microcontroller AT89C52 is the final result of the hardware design. After receiving the signal from IR Transmitter circuit through IR Receiver circuit the output of the second circuit passes into the input of microcontroller circuit. The aim is to control how many lamps will be ON according to the number of the interrupts when someone cuts the signal. To control the number of the lamps, microcontroller has the ability to programming by C language or Assembly language. For this project C language has been used to program the microcontroller. The microcontroller with circuit diagram are shown below in Fig. 3. 15 and 3. 16

63

Figure 3.41: Microcontroller Circuit Diagram

64

65

Figure 3.42: The whole Circuit Diagram

3.6 INTERFACE MICROCONTROLLER and TEST the SYSYSTEM DESIGN

Several experiments were conducted to investigate the behaviour of micro controller that connected to fuzzy system to control the number of lamps depending on the fuzzy system output. The design and testing of the hardware circuit were conducted on experimental circuits and several diodes were conducted to investigate the output of hardware circuit. The circuit interface was divided into several circuits as following:

3.6.1 Transmitter Circuit Interface

66

Figure .3.43: Transmitter Circuit Interface The transmitter circuit uses two infrared sender sensors for sending infrared to receiver circuit. The circuit design voltage (12 VDC), to turn circuit on.

3.6.2 Receiver Circuit Interface

Figure 3.44: Receiver Circuit Interface The receiver circuit uses infrared receiver sensor to get infrared from transmission. It has two LEDs display when circuit is on and when sensor sense signal sent.

3.6.3 Receiver and Transmitter Circuits Interface

67

Figure 3.45: Receiver and Transmitter Circuits Interface

The above figure shows the receiver and transmitter circuit when they connected to each other. The receiver circuit 1 illustrates that turned on and received infrared signal while the receiver circuit 2 only turned on.

3.6.4 Microcontroller Circuit Interface

68

Figure 3. 46: Microcontroller Circuit Interface Microcontroller is the brain of hardware design. Microcontroller receives output data respectively from fuzzy system. This data is 5 or 0 volt represents to microcontroller as 1 or 0 data and converts this data into purpose output according to its program.

3.6.5 The Circuit of Automated Light Controller using Fuzzy Logic Interface

This project has two general parts: computer and hardware circuit. The computer is the brain of the whole system while the microcontroller is the brain hardware circuit. The PC acts as a central station of communication between hardware circuit and fuzzy system. The PC carries the data from hardware circuit to fuzzy system and after fuzzy process it carries the fuzzy data to hardware circuit. Fig.3. 22 shows the whole circuit interface for this project.

69

Figure 3. 47: The Circuit of Automated Light Controller using Fuzzy Logic Interface

CAHPTER 4 RESULTS AND DISCUSSION


This chapter discusses the experimental results of the software and hardware circuits. The results were obtained during the system testing phase, based on fuzzification, fuzzy inference and defuzzificati. On the test was implemented on the hardware part as an input variable to obtain the response from software. The result obtained from the integrated circuit is also reported.

4.1 FUZZIFICATION

In this study, two inputs are integrated with the fuzzy system. That are no. of people and light intensity. Both inputs the real values have been implemented in fuzzification phase. 70

The fuzzification converted these crisps inputs into linguistic variables based on the membership function to obtain the confidence values. The numbers of confidence values are generated depending on the number of linguistic variables. For this study, there are three linguistic quantifier for each fuzzy variable. At the same time there are three confidence values that have been generated. Listed below are the fuzzy variables defined using linguistic quantifiers.

No. of people (NP) {Few, Many, Too-Many} Light intensity (LI) {Dim, Bright, Very-Bright) The membership function for each input fuzzy variables is shown in Fig.4.1 and Fig. 4.2.

Few

Many

Too-Many

No. of people

Figure 4.1: Membership Function graph for No. of People

Dim

Bright

V-Bright

71

Light intensity

Figure 4.2: Membership Function graph for Light intensity

The confidence value which is obtained by fuzzification step is accepted in the next step of fuzzy logic system. The code for fuzzification code and the process of getting the confidence value for fuzzy variables is presented in Fig.4.3.

Figure 4.3: The Fuzzification Phase

For testing, four different cases have been chosen to produce difference output for each step in fuzzy system and the output of hardware design. Refining to Fig. 4.1 and Fig. 4.2, when no. of people = 3 the confidence value for its linguistic descriptors are {1,0,0}. If the light intensity = 2, the confidence value for its linguistic descriptors are {0.5,0.5,0}. For the first case the no. of people is Few and the light intensity is Dim as shown in Fig. 4.6.

72

Figure represent the membership function of the first case Fig. 4.7 and Fig. 4.8.4.4: Fuzzification Test1: NP=3,

which No. of people = 3 and light intensity = 2.

Few

Many

Too-Many

No. of people

Figure 4.5: Membership Function graph for NP=3

Dim

Bright

V-Bright

Light intensity

Figure 4.6: Membership Function graph for LI=2

73

For the case the no. of people is set to Few with different in the expression of membership function with first case and the light intensity is Dim as shown in Fig. 4.7.

Figure 4.7: Fuzzification Test2: NP = 4, LI = 2

To prove that the next membership functions for both of input present the secon case as shown in Fig4.7 and Fig. 4.8.

Few

Many

Too-Many

No. of people

74

Figure 4.8: Membership Function graph for NP=4

Dim

Bright

V-Bright

Light intensity

Figure 4.9: Membership Function graph for LI=2

Figure 4.10: Fuzzification Test3: NP = 4, LI = 4

To prove that the next membership functions for both of input present the first case as showing in Fig. 4.7 and Fig. 4.8.

Few

Many

Too-Many

No. of people

75

Figure 4.11: Membership Function graph for NP=4

Dim

Bright

V-Bright

Light intensity

Figure 4.12: Membership Function graph for LI=4

Figure .4.13: Fuzzification Test4: NP = 6, LI = 6

To prove that the next membership functions for both of input present the first case as showing in Fig4.7 and Fig.4.8.

Few

Many

Too-Many

No. of people

76

Figure 4.14: Membership Function graph for NP=6

Dim

Bright

V-Bright

Light intensity

Figure 4.15: Membership Function graph for LI=6

4.2 FUZZY INFERENCE

Fuzzy inference presents IF-THEN rules which implemented on the fuzzy sets of the inputs; no. of people and light intensity by choosing the minimize confidence values for the row and column as resultant confidence value. Depending on the first case, the first confidence value for the first column Dim will compared with the first confidence value for the first row Few. The minimum value between these two values will be taken as the value which appropriate to the output. FAM Table of no. of people and light intensity is shown in Table.4.1.

Table 4.1: FAM Table

No. of people Dim Few

Light-Intensity Bright V-Bright

Dim

Dim

Dim

77

Many

Bright

Bright

Bright

Too-Many

Very-Bright

Very-Bright

Very-Bright

Based on the table above, the following IF-THEN rules have been generated. The columns represent the linguistic variables for input light intensity, while the rows

represent the linguistic variables for input no. of people. Listed below are a nine rules: Notes: No. of people = NP Light intensity = LI

IF NP is LOW AND LI is DIM THEN LI is DIM IF NP is LOW AND LI is BRIGHT THEN LI is DIM IF NP is LOW AND LI is V-BRIGHT THEN LI is DIM IF NP is MANY AND LI is DIM THEN LI is BRIGHT IF NP is MANY AND LI is BRIGHT THEN LI is BRIGHT IF NP is MANY AND LI is V-BRIGHT THEN LI is BRIGHT IF NP is TOO-MANY AND LI is DIM THEN LI is V-BRIGHT IF NP is TOO-MANY AND LI is BRIGHT THEN LI is V-BRIGHT IF NP is TOO-MANY AND LI is V-BRIGHT THEN LI is V-BRIGHT

The algorithm for FAM Table and the process of getting the minimum value of the implementation IF-THEN rules on the linguistic variables are presented in Fig. 4.16.

78

Figure 4.16: FAM Table Algorithm The functionality of fuzzy inference is compared with the confidence values for the input variables and chose the minimum value by mapped IF-TEHEN rules as following FAM Table in Fig.4.17.

Figure 4.17: FAM Table Test1: NP=3, LI=2

The minimum values have been chosen depending on the following IF-THEN rules. The minimum value is determined by comparing the first column wit first row as following rules: Note: No. of people is NP, Light intensity is LI.

IF NP < LI THEN MinVal = NP

NP = 1 , LI = 0.5 79

Else MinVal = LI

THEN MinVal = 0.5

For the second case no. of people = 4 and light intensity = 2. The details of counting minimum value have been discussed in first case. FAM table is represented as shown in Fig. 4.18.

Figure 4.18: FAM Table Test2: NP=4, LI=2

For the third case no. of people = 4 and light intensity = 4. The details of counting minimum value have been discussed in first case. FAM table is represented as shown in Fig. 4.19.

80

Figure 4.19: FAM Table Test3: NP=4, LI=4

For the fourth case no. of people = 4 and light intensity = 4. The details of counting minimum value have been discussed in first case. FAM table is represented as shown in Fig.4.20.

Figure 4.20: FAM Table Test4: NP=6, LI=6

4.3 Defuzzification

81

The final result of the fuzzy system is to convert the confidence values back to real values that can be appropriated to the user input. The method of center of area (COA) has been used to determine the real value of the output. Defuzzification is the last step in fuzzy system to map the output depending on fuzzy process. It sent its result to the hardware design to control the number of lamps according to the fuzzy process output. The algorithm for defuzzification and the process of getting the real values which appropriate to user inputs is presented in Fig. 4.21.

Figure 4.21: The Defuzzification Phase

The defuzzification used the method of center of area (COA) as discussed in another section to find out the output for defuzzification step. The algorithm for this defuzzification method is:

82

To prove that the next membership function for both of inputs presents the first case is no. of people = 3 and light intensity = 2 as showing in Fig. 4.22.

Dim

Bright

V-Bright

Light intensity

Figure 4.22: Defuzzification Membership Function Test1

Fig. 4.23. shows the software testing of defuzzificatin step of the real value and the output which mapped into hardware input.

Figure 4.23: Defuzzification Test1: LI = 2 = LOW

After defuzzified the confidence values converted into real value that can be understood by the user. This real value is an input to hardware design exactly input of microcontroller to control the output of the hardware. For first case the output of defuzzification is 2 mapped to microcontroller which controlled the number of lamps into 2 lamps. The hardware testing for first step is shown in Fig. 4.24.

83

Figure 4.24: Hardware Design Test1= 2lamps

For the second case the output of defuzzification is BRIGHT which means three lamps should be on as shown in Fig. 4.25. For more details as explained as first case.

Figure 4.25: Defuzzification Test2: LI = BRIGHT

The output of the hardware circuit shows that three lamps turned on depending on the output of defuzzification process for second case. Fig. 4.26. illustrates the final output of hardware circuit for second case.

84

Figure 4.26: Hardware Design Test2 = 3lamps

The third case of defuzzification presented output which is BRIGHT as same as the second case. Note that, there is a different in the number of people which entered the room. Fig. 4.27 shows the output of diffuzzification for this case.

Figure 4.27: Defuzzification Test3: LI = BRIGHT

The output of hardware circuit is three lamps for third case and presented as shown in Fig. 4.28.

85

Figure 4.28: Hardware Design Test3 = 3lamps

The implementation of fourth case shows that the light intensity is BRIGHT as same as the third case but different in number of people and the number of lamps that turned on. Fig. 4.29 shows the output of defuzzification which was BRIGHT and the lamps that should be on are four.

Figure 4.29: Defuzzification Test4: LI = BRIGHT

86

Depending on the last case and the output of defuzzification the output of the hardware circuit is four lamps. Fig. 4.30 shows the output of hardware circuit.

Figure 4.28: Hardware Design Test3 = 4lamps

87

CHAPTER 5 CONCLUSION AND RECOMENATION

5.1 Conclusion

In this study, the practical implementation of a fuzzy logic controller for automated lighting counting was presented. The automated light controller using fuzzy logic proved to be effective system. It was demonstrated that the fuzzy logic control design method resulted in better energy saving than conventional control method. The fuzzy logic controller is a good responsive, practical and simple and gathers all requirements with the features of a knowledge based approach with unknown system structure.

This study has achieved its objective, which is to design a fuzzy logic system which integrates with hardware to control light intensity in a room. This study illustrates that fuzzy logic controlling method could be a suitable alternative method compared to conventional controlling methods.

88

5.2 Recommendation

This project used sensors to detect signal if somebody entered or left the room. This signal will be lost if the wiring sensor that used is longer than 10 feet. As solution, the circuit need amplifier to make the signal stronger. Furthermore, the computer must be located nearby to the sensors and it does not have the ability for easy movement. In recent years, the bluetooth techniques have been widely use in many modern industries. For this project, the bluetooth technique could be alternative to overcome the wiring sensors problems.

This project was developed by using Microsoft Visual Basic 6.0. In the future, other advance programming languages such as Java and C# can be used to develop the system, which may make it having more features, faster other than what have been presented in this version. The proposed system besides that does not have the ability to store information. When the system is restarted again all last data was lost. For future work, database could be designed to store and interact with new data.

The development of smart lighting control system in building is outgrowing nowadays. The system should be able to not only detect changes in one room, as it does now, but also could be designed for more than one room to determine in which room the changes were occurring.

89

6. REFERENCES

Anderson, G., Zheng, U., Wyeth, R., Johnson, A. and Bissett, J. (2000). "A rough set/fuzzy logic based decision making system for medical applications", International Journal of General Systems, Vol. 29 No.6, pp.879-96.

AptronixInc.(1996).WhyUseFuzzyLogic? http//www.aptronix.com/file/whyfuzzy.htm

Automatic Lighting Control for Energy Savings. Adapted from B.C. Hydro. Guides to Energy Management. GEM No. L108. January 1990. With permission from B.C. Hydro, Vancouver, British Columbia.

Awad, E. M. (1999), Building Expert System, West Publishing Company, USA. Brackney. L and Shoureshi. R. (2000). Fuzzy-Based Self-Organizing Control for Buildings System, American Control Conference. Chuen. C. E. (1990). Fuzzy Logic in Control Systems: Fuzzy Logic Controller-Part I. IEEE Transaction on System. IEEE. Cristina. C, Ricardo. T, Marley. M. R., Marco. A. C. (2002). Towards Evolvable Analog Fuzzy Logic Controllers.IEEE.

Cziker. A., Chindris. M., Miron. A. (2007). Implementation of Fuzzy Logic in Daylighting Control. Intelligent Engineering Systems, 11th International Conference on 195 200. IEEE.

Cziker. A, Chindris. M and Miron. A (2007). Implementation of Fuzzy Logic in Daylighting Control. International Conference on Intelligent Engineering Systems, IEEE.

Daniel. S & Alan. G. (2001). Synchronous Programming of Automatic Control Applications Using OCCAD and ESTEREL. Proceedings of the 40th IEEE Conference on Decision and Control. Orlando, Florida, USA. IEEE.

90

Demiroren. A & Yesil. E. (2003). Automatic generation control with fuzzy logic controllers in the power system including SMES units. ScienceDirect. doi:10.1016/j.ijepes.10.016.

Donna L. Hudson, Maurice and E. Cohen. (2007). Weighing Evidence in Decision Support Systems. Computers and Their Applications : 95-100.

Francis Rubinstein, Michael Siminovitch, and Rudolph Verderber. (1993). Fifty Percent Energy Savings with Automatic Lighting Controls, IEEE TRANSACTIONS.

Friedlob. G. T and Schleifer. L. L, (1999), Fuzzy Logic Application for Audit Risk and Uncertain. Managering Auditing Journal, 14(3), 127-135.

Froschauer. R, Auinger. F & Grabmair. G. (2006). Automatic control application recovery in distributed IEC 61499 based automation and control systems. Proceedings of the IEEE Workshop on Distributed Intelligent Systems: Collective Intelligence and Its Applications (DIS06).IEEE .

Garibadi. J.M, (1997). Intelligent techniques for handling uncertainty in the assessment of neonatal outcome. PHD Thesis, university of Plymout. UK.

Garibaldi. J. M, and IFeachor. E. C. (1999). Application of simulated Annealing Fuzzy Model Tuning to UmbilicalCord Acid-base Interpretation, IEEE Transaction on Fuzzy Systems, Vol.7, NO.1.

Godo, Ramon. L, Josep Puyol-Gruart, Carles. S, (2000). Renoir, Pneumon- IA and TerapIA: three medical applications based on fuzzy logic. Artificial Intelligence Research Institute (IIIA), Spanish Scientific Research Council (CSIC), Campus UAB, 08193 Bellaterra, Spain.

Godo. L, Lopes de Mantaras. R, Payol-Gruart. J, and Siera. C, (2000), Renoir, PneumomIA and Terap-IA : three medicakapplications based on fuzzy logic. Journal of Artificial Intelligence in Medical, 21.pp.153-162.

91

Goonatilake and Khebbal(1995), Intelligent Hybrid (Editors), New York: John Wiley & Sons.

Gradojevic. N, Jing. Y and Garvelle. T, (2001), Neuro-Fuzzy Decision-making in Foreign Exchange Tradding and Other Application. UBC Economics Depeartment, Canada.

Hasilogu. A. S, Yavuz. U, Rezos. S, and Kaya. M. D, (2003). A Fuzzy Expert System for Produce Life Cycle Mnagement. International XII, Turkish Symposium on Artificail Intelligence and Neural Networks.

Heemin. P, Jeff. B & Mani. B. S. (2007). Design and Implementation of a Wireless Sensor Network for Intelligent Light Control. Cambridge, Massachusetts, USA. ACM.

Herrmann. C. S. (1995). A Hybrid Fuzzy-Neural Expert System for Diagnosis, In proceedins of the International Joint Conference on Artifical intelligence (IJCAI). Montreal, Canada. Morgan Kaufman.

http://cxem.net/doc/mc/at89c52.pdf

Ilyas. E & Yunis. T. (2005). Fuzzy logic control to be conventional method. ScienceDirect. .

Jason H. T. & Michael P. Y. (2003). Applying Fuzzy Logic to Medical Decision Making in the Intensive Care Unit, American Journal of Respiratory and Critical Care Medicine. Jee. S., Koren. Y. (2004). Adaptive fuzzy logic controller for feed drives of a CNC machine tool. Mechatronics 14(3):299326.

Joseph. B. (2006). Paradigm shift an introduction to fuzzy logic. IEEE.

92

Kuo. K., and Lin. J. (2002). Fuzzy logic control for flexible link robot arm by singular perturbation approach. Appl Soft Comput.

Lefteri. H. T., Robert. E., Uhrig. (1997). Fuzzy Neural Approaches in Engineering. Professional Refrence and Trade Group. 605 Third Avenue, New York, N.Y. 10158-0012

Liang. M., Yeap. T., Rahmati. S., and Han. Z. (2002). Fuzzy control of spindle power in end milling processes. Int J Mach Tools Manufact 42:148796.

Lin. J. C, and Shiffman. R. N, (1996), Operationalization of Clinical practice Guidelines Using Fuzzy Logic. Center for Medical Informatics, Yale University School of Medicine, New Haven, Connecticut, USA.

Lin F., Yang. S.c(2003). Adaptive fuzzy-logic velocity observer for servo motor drives. Mechatronics 13:22941.

Lotfi A. Z. (1997). Toward a theory of fuzzy information granulation and its centrality in human reasoning and fuzzy logic. Research supported in part by NASA Grant NCC 2-275, ONR Grant N00014-96-1-0556, LLNL Grant 442427-26449, ARO Grant DAAH 04-961-0341, and the BISC Program of UC Berkeley. ScienceDirect. Elsevier Science.

Lotfi A. Z. (1984). "Making computers think like people," I.E.E.E. Spectrum.

Lotfi A. Z. (2004). Fuzzy Logic System: Origin, Concept, and Trends, UC/Berkeley, University of California. Mamdani EH.(1974). Application of fuzzy algorithms for control of simple dynamic plant. Proc IEEE 121(12):15858.

93

Marks. L.A, Dunn. E.G, Keller. J.M & Godsey. L.D. (1995). Multiple criteria decision making (MCDM) using fuzzy logic: an innovative approach to sustainable agriculture, Proceedings of ISUMA-NAFIPS, IEEE. Mendel. J, (1995). Fuzzy Logic Systems for Engineering: A Tutorial, In, Proc, of the IEEE, 38(3). Metin. A, Maurice. C, Donna. H. (1997). Fuzzy sets in life sciences, Fuzzy Sets and Systems, Elsevier Science. Metin , Ciresi, Gregory. (1997). Fuzzy logic in medical control applications. Biomedical Engineering Applications, Basis Communications. Vol 8. No 6 (1996) 471-487 [issn:10162356].

Mohd. K. H., MohdAmraliah. M., and Ikmal. A. Jalal. (2003). Lighting Management System. Student Conference on Research and Development (SCOReD) Proceedings, Putrajaya, Malaysia.

Neil. A. D. (2004). Introduction to Control Systems. University of Wisconsin-Madison.

Ojala. T, (1999), Neurofuzzy System in Control. Master Science Thesis, Tampere University of Technology.

Philip. B. (2007). Fuzzy Logic Control of the Syrup Mixing Process in Beverage Production. Leonardo Journal of Sciences. ISSN 1.

Radakovic. Z., Milosevic. V., and Radakovic. S. (2002). Application of temperature fuzzy controller in an indirect resistance furnace. Appl Energy 73:16781.

Roberto. S, Oscar. C, Patricia. M, Antonio. R & Oscar. M. (2006). Experimental study of intelligent controllers under uncertainty using type-1 and type-2 fuzzy logic. ScienceDirect.

94

Shoureshi. R., Brackney. L, Kubota. N, and Batta. G. (2000). A modern control approach to active noise control, ASME J. Dynamic Syst., Measurement, Contr., vol. 115, pp. 673678.

Sulaiman. F, Ahmad. A & Kamarulzaman. M.S. (2006). Automated Fuzzy Logic Light Balanced Control Algorithm Implemented in Passive Optical Fiber Daylighting System. AIML 06 International Conference, Sharm El Sheikh, Egypt.

Wang LX. (1994). Adaptive fuzzy systems and control: design and stability analysis. Englewood Cliffs, NJ: Prentice-Hall.

Watson. I, (1998). CBR is a methodology not a technology. In, Research & Development in Expert Systems XV. Miles. R, Moulton. M, & Bramer. M, (Eds), pp. 213-223. Springer, London. ISBN 1-85233-086-4.

Woo. Z., Chung. H., and Lin. J. (2000). A PID type fuzzy controller with self-tuning scaling factors. Fuzy Sets Syst 115:3216.

Yager.R.R and Zadeh. L. A. (1992), An Introduction to Fuzzy Logic Application in Intelligent System. Kluwer Academic Publisher: UAS.

Yu. I., Kazuhiro. Y., and Junji. H. (2005). Fault-Tolerant Control System of Flexible Arm for Sensor Fault by Using Reaction Force Observer. IEEE/ASME TRANSACTIONS ON MECHATRONICS, VOL. 10, NO.

95

Das könnte Ihnen auch gefallen