Sei sulla pagina 1di 40

CHAPTER 1

INTRODUCTION

1.1 INTRODUCTION

In modern greenhouse, a combination of computer, sensors, wireless communication


and other technologies popularised over recent years, which typically represents the
transformation from the traditional agriculture whose quality and yield are higher. The
researches of greenhouse remote monitoring are attracting and increasing attention.

Our aim is to improve the control of indoor climate key parameters of greenhouse
using fuzzy system to achieve significant result.

The indoor climate control system is based on fuzzy controllers that manage the
various decisions to achieve an optimal greenhouse climate depending on weather,
meteorological data and user instructions.

1.2 REVIEW OF EXISTING SYSTEM

The existing system is implemented for remote monitoring and control of greenhouse
parameters with the help of sensors and GSM communication. It overcomes the
disadvantages of wired constraints such as complicated wiring, difficult maintenance and
distance, to monitor and control the applications. The application will have embedded system
which consists of ARM7 microcontroller, real time operating system, sensors, GSM modem
and control devices to monitor the environmental parameters condition namely temperature,
humidity, CO2 concentration and light intensity in greenhouse. The threshold levels of the
sensors will be set with the help of push button keys or remotely via GSM communication
mode.

1
1.3 SHORTCOMING OF EXISTING SYSTEM

In the existing system automatic controlling process takes place by fully based on
ARM7 microcontroller circuit. In this process the user have to send the monitoring and
control commands to control the parameters of greenhouse each and every time. The quick
and frequent responses are not possible. When compared to fuzzy based system control
decision making level in ARM7 microcontroller is not precise and fast.

1.4 PROPOSED SOLUTION

1. It can be used in agriculture vegetable greenhouse to monitor and control the


environmental parameters to overcome the disadvantages of traditional measuring and
controlling.
2. It can be kept long distance, real time monitoring for parameter of greenhouse and the
information can be obtained of greenhouse at any time.
3. It has the advantages of fuzzy control, not needing cables, low power consumption,
cheap rate and good robustness, flexible, extension, convenient, installing over the
traditional measurement and control system.

1.5 OBJECTIVE

 The main objective of our project is to monitor and control the indoor climate
of greenhouse using fuzzy as shown in Figure1.1.
 To reduce the complexity, cost and energy consumption. And to resemble the
human decision making ability and to get precise solutions.

2
1.6 LITERATURE SURVEY

1. Nagesh Kumar D.N designed a system using ARM microcontroller. In this method,
the user has to send command message to the controller.

2. LI Xiaofeng, QIN Linlin, LU Linjian, WU Gang developed a Android-based modern


greenhouse system. This system was costlier.

3. Stefano Benni, Patrizia Tassinari, Filippo Bonora, Alberto Barbaresi,


DanieleTorreggiani, they mainly focused on only greenhouses ventilation by using
computational fluid dynamics(CFD)

1.8 ORGANISATION OF THE PROJECT

The thesis is organised in a way that it contain five chapters followed by references and
appendix.

1. Chapter 1 gives the basic introduction about the project.


2. Chapter 2 elaborates the block diagram.
3. Chapter 3 covers the hardware implementation and peripherals explanation.
4. Chapter 4 deals with the software implementation and flowchart representation.
5. Chapter 5 presents the summary and sample output of the project.
6. Appendixes contain all the source codes and datasheets.

3
CHAPTER 2

BLOCK DIAGRAM EXPLANATION

2.1 BLOCK DIAGRAM

Figure 2.1 Block diagram of system

4
2.2 EXPLANATION OF BLOCK DIAGRAM

2.2.1 Green house

Green house (Polyhouse) farming is farming under full controlled condition, temperature,
humidity, water, fertilizers everything is automated. Vegetables and flowers are the normal
corps cultivated in a Polyhouse. Mostly with flower cultivation you can make lakhs of profit.

2.2.2 Sensors

Sensors used in this project are DHT11, LDR , MQ7. DHT11 sensor is used get humidity
and temperature values. MQ7 is used here to get the CO2 data. LDR is used to get the light
data. Humidity and temperature data are digital type. CO2 and light data are analog type.

2.2.3 Arduino

Need for Arduino in this project is to transmit the acquired data in the green house to the
control computer via ZigBee and to receive the output values of the fuzzy via ZigBee.

2.2.4 XBee

It is used to transmit the sensor output values to the control computer and receive the input
values for the output devices from control computer.

2.2.5 Control Computer

Control computer is used to set the optimum range for temperature, humidity, CO 2,
illuminations using fuzzy logic using MATLAB.

2.2.6 Output Devices

Output devices used here are 5V DC fan (2 numbers). One fan is used to control humidity
and temperature. Another fan is used for controlling CO2 level. Another incandescent is used
for light illumination level.

5
CHAPTER 3

HARDWARE IMPLEMENTATION

3.1 SCHEMATIC DIAGRAM

Figure 3.1 (a) Schematic of the transmitting system

Figure3.1 (b) Schematic of receiving system

6
3.2 ARDUINO HARDWARE

Arduino is an open-source electronics platform based on easy-to-use hardware and


software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a
Twitter message - and turn it into an output - activating a motor, turning on an LED,
publishing something online. You can tell your board what to do by sending a set of
instructions to the microcontroller on the board. To do so you use the Arduino programming
language (based on Wiring), and the arduino software(IDE) based on Processing.

Over the years Arduino has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers - students,
hobbyists, artists, programmers, and professionals - has gathered around this open-source
platform, their contributions have added up to an incredible amount of accessible
knowledge that can be of great help to novices and experts alike.

3.2.1 Need for arduino

There are many other microcontrollers and microcontroller platforms available for
physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard,
and many others offer similar functionality. All of these tools take the messy details of
microcontroller programming and wrap it up in an easy-to-use package. Arduino also
simplifies the process of working with microcontrollers, but it offers some advantage for
teachers, students, and interested amateurs over other systems:

 Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX, and Linux
operating systems. Most microcontroller systems are limited to Windows.
 Simple, clear programming environment - The Arduino Software (IDE) is easy-to-use for
beginners, yet flexible enough for advanced users to take advantage of as well. For teachers,
it's conveniently based on the Processing programming environment, so students learning to
program in that environment will be familiar with how the Arduino IDE works.
 Open source and extensible software - The Arduino software is published as open source
tools, available for extension by experienced programmers. The language can be expanded
through C++ libraries, and people wanting to understand the technical details can make the

7
leap from Arduino to the AVR C programming language on which it's based. Similarly, you
can add AVR-C code directly into your Arduino programs if you want to.
 Open source and extensible hardware - The plans of the Arduino boards are published under
a Creative Commons license, so experienced circuit designers can make their own version of
the module, extending it and improving it. Even relatively inexperienced users can build
the breadboard version of the module in order to understand how it works and save money.

` Figure 3.1 ARDUINO UNO BOARD

3.2.2 Digital pins


In addition to the specific functions listed below, the digital pins on an Arduino board
can be used for general purpose input and output via the pinmode, digitalRead(),
and digitalWrite() commands. Each pin has an internal pull-up resistor which can be turned
on and off using digitalWrite() (w/ a value of HIGH or LOW, respectively) when the pin is
configured as an input. The maximum current per pin is 40 mA.

 Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. On the
Arduino Diecimila, these pins are connected to the corresponding pins of the FTDI USB-to-
TTL Serial chip. On the Arduino BT, they are connected to the corresponding pins of
the WT11 Bluetooth module. On the Arduino Mini and LilyPad Arduino, they are intended
for use with an external TTL serial module (e.g. the Mini-USB Adapter).
 External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value.

8
 PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function. On
boards with an ATmega8, PWM output is available only on pins 9, 10, and 11.
 BT Reset: 7. (Arduino BT-only) Connected to the reset line of the bluetooth module.
 SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication,
which, although provided by the underlying hardware, is not currently included in the
Arduino language.
 LED: 13. On the Diecimila and LilyPad, there is a built-in LED connected to digital pin 13.
When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.

3.2.3 Analog pins

The analog input pins support 10-bit analog-to-digital conversion (ADC) using
the analogRead() function. Most of the analog inputs can also be used as digital pins: analog
input 0 as digital pin 14 through analog input 5 as digital pin 19. Analog inputs 6 and 7
(present on the Mini and BT) cannot be used as digital pins.

 I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire
library (documentation on the Wiring website).

 VIN :(sometimes labelled "9V"). The input voltage to the Arduino board when it's using an
external power source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying voltage via the
power jack, access it through this pin. Note that different boards accept different input
voltages ranges, please see the documentation for your board. Also note that the LilyPad has
no VIN pin and accepts only a regulated input.
o 5V. The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board
regulator, or be supplied by USB or another regulated 5V supply.
o 3.3V (Diecimila-only) A 3.3 volt supply generated by the on-board FTDI chip.
 GND: Ground pins.

Other pins:

 AREF. Reference voltage for the analog inputs. Used with analogReference().

9
 Reset. (Diecimila-only) Bring this line LOW to reset the microcontroller. Typically used to
add a reset button to shields which block the one on the board.

3.3 DHT11 SENSOR

This DHT11 Temperature & Humidity Sensor features a temperature & humidity
sensor complex with a calibrated digital signal output. By using the exclusive digital-signal-
acquisition technique and temperature & humidity sensing technology, it ensures high
reliability and excellent long-term stability. This sensor includes a resistive-type humidity
measurement component and an NTC temperature measurement component, and connects to
a highperformance 8-bit microcontroller, offering excellent quality, fast response, anti-
interference ability and cost-effectiveness. Each DHT11 element is strictly calibrated in the
laboratory that is extremely accurate on humidity calibration. The calibration coefficients are
stored as programmes in the OTP memory, which are used by the sensor’s internal signal
detecting process. The single-wire serial interface makes system integration quick and easy.
Its small size, low power consumption and up-to-20 meter signal transmission making it the
best choice for various applications, including those most demanding ones. The component is
4-pin single row pin package. It is convenient to connect and special packages can be
provided according to users’ request.

Figure 3.3 DTH11

10
3.3.1. Technical Specifications

Power and Pin DHT11’s power supply is 3-5.5V DC. When power is supplied to the
sensor, do not send any instruction to the sensor in within one second in order to pass the
unstable status. One capacitor valued 100nF can be added between VDD and GND for power
filtering. 5. Communication Process: Serial Interface (Single-Wire Two-Way) Single-bus
data format is used for communication and synchronization between MCU and DHT11
sensor. One communication process is about 4ms. Data consists of decimal and integral parts.
A complete data transmission is 40bit, and the sensor sends higher data bit first.

Data format: 8bit integral RH data + 8bit decimal RH data + 8bit integral T data +
8bit decimal T data + 8bit check sum. If the data transmission is right, the check-sum should
be the last 8bit of "8bit integral RH data + 8bit decimal RH data + 8bit integral T data + 8bit
decimal T data".

3.4. LDR- LIGHT DEPENDENT RESISTOR

A Light Dependent Resistor (LDR) or a photo resistor is a device whose resistivity


is a function of the incident electromagnetic radiation. Hence, they are light sensitive devices.
They are also called as photo conductors, photo conductive cells or simply photocells. They
are made up of semiconductor materials having high resistance. There are many different
symbols used to indicate a LDR, one of the most commonly used symbol is shown in the
figure below. The arrow indicates light falling on it.

A Light Dependent Resistor (LDR) or a photo resistor is a device whose resistivity


is a function of the incident electromagnetic radiation. Hence, they are light sensitive devices.
They are also called as photo conductors, photo conductive cells or simply photocells. They
are made up of semiconductor materials having high resistance. There are many different
symbols used to indicate a LDR, one of the most commonly used symbol is shown in the
figure below. The arrow indicates light falling on it.

When light is incident on a photocell it usually takes about 8 to 12 ms for the change
in resistance to take place, while it takes one or more seconds for the resistance to rise back
again to its initial value after removal of light. This phenomenon is called as resistance
recovery rate. This property is used in audio compressors. Also, LDR’s are less sensitive than

11
photo diodes and photo transistor. (A photo diode and a photocell (LDR) are not the same, a
photo-diode is a p-n junction semiconductor device that converts light to electricity, whereas
a photocell is a passive device, there is no p-n junction in this nor it “converts” light to
electricity). Types of Light Dependent Resistors: Based on the materials used they are
classified as:

1. Intrinsic photo resistors (Un doped semiconductor): These are made of pure
semiconductor materials such as silicon or germanium. Electrons get excited from
valance band to conduction band when photons of enough energy fall on it and
number charge carriers is increased.
2. Extrinsic photo resistors: These are semiconductor materials doped with impurities
which are called as dopants. Theses dopants create new energy bands above the
valence band which are filled with electrons.
3. Hence this reduces the band gap and less energy is required in exciting them.
Extrinsic photo resistors are generally used for long wavelengths.

LDR’s have low cost and simple structure. They are often used as light sensors. They
are used when there is a need to detect absences or presences of light like in a camera light
meter. Used in street lamps, alarm clock, burglar alarm circuits, light intensity meters, for
counting the packages moving on a conveyor belt, etc.

Figure 3.4 LDR

12
3.5 MQ-7 CO SENSOR

The MQ-7 is a Carbon Monoxide (CO) sensor suitable for sensing CO concentrations
in the air. It can detect CO-gas concentrations anywhere from 20 to 2000 ppm.It make
detection by method of cycle high and low temperature, and detect CO at low temperature.It
is widely used in domestic CO gas leakage alarm, industrial CO gas alarm and portable CO
gas detector.

3.5.1 Specifications

 Operating Voltage: 3.3 – 5V.

 Type: Analog Sensor.

 Can detect the presence of carbon monoxide

Figure 3.5 MQ7 sensor Figure 3.6 MQ& sensor pins

3.5.2 Hardware Connections

The connections are made as follows:

 Vcc to 5V

 GND to GND

 A0 to Analog0

13
3.6 L293D

L293D is a typical Motor driver or Motor Driver IC which allows DC motor to drive
on either direction. L293D is a 16-pin IC which can control a set of two DC motors
simultaneously in any direction. It means that you can control two DC motor with a single
L293D IC. Dual H-bridge Motor Driver integrated circuit (IC).

It works on the concept of H-bridge. H-bridge is a circuit which allows the voltage to
be flown in either direction. As you know voltage need to change its direction for being able
to rotate the motor in clockwise or anticlockwise direction, Hence H-bridge IC are ideal for
driving a DC motor.

In a single L293D chip there are two h-Bridge circuit inside the IC which can rotate
two dc motor independently. Due its size it is very much used in robotic application for
controlling DC motors. Figure 3.6 shows the pin diagram of a L293D motor controller.

There are two Enable pins on l293d. Pin 1 and pin 9, for being able to drive the motor,
the pin 1 and 9 need to be high. For driving the motor with left H-bridge you need to enable
pin 1 to high. And for right H-Bridge you need to make the pin 9 to high. If anyone of the
either pin1 or pin9 goes low then the motor in the corresponding section will suspend
working. It’s like a switch.

Figure 3.6 Pin diagram of L293D

14
3.7 TEMPERATURE CONTROLLERS

There are three primary cooling devices in most greenhouses. These are the vent
system, exhaust fan, swamp cooler. Some greenhouses may make use of air conditioners and
misting systems as well.

 Vents are hinged or track connected panels in the roof or sides of greenhouses. They
open up the greenhouse to outside natural air. Hot air that builds up in the greenhouse
can escape and fresh air can enter the house. The microcontroller can be used to
automate the opening and closing of these vents depending upon requirement. But
during hot summer days, venting alone will not get the job done.
 Exhaust fans can move a large volume of the hot greenhouse air out and full fresh
air in through the rear vent. They are powerful for a reason, as full sun on a hot
summer day can cause temperatures inside the greenhouse to superheat. An exhaust
fan must be able to pull this air out, or the temperature will continue to rise.

Figure 3.7 Exhaust fan

15
3.8 CONTROLLING ILLUMINATION

Growing lights enable cultivators to extend daylight hours-useful for winter and
spring growing when levels of natural lights can be low, and one can therefore improve plant
growth. Three basic types of lamps used in greenhouse lighting are:

 Fluorescent lamps have the advantage of higher light efficiency with low heat. This
type of lamp is the most widely used for supplemental light. It is available in a variety
of colours but cool-white lamps are the most common. High intensity(1500ma)
fluorescent tubes that require higher wattage are also commonly used to reach 2000
foot candles.
 Incandescent lamps vary in size from 60 watts to 500 watts. The grower can vary
foot-candle levels by adjusting the spacing and mounting height above the plants.

Figure 3.8 Incandescent lamps

16
CHAPTER 4

SOFTWARE IMPLEMENTATION

4.1 ARDUINO SOFTWARE

The Arduino Software (IDE) allows you to write programs and upload them to your
board. The popularity of Arduino is steadily increasing and it is fast becoming the
microcontroller of choice for students, hobbyists and smaller companies. The Arduino
website offers free resources and tutorials as well as a language reference to help you
understand the code and syntax. All the Arduino (and most of the clone boards) can use the
Arduino software.

4.1.1 The Arduino Software Interface

The Arduino interface is pretty “bare-bones”. When you load the software, the first
screen you will see is a white window shown in Figure1. Arduino projects are called
“sketches” and when you start a new sketch, several additional files are also created.

The main headings are “File” “Edit” “Sketch” “Tools” “Help” and several shortcut
icons beneath “Verify”, “Upload”, “New”, “Open”, “Save”, and at the far right, the “Serial
Monitor”. Note that all these icons are also available from the main menus.

Figure 4.1 Arduino software

17
4.1.2 Procedure to connect to the board

1. Launch the Arduino software by double-clicking the Arduino icon.


2. Plug one end of the USB into the Arduino and the other end into your computer.
3. Your computer should detect the new device and tell you if it has installed correctly.
At this time, two things can happen; if you have an older board using an FTDI chip
(ex. Duemilanove based), Windows should detect it and you’re good to go to the next
step. If you have a board which uses an ATMega chip to convert USB to serial (for
example the UNO), you will need to install the drivers manually.
4. Take a look at your board’s main processor chip (usually found between the pin
headers) to see which you have. It will likely be the ATMega168, ATMega328, or a
more powerful ATMEga640. ATMega1280 etc.
5. In the software, select “Tools” -> “Board” -> You will get a list of possible boards. If
you have a different board, select it from the drop-down list; if you have purchased a
compatible board, that manufacturer should indicate which board to choose.
6. In the software, select “Tools” -> “Serial Port” -> COM # (note that if you have
several COM ports, you will need to go to Device Manager to see which COM port is
assigned to your board.

4.2 MATLAB PROGRAMMING

MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and


fourth-generation programming language. A proprietary programming language developed
by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data,
implementation of algorithms, creation of user interfaces, and interfacing with programs
written in other languages, including C, C++, C#, Java, Fortran and Python. Although
MATLAB is intended primarily for numerical computing, an optional toolbox uses the
MuPAD symbolic engine, allowing access to symbolic computing abilities. An additional
package, Simulink, adds graphical multi-domain simulation and model-based design for
dynamic and embedded systems. In 2004, MATLAB had around one million users across
industry and academia. MATLAB users come from various backgrounds of engineering,
science, and economics.

18
4.2.1 Functions

When creating a MATLAB function, the name of the file should match the name of
the first function in the file. Valid function names begin with an alphabetic character, and
can contain letters, numbers, or underscores. Functions are also often case sensitive. An
anonymous function is like an inline function in traditional programming languages,
defined within a single MATLAB statement. It consists of a single MATLAB expression
and any number of input and output arguments. You can define an anonymous function
right at the MATLAB command line or within a function or script.

4.2.2 Function handles

MATLAB supports elements of lambda calculus by introducing function handles,or


function references, which are implemented either in .m files or anonymous/nested
functions.

Creating script
 Highlight commands from the Command History, right-click, and select Create Script.
 Click the New Script button on the Home tab.
 Use the edit function. For example, edit new_file_name creates (if the file does not
exist) and opens the file new_file_name.

Run Functions in the Editor


 Create a function in a program file named myfunction.m .
 View the commands available for running the function by clicking Run on the Editor
tab.
 Replace the text type code to run with an expression that allows you to run the function.

Difference between script and function


Scripts are m-files containing MATLAB statements. MATLAB ``functions'' are another
type of m-file. The biggest difference between scripts and functions is that functions have
input and output parameters. Script files can only operate on the variables that are
hardcoded into their m-file.

19
4.3 ZIGBEE MODULE

ZigBee based specification for a suite of high-level communication protocols used to


create personal area networks with small, low-power digital radios, such as for home
automation, medical device data collection, and other low-power low-bandwidth needs,
designed for small scale projects which need wireless connection.The ZigBee module is
shown in figure 4.2.

Figure 4.2 ZigBee module

The technology defined by the ZigBee specification is intended to be simpler and less
expensive than other wireless personal area networks (WPANs), such as Bluetooth or Wi-Fi.
Applications include wireless light switches, electrical meters with in-home-displays, traffic
management systems, and other consumer and industrial equipment that require short-range
low-rate wireless data transfer.

Its low power consumption limits transmission distances to 10–100 meters line-of-
sight, depending on power output and environmental characteristics. ZigBee devices can
transmit data over long distances by passing data through a mesh network of intermediate
devices to reach more distant ones. ZigBee is typically used in low data rate applications that
require long battery life and secure networking (ZigBee networks are secured by 128 bit
symmetric encryption keys.) ZigBee has a defined rate of 250 kbit/s, best suited for
intermittent data transmissions from a sensor or input device.

ZigBee is a low-cost, low-power, wireless mesh network standard targeted at the wide
development of long battery life devices in wireless control and monitoring applications.
Zigbee devices have low latency, which further reduces average current. ZigBee chips are
typically integrated with radios and with microcontrollers that have between 60-256 KB of
flash memory. ZigBee operates in the industrial, scientific and medical (ISM) radio bands:
2.4 GHz in most jurisdictions worldwide; 784 MHz in China, 868 MHz in Europe and 915

20
MHz in the USA and Australia. Data rates vary from 20 kbit/s (868 MHz band) to 250 kbit/s
(2.4 GHz band).

The ZigBee network layer natively supports both star and tree networks, and generic
mesh networking. Every network must have one coordinator device, tasked with its creation,
the control of its parameters and basic maintenance. Within star networks, the coordinator
must be the central node. Both trees and meshes allow the use of ZigBee routers to extend
communication at the network level.

ZigBee builds on the physical layer and media access control defined in IEEE
standard 802.15.4 for low-rate WPANs. The specification includes four additional key
components: network layer, application layer, ZigBee device objects (ZDOs) and
manufacturer-defined application objects which allow for customization and favour total
integration. ZDOs are responsible for some tasks, including keeping track of device roles,
managing requests to join a network, as well as device discovery and security.

ZigBee is one of the global standards of communication protocol formulated by the


significant task force under the IEEE 802.15 working group. The fourth in the series, WPAN
Low Rate/ZigBee is the newest and provides specifications for devices that have low data
rates, consume very low power and are thus characterized by long battery life. Other
standards like Bluetooth and IrDA address high data rate applications such as voice, video
and LAN communications.

4.3.1 Operating modes

ZigBee Coordinator (ZC) The most capable device, the Coordinator forms the root
of the network tree and might bridge to other networks. There is precisely one ZigBee
Coordinator in each network since it is the device that started the network originally (the
ZigBee Light Link specification also allows operation without a ZigBee Coordinator, making
it more usable for over-the-shelf home products). It stores information about the network,
including acting as the Trust Centre & repository for security keys.

ZigBee Router (ZR) As well as running an application function, a Router can act as
an intermediate router, passing on data from other devices.

21
ZigBee End Device (ZED) Contains just enough functionality to talk to the parent
node (either the Coordinator or a Router); it cannot relay data from other devices. This
relationship allows the node to be asleep a significant amount of the time thereby giving long
battery life. A ZED requires the least amount of memory, and, therefore, can be less
expensive to manufacture than a ZR or ZC.

The current ZigBee protocols support beacon and non-beacon enabled networks. In
non-beacon-enabled networks, an unslotted CSMA/CA channel access mechanism is used. In
this type of network, ZigBee Routers typically have their receivers continuously active,
requiring a more robust power supply. However, this allows for heterogeneous networks in
which some devices receive continuously while others only transmit when an external
stimulus is detected. The typical example of a heterogeneous network is a wireless light
switch: The ZigBee node at the lamp may constantly receive, since it is connected to the
mains supply, while a battery-powered light switch would remain asleep until the switch is
thrown. The switch then wakes up, sends a command to the lamp, receives an
acknowledgment, and returns to sleep. In such a network the lamp node will be at least a
ZigBee Router, if not the ZigBee Coordinator; the switch node is typically a ZigBee End
Device.

In beacon-enabled networks, the special network nodes called ZigBee Routers


transmit periodic beacons to confirm their presence to other network nodes. Nodes may sleep
between beacons, thus lowering their duty cycle and extending their battery life. Beacon
intervals depend on data rate; they may range from 15.36 milliseconds to 251.65824 seconds
at 250 kbit/s, from 24 milliseconds to 393.216 seconds at 40 kbit/s and from 48 milliseconds
to 786.432 seconds at 20 kbit/s. However, low duty cycle operation with long beacon
intervals requires precise timing, which can conflict with the need for low product cost.

In general, the ZigBee protocols minimize the time the radio is on, so as to reduce
power use. In beaconing networks, nodes only need to be active while a beacon is being
transmitted. In non-beacon-enabled networks, power consumption is decidedly asymmetrical.
Some devices are always active while others spend most of their time sleeping.

Except for the Smart Energy Profile 2.0, ZigBee devices are required to conform to
the IEEE 802.15.4-2003 Low-Rate Wireless Personal Area Network (LR-WPAN) standard.
The standard specifies the lower protocol layers—the physical layer (PHY), and the Media
Access Control portion of the data link layer (DLL). The basic channel access mode is

22
"carrier sense, multiple access/collision avoidance" (CSMA/CA). That is, the nodes talk in
the same way that humans converse; they briefly check to see that no one is talking before he
or she start, with three notable exceptions. Beacons are sent on a fixed timing schedule and
do not use CSMA. Message acknowledgments also do not use CSMA. Finally, devices in
beacon-enabled networks that have low latency real-time requirements may also use
Guaranteed Time Slots (GTS), which by definition do not use CSMA.

4.3.2 Configuring ZigBee module

Zigbee module can be configured for required specifications by using a open-source


software XCTU.

XCTU

XCTU is a free, multi-platform application compatible with Windows, MacOS and Linux. It
provides graphical network view for simple wireless network configuration and architecture.
API Frame Builder is a simple development tool for quickly building XBee API frames.
Firmware Release Notes Viewer allows users to explore and read firmware release notes.

Need for configuration:

 To fix the baud rate


 To pair the transmitter and receiver module

Installing XCTU

Once XCTU has been downloaded, the next step is to install the program. When the program
asks for updating from Digi, we must answer ‘yes’ so as to download all the firmware
versions for all the XBee modules.

Configuring XCTU

When XCTU has been properly installed, the Waspmote Gateway can be connected to the
computer. It will be recognized as a ‘USB Serial Port’. We have to know the COM number
given to this device in order to specify it in the XCTU.

23
Finally, we launch XCTU and the program will start. A window like the one below will
appear, showing the different functions and the different COM ports detected.

Figure 4.3 XCTU MAIN PAGE

Details for the XCTU operation:

 Place the XBee you need to configure in the Gateway. Then connect the Gateway to a
USB port in your PC.
 Run the XCTU application, press the button “Discover radio modules connected”, select
the appropriate communication port and configure it as shown below in figure 4.4
,4.5,4.6,4.7,4.8,4.9,4.10,4.11,4.12,4.13,4.14.

24
Figure 4.4 Discovering devices-1

Figure 4.5 Discovering devices-2

25
 The application will start to look for different devices connected and will deliver a
message similar to this one:

Figure 4.6 Discovering devices-3

It is possible that XCTU asks you to do a reset of the XBee in this step (or in the next steps).
To do that, just press the button “RST” in your Gateway for 1 or 2 seconds.

Figure 4.7 Reset action

26
 Then go to the Configuration Working mode and click to select the device. We must
check each parameter first.

Figure 4.8 Configuration-1

 Check the first parameter, channel (CH):

Figure 4.9 Configuration-2

27
 The PAN ID (ID):

Figure 4.10 Configuration-3

 The destination address (2 parts: DH and DL):

Figure 4.11 Configuration-4

28
 The KY parameter (if needed). It must be set as hexadecimal key:

Figure 4.12 Configuration-5

 The serial interface baud rate:

Figure 4.13 Configuration-6

29
 The API options:

Figure 4.14 Additional configuration

1. If you set to 1 the JV parameter (in ZigBee End Devices/Routers) and write it, after
rebooting the radio module, it will verify the Coordinator (if it has been configured) is
on its operating channel when joining or coming up from a power cycle. If a
coordinator is not detected, the router will leave its current channel and attempt to join
a new PAN. This feature can be useful when several ZigBee End Device or Router
have not been configured yet; this way you can get them connected to an existing
network in a semi-automatic way. If JV=0, the router will continue operating on its
current channel even if a coordinator is not detected.
2. If you need to change your XBees configuration to the values by default set by Digi
(NOT the same values by default that Libelium sets), you can do it in XCTU. Note it
is risky since you could let the XBee without communication. You can just press the
button ‘Tools’, then ‘XBee Recovery’, select the product family of your device and
after that you will probably have to reset the XBee. You can read again to check the
change.

30
4.3.3 Arduino serial communication with ZigBee module

Figure 4.15 Schematic of Arduino with ZigBee

The schematic of Arduino with ZigBee is shown in figure 4.15.


In order to establish serial communication between arduino UNO and ZigBee,
Connect the TX of arduino to RX of zigbee and RX of arduino to TX of zigbee
Vcc of ZigBee to +5v and gnd to common ground

4.3.4 ZigBee to pc

ZigBee connected to PC via a standard USB cable forms the receiving circuit.The schematic
of zigBee with usb-plug in is shown in figure 4.16.

Figure 4.16 Schematic of ZigBee with usb-plug in

31
4.4 INTRODUCTION TO FUZZY EXPERT SYSTEM

A fuzzy interface system(FIS) is a system that uses fuzzy set theory to map
inputs(features in the case of fuzzy classification) to outputs (classes in the case of fuzzy
classification).

4.4.1 Fuzzification

The purpose of fuzzification is to map the inputs from a set of sensors (or features of
those sensors such as amplitude or spectrum) to values from 0 to 1 using a set of input
membership functions. In the example shown in Figure 4.17, there are two inputs, x0 and
y0 shown at the lower left corner. These inputs are mapped into fuzzy numbers by drawing a
line up from the inputs to the input membership functions above and marking the intersection
point.

Figure 4.17 A two input, two rule Mamdani FIS with crisp inputs

These input membership functions, as discussed previously, can represent fuzzy


concepts such as "large" or "small", "old" or "young", "hot" or "cold", etc. For example,
x0 could be the EMG energy coming from the front of the forearm and y0 could be the EMG

32
energy coming from the back of the forearm. The membership functions could then represent
"large" amounts of tension coming from a muscle or "small" amounts of tension. When
choosing the input membership functions, the definition of what we mean by "large" and
"small" may be different for each input.

4.4.2 FUZZY INTERFERENCE SYSTEM (FIS)

Fuzzy interference system consists of two parts i.e. rule base and knowledge
base.Knowledge Base contains relationship between input and output variables.Rule base
contains relationship between input and output variables.Rule base contains relationship
between input and output expressed as if-then statement.

Creating fuzzy rules

Fuzzy rules are a collection of linguistic statements that describe how the FIS should
make a decision regarding classifying an input or controlling an output. Fuzzy rules are
always written in the following form:

if (input1 is membership function1) and/or (input2 is membership


function2) and/or �. then (outputn is output membership functionn).

For example, one could make up a rule that says:

if temperature is high and humidity is high then room is hot.

There would have to be membership functions that define what we mean by high
temperature (input1), high humidity (input2) and a hot room (output1). This process of taking
an input such as temperature and processing it through a membership function to determine
what we mean by "high" temperature is called fuzzification. Also we must define what we
mean by "and" / "or" in the fuzzy rule. This is called fuzzy combination. Combining outputs
into an output Distribution

The outputs of all of the fuzzy rules must now be combined to obtain one fuzzy output
distribution. This is usually, but not always, done by using the fuzzy "or".

33
Consequence

The consequence of a fuzzy rule is computed using two steps:

1. Computing the rule strength by combining the fuzzified inputs using the fuzzy combination
process

2. Clipping the output membership function at the rule strength.

Fuzzy Inputs

Figure 4.18 shows a modification of the Mamdani FIS where the input y0 is fuzzy, not crisp.
This can be used to model inaccuracies in the measurement. For example, we may be
measuring the output of a pressure sensor. Even with the exact same pressure applied, the
sensor is measured to have slightly different voltages. The fuzzy input membership function
models this uncertainty. The input fuzzy function is combined with the rule input
membership function by using the fuzzy "and" as shown in Figure 4.18.

Figure 4.18 A two Input, two rule Mamdani FIS with a fuzzy input

34
4.4.3 Defuzzification of Output Distribution

In many instances, it is desired to come up with a single crisp output from a FIS. For
example, if one was trying to classify a letter drawn by hand on a drawing tablet, ultimately
the FIS would have to come up with a crisp number to tell the computer which letter was
drawn. This crisp number is obtained in a process known as defuzzification. There are two
common techniques for defuzzifying.

1. Center of mass This technique takes the output distribution and finds its center of mass to
come up with one crisp number. This is computed as follows:

where z is the center of mass and uc is the membership in class c at value zj. An example
outcome of this computation is shown in Figure 4.19.

Figure 4.19 Defuzzification Using the Center of Mass

35
2. Mean of maximum This technique takes the output distribution and finds its mean of
maxima to come up with one crisp number. This is computed as follows:

where z is the mean of maximum, zj is the point at which the membership function is
maximum, and l is the number of times the output distribution reaches the maximum level.
An example outcome of this computation is shown in Figure 4.20.

Figure 4.20 Defuzzification Using the Mean of Maximum

4.4.4 Design of fuzzy control system

In this system we use mamdani interface system in fuzzy logic. The input parameters
are temperature, humidity, CO2 level and light level. The output of fuzzy are speed of the
vent, brightness of illumination and speed of cooling fan. These data is corresponding to a
greenhouse cultivating tomato as its crop inside.

OPTIMUM OPTIMUM HUMIDITY OPTIMUM CO2 LEVEL


TEMPERATURE
100 to 350 C 65%-75% RH 1000ppm to 1500ppm
Table 4.1 Optimum conditions of tomato crop

36
Figure 4.21 Fuzzy toobbox

The rules are designed in such a way that the optimum conditions for plant growth is
ensured. The given rules and input an output of fuzzy are stored in a .FIS file. This file is then
evaluated in MATLAB script.

Figure 4.22 Fuzzy rules

37
4.5 ALGORITHM

1. Acquire temperature, humidity, light, CO2 data from greenhouse to Arduino.


2. Transmission of the acquired data to control computer via ZigBee.
3. Format the acquired data in appropriate data type.
4. Feed the input values into fuzzy system.
5. Get the output from the fuzzy system.
6. Send the output values to the Arduino in the greenhouse via ZigBee.
7. Output devices (fan1, fan2, light) changes its states according to the output values.
8. Continuously check for changes in input values.

38
4.6 FLOW CHART

39
CHAPTER 5

CONCLUSION AND RESULTS

5.1 CONCLUSION

 In this work, a smart fuzzy based greenhouse monitoring and control was
developed.
 The fuzzy logic system were involved to manage the indoor climate with
particular attention to the effectiveness, the energy use and production costs.
 This, allows a real time data access, reduce the complexity.

5.2 FUTURE ENHANCEMENT

Future enhancement is part of all products life cycles. This list our some missing
things in the current system. It also indicates adding more features to the system. Some of
them are listed below

 Adopting touch screen based products to the system.


 It can be implemented with GPRS to control through internet.

40

Potrebbero piacerti anche