DVA406 Report - Lighting Control Usinf Fuzzy.doc

March 9, 2018 | Author: Bilal Shahid | Category: Arduino, Fuzzy Logic, Lighting, Electronic Circuits, Computer Program
Share Embed Donate


Short Description

Report...

Description

INTELLIGENT INDOOR LIGHTING CONTROL USING FUZZY LOGIC

Project Report DVA 406 – Intelligent Systems [Period 3] Spring 2013

Submitted to: Ning Xiong

Submitted by:

Yasser M. Najib, IDT Department, MDH

Rana Najdat, IDT Department, MDH

Bilal Shahid, IDT Department, MDH EE Department, LUMS

DVA406 Project Report

2

Table of Contents

1

ABSTRACT .............................................................................................................. …….….3

2

INTRODUCTION .................................................................................................................... 4 2.1

What is Fuzzy Logic? ………………............................................................ ……………4

2.2

Background……………. ........................ ………………..……………….………….......... 4

2.3

Purpose ...………………………..………….……………..……………….………….......... 4

3

METHOD................................................................................................................................. 5

4

SOFTWARE............................................................................................................................ 6 4.1

Fuzzy Rule Based Decisions............................................................................ .............6

4.2

Microcontroller Programming ................................................................................ ........8

5

HARDWARE ........................................................................................................................... 9

6

DISCUSSION .......................................................................................................................... 9

7

RESULTS .............................................................................................................................. 9

8

REFERENCES AND APPENDICES .................................................................................... 10 8.1

Appendix A: Glossary of Acronyms….......................................................... ........... …10

8.2

Appenidx B: Description of Electronic Devices Used in Hardware ……………………11

8.3

References..……………………..………….……………..……………….………….........12

DVA406 Project Report

1

3

ABSTRACT

This report aims at describing the project design, software and hardware for the course DVA406, Intelligent Systems. The Indoor Lighting Control Using Fuzzy Logic was implemented using control of a set of indoor light bulbs through inputs from two Light Dependent Resistors (LDRs) and controlling the sensor values through a microcontroller. The microcontroller was programmed to intelligently control the light intensity in an indoor environment. The software code implemented was a translation of the rule based decisions obtained from inference from Fuzzy Logic. The membership functions for each LDR input were defined and then a crisp output was obtained after defuzzification and a rule matrix was drawn to identify and select the correct output. The output values corresponded to the number of lamps or light bulbs that would turn ON or OFF. The program was written in an Arduino sketch and the circuitry was mounted on a Printed Circuit Board (PCB) with all the components. The circuit was connected to the light bulbs through a wiring cable. The results indicate a complete sensing circuit that uses Fuzzy Logic and works as Indoor Lighting Control for any appropriate environment.

DVA406 Project Report

2

INTRODUCTION

2.1

What is Fuzzy Logic?

4

Fuzzy logic is a system, which is an extension of multivalued logic derived from the theory of fuzzy sets, which relates to classes of objects with un-sharp boundaries in which membership is a matter of degree [1]. Fuzzy logic is a branch of artificial intelligence that deals with reasoning algorithms used to emulate human thinking and decision making in machines [4]. Fuzzy logic and fuzzy theory aim to represent and manipulate linguistic, vague and uncertain information in order to create systems that are much closer in spirit to human thinking and reasoning [8]. P

P

P

P

P

2.2

P

Background

There are several terms used to describe some commonly used terms in fuzzy logic that will help in understanding the variables and the terminologies used in implementing rules that govern the outcomes. These terms explain the method used in implementing the logic behind the rules used to program the controller for lighting control in this project. Membership Functions (MF) This device uses power electronics to vary the frequency of input power to the motor, thereby controlling motor speed [8]. P

P

Fuzzification This term applies to the process of converting the controller inputs into information that can easily be used by the fuzzy inference mechanism [8]. P

P

Defuzzification This term means to convert conclusions of the inference mechanism into actual and crisp input to the process [8]. P

P

Firing Strength The degree to which the condition part of each rule is satisfied is termed as the firing strength of the rule [8]. P

2.3

P

Purpose

Lighting generally consumes a quarter to half of the total electricity consumption in a building [9]. Nowadays, the building lighting source is dominated by the use of fluorescent lights. For these reasons, this project proposes a building lighting system based on fuzzy logic scheme to automate light bulbs to achieve an optimum light intensity with maximum energy conservation. P

P

DVA406 Project Report

3

5

METHOD

The project was completed in different stages. Firstly, an online research and study was done to see how fuzzy logic can be used to control indoor lighting to any environment. Then the rule based decisions were made. These rules were then used to write the code for programming the microcontroller. The hardware circuit was designed and a PCB was designed with all the necessary circuit compoenets mounted on top. The hardware was then tested by checking all the possible output combinations from the sensor values. The results were compared to the expected as specified in the rule matrix. The input variables were indoor lighting and inference from LDRs acting as sensors. The output variable was the required illumination to achieve the required level which was translated into the number of lamps that had to be turned ON. In the test set up, a room’s lighting was controlled.

Figure 1. This test setup shows a snapshot of the hardware designed with the circuitry on a PCB and the Arduino microcontroller board. The test setup is shown with all the components working correctly during project demonstration.

DVA406 Project Report

4

SOFTWARE

4.1

Fuzzy Rule based Decisions

6

The inputs and outputs are defined by membership functions. The light information from light dependent resistors from the sensor circuit was used as input variable X1 and X2. Figure 2 illustrates the input variables using triangle membership functions as demonstrated and used in the project. The output variables (see Table 2) are the numerical value converted into number of additional light bulbs that should be turned ON. The fuzzy set of the output variable is inferred by max-min composition and the fuzzy relation describes the desired control action. The fuzzy set of the output variable is defuzzified to deliver a crisp numerical value by the maximum value method.

Input X1 LOW

MEDIUM

HIGH

1.0

0.5

0.0

0.25

0.5

0.75

1.0

Scaled Input Values from LDR

Input X2 LOW

MEDIUM

HIGH

1.0

0.5

0.0

0.25

0.5

0.75

1.0

Scaled Input Values from LDR

Figure 2. Triangle membership functions for the inputs X1 and X2 with all the values summing up to 1 for overlapping regions.

DVA406 Project Report

7

The inputs were defined by LOW, MEDIUM and HIGH on both LDRs, while the outputs were five different combinations of VERY LOW, LOW, MEDIUM, HIGH and VERY HIGH. The rule matrix was used and the selection was based on: ‘if X AND Y, then Z’ rule (see Table 1). The output corresponded to a fixed number of bulbs that should be lit up from the control logic.

LDR 1

Inputs

Low

Medium

High

Low

Very High

High

Medium

Medium

High

Medium

Low

High

Medium

Low

Very Low

LDR 2

Table 1. Rule matrix showing the input and output combinations

Abbreviation

Description

Number of lights to turn ON

VL

Very Low

0

L

Low

1

M

Medium

2

H

High

3

VH

Very High

4

Table 2. Interpretation of Output in term of the variables and number of light bulbs to be turned ON as a response to the input from LDRs

Thus the rules for all the possibilities were defined for later use in the microcontroller programming.

DVA406 Project Report

4.2

8

Microcontroller Programming

The Arduino [2] board was used because it is simple to program and is open source. The software code was written using the rules already defined by fuzzy. The code was written as Arduino sketch in a computer and tested on the hardware by connecting the board with the computer (see Figure 3). The input pins were connected to analog input pins on the board and the analog to digital conversion was performed by the in-built circuitry on the board and then the information was processed. The output pins were thus controlled such that particular pins were set HIGH so that only the specific number of bulbs light up. This is how the lighting was controlled. P

P

Figure 3. A code section of the Arduino sketch showing the rules implemented as C code in the software.

DVA406 Project Report

9

5

Hardware The output signals were generated through digital high and low signals through the software part as done on the Arduino board. These were used to turn ON/OFF the light bulbs connected to the external circuit through a wiring cable and mechanical relays. The analog signals from the sensors were acquired through analog input pins and fed to the microcontroller. The input from the LDRs was handled to give an output with a clear visual indication representing the output. 6

DISCUSSION

It is suggested that the project could be repeated with more sensors with a wider range to create a robust design of lighting control. The rule based system could also be performed using a software like MATLAB FIS, Fuzzy Logic Toolbox™ [1] to get an accurate result for the output value, but the system would then have to rely on one input only. A simulation could also be made on MATLAB Simulink [3] with a PID controller or similar to get a response from the sensor inputs. A temperature sensor model could also be designed as an extension to this project and coupled to get a complete indoor environment control. P

P

7

P

P

RESULTS

The project completed with the Indoor Lighting Control working as desired being able to detect light intensity values from the LDRs and controlling the number of bulbs turned ON in a small room.

Figure 4. A photograph of the light bulbs operating as controlled by the fuzzy rules defined in the software.

DVA406 Project Report

8

REFERENCES AND APPENDICES

8.1

Appendix A: Glossary of Acronyms

FL FIS LDR MF PCB PID Controller 16T

Fuzzy Logic Fuzzy Inference System Light Dependent Resistor Membership Function Printed Circuit Board Proportional Integral Derivative Controller

10

DVA406 Project Report

8.2

11

Appendix B: Description of Electronic Devices Used in Hardware

The LDR LDRs are made from semiconductor materials to enable them to have their light sensitive properties. Light dependent resistors are often used in circuits where it is necessary to detect the presence or the level of light, such as in this project, Intelligent Indoor Lighting Control using Fuzzy Logic. They can be described by a variety of names from light dependent resistor, LDR, photo resistor, or even photo cell (photocell) or photoconductor [5]. P

P

Figure 5. This is a simple cross section of an LDR with its circuit symbol [5] P

The Relay The relay used in the project was Omron PCB Relay G5V-2 5DC [6]. A relay is a simple electromechanical switch made up of an electromagnet and a set of contacts. A relay consists of two separate and completely independent circuits. The first activates the electromagnet which attracts an armature. The armature acts as a switch in the second circuit. When the electromagnet is energized, the armature completes another second circuit [7]. P

0T

0T

P

0T

0T

P

Figure 6. This is a picture of the Omron PCB Relay G5V-2 5DC [6]. P

P

P

DVA406 Project Report

8.3

12

References

[1] "Fuzzy Logic Toolbox™ 2 User’s Guide." The MathWorks, Inc., 2010. Web. [2] Margolis, Michael. Arduino Cookbook. 2nd Edition ed. N.p.: O'Reilly, 2011. Print. [3] "MATLAB SIMULINK ® - Simulation and Model Based Design." N.p., n.d. Web. . [4] "Fuzzy Logic." Advanced PLC Topics and Networks. N.p.: Industrial Text & Video, n.d. 798-845. Www.industrialtext.com. Web. [5] http://abhitechstrong.blogspot.se/2013/01/basic-electronics-tutorial-5.html [6] "PCB Signal Relay – G5V-2." Omron Electronic Components. FCC., 2010. Web. . [7] Bullock, Madeline. "How Relays Work" 01 April 2000. HowStuffWorks.com. 06 March 2013. [8] Xiong, Ning. "Lecture 3: Fuzzy Logic Control." Vasteras. Feb.-Mar. 2013. Lecture. [9] Hartoyo, Aryanto, and Seno D. Panjaitan. "A Lighting Control System in Buildings Based on Fuzzy Logic." TELKOMNIKA, Vol.9.No.3 (December 2011): 423-32. Web. 0T

0T

0T

0T

0T

0T

0T

. 0T

0T

0T

0T

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF