Вы находитесь на странице: 1из 59

Daylighting and Fan Control System for Classroom based on Fuzzy Logic

A Research Project

presented to the faculty of the

Department of Electrical Engineering

of the

University of Cebu Lapu-Lapu and Mandaue

Mandaue City, Cebu Philippines

In partial fulfillment

of the Requirements for the Degree of

Bachelor of Science in Electrical Engineering

By:

Eros Reich Josephus O. Omega

Catherine C. Saut

Samuel Caesar F. Talidro

Engr. Joseph Manbert Mendez

Adviser

October 2019
Table of Contents
CHAPTER I .................................................................................................................................... 1
PROBLEM & ITS SETTINGS ................................................................................................... 1
1.1 Introduction ........................................................................................................................... 1
1.2 Statement of the Problem ...................................................................................................... 3
1.3 Significance of the Study ...................................................................................................... 3
1.4 Scope and Limitations ........................................................................................................... 4
1.5 Definition of Terms ............................................................................................................... 4
CHAPTER II................................................................................................................................... 6
REVIEW OF RELATED LITERATURE .................................................................................. 6
2.1 A Fuzzy Controller for Indoor Lighting system with Daylighting Contribution .................. 8
2.2 Implementation of a Lighting Control System based on Fuzzy Logic ................................. 8
2.3 Development of Automation System for Room Lighting Based on Fuzzy logic Controller
................................................................................................................................................... 10
2.4. Energy Savings by Fuzzy Base Control of Occupancy Concentration in Institutional
Buildings ................................................................................................................................... 11
2.5 Design of an energy-saving controller for an intelligent LED lighting system .................. 12
2.6 Daylight Sensing LED Lighting System ............................................................................. 12
2.7 Daylight illuminance control with fuzzy logic .................................................................... 14
2.8 Temperature Control System Using Fuzzy Logic Technique ............................................. 15
CHAPTER III ............................................................................................................................... 18
METHODOLOGY .................................................................................................................... 18
3.1 Understanding the system ................................................................................................... 18
3.2 Block diagram of System .................................................................................................... 19
3.3 Conceptual Framework ....................................................................................................... 20
3.4 Circuit Diagram ................................................................................................................... 21
................................................................................................................................................... 21
3.5 Research Flow ..................................................................................................................... 23
3.6 Electronic Parts ................................................................................................................... 24
CHAPTER IV ............................................................................................................................... 31
DATA & RESULTS ................................................................................................................. 31
4.1 Test Runs & Results ............................................................................................................ 31
4.2. Cost Analysis...................................................................................................................... 32
CHAPTER V ................................................................................................................................ 34
SUMMARY, CONCLUSION AND RECOMMENDATION ................................................. 34
5.1 Summary and Findings ....................................................................................................... 34
5.2 Conclusion........................................................................................................................... 34
5.3 Recommendations ............................................................................................................... 34
CHAPTER VI ............................................................................................................................... 35
APPENDICES ........................................................................................................................... 35
Appendix 1: Source Code ......................................................................................................... 35
Appendix 2: Actual Project ....................................................................................................... 50
Bibliography ................................................................................................................................ 55
CHAPTER I

PROBLEM & ITS SETTINGS

1.1 Introduction

Electricity is both a basic part of nature and one of the most widely used forms of energy.
It is all around us powering technology such as lights, mobile phones, air conditioners, computers,
refrigerators and fans. Approximately, twenty-percent of the electricity consumed in the world is
spent for lighting[1]. More efficient utilization of the sun, as a natural source of light, for lighting
would save electricity used for lighting. Right in our own home we have the power to save energy
while saving our money. Saving energy reduces the demand for resources needed to make energy
and increasing energy efficiency is same as adding another clean energy source to our electric
power grid.

There are several methods to energy saving, one of which is through daylight control.
Daylight control is the method where it depends on the adaptation of artificial light based on the
available amount of daylight for commercial spaces. It is a lighting system that harvests day light
to provide free lighting during day and electrical lighting at night. Its principle is just simple: “As
natural light levels increase; electric light levels can be decreased to maintain a target task-light
level in a space[2].’’ Daylight penetration and its even distribution throughout a space are basic
considerations made in building design. Both define the effectiveness of daylighting. Enough
daylight reduces the demand for electrical lighting and provides a healthy visual environment.
Moreover, daylighting results in enhanced energy efficiency and visual acuity. Apart from the
benefit provided by daylight’s intensity, uniformly distributed daylight does not give rise to glaring
surfaces and enhances visual quality and comfort. Consequently, the primary physical measure use
to quantify this phenomenon is illuminance. The estimation of uniformly distributed daylight is
necessary, both in early architectural design processes and in daylighting performance evaluation
studies.

1|Page
Daylighting

The two primary reasons for using daylight to meet the illumination requirements of an
architectural space are the psychological benefits and the energy savings benefits. Good
daylighting has been shown to improve the overall attitude, satisfaction and well-being of building
occupants[3]. Several research studies have shown a variety of benefits of daylighting in different
building types and functions, among them improved retail sales in big box stores, increased worker
productivity and reduced absenteeism in office buildings, improved student educational
performance in schools, and improved patient recovery times in hospitals. Exposure to daylight
has also been shown to improve general health and circadian rhythm. These psychological benefits
can easily justify any extra design effort or added expense associated with introducing controlled
daylight into buildings.

With the apparent benefits of daylighting in terms of energy saving and aesthetics, this
paper proposed a method using fuzzy logic in utilizing daylight as the primary source of
illumination and ventilation in classroom zones. By implementing fuzzy logic schemes on
programmable microcontroller units, this research aims to design a simple lighting system and fan
control system which can be implemented on classrooms.

Effects of High Temperature on the Performance of Students

Temperature has a big effect to our mood which in turn may affect one’s performance.
Temperature has great effort on the decrease of memory and cognitive ability. According to a study
done by the University of Scranton, it is revealed that students perform best in controlled
temperature with test scores averaging in the 90th percentile. Score would average to as low as 70
when temperature is too hot. These studies were furthered by the National Bureau of Economic
Research, particularly during a year when classroom temperatures were higher, the national high
school students performed significantly worse on their PSAT tests. Rise in temperature could result
in the decrease of learning with extreme heat being damaging.
1.2 Statement of the Problem

Much energy is wasted from a lighting system during daytime. For the same amount of
light present, an inefficient lighting system consumes much energy in conjunction with the amount
of daylight present. To add to the issue above, there are times when lights are not turned off during
daytime which furthers the amount of wasted energy or lights that are not switched on during night
time which could be proven hazardous especially for people who have problems with their vision.

As most lighting system used nowadays are expensive and very sophisticated in terms of
its design making it rarely used in most building zone and to common household, nonetheless.

This study aims to address the current problem which is to design an uncomplicated
lighting and ventilation system to be used in classrooms which is not only energy efficient but also
cost effective.

As the study progresses, the following statement must be addressed: design a lighting
system using dimmable LED and a ventilation system using a fan; design and incorporate fuzzy
logic rules into the lighting for efficient daylighting control and ventilation system for ambient
temperature control.

1.3 Significance of the Study

This study will be beneficial to the following sectors:

Community - it would benefit the community since it provides user comfort, maximizes efficiency
in workspace.

Environment - the research would benefit the environment as it reduces the demand for energy
derived from non-renewable sources such as fossil fuels.
1.4 Scope and Limitations

1.4.1 Scope

The research work is focused on a three input (motion, temperature and ambient
lighting) automated lighting and ventilation system which is to be used in classrooms.

1.4.2 Limitations

The study is limited only to the designing of a fuzzy based lighting and ventilation
system. In this study, the researcher only considers at least one LED lamp and one fan thus the
equation for the number of lamps used for a controlled environment wouldn’t be used.

1.5 Definition of Terms

Crisp - is like binary values that are either statement answer is 0 or 1. In sampler way, It define as
either value is true or false. Only two value it's varying like binary. But in case of fuzzy we could
able to take the intermediate value. In short value in between 0 or 1.

Crisp Input - are exact inputs measured by sensors and passed into the control system for
processing, such as temperature, pressure, rpm's, etc. Each crisp input that is to be processed by
the FIU has its own group of membership functions or sets to which they are transformed.

Crisp Output - it is the defuzzified output fuzzy set to a crisp value.

Daylighting - is the practice of placing windows, skylights, other openings, and reflective surfaces
so that sunlight can provide effective internal lighting

Daylight harvesting (daylighting control) - the contribution of daylight is taken into


consideration

Defuzzification - dissolves multiple degree ambiguous by putting raw fuzzy outputs into a
composite numerical output.
Degree of Membership- represents the degree of truth as an extension of valuation. Degrees of
truth are often confused with probabilities, although they are conceptually distinct, because fuzzy
truth represents membership in vaguely defined sets, not likelihood of some event or condition.

Fuzzification - the current input values are compared against stored input membership functions,
usually in a program loop structure to determine the degree to which each linguistic variable of
each system is true.

Fuzzy Logic - is a logic or control system of an n-valued logic system which uses the degrees of
state “degrees of truth “of the inputs and produces outputs which depend on the states of the inputs
and rate of change of these states (rather than the usual “true or false” (1 or 0), Low or High
Boolean logic (Binary) on which the modern computer is based). It basically provides foundations
for approximate reasoning using imprecise and inaccurate decisions and allows using linguistic
variables.

Fuzzy Output - considers raw suggestions for what the system output should be in response to the
current input conditions.

Illumination - an observable property and effect of light, may also refer to lighting.
CHAPTER II

REVIEW OF RELATED LITERATURE

Fuzzy Logic

Fuzzy logic is an approach to computing based on "degrees of truth" rather than the usual
"true or false" (1 or 0) Boolean logic on which the modern computer is based. The idea of fuzzy
logic was first advanced by Dr. Lotfi Zadeh of the University of California at Berkeley in the
1960s. Dr. Zadeh was working on the problem of computer understanding of natural language.
Natural language (like most other activities in life and indeed the universe) is not easily translated
into the absolute terms of 0 and 1[4]. (Whether everything is ultimately describable in binary terms
is a philosophical question worth pursuing, but in practice much data we might want to feed a
computer is in some state in between and so, frequently, are the results of computing.)[4] It may
help to see fuzzy logic as the way reasoning really works and binary or Boolean logic is simply a
special case of it. Fuzzy logic includes 0 and 1 as extreme cases of truth (or "the state of matters"
or "fact") but also includes the various states of truth in between so that, for example, the result of
a comparison between two things could be not "tall" or "short" but ".38 of tallness." Fuzzy logic
seems closer to the way our brains work. We aggregate data and form a number of partial truths
which we aggregate further into higher truths which in turn, when certain thresholds are exceeded,
cause certain further results such as motor reaction. Fuzzy logic is essential to the development of
human-like capabilities for AI, sometimes referred to as artificial general intelligence: the
representation of generalized human cognitive abilities in software so that, faced with an
unfamiliar task, the AI system could find a solution.

The practice of fuzzy logic derives from the transformation of verbal expressions into
analytical information for use in computing processes. This mathematical tool then categorizes
variables into certain degrees of subsets based on the theory that “an event occurs with a relative
graded membership”. Thus, a fuzzy inference system (FIS) constructs a model that provides
outcomes with meaningful decision-making implications as a result of these categories of
imprecise data and vague statements of verbal information. This model helps to categorize the
complexity of real-world tasks into simple units. The prediction of daylight illuminance is one
such task.

Fuzzy controllers are very simple conceptually. They consist of an input stage, a processing
stage, and an output stage. The input stage maps sensor or other inputs, such as switches,
thumbwheels, and so on, to the appropriate membership functions and truth values. The processing
stage invokes each appropriate rule and generates a result for each, then combines the results of
the rules. Finally, the output stage converts the combined result back into a specific control output
value.

There are several ways to define the result of a rule, but one of the most common and
simplest is the "max-min" inference method, in which the output membership function is given the
truth value generated by the premise. Rules can be solved in parallel in hardware, or sequentially
in software. The results of all the rules that have fired are "defuzzified" to a crisp value by one of
several methods. There are dozens, in theory, each with various advantages or drawbacks. The
"centroid" method is very popular, in which the "center of mass" of the result provides the crisp
value centroid method favors the rule with the output of greatest area. The diagram demonstrates
max-min inferencing and centroid defuzzification for a system with input variables "x", "y", and
"z" and an output variable "n". Note that "mu" is standard fuzzy-logic nomenclature for "truth
value”.

Figure 1. Centroid Deffuzzification using max-min inferencing

g
2.1 A Fuzzy Controller for Indoor Lighting system with Daylighting Contribution

The input linguistic variables of the fuzzy controller are the level of the illuminance
measured by the three photosensors while the output variables are the level of the DC control
signal sent to electronic ballasts. Every linguistic variable has five fuzzy values with triangular or
trapezoid membership functions, as follows:

For input variables – D – dark; HD – half dark; M – half; HL – half light; L – light;

For output variables – VL – very low; L – low; M – medium; H – high; VH – very high[5].

Figure 2.a. Input Variables Fuzzification[5]

Figure 2.b. Fuzzification of Output Variables[5]

2.2 Implementation of a Lighting Control System based on Fuzzy Logic


The proposed system uses four sensing devices (an occupancy/motion sensor and three
photosensors), continuously electronic dimming ballasts for every luminary aiming the control of
the electric lighting output, and a fuzzy controller[6]. Data obtained by simulation proved the
correctness of the proposed solution.

Figure 3.Basic structure of Fuzzy controller[6]

Energy Management

Energy management controls provide energy saving through reduced illuminance or


reduced time of use. In order to increase energy efficiency, it is not just using less energy but also
it requires awareness of how energy is used, where it is wasted, and how it can be used more
efficiently and effectively in everyday life. An energy management practice is a technique,
method, procedure, routine or rule adopted at a precise stage of the industrial energy management
setting to achieve the company’s energy efficiency objectives. It acts on technological, non-
technological, or of support aspects, by improving the energy performance directly or indirectly in
a specific area of the company. There is a range of technologies from a simple timer that turns off
a lamp to a centralized, computer-based system that will monitor, control and optimize building
systems. The four main devices that are used include Programmable time controls, Automatic
lighting controls, HVAC control system or programmable/smart thermostats, and an energy
management/building automation system. Through the four systems a building can reduce energy
consumption by up to 20%. You would be saving money and saving energy by investing in these
devices. This is a matter of doing good (socially and economically) and managing money
well (economically viable).

Programmable time controls are the simplest and least expensive.

Automatic lighting controls consist of photo sensors that gage the quantity of light in an area and
the output of the light fixture then adjust. A simple photo control that turns outdoor lighting on
and off in reaction to the how much sunlight is near and day lighting controls that adjust indoor
light fixture output levels near windows or under skylights in response to the outdoor light entering
the building are both examples of automatic lighting controls. The controls can be simple on/off,
stepped light output reduction and dimming devices. Photo sensors can in addition be used to
control automated blinds that limit direct sunlight to decrease cooling loads.

Modern programmable thermostats maintain comfortable indoor temperatures and are


programmed to automatically increase or decrease the temperature of your facility according
to schedules that you desire.

Energy Management Systems (EMS) or Building Automation Systems (BAS) refer to a


centralized, computer-based system that monitors and controls a building energy use. They provide
the capability to monitor and integrate the functions of multiple buildings from a central location.

Many studies have been done on improving the energy efficiency of lighting system by
embracing different strategies such as occupancy sensing, tuning, scheduling, adaptive
compensation, demand response and daylight harvesting. In our study we are dealing with Daylight
Harvesting commonly known as- Daylighting Control where the amount of daylight is taken into
consideration and it uses lighting control systems that are dimmable then the artificial lighting may
be continuously adjusted in proportion to the changing daylight availability. Aside from, Fuzzy
logic controller is much better to use because of its simplicity and flexibility, and cheaper to
develop. It can also handle problems with imprecise and incomplete data.

2.3 Development of Automation System for Room Lighting Based on Fuzzy logic Controller
In human daily life, light has a major effect on our moods and general well-being and it
turns your home into the place for doing things you love[10]. So, the right lighting at home can
lift the spirits, as well as illuminate practical tasks. However, we always forget to switch the lamp
off as the room is empty or to decrease the number of lamps to be switched on, if the incoming
light to the room is going brighter. So, efficiency of lighting energy usage is an important effort to
do by human being. One of the lighting energy efficiency researches is using lighting control
method. The controller will control the number of lamps to be switched on while maintaining the
suitable illuminance for the specific condition of the room. By the use of an automatic controller
then lighting energy consumption can be reduced.

In this related literature, fuzzy logic is proposed as the control method for a room lighting
system with CFLs as the controlled objects. Nowadays, most of room lighting uses Compact
Fluorescent Lamp (CFL), because CFL is more efficient than incandescent lamp but in our
research, we prefer Light Emitting Diode (LEDs) lamps as the controlled objects since it is
affordable and consume less energy.

Figure 4.a. Hardware Block Diagram[10] Figure 7.b. Software Algorithm[10]

2.4. Energy Savings by Fuzzy Base Control of Occupancy Concentration in Institutional


Buildings
This paper presents a simulation study of the effect of occupancy level on energy usage
pattern of Building 19 at Rockhampton campus of Central Queensland University, Queensland,
Australia[11]. The study was based on simulation using Energy Plus simulation engine and
enhanced by the building’s profile such as building’s floorplan, number of occupants who use the
building during working hours, real energy demand, HVAC system, lighting system and etc. The
occupant projection is performed by the simulation engine which was able to generate a random
number of occupants based on information has been provided by the university’s facilities
management team.
Figure 5.Building no.19, at Rockhampton Campus of CQ University[11]

2.5 Design of an energy-saving controller for an intelligent LED lighting system


In this paper, they present an energy-saving controller that is capable of shaping the light
output of an LED lighting system autonomously based on data received from sensors[14]. A
wireless sensor module was designed to provide accurate sensor feedback to the controller. The
framework of the smart lighting system along with the controller optimization process was also
described. A purpose-built smart luminaire complete with an LED driver was designed and
constructed to study the performance of the control system. The results show increased energy-
savings compared to similar systems, especially for a continuous usage pattern environment. The
scope of this paper was limited to the design of an energy-saving controller and validation of its
performance via real-world experimental results. To improve their study, we design a lighting
system using dimmable LEDs based on fuzzy logic controller by daylighting control to save more
energy.

2.6 Daylight Sensing LED Lighting System


In this study, in order to reduce energy consumption, they used Light Emitting Diodes
(LEDs) for general lighting applications in offices, industry and homes. With LED lighting
systems, the light output can be flexibly and easily controlled. They use a photosensor to measure
light levels and signal a controller to dim or switch the lights in response to daylight. A photosensor
can include a light-sensitive photocell, input optics, and an electronic circuit that converts the
photocell signal into an output control signal. Photosensors can mount on walls or ceilings, and
they can be a part of light fixtures[15]. Technicians can install fixture-integrated sensors as part of
the original fixture or later in the field by attaching them to a lamp via a clip and wiring them
directly to the ballast. As daylight harvesting grows in importance, photosensors are becoming
more sophisticated. But managers must beware: No existing standard defines the way photosensors
should operate. In our study, we also use photosensor for the measurement of light levels and a
microcontroller based on fuzzy logic for the dimming or switching the lights similar with their
study.

Figure 6.a. Proposed daylight sensing based lighting control system[15]

Figure 11.b. Photodetector based lighting control system[15]


2.7 Daylight illuminance control with fuzzy logic

The main aim of the paper is to present the automatic roller blind, based on the fuzzy logic
control, and to obtain the desired inside illuminance according to the available momentary solar
radiation. The development of the technology increases the possibility to exploit the visible part
of energy flow through the transparent part of the building envelope with its automatically active
response. In our case this is realized by roller blind positioning adaptable to the outside weather
conditions. The real model of a building physical test chamber properly equipped was built for the
development of the fuzzy control system for variable window geometry[17]. The test chamber
allows the investigation and experimentation in illuminance control and enables us to study the
influences of the movable shade interventions on the luminous efficacy. The main focus of the
study is on designing and developing the fuzzy illuminance controller. Based on the experiments
the fuzzy illuminance controller was optimized iteratively. The design of fuzzy controllers is
closely related to human reasoning. We want the movable shadow device to be changeable as if it
was adapted manually to the internal demands and external conditions, and even better. Well
designed and tuned illuminance fuzzy controller enables the automatic positioning of the roller
blind responding to the momentary solar radiation, to get as close as possible to the desired inside
daylight illuminance in the building, and it enables moderate continuous movement of the shades.

This paper proposed a modern approach to control the inside illuminance with fully
automated fuzzy system for adjusting shades, which responds constantly to the changes in the
available solar radiation, which makes decisions as it follows the human thinking process.

Figure 12. Detailed scheme of the illuminance control loop.[17]


2.8 Temperature Control System Using Fuzzy Logic Technique

In this paper, microcontroller was used to implement a fuzzy logic-based temperature


control system. The system is aimed at controlling the temperature of an environment by regulating
a heater and the speed of a fan.

Microcontroller has to make decisions based on external temperature condition. The variable
“temperature” which is inputted on the system can be divided into a range of states such as “Cold”,
“Cool”, “Moderate”, “Warm”, “Hot”, “Very hot”. Defining the bounds of these states is a bit
tricky.

An arbitrary threshold might be used to separate “warm” from “hot”, but this would result in a
discontinuous change when the input value passes over that threshold. The way to make the states
“fuzzy” is to allow them change gradually from one state to the next. The input temperature states
can be defined using “membership functions” as in figure 1.

With this scheme, the input variable state no longer jumps abruptly from one state to the next.
Instead as the temperature changes, it loses value in one membership function while gaining value
in the next.

Given “mappings” of inputs variable into membership functions and truth values, the
microcontroller then makes decision of what action to take based on a set of “rules” for each of
the form. For instance, if the external temperature is warm, then the fan speed is not very fast, but
heater is low. In this example, the input variable temperature has values defined by fuzzy set. The
output variables which are the speed of fan and heater temperature are also defined by a fuzzy set
that can take values like “static”, “slightly increased”, “slightly decreased”, and so on.
MICROCONTROLLER-BASED FUZZY LOGIC

A microcontroller-based fuzzy logic control system has a fuzzy inference kernel and a knowledge-
base. The fuzzy inference kernel is executed periodically to determine system output based on
current system input. The knowledge-base contains membership functions and rules.

A programmer who does not know how the application system works can write a fuzzy inference
kernel. One “execution pass” through a fuzzy inference kernel generates system output signals in
response to current system input conditions [7].

The proposed logical/physical system with the problem statement and the features of the new
system (a fuzzy logic-based temperature control system) seems to meet the requirement of the new
system.

The system inputs are variable inputs introduced into the system with the aid of sensors
(temperature sensors). These sensors deliver signals to the ADC. The ADC circuit converts
analogue signals to digital signal which the microcontroller understands. The microcontroller is
the heart of the system. It contains the inference kernel and the knowledge-base. The fuzzy
inference kernel is executed periodically to determine system outputs based on current system
inputs. The knowledge-base contains membership functions and rules. The inference kernel is the
engine of the microcontroller where fuzzification, rule evaluation and deffuzzification are done.
The display fuzzy output is done by the display unit, while the fuzzy output interface aids in the
transmission of deffuzified signals to the system output [8].

(IJARAI)
International Journal of Advanced Research in Artificial Intelligence, Vol. 1, No. 3, 2012
2. 9 Automatic Control of Fan Speed using Fuzzy Logic

This paper gives you the concept of an electric fan speed control by using fuzzy logic. This
provides a clear view of how speed control is done based on data from the temperature sensor
using fuzzy logic. In this we used data from analysis and verified it with different mathematical
formulas. In this paper the input was taken into fuzzifed form and converted into a defuzzifed
value to get the output by following certain rule blocks. In mythological analysis we considered 3
stages, Fuzzification of Input, Rule Block were defined, Defuzzification , to get the output. We
have tried to make a fuzzy inference system that has been used without any failure in establishing
the relation between environment temperature and fan speed. Due to the shortage of electricity
supply, we have to start research in areas where energy can be used efficiently.

In households during summer, A.C. is responsible for 60-70% of our summer electricity
bill [ HYPERLINK \l "Ari07" 1 ]. The window A.C. that has been mostly employed uses 500 to
1440 watts2]}.In comparison, an electric fan uses only 90 watts, depending upon the speed and
size [ HYPERLINK \l "htt" 3 ]. In our study we implemented it on classroom to provide comfort
and ventilation to the students and teachers. Electric fan is a device that helps us to stay cool in
summer while saving our money as well as protecting the environment by limiting the release of
Carbon-di-oxide. In this paper the idea to use fuzzy logic came from the fact that temperature
cannot be defined accurately. While all the regularly used system are defined by mathematical
equations.
CHAPTER III

METHODOLOGY

3.1 Understanding the system

Figure 3.1 Algorithm for system control


Motion is first detected by the system before being read by the fuzzy controller. It means
when no motion is detected then there will be no control signal be sent on the MOSFET and the
LED and FAN would be turned off. When motion is detected, data will be sent to the fuzzy
controller then the amount of illuminance will be read by the sensor to be analyzed by the fuzzy
controller. If the amount of illuminance is greater than the desired value, then there will be no
control signal be sent to the dimming circuit and the LED would be turned off. If the amount of
illuminance is less than the desired value, control signal would be sent to the dimming circuit and
the amount of illuminance emitted by the LED will depend upon the received controlled voltage
provided the control signal. Figure 15 shows the algorithm for daylight control of the fuzzy
controller. Voltage is controlled by the information sent by the motion sensor in conjunction with
the amount of daylight present. If the motion sensor reading is False, then controlled voltage is
zero. Control voltage decreases or increases depends upon the amount of Lux detected by the
sensor.

3.2 Block diagram of System

INPUT STAGE PROCESSING OUTPUT STAGE


STAGE

DAYLIGHT
 LDR FUZZIFICATIO
N
TEMPERATURE CONTROL
INFERENCING
 DHT11 OUTPUT VALUE
DEFUZZIFICATI
MOTION ON
 MOTION
SENSOR

Figure 7.Block diagram


3.3 Conceptual Framework

MOTION TEMPERATURE
LIGHT SENSOR SENSOR SENSOR

BUCK CONVERTER

ARDUINO MEGA

CENTRALIZED POWER SUPPLY MOSFET


LED

FAN
Figure 3.3 Conceptual Framework
The conceptual framework shows that the primary input of the system are ambient light,
ambient temperature and motion which are detected by the photosensor-LDR, temperature sensor-
DHT11 and motion sensor respectively. Data collected by the sensor are analyzed by the fuzzy
controller which in turn are converted into control output signal. The Control signal is then sent to
the MOSFET which regulate the amount of voltage to be supplied to the LED lamp and fan.

3.4 Circuit Diagram

Figure 3.4 Daylighting and Fan Control System based on Fuzzy Logic Circuit

The circuit consist of three sensors, one controller, two voltage regulators for the fan and
LED bulb. The centralized power supply has 18 channels with 12V DC output. First channel is
connected to Buck converter which is DC-DC step-down adjustable converter to supply exact 5V
for Arduino Mega AT2560 mini microcontroller. The second channel is connected to MOSFET or
voltage regulator for LED, the same procedure for the fan using another channel connected to
MOSFET or voltage regulator to drive the fan. The input source of the MOSFET is connected to
the power supply and its output responds according to the reading of the Arduino Mega AT2560
both for LED bulb and fan. The sensors are connected to the microcontroller in order to read data
and send it to the output of the system. The inputs are light sensor, temperature sensor and motion
sensor. The outputs are LED bulb and fan. The system will enable if there is motion detected and
disabled if there is no motion detected within two minutes.

For the sensor circuit, the digital outputs of LDR and DHT11 is connected to the digital
pins AO and 9 of Arduino Mega, respectively. For voltage regulator circuit, the digital input of
LED Bulb and fan is connected to the digital pins 11 and 6 of Arduino, respectively. Then for the
Motion Detection circuit,the output is connected to the digital pin 4 of Arduino Mega AT2560.
3.5 Research Flow

Start

Design an LED lighting


and fan ventilation
system

Develop fuzzy rules for


lighting and fan system

Motion Sensor

Does fuzzy rule


produce the
NO YES End
most efficient
output?

Fig. 3.5.1 Flow diagram of the system


3.6 Electronic Parts

PIR

Fig.3.6.1 Pin Configuration of PIR (Passive Infrared) Motion Sensor

Specifications:

 Wide range on input voltage varying from 4V to 12V (+5V recommended)


 Output voltage is High/Low (3.3V TTL)
 Can distinguish between object movement and human movement.
 Has operating modes- Repeatable(H) and Non-Repeatable(H)
 Cover distance of about 120˚ and 7 meters
 Low power consumption of 65mA
 Operating temperature from -20˚C to +80˚C
DHT11

Fig.3.6.2 Pin Configuration of DHT11 Temperature Sensor

Specifications:

 Operating Voltage 3.5V to 5.5V.


 Operating Current: 0.3 mA(measuring) 60uA(standby)
 Output: Serial data.
 Temperature Range: 0˚C to 50 ˚C.
 Humidity Range: 20% to 90%
 Resolution: Temperature and Humidity both are 16-bit
 Accuracy: ±1 ˚C and ±1%
MOSFET

Fig.3.6.3 Pin Configuration of MOSFET

Specifications:

 Voltage: 3.3V, 5V

 Output load voltage :0-24V

 Output load current: <5A (1A need to add more heat sink)

 Platform: Arduino, MCU, ARM, Raspberry Pi

 Using original IRF520 Power MOS, you can adjust the output PWM.

 Drive up to 24V allows the load, such as LED lights, DC motors, miniature pumps,
solenoid valves.

 PWM dimming LED can be used to achieve step less dimming, variable speed motor
control.

Note: Above 1A load, you need to install heat sink


LDR

Fig.3.6.4 Pin Configuration of LDR

Specifications:

 Input Voltage: DC 3.3V to 5V

 Output: Analog and Digital

 Sensitivity adjustable
Arduino

Fig.3.6.5 Pin Configuration of Arduino Mega Mini

Specifications:

 Microcontroller: ATmega 2560 (16MHz)

 Interface: USB-UART-CH340G (12MHz)

 Input voltage: 6-9V (Peack @18V)

 Output current: 800mA/5V and 800mA/3.3V

 Connection: PC-Micro USB

 70 Digital I/Os

 16 Analog entries

 14 PWM

 4 UART bus
Buck Converter Module

Fig.3.6.6 Pin Configuration of Buck Converter Module

Specifications :
IC Chip: Monolithic Power Systems (MPS) MP1584EN
Input Voltage: 4.5V to 28V
Output Voltage:0.8V to 20V
Output Current: 1.8 A typical (3.0 Max)
Output Ripple Frequency: 340 KHz
Ripple Voltage: 30mV
Output Accuracy: +/- 0.5%
Dimensions: 1.7 x 1.7 x 0.4 cm
Operating Temperature: -50 ~ +85 deg. C
Centralized Power Supply

Fig.3.6.7 Pin Configuration of Centralized Power Supply

Specifications:

Input Voltage: AC100-240V

Input Voltage Frequency: 50/60Hz

Output Specification Output Voltage: DC 12V

Output Current: 10 - 30 Amperes

Dimensions (mm): 315(L) X 215(W) X 65(H)

Fuse Type: PTC (Resetable fuse)

Fuse Rating: 1.1Amps / 60VAC


CHAPTER IV

DATA & RESULTS

4.1 Test Runs & Results

Result:

LDR LED Luxmeter Fan


Time DHT11 Input (°C)
Input Change Reading (lux) Speed
1:45 PM 173 159.9 206 25.5 957.3
2:00 PM 174 162.94 224 25.5 957.3
2:15 PM 176 170 226 25.5 957.3
2:30 PM 178 173 230 25.5 957.3
2:45 PM 173 159.9 201 25.6 957.3
3:00 PM 173 159.9 207 25.5 957.3
4:30 PM 379 473 133 26.2 957.3
4:45 PM 444 598 103 26.2 957.3
5:00 PM 518 673 95 26.2 957.3
6:00 PM 599 748 33.2 23.8 0
6:15 PM 597 748 33.1 23.8 0
6:30 PM 599 748 33.1 23.8 0
6:45 PM 598 748 33.1 23.8 0
7:00 PM 598 748 33.2 23.8 0
7:15 PM 599 748 33.2 23.8 0
7:30 PM 602 748 33.4 23.8 0
7:45 PM 601 748 33.4 23.9 0
8:00 PM 600 748 33.4 23.9 0
4.2. Cost Analysis

Items Quantity Price Total


(Php) (Php)
Centralized Power 1 1 200.00 1600.00
Supply

12V Fan 1 750.00 750.00

12V LED Bulb 4 250.00 1 000.00

Arduino Mega mini 1 995.00 995.00

DHT11 1 140.00 140.00

MOSFET 2 200.00 400.00

Buck Converter 1 150.00 150.00

LDR 1 140.00 140.00

PIR 1 140.00 140.00

Connecting Wires 46 m 4.00/m 184.00

Electrical Tape 1 40.00 40.00

Junction Box 4 20.00 80.00

Switch 1 25.00 25.00

TOTAL 5,644.00

Table 4.1 Bill of Materials


Total Material Cost = Php 5,644.00

Labor Cost = Php 1,500.00

Overall Cost = Total Material Cost + Labor Cost = Php 7,144.00

Therefore, the overall cost in making the project is Php 7,144.00

Note: The labor cost includes only the programming of the codes.
CHAPTER V

SUMMARY, CONCLUSION AND RECOMMENDATION

5.1 Summary and Findings

The system has three sensors, LDR, DHT11, and PIR for ambient light, ambient
temperature and motion detection respectively.

5.2 Conclusion

After the research, the researchers arrived at the following:

 For this project, Arduino Mega would be the best choice for the microcontroller since its
is very compact in size and has many available pins which could be used to install several
luminaires and fan.
 The centralized power supply is ideal for this project which uses several DC channel, thus
making it possible to supply several other luminaires and fan.

5.3 Recommendations

 The researcher developed a fuzzy based lighting and ventilation system which is an open
loop system and doesn’t have a feedback from the amount of lux in the surface. The
researcher recommends additional sensor for detecting the amount of lux in the surface and
be used as feedback data to feed in the microcontroller, thus making the system a closed
loop.
 This project only uses 4 LED lamps joined together functioning as one luminaire. To
maximize the illumination in the classroom, we recommend using several luminaires.
CHAPTER VI

APPENDICES

Appendix 1: Source Code

“Main Code”

#include "Light.h"

#include "Fan.h"

#include "PIR.h”

TLight light;

TFan fan;

TPIR sw;

void setup() {

Serial.begin(9600);

light.init(11, A0);

fan.init(6, 9);

sw.init(4);

void loop() {

sw.run();

if(sw.IsOn){

light.run();

fan.run();
} else {

light.off();

fan.off();

delay(1000);

“Fan.h”

#include <Fuzzy.h>

#include <FuzzyComposition.h>

#include <FuzzyInput.h>

#include <FuzzyIO.h>

#include <FuzzyOutput.h>

#include <FuzzyRule.h>

#include <FuzzyRuleAntecedent.h>

#include <FuzzyRuleConsequent.h>

#include <FuzzySet.h>

#include <DHT.h>

#define DHT11_PIN 9

#define DHTTYPE DHT11

Fuzzy *fuzzy = new Fuzzy();

DHT dht (DHT11_PIN, DHTTYPE);

class TFan {

private:
int PIN_TEMP = 7;

int PIN_OUT = 6;

public:

bool Fuzzy = true;

void init(int aPinOut, int aTemp);

void run();

void off();

};

void TFan::init(int aPinOut, int aTemp){

PIN_OUT = aPinOut;

PIN_TEMP = aTemp;

pinMode(PIN_OUT, OUTPUT);

pinMode(PIN_TEMP, INPUT);

dht.begin();

Serial.begin(9600);

FuzzyInput *dhtinput = new FuzzyInput(1);

FuzzySet *verylow = new FuzzySet(25, 26, 27, 28);

dhtinput->addFuzzySet(verylow);

FuzzySet *low = new FuzzySet(28, 29, 30, 31);

dhtinput->addFuzzySet(low);

FuzzySet *medium = new FuzzySet(31, 32, 33, 34);

dhtinput->addFuzzySet(medium);
FuzzySet *high = new FuzzySet(34, 35, 36, 37);

dhtinput->addFuzzySet(high);

FuzzySet *veryhigh = new FuzzySet(37, 38, 39, 41);

dhtinput->addFuzzySet(veryhigh);

fuzzy->addFuzzyInput(dhtinput);

FuzzyOutput *fanspeed = new FuzzyOutput(1);

FuzzySet *veryslow = new FuzzySet(950,954.87,959.73, 964.6);

fanspeed->addFuzzySet(veryslow);

FuzzySet *slow = new FuzzySet(964.6, 969.67, 974.33, 979.2);

fanspeed->addFuzzySet(slow);

FuzzySet *average = new FuzzySet(979.2, 984.07, 988.93, 993.8);

fanspeed->addFuzzySet(average);

FuzzySet *fast = new FuzzySet(993.8, 998.67, 1003.53, 1008.4);

fanspeed->addFuzzySet(fast);

FuzzySet *veryfast = new FuzzySet(1008.4,1013.27,1018.13,1023);

fanspeed->addFuzzySet(veryfast);

fuzzy->addFuzzyOutput(fanspeed);

FuzzyRuleAntecedent *ifDhtinputVerylow = new FuzzyRuleAntecedent();

ifDhtinputVerylow->joinSingle(verylow);

FuzzyRuleConsequent *thenFanspeedVeryslow = new FuzzyRuleConsequent();

thenFanspeedVeryslow->addOutput(veryslow);
FuzzyRule *fuzzyRule01 = new FuzzyRule(1, ifDhtinputVerylow,
thenFanspeedVeryslow);

fuzzy->addFuzzyRule(fuzzyRule01);

FuzzyRuleAntecedent *ifDhtinputLow = new FuzzyRuleAntecedent();

ifDhtinputLow->joinSingle(low);

FuzzyRuleConsequent *thenFanspeedSlow = new FuzzyRuleConsequent();

thenFanspeedSlow->addOutput(slow);

FuzzyRule *fuzzyRule02 = new FuzzyRule(2, ifDhtinputLow, thenFanspeedSlow);

fuzzy->addFuzzyRule(fuzzyRule02);

FuzzyRuleAntecedent *ifDhtinputMedium = new FuzzyRuleAntecedent();

ifDhtinputMedium->joinSingle(medium);

FuzzyRuleConsequent *thenFanspeedAverage = new FuzzyRuleConsequent();

thenFanspeedAverage->addOutput(average);

FuzzyRule *fuzzyRule03 = new FuzzyRule(3, ifDhtinputMedium, thenFanspeedAverage);

fuzzy->addFuzzyRule(fuzzyRule03);

FuzzyRuleAntecedent *ifDhtinputHigh = new FuzzyRuleAntecedent();

ifDhtinputHigh->joinSingle(high);

FuzzyRuleConsequent *thenFanspeedFast = new FuzzyRuleConsequent();

thenFanspeedFast->addOutput(fast);

FuzzyRule *fuzzyRule04 = new FuzzyRule(4, ifDhtinputHigh, thenFanspeedFast);


fuzzy->addFuzzyRule(fuzzyRule04);

FuzzyRuleAntecedent *ifDhtinputVeryhigh = new FuzzyRuleAntecedent();

ifDhtinputVeryhigh->joinSingle(veryhigh);

FuzzyRuleConsequent *thenFanspeedVeryfast = new FuzzyRuleConsequent();

thenFanspeedVeryfast->addOutput(veryfast);

FuzzyRule *fuzzyRule05 = new FuzzyRule(5, ifDhtinputVeryhigh,


thenFanspeedVeryfast);

fuzzy->addFuzzyRule(fuzzyRule05);

void TFan::run(){

float input = dht.readTemperature();

fuzzy->setInput(1, input);

fuzzy->fuzzify();

float iFuzzy = fuzzy->defuzzify(1);

if (input >= 40)

iFuzzy = 1023;

Serial.println("\n\n\nDHT11: ");

Serial.print("\t\t\tAmbient Temperature: ");

Serial.println(input);

Serial.println("Result: ");

Serial.print("\t\t\tFan Speed: ");


Serial.println(iFuzzy);

analogWrite(PIN_OUT, iFuzzy);

void TFan::off(){

analogWrite(PIN_OUT, 0);

“Light.h”

#include <Fuzzy.h>

#include <FuzzyComposition.h>

#include <FuzzyInput.h>

#include <FuzzyIO.h>

#include <FuzzyOutput.h>

#include <FuzzyRule.h>

#include <FuzzyRuleAntecedent.h>

#include <FuzzyRuleConsequent.h>

#include <FuzzySet.h>

Fuzzy *fuzzy01 = new Fuzzy();

class TLight {

private:

int PIN_LDR = A0;

int PIN_OUT = 11;

public:

bool Fuzzy = true;


void init(int aPinOut, int aLDR);

void run();

void off();

};

void TLight::init(int aPinOut, int aLDR){

PIN_OUT = aPinOut;

PIN_LDR = aLDR;

pinMode(PIN_OUT, OUTPUT);

pinMode(PIN_LDR, INPUT);

Serial.begin(9600);

FuzzyInput *ldrinput = new FuzzyInput(1);

FuzzySet *veryverylow = new FuzzySet(0, 27, 54, 81);

ldrinput->addFuzzySet(veryverylow);

FuzzySet *verylow = new FuzzySet(67.5, 94.5, 121.5, 148.5);

ldrinput->addFuzzySet(verylow);

FuzzySet *low = new FuzzySet(135, 162, 189, 216);

ldrinput->addFuzzySet(low);

FuzzySet *averagelow = new FuzzySet(202.5, 229.5, 256.5, 283.5);

ldrinput->addFuzzySet(averagelow);

FuzzySet *mediumlow = new FuzzySet(270, 297, 324, 351);


ldrinput->addFuzzySet(mediumlow);

FuzzySet *moderate = new FuzzySet(337.5, 364.5, 391.5, 418.5);

ldrinput->addFuzzySet(moderate);

FuzzySet *mediumhigh = new FuzzySet(405, 432, 459, 486);

ldrinput->addFuzzySet(mediumhigh);

FuzzySet *averagehigh = new FuzzySet(472.5, 499.5, 526.5, 553.5);

ldrinput->addFuzzySet(averagehigh);

FuzzySet *high = new FuzzySet(540, 567, 594, 621);

ldrinput->addFuzzySet(high);

FuzzySet *veryhigh = new FuzzySet(607.5, 634.5, 661.5, 688.5);

ldrinput->addFuzzySet(veryhigh);

FuzzySet *veryveryhigh = new FuzzySet(675, 702, 729, 756);

ldrinput->addFuzzySet(veryveryhigh);

fuzzy01->addFuzzyInput(ldrinput);

FuzzyOutput *Ledchange = new FuzzyOutput(1);

FuzzySet *veryveryslow = new FuzzySet(100, 100, 108, 118);

Ledchange->addFuzzySet(veryveryslow);

FuzzySet *veryslow = new FuzzySet(115, 120, 135, 150);

Ledchange->addFuzzySet(veryslow);

FuzzySet *slow = new FuzzySet(145, 160, 175, 215);

Ledchange->addFuzzySet(slow);

FuzzySet *averageslow = new FuzzySet(200, 225, 255, 275);


Ledchange->addFuzzySet(averageslow);

FuzzySet *mediumslow = new FuzzySet(250, 290, 330, 370);

Ledchange->addFuzzySet(mediumslow);

FuzzySet *average = new FuzzySet(360, 375, 400, 420);

Ledchange->addFuzzySet(average);

FuzzySet *mediumfast = new FuzzySet(415, 425, 430, 443);

Ledchange->addFuzzySet(mediumfast);

FuzzySet * averagefast= new FuzzySet(435, 440, 445, 455);

Ledchange->addFuzzySet(averagefast);

FuzzySet *fast = new FuzzySet(450, 460, 470, 480);

Ledchange->addFuzzySet(fast);

FuzzySet *veryfast = new FuzzySet(475, 485, 490, 498);

Ledchange->addFuzzySet(veryfast);

FuzzySet *veryveryfast = new FuzzySet(495, 500, 505, 511.99);

Ledchange->addFuzzySet(veryveryfast);

fuzzy01->addFuzzyOutput(Ledchange);

FuzzyRuleAntecedent *ifLdrinputVeryverylow = new FuzzyRuleAntecedent();

ifLdrinputVeryverylow->joinSingle(veryverylow);

FuzzyRuleConsequent *thenLedchangeVeryveryslow = new FuzzyRuleConsequent();

thenLedchangeVeryveryslow->addOutput(veryveryslow);

FuzzyRule *fuzzyRule01 = new FuzzyRule(1, ifLdrinputVeryverylow,


thenLedchangeVeryveryslow);
fuzzy01->addFuzzyRule(fuzzyRule01);

FuzzyRuleAntecedent *ifLdrinputVerylow = new FuzzyRuleAntecedent();

ifLdrinputVerylow->joinSingle(verylow);

FuzzyRuleConsequent *thenLedchangeVeryslow = new FuzzyRuleConsequent();

thenLedchangeVeryslow->addOutput(veryslow);

FuzzyRule *fuzzyRule02 = new FuzzyRule(2, ifLdrinputVerylow,


thenLedchangeVeryslow);

fuzzy01->addFuzzyRule(fuzzyRule02);

FuzzyRuleAntecedent *ifLdrinputLow = new FuzzyRuleAntecedent();

ifLdrinputLow->joinSingle(low);

FuzzyRuleConsequent *thenLedchangeSlow = new FuzzyRuleConsequent();

thenLedchangeSlow->addOutput(slow);

FuzzyRule *fuzzyRule03 = new FuzzyRule(3, ifLdrinputLow, thenLedchangeSlow);

fuzzy01->addFuzzyRule(fuzzyRule03);

FuzzyRuleAntecedent *ifLdrinputAveragelow = new FuzzyRuleAntecedent();

ifLdrinputAveragelow->joinSingle(averagelow);

FuzzyRuleConsequent *thenLedchangeAverageslow = new FuzzyRuleConsequent();

thenLedchangeAverageslow->addOutput(averageslow);

FuzzyRule *fuzzyRule04 = new FuzzyRule(4, ifLdrinputAveragelow,


thenLedchangeAverageslow);
fuzzy01->addFuzzyRule(fuzzyRule04);

FuzzyRuleAntecedent *ifLdrinputMediumlow = new FuzzyRuleAntecedent();

ifLdrinputMediumlow->joinSingle(mediumlow);

FuzzyRuleConsequent *thenLedchangeMediumslow = new FuzzyRuleConsequent();

thenLedchangeMediumslow->addOutput(mediumslow);

FuzzyRule *fuzzyRule05 = new FuzzyRule(5, ifLdrinputMediumlow,


thenLedchangeMediumslow);

fuzzy01->addFuzzyRule(fuzzyRule05);

FuzzyRuleAntecedent *ifLdrinputModerate = new FuzzyRuleAntecedent();

ifLdrinputModerate->joinSingle(moderate);

FuzzyRuleConsequent *thenLedchangeAverage = new FuzzyRuleConsequent();

thenLedchangeAverage->addOutput(average);

FuzzyRule *fuzzyRule06 = new FuzzyRule(6, ifLdrinputModerate,


thenLedchangeAverage);

fuzzy01->addFuzzyRule(fuzzyRule06);

FuzzyRuleAntecedent *ifLdrinputMediumhigh = new FuzzyRuleAntecedent();

ifLdrinputMediumhigh->joinSingle(mediumhigh);

FuzzyRuleConsequent *thenLedchangeMediumfast = new FuzzyRuleConsequent();

thenLedchangeMediumfast->addOutput(mediumfast);
FuzzyRule *fuzzyRule07 = new FuzzyRule(7, ifLdrinputMediumhigh,
thenLedchangeMediumfast);

fuzzy01->addFuzzyRule(fuzzyRule07);

FuzzyRuleAntecedent *ifLdrinputAveragehigh = new FuzzyRuleAntecedent();

ifLdrinputAveragehigh->joinSingle(averagehigh);

FuzzyRuleConsequent *thenLedchangeAveragefast = new FuzzyRuleConsequent();

thenLedchangeAveragefast->addOutput(averagefast);

FuzzyRule *fuzzyRule08 = new FuzzyRule(8, ifLdrinputAveragehigh,


thenLedchangeAveragefast);

fuzzy01->addFuzzyRule(fuzzyRule08);

FuzzyRuleAntecedent *ifLdrinputHigh = new FuzzyRuleAntecedent();

ifLdrinputHigh->joinSingle(high);

FuzzyRuleConsequent *thenLedchangeFast = new FuzzyRuleConsequent();

thenLedchangeFast->addOutput(fast);

FuzzyRule *fuzzyRule09 = new FuzzyRule(9, ifLdrinputHigh, thenLedchangeFast);

fuzzy01->addFuzzyRule(fuzzyRule09);

FuzzyRuleAntecedent *ifLdrinputVeryhigh = new FuzzyRuleAntecedent();

ifLdrinputVeryhigh->joinSingle(veryhigh);

FuzzyRuleConsequent *thenLedchangeVeryfast = new FuzzyRuleConsequent();

thenLedchangeVeryfast->addOutput(veryfast);
FuzzyRule *fuzzyRule10 = new FuzzyRule(10, ifLdrinputVeryhigh,
thenLedchangeVeryfast);

fuzzy01->addFuzzyRule(fuzzyRule10);

FuzzyRuleAntecedent *ifLdrinputVeryveryhigh = new FuzzyRuleAntecedent();

ifLdrinputVeryveryhigh->joinSingle(veryveryhigh);

FuzzyRuleConsequent *thenLedchangeVeryveryfast = new FuzzyRuleConsequent();

thenLedchangeVeryveryfast->addOutput(veryveryfast);

FuzzyRule *fuzzyRule11 = new FuzzyRule(11, ifLdrinputVeryveryhigh,


thenLedchangeVeryveryfast);

fuzzy01->addFuzzyRule(fuzzyRule11);

void TLight::run(){

int input = analogRead(PIN_LDR);

fuzzy01->setInput(1, input);

fuzzy01->fuzzify();

float iFuzzy = fuzzy01->defuzzify(1);

if (input >= 756)

iFuzzy = 511.99;

analogWrite(PIN_OUT, iFuzzy);
Serial.println(input);

Serial.print("\t\t\tLDR Input: ");

Serial.println(input);

Serial.print("\t\t\tLed Change: ");

Serial.println(iFuzzy);

void TLight::off(){

analogWrite(PIN_OUT, 0);

delay(2000);

“PIR.h”

class TPIR {

private:

int PIN_PIR = 4;

int TIMEOUT = 120;

long TIMER = 0;

public:

void init(int aPIN_PIR);

void run();

bool IsOn = false;

};

void TPIR::init (int aPIN_PIR){

PIN_PIR = aPIN_PIR;
pinMode(PIN_PIR, INPUT);

void TPIR::run(){

if (TIMER != round(millis()/ 1000)){

TIMER = round(millis()/ 1000);

if (TIMEOUT > 0){

TIMEOUT--;

Serial.println(TIMEOUT);

IsOn = TIMEOUT != 0;

if (digitalRead(PIN_PIR))

TIMEOUT = 120;

Appendix 2: Actual Project


Bibliography
[1] L. Wilson, “Average Household Electricity use around the world.”

[2] “Lighting Design Considerations,” 2001.

[3] LightLouver, “Why Daylighting?,” 2010.

[4] M. Rouse, “fuzzy logic,” 2016.

[5] A. Cziker, M. Chindris, and A. Miron, “Fuzzy controller for indoor lighting system with
daylighting contribution,” in 5th international conference on electrical and electronics
engineering (ELECO2007), 2007.

[6] A. Cziker, M. Chindris, and A. Miron, “Implementation of fuzzy logic in daylighting


control,” in INES 2007 - 11th International Conference on Intelligent Engineering Systems,
Proceedings, 2007.

[7] J. Liu, W. Zhang, X. Chu, and Y. Liu, “Fuzzy logic controller for energy savings in a smart
LED lighting system considering lighting comfort and daylight,” Energy Build., 2016.

[8] T. Kazanasmaz, “Fuzzy logic model to classify effectiveness of daylighting in an office


with a movable blind system,” Build. Environ., 2013.

[9] V. Logar, Ž. Kristl, and I. Škrjanc, “Using a fuzzy black-box model to estimate the indoor
illuminance in buildings,” Energy Build., 2014.

[10] D. Kolokotsa, G. Saridakis, K. Dalamagkidis, S. Dolianitis, and I. Kaliakatsos,


“Development of an intelligent indoor environment and energy management system for
greenhouses,” Energy Convers. Manag., 2010.

[11] Y. Y. Ghadi, M. G. Rasul, and M. M. K. Khan, “Energy Savings by Fuzzy Base Control of
Occupancy Concentration in Institutional Buildings,” in Energy Procedia, 2017.

[12] L. Zhao, S. Qu, W. Zhang, and Z. Xiong, “An energy-saving fuzzy control system for
highway tunnel lighting,” Optik (Stuttg)., 2019.

[13] S. Görgülü and N. Ekren, “Energy saving in lighting system with fuzzy logic controller
which uses light-pipe and dimmable ballast,” Energy Build., 2013.
[14] I. Chew, V. Kalavally, N. W. Oo, and J. Parkkinen, “Design of an energy-saving controller
for an intelligent LED lighting system,” Energy Build., 2016.

[15] S. Li, A. Pandharipande, and F. M. J. Willems, “Daylight Sensing LED Lighting System,”
IEEE Sens. J., 2016.

[16] S. Yoo, J. Kim, C.-Y. Jang, and H. Jeong, “A sensor-less LED dimming system based on
daylight harvesting with BIPV systems,” Opt. Express, 2013.

[17] M. Trobec Lah, B. Zupančič, J. Peternelj, and A. Krainer, “Daylight illuminance control
with fuzzy logic,” Sol. Energy, 2006.

[18] A. Maier, “DAYLIGHT LUMINAIRE BUILDINGS: FOCUS ON DAYLIGHT


HARVESTING,” in 13th SGEM GeoConference NANO, BIO AND GREEN �
TECHNOLOGIES FOR A SUSTAINABLE FUTURE, 2013.

[19] D. Kaur, A. Mukherjee, V. P. Upadhyay, G. Kumar, and S. Raja, “Simulation of dimmer


circuit for daylight harvesting,” in Energy Procedia, 2012.

Вам также может понравиться