You are on page 1of 3

1

Indoor Lighting Control Using Fuzzy Logic


Bilal Shahid Student, IDT, MDH Department of EE, LUMS
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. 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. Thus the rules for all the possibilities were defined for later use in the microcontroller programming. B. 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. 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.

Yasser M. Najib Student, IDT, MDH

Rana Najdat Student, IDT, MDH

AbstractThis 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. Key Words Indoor Lighting Control, Analog circuits, LDR, Sensors, Fuzzy Logic, Intelligent Systems, Arduino, Microcontroller.

I. INTRODUCTION HIS document is a report on the project Indoor Lighting Control using Fuzzy Logic. 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].

II.

SOFTWARE

A. Fuzzy Logic Rule Based Decisions 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 1 illustrates the input variables using triangle membership functions as demonstrated and used in the project. The output variables (see Figure 2) are the numerical value converted into number of additional light bulbs that should be turned ON.

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

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

IV. 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 on 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.

III.

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. LDR 1 Inputs Low LDR 2 Medium High Low Very High High Medium Medium High Medium Low High Medium Low Very Low

V. 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. Figure3. A picture of the light bulbs operating as controlled by the fuzzy rules defined in the software. VI. TEST MEASUREMENT SETUP This test setup shows a snapshot of the hardware designed with the circuitry on a PCB and the Arduino microcontroller board.

Table1. Rule matrix showing the input and output combinations

3 Figure5. Test setup with all the components shown working during project demonstration.

VII. ACKNOWLEDGEMENTS We would like to thank Ning Xiong for making it possible for us to complete this project. Without his insight and help, we would not have been able to use the tools and knowledge that were new for us. His constant support from the start including weekly meetings on designing the logic and lectures on fuzzy controllers were of immense importance in accomplishment of this project.

VIII. REFERENCES
[1] [2] [3] [4]

[5]

"Fuzzy Logic Toolbox 2 Users Guide." The MathWorks, Inc., 2010. Web. Margolis, Michael. Arduino Cookbook. 2nd Edition ed. N.p.: O'Reilly, 2011. Print. "MATLAB SIMULINK - Simulation and Model Based Design." N.p., n.d. Web. <http://www.mathworks.se/>. "Fuzzy Logic." Advanced PLC Topics and Networks. N.p.: Industrial Text & Video, n.d. 798845. Www.industrialtext.com. Web. BSP295 Datasheet Pdf Datenblatt - Siemens Semiconductor Group - SIPMOS Small-Signal Transistor (N Channel Enhancement Mode Logic Level) ALLDATASHEET "BSP295 Datasheet Pdf Datenblatt Siemens Semiconductor Group - SIPMOS Small-Signal Transistor (N Channel Enhancement Mode Logic Level) ALLDATASHEET N.p., n.d. Web. 19 Feb. 2013.

You might also like