(cis) project report

advertisement
1
“GREENHOUSE MONITORING SYSTEM USING WSNs”
B.E (CIS) PROJECT REPORT
By
Sumaira Rauf
Department of Computer and Information Systems Engineering
N.E.D. University of Engg. & Tech.,
Karachi-75270
2
“GREENHOUSE MONITORING SYSTEM USING WSNs”
B.E (CIS) PROJECT REPORT
Project Group:
Sumaira Rauf CS-127
Hamra Rehan CS-082
Shayan Rashid CS-085
Asma Fatima CS-100
Batch:
2009-1010
Project Advisors:
Ms. Maria Waqas (Internal Advisor)
Mr. Kashif Asrar (Co-Internal Advisor)
Mr. Ovais Ahmed Khatri (External Advisor)
November 2013
Department of Computer and Information Systems Engineering
N.E.D. University of Engg. & Tech.,
Karachi-75270
3
ABSTRACT
Greenhouse is kind of advanced hortical facility which changes plant growth environment
creating suitable conditions for plant growth, avoiding the outside season change & the
adverse effects caused by bad weather. The purpose of greenhouse environment is to
increase crop yields and to improve quality of crops. The optimal plant growth depends
upon air temperature, humidity & active radiation of light, which results in maximum
photosynthetic activity.
Monitoring & control of greenhouse environment play an important role in greenhouse
production & management. This project consists of implementation of a WSN that can
monitor the air temperature, humidity & ambient light intensity in greenhouse. This can
help in understanding the environmental conditions & adopting different methods to
increase the crop production. The system is integrated with small size application specific
sensors & radio frequency modules. All monitored parameters are transmitted through a
wireless link to PC based monitoring system for analysis. Due to GSM and email , the
authorized person will be informed about the conditions remotely by receiving SMS and
email respectively.
4
ACKNOWLEDGEMENTS
We take opportunity to sincerely thank our Internal and Co-Internal project advisors,
MS.MARIA WAQAS
&
MR. KASHIF ASRAR
for their thorough and un-tiring efforts for guiding us in the project and for being
supportive in such a way that helped us a lot in bringing this project where it stands at the
moment.
Also, not forgetting the devoted co-operation and support provided in the form of great
help, by our external advisor
MR. OVAIS AHMED KHATRI
we would like to thank him for helping out in everything where ever we got stuck.
God Bless.
5
Table of Contents
1
ARCHITECTURE (FLOW) DIAGRAM ........................................................................................ 8
2
INTRODUCTION ............................................................................................................................ 9
2.1
OVERVIEW .................................................................................................................................... 9
2.2
BENEFITS ....................................................................................................................................... 9
2.2.1
Economic ................................................................................................................................. 9
2.2.2
Reduced greenhouse gas emissions ......................................................................................... 9
2.2.3
Reduced energy costs ............................................................................................................ 10
2.2.4
Information............................................................................................................................ 10
2.2.5
Scalability.............................................................................................................................. 10
2.3
VALUE ADDED FEATURES ...................................................................................................... 10
2.3.1
Control opportunities ............................................................................................................ 10
2.3.2
Increased energy savings ...................................................................................................... 10
2.3.3
Information management ...................................................................................................... 11
2.4
STATEMENT OF SCOPE:............................................................................................................ 11
2.5
SCOPE OF WSNS:......................................................................................................................... 11
2.5.1
Smart Home/Smart Office ..................................................................................................... 11
2.5.2
Military.................................................................................................................................. 11
2.5.3
Industrial & Commercial ...................................................................................................... 12
2.5.4
Traffic Management and Monitoring .................................................................................... 12
2.5.5
Agriculture ............................................................................................................................ 12
3
JENNIC EVALUATION KIT........................................................................................................ 13
3.1
SDK INSTALLATION .................................................................................................................. 13
3.1.1
SDK Toolchain Installer........................................................................................................ 13
3.1.2
SDK Libraries Installer ......................................................................................................... 13
3.1.3
Toolchain Contents ............................................................................................................... 14
3.2
INTRODUCTION TO ECLIPSE ................................................................................................... 14
3.3
FLASH PROGRAMMER .............................................................................................................. 15
3.4
HARDWARE ................................................................................................................................ 16
3.4.1
JN5148 Wireless Microcontrollers ....................................................................................... 16
3.4.2
Logistics ................................................................................................................................ 16
3.5
WIRELESS NETWORK CONCEPTS .......................................................................................... 17
3.5.1
Radio Frequency ................................................................................................................... 17
3.5.2
Node Types ............................................................................................................................ 17
3.5.3
Network Formation and Topology ........................................................................................ 18
3.5.4
Wireless Network Protocol Stack .......................................................................................... 18
3.6
WIRELESS NETWORK PROTOCOL OPTIONS ........................................................................ 19
4
JENNIC JN5148 NODES ............................................................................................................... 20
4.1
APPLICATION OVERVIEW ...................................................................................................................... 20
4.2
APPLICATION OPERATION............................................................................................................... 20
4.2.1
JenNet Co-ordinator .............................................................................................................. 20
4.2.2
JenNet Router ........................................................................................................................ 21
4.2.3
JenNet End Device ................................................................................................................ 21
4.3
BASIC FEATURES ............................................................................................................................ 22
4.4
NETWORK FORMATION ................................................................................................................... 22
4.5
SENSOR FUNCTIONS ........................................................................................................................ 23
4.5.1
Light Sensor Functions.......................................................................................................... 23
4.5.2
Temperature/Humidity Sensor Functions.............................................................................. 24
4.6
UARTS ........................................................................................................................................... 24
4.6.1
UART Signals and Pins ......................................................................................................... 25
6
4.6.2
4.6.3
5
UART Operation ................................................................................................................... 25
Configuring the UARTs ......................................................................................................... 25
DATABASE & ARTIFICIAL INTELLIGENCE .......................................................................... 27
5.1
GREENHOUSE DATABASE ....................................................................................................... 27
5.2
IDEAL VALUES IN A GREENHOUSE ....................................................................................... 27
5.2.1
TEMPERATURE ................................................................................................................... 28
5.2.2
HUMIDITY ............................................................................................................................ 28
5.2.3
LIGHT ................................................................................................................................... 29
5.2.4
WEATHER ............................................................................................................................ 30
5.3
DECISION MAKING THROUGH MACHINE LEARNING ALGORITHMS ............................ 31
5.3.1
WHAT IS WEKA .................................................................................................................... 31
5.3.2
ARFF FILE CREATION........................................................................................................ 32
5.3.3
MACHINE LEARNING ALGORITHMS................................................................................ 33
6
SMS & EMAIL GENERATION .................................................................................................... 37
6.1
GSM TECHNOLOGY ........................................................................................................................ 37
6.1.1
GSM ARCHITECTURE ............................................................................................................. 37
6.1.2
GSM PROTOCOL STACK ......................................................................................................... 37
6.1.3
GSM PHONE HARDWARE ...................................................................................................... 38
6.1.4
FEATURE PHONE ................................................................................................................... 38
6.1.5
GSM MODEM ARCHITECTURE ............................................................................................... 38
6.1.6
AT COMMANDS ..................................................................................................................... 39
6.1.7
At commands and their responses according to GSM standards .......................................... 39
6.1.8
WHY GSM PHONE: ................................................................................................................ 40
6.1.9
INSATALLING PC SUITE .......................................................................................................... 40
6.1.10
PORT SELECTION ................................................................................................................... 41
6.1.11
MANUAL SMS ALERT:- ........................................................................................................... 41
6.1.12
AUTOMATIC SMS GENERATION:- .......................................................................................... 42
6.2
EMAIL GENERATION ....................................................................................................................... 42
6.2.1
Manual Email Alert:- ............................................................................................................ 43
6.2.2
Automatic Email Generation:- .............................................................................................. 43
6.3
SMTP (SIMPLE MAIL TRANSFER PROTOCOL) :- .................................................................. 44
6.3.1
Introduction ........................................................................................................................... 44
6.3.2
What is SMTP? ...................................................................................................................... 44
6.3.3
Purpose of SMTP:- ................................................................................................................ 44
6.3.4
SMTP VS Mail Retrieval:-..................................................................................................... 45
6.4
SENDING EMAIL USING GMAIL SMTP SERVER ................................................................... 45
6.4.1
Gmail SMTP Settings:-.......................................................................................................... 45
6.4.2
Email Generation Using C# .................................................................................................. 46
7
WORKING WITH WIRESHARK ................................................................................................ 48
7.1
APPLICATION OVERVIEW ....................................................................................................... 48
7.2
ABOUT WIRESHARK ................................................................................................................. 48
7.3
REQUIREMENTS OF WIRESHARK .......................................................................................... 49
7.3.1
Installing and Configuring a Loopback Adaptor .................................................................. 49
7.3.2
Program a JN51xx Board as a Sniffer .................................................................................. 49
7.3.3
ARP entry .............................................................................................................................. 49
7.4
SNIFFER SERVER GUI FIGURE 6.2 ............................................................................................. 49
7.5
WIRESHARK CAPTURES........................................................................................................... 50
8
WIRED CIRCUITRY .................................................................................................................... 51
8.1
COMPONENTS USED ................................................................................................................. 51
8.1.1
Parallel Port Male Connector (DB-25): ............................................................................... 51
8.1.2
Octal Transceiver (74ls245): ................................................................................................ 53
7
8.2
PCB DESIGNING ......................................................................................................................... 53
8.2.1
Steps to PCB design using OrCad: ....................................................................................... 54
8.3
WORKING: ................................................................................................................................... 59
8.4
INTERFACING OF HARDWARE ............................................................................................... 59
8.4.1
Interfacing via PC Ports ....................................................................................................... 59
8.4.2
Parallel Port.......................................................................................................................... 59
8.4.3
Accessing the parallel port .................................................................................................... 60
9
WIRELESS TECHNOLOGY ........................................................................................................ 61
9.1
INTRODUCTION ......................................................................................................................... 61
9.2
DIFFERENT WIRELESS TECHNOLOGIES ............................................................................... 61
9.3
WIRELESS PAN ........................................................................................................................... 61
9.4
SELECTED TECHNOLOGY........................................................................................................ 62
9.5
XBEE SERIES 1 PRO ....................................................................................................................... 62
9.5.1
XBEE OVERVIEW ................................................................................................................ 63
9.5.2
MULTI-NODE NETWORK ISSUES ..................................................................................... 63
9.5.3
XBEE BENEFITS .................................................................................................................. 63
9.5.4
COMMUNICATION MODES ............................................................................................... 64
9.5.5
XBEE MODULE STYLES ..................................................................................................... 65
9.6
PIN DIAGRAM ............................................................................................................................. 65
9.7
PIN CONFIGURATION ............................................................................................................... 65
9.8
OTHER XBEE FEATURES ................................................................................................................. 67
9.9
SETUP ........................................................................................................................................... 68
9.9.1
Parts Requied ........................................................................................................................ 68
9.9.2
Configure the first radio: ...................................................................................................... 69
9.9.3
Configure the second radio ................................................................................................... 72
9.10 USING REMOTE AT COMMANDS TO TOGGLE AN IO ON A REMOTE XBEE 802.15.4 RADIO ............ 74
10
JENNET STACK ........................................................................................................................... 76
10.1
10.2
10.3
10.4
10.5
11
INTRODUCTION TO JENNET ...................................................................................................... 76
RADIO FREQUENCY OPERATION ........................................................................................... 76
BATTERY-POWERED OPERATION ......................................................................................... 77
EASY INSTALLATION AND CONFIGURATION .................................................................... 77
RELIABLE RADIO COMMUNICATION ................................................................................... 78
PROBLEMS/CHALLENGES FACED .......................................................................................... 79
APPENDIX A: FRAMES ........................................................................................................................ 81
12
REFERENCES ............................................................................................................................... 83
13
BIBLIOGRAPHY .......................................................................................................................... 84
8
Chapter One
1
ARCHITECTURE (FLOW) DIAGRAM
9
Chapter Two
2
2.1
OVERVIEW
2.2
BENEFITS
2.2.1 Economic
Against a backdrop of global
INTRODUCTION
economic slowdown, funding is becoming limited.
Electricity is among a country’s most important and expensive assets, typically accounting
for a third of its electricity bill. With energy prices increasing, this is driving the demand
for energy-conserving technologies for municipal lighting. Maintenance costs are also
increasing, with huge numbers of lamps nearing the end of their serviceable life.
2.2.2 Reduced greenhouse gas emissions
With the energy savings comes a corresponding reduction in your community's CO2
footprint. Each saving of 1500 kWh reduces CO2 emissions by approximately 1 ton for
mixed power generation.
10
2.2.3 Reduced energy costs
No greenhouse can survive without controlled parameters such as light, humidity and
temperature. Not every greenhouse requires full illumination all the time. Therefore,
depending on the site and situation, a frequently feasible option is to dim lights, fans, and
sprinkler thereby striking a balance between economical goals and citizens’ safety needs.
Reduced maintenance costs
2.2.4 Information
Information is an increasingly valuable asset. If we can capture data on ambient
temperature, moisture, visibility, light intensity, rain and traffic density, we can further
lower energy costs and roll out new services for your customers. These innovative
applications can add further value to your intelligent lighting system.
2.2.5 Scalability
The JenNet wireless network is highly scalable. We can add nodes anywhere in the
network and the network software will look after the connections for us. If a network
becomes full, JenNet has features that allow seamless load balancing of the network,
transferring devices from the heavily loaded network to a less loaded network.
2.3 VALUE ADDED FEATURES
Once a wireless intelligent lighting system has been implemented, the infrastructure then
exists for value added features.
2.3.1 Control opportunities
 During an emergency, illuminate the greenhouse at maximum intensity.

Turn on fans, air conditioners in case of very hot temperature.

Turn on the sprinklers in case of any fire detection..
2.3.2 Increased energy savings
 Greenhouse monitoring appliances control via push-switch or mobile phone text
message.

The use of an astronomical clock, to make best use of the light from the Sun and
Moon.

Automatic dimming of appliances based on the local weather.
11
2.3.3 Information management
 Light performance auditing could reduce a greenhouse’s liability exposure.

Data collected from temperature sensors could feed into highway maintenance
operations during cold weather, giving real-time thermal mapping of the network.

If power usage is monitored in the greenhouse then this data can be used for billing
of the electricity usage.
2.4
STATEMENT OF SCOPE:
 Wireless sensor networks have a bright future

Many applications have been proposed

Potential to revolutionize human-computer interactions

Availability of sensors will lead to new and exciting applications
 A lot of research remains to be done

Wireless sensors will not evolve into traditional computers

Many obstacles to overcome

Allow realism to guide research efforts
2.5 SCOPE OF WSNs:
2.5.1
Smart Home/Smart Office
Smart home environments can provide custom behaviours for a given individual.
Considerable amount of research has been devoted to this topic. The research on smart
homes is now starting to make its way into the market. It takes a considerable amount of
work and planning to create a smart home. There are many examples of products currently
on the market which can perform individual functions that are considered to be part of a
smart home.
2.5.2
Military
New and emerging technologies, such as networks, support military operations by
delivering critical information rapidly and dependably to the right individual or
12
organization at the right time. This improves the efficiency of combat operations.
2.5.3
Industrial & Commercial
Since the long-time wireless transmission of data is being done in industrial applications,
but recently it has gained importance. Successful use of wireless sensors in systems such
as supervisory control and data acquisition has proved that these devices could effectively
address the needs of industrial applications. The critical process applications of WSNs in
industry are monitoring temperature, flow level, and pressure parameters.
2.5.4 Traffic Management and Monitoring
The vehicle tracking application is to locate a specific vehicle or moving object and
monitor its movement. This work also describes design of WSN for vehicular monitoring.
As the power source (battery) is limited, it is important that a design of sensor node is
power efficient.
Agriculture
Wang and Wang (2006) stated that agriculture can also be benefited by the deployment of
2.5.5
WSN to get the information regarding soil degradation and water scarcity. With help of
WSNs we can check the clean water consumed in irrigation and manage it.
13
Chapter Three
3
JENNIC EVALUATION KIT
In the JN5148-EK010 Evaluation Kit, following components are present
•
•
•
•
•
3.1
1 Controller board with LCD and pre-installed module with uFl connector.
Sensor boards:
1. Two with pre-installed module with uFl connector.
2. Two with pre-installed module with integrated PCB antenna.
SMA-connector antenna
USB-to-Serial (FTDI) cables.
Pack of 10 AAA batteries for the boards
SDK INSTALLATION
3.1.1 SDK Toolchain Installer
The JN5148 SDK Toolchain is supplied in the file JN-SW-4041-SDK-ToolchainvX.Y.exe. This includes the following development tools:
•
Cygwin CLI (Command Line Interface)
•
Eclipse IDE (Integrated Development Environment)
•
Debugging tools (standalone or as Eclipse plug-ins)
•
JN51xx Compiler Tools
•
JN51xx Flash Programmer (standalone or as Eclipse plug-ins)
3.1.2 SDK Libraries Installer
The SDK Libraries are supplied in the file JN-SW-4040-SDK-Libraries-vX.Y.exe. This
includes a number of APIs containing C functions, as well as other software
components:
•
ZigBee PRO networking layer and APIs
•
JenNet networking layer and APIs
•
IEEE 802.15.4 networking layer and API
•
JenOS APIs
•
JN51xx Integrated Peripherals API
•
LPRF Board API
14
•
Configuration tool command line utilities
3.1.3 Toolchain Contents
The software components that can be installed from the JN5148 SDK Toolchain are
listed in the table below.
Figure 2.1 ToolChain Table
3.2 INTRODUCTION TO ECLIPSE
Eclipse is an open-source development platform, originally developed by IBM and now
supported by the Eclipse Foundation (www.eclipse.org). The platform provides a
fullyfeatured integrated environment for developing and building software applications,
and is rapidly becoming the accepted standard IDE for use within the embedded software
community.
•
Create an Eclipse project for your application (from an NXP template)
•
Edit your application code using the Eclipse editor
•
Build your application, to produce a binary file
•
Download your binary file to the device that is to run the application
•
Debug your application code.
15
Figure 2.2
3.3 FLASH PROGRAMMER
The JN51xx Flash Programmer application can be used to download binary code to the
SPI bus connected Flash memory chip on a JN51xx module or dongle. The JN51xx Flash
Programmer is available through a GUI (Graphical User Interface) or a CLI (Command
Line Interface).
Check that the MAC address shown is correct for the device.
Figure 2.3
16
3.4 HARDWARE
Nodes can use high-power modules to facilitate transmission over a minimum of 350
meters under most conditions. Typically, the range will be in excess of 1 km since the
nodes are elevated and in the line-of-sight of each other. However, you can experience
complex fade conditions caused by buildings.
Figure 2.4
3.4.1 JN5148 Wireless Microcontrollers
The JN5139 and JN5148 wireless microcontrollers provide most of the
environmental hardware functionality on-chip, with a 2.4-GHz radio transceiver and
digital and analogue peripherals that are used as follows:
• GPIO provides digital drive for lamp power-switching
• UARTs service the serial gateway link
• ADCs can be used for sensor and power measurement
• DACs provide analogue control for dimming
3.4.2 Logistics
A network can assume any shape, up to a depth of 1000 nodes, with a maximum of
16 children per parent node and a maximum of 1000 nodes in the network.
Therefore, a Gateway can service up to 1000 nodes.
17
3.5 WIRELESS NETWORK CONCEPTS
The basic concepts that are essential to using the evaluation kit are
•
Radio frequency.
•
Node types.
•
Network formation and topology.
•
Software stack
3.5.1 Radio Frequency
The evaluation kit boards communicate in the 2400-MHz radio frequency (RF) band.
This is one of the standard RF bands used by the IEEE 802.15.4 wireless network
Protocol. The 2400-MHz band spans radio frequencies 2405 to 2480 MHz and is divided
into 16 channels, numbered 11 to 26 (the numbers up to 10 are used for other RF bands) -
Figure 2.5
3.5.2 Node Types
In addition to running an application (e.g. temperature measurement), each node of a
wireless network has a networking role. A wireless network can contain three types of
node, differentiated by their networking roles, as described below:
Figure 2.6
18
3.5.3
Network Formation and Topology
A wireless network is formed by starting the Co-ordinator node, which performs
network initialisation including the selection of the radio channel in which the network
will operate.
A number of network shapes or topologies are possible, which are dependent on the
wireless network protocol used. These are the Star, Tree and Mesh topologies.
3.5.3.1 Tree Networks
The Tree topology is available in the IEEE 802.15.4 and JenNet protocols (in ZigBee
PRO, it is enhanced to a Mesh topology). It is suitable for larger networks and higher
traffic levels than the Star topology
Figure 2.7
3.5.4
Wireless Network Protocol Stack
The software which runs on a wireless network node deals with both application specific
tasks (e.g. temperature measurement) . The software on a node is organised as a
number of layers, forming a stack. The basic layers of a wireless network protocol stack
are:
Figure 2.8
19
3.6 WIRELESS NETWORK PROTOCOL OPTIONS
The JN5148 SDK offers a choice of three wireless network protocols:
A comparison of these three protocols is presented in the table below.
Figure 2.9
20
Chapter Four
4
JENNIC JN5148 NODES
4.1 Application Overview
In our application JN5148 evaluation kit sensor boards are used to demonstrate the
transmission of sensor data over a network to a central Co-ordinator. The sensor boards
send temperature data, light data, humidity data and battery voltage data over the network
to the Co-ordinator node. The Router sensor boards allow further sensor boards to join the
network, allowing it to be extended.
4.2 Application Operation
4.2.1
JenNet Co-ordinator
The JenNet Co-ordinator can be either a controller board or a sensor board from a JN5148.
The Co-ordinator initially creates the JenNet network for the other sensor boards to join.
The Co-ordinator takes readings from its sensors every 5 seconds, and outputs its readings
and network address to the UART (19200-8-N-1).
The Co-ordinator also receives readings from the other sensor boards in the network.
These received readings and network addresses are also output to the UART.
Once a set of readings has been taken, the Co-ordinator pauses for 5 seconds before taking
the next set of readings. The Co-ordinator continues to run the JenNet stack during this
time to receive and output readings from the other sensor boards.
4.2.1.1 Additional Functionality Of Gateway
At the core of the gateway device is a Jennic wireless microcontroller with the following
key functionality:
• Implements gateway communication with the control centre
• Implements the JenNet stack for network communications, operating as a JenNet Coordinator node. The Co-ordinator controls the network formation and without it, no
21
network can form.
The above functionality is summarised in Figure below.
4.2.2
JenNet Router
The Routers initially join the network created by the Co-ordinator and allow further sensor
boards to join the network.
A Router takes readings from its sensors every 5 seconds, and outputs the readings and
network address to its UART (19200-8-N-1).
The Router’s readings are also sent to the Co-ordinator through the network.
Once a set of readings has been taken, the Router pauses for 5 seconds before taking the
next set of readings. The Router continues to run the JenNet stack during this time to allow
other
sensor
4.2.3
boards
to
send
their
data
to
the
Co-ordinator.
JenNet End Device
The End Devices initially join the network formed by the Co-ordinator and Routers.
An End Device takes readings from its sensors, and outputs the readings and network
address to its UART (19200-8-N-1).
The End Device’s readings are also sent to the Co-ordinator through the network.
Once a set of readings has been taken, the End Device enters sleep mode for 5 seconds
before waking to take the next set of readings. Being in sleep mode allows the End Device
to conserve power when not taking readings or using the radio.
22
4.3 Basic Features

Sensors measure voltage, ambient temperature, ambient humidity and ambient
light.

Visualisation of the network structure, allowing:

Path of a node to be traced

Display of the network shape

Automatic network recovery from multiple node failures

Addition and removal of network nodes

Message security using encryption

Load balancing and re-allocation of nodes from one network to another

Sending messages between networks
4.4 Network Formation
A network will form automatically when the programmed boards are powered on, but the
boards must be started in the following order:
Step 1 Power-on the Co-ordinator
First power-on (or reset) the Co-ordinator (Controller board) and note the
following activity:
a) Co-ordinator LED D2 flashes rapidly, indicating that the Co-ordinator is
creating the network.
b) Co-ordinator LED D2 flashes slowly, indicating that the network is up and
running the application.
Step 2 Power-on the Routers
Now power-on the Routers and note the following activity:
a) Router LED D2 flashes rapidly, indicating that the Router is attempting to
join the network.
b) Router LED D2 flashes slowly, indicating that the Router is connected to
the network and running the application
23
4.5 Sensor Functions
4.5.1
Light Sensor Functions
The chapter describes the functions that can be used to interact with the ambient light
sensor on a board. This sensor provides an indication of the level of light falling on the
board. The functions are defined in the header file AlsDriver.h .The TAOS TSL2550
ambient light sensor used on the boards contains two photo diodes connected to two
separate channels:

The Channel 0 photo-diode is sensitive to both visible and infra-red light.

The Channel 1 photo-diode is primarily sensitive to infra-red light.
The light-levels obtained from the two channels (Ch0 and Ch1) can be combined to
approximate the response of the human eye, which is sensitive to visible light but
insensitive to infra-red light. This adjusted light-level (in units of lux) is given by:
Lightlevel = 0.39
Ch0 – Ch1
e0.181R2
The result of this calculation allows a second device to be controlled to match the
sensitivities of the human eye, e.g. to control the back-light required for an LCD screen in
the given ambient lighting conditions.
Typical channel values and the corresponding light-levels for different light sources are
summarised in the following table:
Table 3.1
24
The light sensor functions are listed below,
Functions:
vALSreset
vALSstartReadChannel
u16ALSreadChannelResult
vALSpowerDown
4.5.2
Temperature/Humidity Sensor Functions
The chapter describes the functions that can be used to interact with the temperature and
humidity sensors on a board:

Temperature can be measured in the range 0 to 124oC.

Relative humidity can be measured in the range 0-100%.
These two measurements are actually provided by a single sensor unit on the board.
The functions are defined in the header file HtsDriver.h . The temperature and humidity
sensor functions are listed below.
Function s:
vHTSreset
vHTSstartReadTemp
u16HTSreadTempResult
vHTSstartReadHumidity
u16HTSreadHumidityResult
4.6 UARTs
The JN5148 microcontrollers have two UARTs, denoted UART0 and UART1, which can
be independently enabled. These UARTs are 16550-compatible and can be used for the
input/output of serial data at a programmable baud-rate of up to 4 Mbps for the JN514x
device.
25
4.6.1
UART Signals and Pins
A UART employs the following signals to interface with an external device:

Transmit Data (TxD) output - connected to RxD on external device

Receive Data (RxD) input - connected to TxD on external device

Request-To-Send (RTS) output - connected to CTS on external device

Clear-To-Send (CTS) input - connected to RTS on external device
The interface can use just two of these signals (RxD and TxD).
4.6.2
UART Operation
The transmit and receive paths of a UART each have a 16-byte deep FIFO buffer, which
allows multiple-byte serial transfers to be performed with an external device:

The TxD pin is connected to the Transmit FIFO

The RxD pin is connected to the Receive FIFO
On the local device, the CPU can write/read data to/from a FIFO one byte at a time.
The two paths are independent, so transmission and reception occur independently.
4.6.2.1
Wire Mode (with Flow Control)
In 4-wire mode, the UART uses the signal lines TxD, RxD, RTS and CTS. This allows
flow control to be implemented, which ensures that sent data can always be accepted.
The general principle of flow control is described below.
The RTS and CTS lines are flags that are used to indicate when it is safe to transfer data
between the devices. The RTS line on one device is connected to the CTS line on the other
device.
4.6.3
Configuring the UARTs
4.6.3.1 Enabling a UART
A UART is enabled using the function vAHI_UartEnable(), which enables the UART
in 4-wire mode by default.
4.6.3.2
Setting the Baud-rate
The following functions are provided for setting the baud-rate of a UART:

vAHI_UartSetBaudRate()
26
This function allows one of the following standard baud-rates to be set: 4800, 9600,
19200, 38400, 76800 or 115200 bps.
Figure 3.2 Program Reading Data
27
Chapter Five
5
DATABASE & ARTIFICIAL INTELLIGENCE
5.1 GREENHOUSE DATABASE
We have used Microsoft SQL Server 2008 to store the data records mainly temperature,
light and humidity of plants at whatever time and date they are sensed.
Our database table consists of following parameters:

Temperature

Humidity

Light

Date

Time

Weather
The parameter “weather” is auto-generated or you can say predicted by monitoring all the
three values of temperature, humidity and light using a case statement SQL query.
5.2 IDEAL VALUES IN A GREENHOUSE
To maintain our greenhouse perfectly, we have decided a “Threshold” or an “Ideal” value
for all the three parameters. If any of the current parameter value exceeds its respective
threshold, an action will be performed accordingly.
To find out the appropriate threshold values we performed following research.
28
5.2.1
TEMPERATURE
Customary temperatures for Greenhouses are listed below:
5.2.2
HUMIDITY
To vent and heat the greenhouse most energy efficiently, growers might consider
purchasing a device to measure humidity, and then heat and vent accordingly. The
desirable humidity varies with temperature. Plants in warmer environments can tolerate
higher relative humidity. The chart below provides corresponding temperature and relative
humidity set points for disease prevention.
°F
Humidity
50°
83%
61°
89%
68°
91%
86°
95%
Humidity management is a valuable tool to prevent diseases in greenhouses as part of
29
overall Integrated Pest Management. Effective environmental control not only reduces
disease pressure and reduces pesticide use, the re-entry intervals from pesticide
applications are no longer an issue.
5.2.3
LIGHT
Sunlight conditions in greenhouses can vary rapidly, affecting temperature, humidity, and
luminance. To compensate, greenhouse ventilation, heating, shading, irrigation,
humidification, and lighting equipment must be reasonably responsive to these fluctuations
if a controlled growing environment is to be achieved.
It’s important to remember that humans perceive light differently than plants. For
photosynthesis, plants respond strongest to blue and red light, and to red and infra-red
light wavelengths for photoperiod growth responses and germination control. The
intensity, duration, direction, and spectral quality of light radiation that plants receive has
an effect on photosynthesis, flowering, climate response (temperature and water loss), and
plant shape (photomorphogenisis).
Greenhouse raised plants often look quite different from genetically identical outdoor
specimens. This is due in part to their response to climate differences, including the
quantity, quality, and duration of light they receive.
30
TYPICAL SUPPLEMENTARY LUMINATION TREATMENTS (Various Sources)
5.2.4
WEATHER
The parameter value “Weather” is generated as follows:
31
And the database table looks like:
5.3 DECISION
MAKING
THROUGH
MACHINE
LEARNING
ALGORITHMS
We have used WEKA tool for the purpose of decision making through graphs and other
visualizations, which are all based on Machine Learning Algorithms.
5.3.1
WHAT IS WEKA
WEKA, formally called Waikato Environment for Knowledge Learning, is a computer program
that was developed at the University of Waikato in New Zealand for the purpose of identifying
information
from
raw
data
gathered
It contains tools for a whole range of data mining tasks:

Data pre-processing

Classification

Regression
from
agricultural
domains.
32

Clustering

Association

Visualization
5.3.2
ARFF FILE CREATION
WEKA usually accepts .arff files, which are an extension of .csv files and specially
supported by WEKA.
Our
GUI
provides
an
option
to
create
The format of this file after its creation is like this:
ARFF
file
of
the
data.
33
5.3.3
5.3.3.1

MACHINE LEARNING ALGORITHMS
MACHINE LEARNING
Studies how to automatically learn to make accurate predictions based on past
observations.

Classification problems:
Classify examples into set of given categories.
5.3.3.2
WHY MACHINE LEARNING? (Advantages)

Often much more accurate than human-crafted rules (since data driven).

Don’t need a human expert or programmer.

Automatic method to search for hypothesis explaining data.

Cheap and flexible- can be applied to any learning task.
Using the following Machine Learning Algorithms to test our data, we got the best and
accurate result by J48.

ZeroR

J48

NaiveBayes

LMT
Hence, we did all the processing and other steps using the algorithm J48 that is best
suited for data like ours.
34
STEP 1: TRAINING A DATA SET
STEP 2: TRAINING A TEST SET
35
STEP 3: CROSS VALIDATION
STEP 4: PERCENTAGE SPLIT
36
Following these steps, we are done with the training. WEKA provides additional options
like to visualize all the values together , we can use visualize option. It gives an output
like:
Also, we can visualize errors, margin curves, trees etc using WEKA. Missing values can
also be filled. There are a lot more ways in which WEKA can be helpful for us.
SNAPSHOT OF GUI HOMEPAGE
37
Chapter Six
6
SMS & EMAIL GENERATION
6.1 GSM TECHNOLOGY
6.1.1
GSM ARCHITECTURE
A GSM network consists of several functional entities whose functions and
interfaces are defined. The GSM network can be divided into following broad parts.

The Mobile Station(MS)

The Base Station Subsystem (BSS)

The Network Switching Subsystem (NSS)

The Operation Support Subsystem(OSS)
Following is the simple architecture diagram of GSM Network.
Figure 4.1
6.1.2
GSM PROTOCOL STACK
The layered model of the GSM architecture integrates and links the peer-to-peer
communications between two different systems. The underlying layers satisfy the
services of the upper-layer protocols. Notifications are passed from layer to layer to
ensure that the information has been properly formatted, transmitted, and received.
The GMS protocol stacks diagram is
shown:
Figure 4.3
38
6.1.3
GSM PHONE HARDWARE
Initially, for the first couple of years, GSM cell phones were actual phones with very
little additional functionality. They provided everything that was required for voice
calls, as well as SIM phone book editing features. The only additional non-features
were simple improvements like the ability to use them as an alarm clock.
They pioneered handheld computing by introducing touch screen user interfaces and
a wide range of application programs, ranging from calendar/scheduling
applications, dictionaries, exchange rate and tip calculators, scientific calculators,
accounting /finance software, etc.
While in mobile phones the actual cellphone aspect was becoming more and more
commoditized, at some point the PDA features and functionalities were added to
phones, coining the term smartphone. At that point there was a need to differentiate
from those phones that were not-so-smart. Those phones were then called feature
phones.
6.1.4 FEATURE PHONE
A feature phone is a phone that runs the GSM protocol stack (the software
implementing the GSM protocol)as well a s the user interface and all applications
on a single processor. For historic reasons, this processor is known as the so-called
baseband processor (BP).
The baseband processor often exposes a serial port (or today USB) over which the
phone can be used as a terminal adapter, similar to old wireline modems. The
industry standard protocol for this interface is an AT command set - extended and
modified from how computers interfaced old wireline modems. The AT-command
interface can be connected to a computer. The computer can then use the phone to
establish data calls, send/receive short messages via SMS, and generally remotecontrol the phone.
6.1.5
GSM MODEM ARCHITECTURE
Every GSM phone, feature phone and smartphone alike, has a GSM modem
interfacing with the GSM network.
39
This GSM modem consists of several parts:

RF Frontend, responsible for receiving and transmitting on GSM
frequencies

Analog Baseband, responsible for modulation and demodulation

Digital Baseband, responsible for digital signal processing and the GSM
protocol stack.
6.1.6
AT COMMANDS
GSM
mobile
telephones
and
modems can be operated a serial
interface. A command entered at
the user port generally begins with
an ‘AT’ command prefix. One can
easily use these AT Commands
through a computer using hyperterminal by setting a specified baud
rate, data bits, stop bit and parity
for communication while making
sure that the GSM modem is
connected to the computer typically
through
serial
port
Figure 4.5
6.1.7
At commands and their responses according to GSM standards
Table : AT Command Syntax
Table: List of tested AT Commands
40
AT Command Description
Syntax
Response
Get Attention
AT
OK
Deactivate Echo
ATEO
OK
ATD[+923219239818];
OK
ATH
OK
To
Dial
a
number
(e.g. +923219239818)
Disconnect Existing Connection
+CMGF: (0)
Message Format
AT+CMGF=?
OK
0011000C912923913
Read Message (e.g. from Memory
Location 10)
289810000AA0AC87
AT+CMGR=10
C1994A6CF41ED32
OK
AT+CMGS=23
Send Message (e.g. ‘Hye its me’ to
+923219239818)
0011000C91292391328
9810000AA0AC87C19
94A6CF41ED32
>
OK
Ctrl Z
6.1.8
WHY GSM PHONE:
+ Easy to buy
+ Battery operated
+ Voice features
6.1.9
INSATALLING PC SUITE
PC suite need to be installed successfully on the computer to work with
AT commands and a GSM phone. We have used Nokia E63 for sms
sending,
Figure 4.6
hence
NOKIA
PC
SUITE
has
been
installed.
41
6.1.10 PORT SELECTION
After connecting the mobile phone via usb/serial port, we now see the COM port to
which it is attached. It can be seen from Phone & Modem category in the control panel.
Figure 4.7
6.1.11 MANUAL SMS ALERT:-
Our GUI provides a form that allows users to send sms by themselves, if they feel that the
temperature, light or humidity of their greenhouse is above or below standard values. The
user will have to select the COM port from a list of available ports, provide the receiver’s
mobile number and a message to be sent. Fig shows a snapshot of how the user can send
sms manually.
Figure 4.8
42
6.1.12 AUTOMATIC SMS GENERATION:-
One of the features of our project is to generate SMS message automatically. As soon as
the user requests for automatic SMS generation, the values in the database are compared
with the standard value and once a value exceeds it, an SMS is sent to specified user.
Figure 4.9
6.2 EMAIL GENERATION
One of the objectives of our project is to generate emails, both manually and
automatically, as an alert message to users who will be working with greenhouse. When a
user will use the JN-5148 kit to measure temperature, humidity or light in greenhouse, the
sensed values will be saved in a database. The values from the database are then used and
compared with a standard value, like for example a standard temperature of 36C is
predefined. Now all the values of temperatures in the database will be compared with this
standard value and wherever any value will exceed the standard value, an email will be
dispatched to the specified user as an alert, so that he/she could control the greenhouse
respectively. For this purpose, a GUI has been designed. The users can either send an
email manually after seeing the data from the records maintained, or they can select
automatic email generation.
43
6.2.1
Manual Email Alert:-
Our GUI provides a form that allows users to send email by themselves, if they feel that
the temperature, light or humidity of their greenhouse is above or below standard values.
The user will have to provide the receiver’s email address and a message to be sent. Fig
5.1 shows a snapshot of how the user can send email manually.
Figure 5.1
6.2.2
Automatic Email Generation:-
One of the features of our project is to generate emails automatically. As soon as the user
requests for automatic email generation, the values in the database are compared with the
standard value and once a value exceeds it, an email is dispatched to specified user. Fig 5.2
shows the snapshot of automatically email generation.
Figure
5.2
44
6.3 SMTP (SIMPLE MAIL TRANSFER PROTOCOL) :-
6.3.1
Introduction
Electronic mail (e-mail) is one of the most popular network services nowadays. Most email systems that send mail over the Internet use simple mail transfer protocol (SMTP) to
send messages from one server to another
6.3.2
What is SMTP?
Simple Mail Transfer Protocol (SMTP) is an Internet standard for electronic mail (e-mail)
transmission across Internet Protocol (IP) networks.
SMTP provides a set of codes that simplify the communication of email messages between
servers. It's a kind of shorthand that allows a server to break up different parts of a
message into categories the other server can understand. Any email message has a sender,
a recipient - or sometimes multiple recipients - a message body, and usually a title heading.
SMTP is used as the common mechanism for transporting electronic mail among different
hosts within the transmission control protocol/Internet protocol (TCP/IP) suite. It is an
application layer protocol. Under SMTP, a client SMTP process opens a TCP connection
to a server SMTP process on a remote host and attempts to send mail across the
connection. The server SMTP listens for a TCP connection on a specific port (25), and the
client SMTP process initiates
6.3.3
Purpose of SMTP:-
The primary purpose of SMTP is to transfer email between mail and servers. However, it
is critical for email clients as well. In order to send email, the client sends the message to
an outgoing mail server which in turn contacts the destination mail server for delivery.The
other purpose of SMTP is to set up communication rules between servers. For example,
servers have a way of identifying themselves and announcing what kind of communication
they are trying to perform.. In a typical SMTP transaction, a server will identify itself, and
announce the kind of operation it is trying to perform. The other server will authorize the
operation, and the message will be sent. If the recipient address is wrong, or if there is
some other problem, the receiving server may reply with an error message of some
kind.One important point to make about the SMTP protocol is that it does not require
45
authentication.
Figure 5.3
6.3.4
SMTP VS Mail Retrieval:-
SMTP is a delivery protocol only. In normal use, mail is "pushed" to a destination mail
server (or next-hop mail server) as it arrives. Mail is routed based on the destination server,
not the individual user(s) to which it is addressed. Other protocols, such as the Post Office
Protocol (POP) and the Internet Message Access Protocol (IMAP) are specifically
designed for use by individual users retrieving messages and managing mail boxes. To
permit an intermittently-connected mail server to pull messages from a remote server on
demand, SMTP has a feature to initiate mail queue processing on a remote server POP and
IMAP are unsuitable protocols for relaying mail by intermittently-connected machines;
they are designed to operate after final delivery, when information critical to the correct
operation of mail relay (the "mail envelope") has been removed.
6.4
SENDING EMAIL USING GMAIL SMTP SERVER
6.4.1

Gmail SMTP Settings:-
We are using GMAIL SMTP Server to send emails as an alert when the
temperature, humidity or light values are greater than a standard values.
The Gmail SMTP server settings for sending mail through Gmail from any email program
are:

Gmail SMTP server address: smtp.gmail.com

Gmail SMTP user name: Your full Gmail address (e.g. example@gmail.com)
46

Gmail SMTP password: Your Gmail password

Gmail SMTP port: 587

Gmail SMTP TLS/SSL required: yes
6.4.2
Email Generation Using C#
Finally, we have written the code using c# to implement email generation. Following are
the main steps involved.
STEP#1: NAMESPACES:-
1. Using System.Net.Mail :- By importing this namespace we can use the inbuilt
classes like SmtpClient, Mail Message, Mail Address in our code, which are the
important classes required to send email.
2. Using System.Net.Mime :- By importing this we can send email using
Multipurpose Internet Mail Extensions like by specifying attachments like pdf’s,
sending images in the body of email etc.
STEP#2: CODE FOR EMAIL GENERATION:Now comes the important coding to accomplish email task. For the sake of understanding
the process, the complete code is divided into three blocks.
BLOCK 1:-
To send an email a new object of mailMessage (an email) and SmtpClient is created.
MailMessage msg = new MailMessage ();
SmtpClient sc = new SmtpClient ();
MailMessage helps us to create the mail and SmtpClient allows us to send mail to the
reciepient. It also provides provision to include options like Priority (sets priority of mail),
DeliveryNotificationOptions (instructs SMTP server to send a message to FROM address
in case of delay, fail or success mail departure), Reply To (email address to which replies
will be sent).
47
Instances of the MailMessage class are used to construct e-mail messages that are
transmitted to an SMTP server for delivery using the SmtpClient class. The sender,
recipient, subject, and body of an e-mail message may be specified as parameters when a
MailMessage is used to initialize a MailMessage object. These parameters may also be set
or accessed using properties on the MailMessage object. The primary mail message
headers and elements for the message may be set using the following properties of the
MailMessage class.
BLOCK 2:-
The following code is configured to send mails from GMAIL account.
Add – From, To, CC, BCC, subject, Body – as shown.
m.From = new MailAddress("from@gmail.com", "Display name");
m.To.Add (new MailAddress("to@domain.com", "Display name To"));
m.CC.Add (new MailAddress("CC@yahoo.com", "Display name CC"));
//similarly BCC
m.Subject = "Test";
m.Body = "This is a Test Mail";
BLOCK 3:-
Final block comes with the SMTP credentials (credentials of SMTP server which is
responsible to send the message to the recipient).
sc.Host = "smtp.gmail.com";
sc.Port = 587;
sc.Credentials = new System.Net.NetworkCredential("from@gmail.com", "password of
from");
sc.EnableSsl = true; // runtime encrypt the SMTP communications using SSL
sc.Send(m);
48
Chapter Seven
7
WORKING WITH WIRESHARK
7.1 APPLICATION OVERVIEW
The network analyser system consists of a PC running Wireshark and an NXP JN5148
evaluation kit board programmed with a packet sniffer binary. The sniffer node detects (or
'sniffs') over-air packets, encapsulates them into a serial protocol and passes them to the
PC via a USB-serial cable. The NXP Sniffer Server on the PC converts this serial data into
UDP/IP
packets,
which
are
then
interpreted
by
Wireshark.
Figure 6.1
7.2 ABOUT WIRESHARK
Wireshark is a network protocol analyser application. It is widely used for network
troubleshooting and analysis, software and communications protocol development, and
educational purposes. NXP provide dissector plug-ins to the Wireshark source code in
order to add support for the following protocols:•
JenNet protocol based on IEEE 802.15.4
•
JSNIFFER – a protocol for communication with a sniffer binary running on a
JN5148 or JN5139 device
49
•
ZigBee RF4CE and RF4CE CERC profile
Wireshark also includes support for industry-standard protocols, including:-
7.3
•
IEEE 802.15.4
•
ZigBee PRO
•
IETF 6LoWPAN (IETF RFC4944 - first published version)
REQUIREMENTS OF WIRESHARK
7.3.1 Installing and Configuring a Loopback Adaptor
The sniffer uses a serial protocol to send radio packets to the PC via a USB port. This
serialised data is then re-formed and forwarded on to a network adaptor to allow
Wireshark to capture and dissect it. An NXP sniffer proxy server is used in conjunction
with a virtual network adaptor, i.e. the Microsoft Loopback Adaptor. This section provides
information on how to install and configure the Microsoft Loopback
Adaptor.
7.3.2 Program a JN51xx Board as a Sniffer
Use the JN51xx Flash Programmer to install the appropriate NXP sniffer
binary onto a JN51xx-based board.
The packet sniffer captures packets and forwards them to the serial port
of a PC. The serial port speed is pre-programmed into the sniffer at
either 115200 bps or 1 Mbps. Select a speed supported by the PC.
7.3.3 ARP entry
From the DOS command line an entry for the loopback adapter to the
arp table was added:
C:> arp -s 192.168.100.2 00-00-00-00-00-01 192.168.100.1
7.4
SNIFFER SERVER GUI
Figure 6.2
50
WIRESHARK CAPTURES
Figure 6.3
Figure 6.4
51
Chapter Eight
8
WIRED CIRCUITRY
Our circuit performs following tasks:

Receives input from parallel port

Maintains a constant voltage level with the help of voltage regulator.

Maintains a switching mechanism mechanically with the help of relays

Controls a circuit by a low-power signal (with complete electrical isolation
between control and controlled circuits).

Glows the corresponding appliances.
Interfacing of PC with circuitry will be done by using DB-25 male connector.
A C# .NET application will be running on PC which will access the parallel port by using
inpout32 dll which includes an output function that will send the data to the port. That
function will pass arguments including data & respective port address.
8.1
COMPONENTS USED
 Parallel port male connector (DB-25)

Octal Transceiver (74ls245)

Regulator (LM7805)

Relays Capacitor

Diode

Fan

Bulb

Sprinkler

Dimmer
8.1.1
Parallel Port Male Connector (DB-25):
PC parallel port can be very useful I/O channel for connecting circuits to PC.
The PC's parallel port can be used to perform some very amusing hardware
interfacing experiments. PC parallel
52
port is 25 pin D-shaped female connector in the back of the computer. It is
normally used for connecting computer to printer, but many other types of
hardware for that port is available today. To start using the parallel port, a
parallel port cable with D-25 type Male connector on one side is needed. The
male connector goes into the parallel port socket behind the CPU. The output
pins of the parallel port are TTL level output pins. This means that they put out
ideally 0V when they are in low logic level (0) and +5V when they are in high
logic level (1).
53
Fig 7.1 Pin Diagram of DB-25 Male Connector
8.1.2
Octal Transceiver (74ls245):
74245 octal bus transceivers are mainly used to control connectivity between two devices
or circuits. It also provides direction control for signal flow. Function of various pin of this
IC is given below:

A1 through A8: Bus A.

B1 through B8: Bus B.

G΄: Active low enable input. When high, sets all the bus pins to high impedance
state.

DIR: Direction control for signal flow. When set to high logic level, transfers bus
A data to B bus. When set to low logic level, transfers bus B data to A bus.

VCC and GND: Supply connections lines.
Fig 7.2 Pin Configuration of Octal Transceiver (74ls245)
8.2
PCB DESIGNING
A printed circuit board, or PCB, is used to mechanically support and electrically
connect electronic components using conductive pathways, tracks or signal
traces etched from copper sheets laminated onto non-conductive substrate. A
54
PCB populated with electronic components is called a printed circuit assembly
(PCA), printed circuit board assembly or PCB Assembly (PCBA).
8.2.1 Steps to PCB design using OrCad:
 Design circuit using schematic entry package (Capture).

Generate netlist for PCB package.

Import netlist into PCB package (LayoutPlus).

Place components, route signals.
8.2.1.1 Schematic Design:
 Use Capture to enter the design.

Label nets to locate at the PCB stage – net names are carried through to the PCB
design process.

Select project in project window (as opposed to schematic window), select Design
Rule Check for Tools menu

Select project in project window, select Create Netlist from Tools menu.

Choose Layout tab (to generate Layout compatible netlist), generate netlist.

Choose units (English or metric) compatible with the PCB design.
55
Fig 7.7 Schematic Diagram
56
8.2.1.2 PCB Layout:
 Run LayoutPlus. Choose File/New.

Select a “technology file” appropriate for PCB design. These are in Program
Files\OrCad\Layout Plus\data and set defaults for things like track spacing, hole
sizes etc. Some examples:

Choose the netlist file (.mnl extension). If the units (English/metric) are not the
same it won’t be able to load it. Just go back to Capture and generate the netlist
again with the right units.

If some of design components chosen from the OrCad Capture libraries did not
have PCB footprints associated with them “Cannot find footprint for...” messages
will appear. If this happens, choose “link existing footprint to component”. Browse
footprint libraries to find the required footprint (preview of footprint shown on
screen).
8.2.1.3 Draw Board Outline:
 Click obstacle toolbar button.

Somewhere in design, right click, select new.

Right click again, select properties.

Select: board outline

Left click to place one corner of board, and then right click on successive corners.
Draw a board the required size. Right click, select finish when done(only need to
do 3 corners, finish will complete the outline).
8.2.1.4 Choose Layers:
 Use spreadsheet toolbar button to see the Layers spreadsheet.

Enable only the layers that want for routing, set other layers to unused (double
click on the spreadsheet entry, select unused routing).
For a single sided board most probably only the “bottom” layer is required, however for
double sided “top” and “bottom” layers are required.
57
8.2.1.5 Place Components:
 Select “component” tool from toolbar, click on required component and drag it
where required. Right click to see some options, including rotate.

Auto/place board will attempt to place components automatically within board
outline. Components can be moved manually as well.
8.2.1.6 Track Thickness:
 To change, select “nets” spreadsheet; double click on required net to set its
properties.

Net names are inherited from schematic diagram. Explicitly naming nets helps to
identify them in the PCB design.
8.2.1.7 Routing:
Routing can be done automatically as well as manually. It may be required to
route power and ground first, especially if it's a 1 or 2 layer boards. Priority can
also be assigned to critical nets (those that need shortest paths) to optimally
route those. Priority can be selected from the “nets” spreadsheet for each net.To
automatically route, select Tools, auto, route board.
58
Fig 7.8 Layout Design
59
8.3
WORKING:
 Any input given in hexadecimal at the input of parallel port is appearing at its
output in binary.

Octal Bus Transceiver (74ls245) is serving as an amplifier. It is increasing level of
current, thus receiving 20mA current at its input and providing 200mA at output.
Whereas passing the binary input at output as it is, this is appearing as an input to
the relays.

Regulator (lm7805) is converting our 12V supply into 5V. As 5V is required for
the operation of digital ICs whereas 12V is required for relays operation.

Relays are providing isolation between switching circuit and driver circuit. As
relay works on the principle of electromagnetic attraction and repulsion, when it is
receiving a high logic from octal bus transceiver it is pulling electromagnetic due
to which respective appliance is turned on. On low logic from octal bus transceiver
it is doing nothing.
8.4
INTERFACING OF HARDWARE
8.4.1
Interfacing via PC Ports
The UserPort DLL provides support to access parallel port (also called as printer port or LPT port)
of a PC. If you are using a desktop PC or an old laptop, you may have both, parallel and serial
ports. However in newer laptops, none of them may be available and you will have to use USB to
Serial Converter cable. Please note that USB to Parallel converter is not recognized as a virtual
parallel port.
8.4.2 Parallel Port
Parallel port has 25 pins as shown. Parallel port cables,
commonly referred as printer port cables are easily available.
These cables are handy to connect port pins with your
circuit. Pins 2-9 are bi-directional data pins (pin 9 gives the
most significant bit (MSB)), pins 10-13 and 15 are output
pins (status pins), pins 1,14,16,17 are input pins (control
pins), while pins 18-25 are Ground pins.
Fig 7.9 System View of parallel port
60
8.4.3 Accessing the parallel port
Parallel port is a simple and inexpensive tool for building computer controlled devices and
projects. The simplicity and ease of programming makes parallel port popular in
electronics hobbyist world. The parallel port is often used in Computer controlled robots,
Atmel/PIC programmers, home automation etc.
The PC supports up to three parallel ports that are assigned the labels LPT1, LPT2, and
LPT3.Their base addresses are (in hex) 378, 278, and 3BC, respectively. The port labels
and addresses are typically configured through the PC's BIOS.
The c# application running on Visual Studio will access the parallel port by importing
UserPort dll which includes an output function which will send the data to the port
functions of inpout32 dll.
The two functions exported from inpout32.dll are
1) Inp32(), reads data from a specified parallel port register.
2) Out32(), writes data to specified parallel port register.
Moreover, a database containing values of all the parameters (i.e. temperature, humidity
level, light intensity) will be attached to the application. We will retrieve these values from
the database, this way we can signal the parallel port according to the observed conditions
i.e humidity, temperature & light.
For example if the humidity exceeds the ideal range we will turn the sprinkler on/off , if
the temperature exceeds the range we will turn on/off the fan. We can use multiple fans
so that if the temperature is not very high only one fan will be turned on. Similarly if the
temperature is too high all the fans will be turned on. If the light intensity exceeds a
particular range a bulb will be turned on/off.
61
Chapter Nine
9
9.1
WIRELESS TECHNOLOGY
INTRODUCTION
Wireless communication is among technology’s biggest contributions to mankind.
Wireless communication involves the transmission of information over a distance
without help of wires, cables or any other forms of electrical conductors. The
transmitted distance can be anywhere between a few meters (for example, a
television’s remote control) and thousands of kilometers (for example, radio
communication).
Some of the devices used for wireless communication are cordless telephones, mobiles,
GPS units, wireless computer parts, and satellite television.
9.2
DIFFERENT WIRELESS TECHNOLOGIES
1. Infrared(IR) wireless communication
2. Broadcast Radio
3. Microwave Radio
4. Communication Satellites
9.3
WIRELESS PAN
A wireless personal area network (WPAN for short) is a low-range wireless network
which covers an area of only a few dozen meters. This sort of network is generally
used for linking peripheral devices (like printers, cell phones, and home appliances) or
a personal assistant (PDA) to a computer, or just two nearby computers, without using
a hard-wired connection. There are several kinds of technology used for WPANs:
The main WPAN technology is Bluetooth, which offers a maximum throughput of 1
Mbps over a maximum range of about thirty meters. Bluetooth, also known as IEEE
802.15.1, has the advantage of being very energy-efficient, which makes it particularly
well-suited
to
use
in
small
devices.
HomeRF (for Home Radio Frequency), has a maximum throughput of 10 Mbps with a
range of about 50 to 100 meters without an amplifier. The HomeRF standard, despite
62
Intel's support, was abandoned in January 2003, largely because processor
manufacturers had started to support on-board Wi-Fi (via Centrino technology, which
included a microprocessor and a Wi-Fi adapter on a single component).
The technology ZigBee (also known as IEEE 802.15.4) can be used to connect devices
wirelessly at a very low cost and with little energy consumption, which makes it
particularly well-suited for being directly integrated into small electronic appliances
(like home appliances, stereos, and toys). ZigBee, which operates on the frequency
band of 2.4 GHz and on 16 channels, can reach transfer speeds of up to 250 Kbps with
a
maximum
range
of
about
100
meters.
Finally, infrared connections can be used to create wireless connections over a few
meters, with speeds than can reach a few megabits per second. This technology is
widely used in home electronics (like remote controls), but light waves can interfere
with the signal. IrDA (Infrared Data Association), formed in 1995, has more than 150
members
9.4
SELECTED TECHNOLOGY
ZigBee (XBee PRO series 1 module) is selected because of the following reasons
9.5

No configuration is needed for out-of-the-box RF communications

Common XBee footprint for a variety of RF modules

Fast 250 kbps RF data rate to the end node

2.4 GHz for worldwide deployment

Sleep modes supported for extended battery life

Available in our department (CNL lab)
XBee Series 1 PRO
The XBee and XBee-PRO RF Modules were engineered to meet IEEE 802.15.4 standards
and support the unique needs of low-cost, low-power wireless sensor networks. The
modules require minimal power and provide reliable delivery of data between devices. The
modules operate within the ISM 2.4 GHz frequency band and are pin-for-pin compatible
with each other.
Figure 8.1
63
9.5.1
XBEE OVERVIEW
The XBee RF Modem is a wireless transceiver. The XBee uses a fully implemented
protocol for data communications that provides features needed for robust network
communications in a wireless sensor network (WSN). Features such as addressing,
acknowledgements and retries help ensure safe delivery of data to the intended node.
The XBee also has additional features beyond data communications for use in
monitoring and control of remote devices.
9.5.2
MULTI-NODE NETWORK ISSUES
Many wireless modules for microcontrollers simply send data and receive data on the
provided frequency. It is up the end user and his (or her) application code to deal with
issues such as media access rules, data delivery verification, error checking, and, in
multi-node networks, which node will accept and use the data. Devices using a
networking protocol can ease the work of the programmer by handling these tasks.
9.5.3
XBEE BENEFITS
In modern wireless protocols, such as Wi-Fi (IEEE 802.11) and Bluetooth (IEEE
802.15.1), the protocol helps ensure data arrives at the correct destination without
errors. The protocol greatly reduces the work of the programmer in ensuring data
delivery. Some key features of protocols in ensuring data delivery and integrity
include:

Media Access: A means to ensure two network nodes do not transmit at the
same time causing data collisions and errors in transmission.

Addressing: A means to ensure only the intended node uses the received data,
allowing data to be sent from one point to another point. Or, point to multipoint by sending a broadcast meant for all nodes on the network.

Error Detection: A means to verify data received at the node correctly.

Acknowledgements & Retries: A means to inform the transmitting node that
the data was delivered successfully. Lacking this, several retries may be
performed in an effort to deliver the data. The XBee utilizes the IEEE 802.15.4
protocol which implements all of the above features. The XBee, using the IEEE
802.15.4 protocol, incorporates the following for communications and control
on the WSN (wireless sensor network).
64
o Clear Channel Assessment (CCA): Before transmitting, an XBee node
listens to see if the selected frequency is busy.
o Addressing: The XBee has two addressing options: a fixed 64-bit serial
number (MAC address) which cannot be changed, and a 16-bit
assignable address (which we will use) that allows over 64,000
addresses on a network.
o Error Checking and Acknowledgements: The XBee uses a checksum to
help ensure received data contains no errors. Acknowledgements are
sent to the transmitting node to indicate proper reception. Up to 3 retries
are performed by default if acknowledgements are not received.
9.5.4
COMMUNICATION MODES
The XBee supports both an AT and an API (Application Programming Interface) mode for
sending and receiving data at your controller. Both have their advantages
1. AT Mode
In AT Mode, also called Transparent Mode, just the message data itself is sent and
received. The protocol link between the two is transparent to the end user and it
appears to be a nearly direct serial link between the nodes. This mode allows simple
transmission and reception of serial data. AT Commands are used to configure the
XBee, such as to send the data to a node with an address of 5 we may simply write it as
“ATDL 5”.
2.
API Mode
In API Mode, the programmer packages the data with needed information, such as
destination address, type of packet, and checksum value. Also, the receiving node
accepts the data with information such as source address, type of packet, signal
strength, and checksum value. The advantages are the user can build a packet that
includes important data, such as destination address, and that the receiving node can
pull from the packet information such as source address of the data. While more
programming intensive, API Mode allows the user greater flexibility and increased
reliability in some cases.
65
Note that both sides do not need to be in the same mode. Data may be sent in API
Mode and received in AT Mode or vice-versa. The mode defines the communications
link between the PC or controller and the XBee modem, and not between XBee
modules. Data between XBee modules is always
sent
using the
IEEE
802.15.4
LR-WPAN
protocol.
AT mode allows XBee Radios to be configured
easily therefore we opt for it.
9.5.5
XBEE MODULE STYLES
The XBee module comes in several versions but all
have similar pin outs. Differences between XBee
versions include the power output, antenna style,
operating frequency and networking abilities. The XBee is a 20-pin DIP module with pin
spacing of 2 mm (0.079 in) as opposed to typical pin spacing of 2.54 mm (0.1 in). The
XBee is available in two major versions and variants of those versions.
9.6 PIN DIAGRAM
9.7 PIN CONFIGURATION
A short discussion of pin groups will provide better understanding of use and features of
the module:
66
•
DOUT and DIN: These are the pins through which serial data is received by our
controller or PC (DOUT) and sent to the XBee (Din). This data may be either for
transmission between XBee modules or for setting and reading configuration
information of the XBee. The default data rate is 9600 baud (bps) using
asynchronous serial communications.
•
RESET: A momentary low on this pin will reset the XBee to the saved
configuration settings.
•
CTS/RTS/DTR: These are used for handshaking between the XBee and your
controller or the PC. The XBee will not send data out through the DOUT line to
your controller unless the RTS line is held low. This allows the controller to signal
to the XBee that it is ready to receive more data. DTR is typically used by the
XBee when downloading new firmware, and therefore firmware updates can only
be done using XBee adapter boards such as the Parallax USB Adapter Board that
implement this connection. When transmitting, the XBee can signal to the
controller through the CTS line that it is ready to send more data. CTS is seldom
needed because the XBee sends data out by radio much more quickly than it
accepts data from the controller.
•
DIO0–DIO7/D08: These are used as standard 3.3 V digital inputs and outputs. The
XBee can be controlled to set the state of the pins. They can also be used in "line
passing" so that the state of a pin on one XBee (high or low) is reflected on the
corresponding pin of another XBee.AD0 to AD6: These are 10-bit Analog to
Digital Converter (ADC) inputs to the XBee. While we cannot directly read these
values, some can also be used in "line passing" so that the amount of voltage on a
pin on one XBee is reflected by the amount of voltage (PWM) on the
corresponding pin of another XBee.
•
RSSI: The XBee can report the strength of the received RF signal as PWM output
on this pin. This value can also be retrieved using AT commands or as part of a
packet in API Mode.
•
PWM0/1: These pins can be set for 10-bit pulse width modulated output, which can
be used directly or filtered for analog output. They can also be controlled using
“line passing” by the analog input on another XBee.
67
•
ASSOC: When configured, the XBee can be set to join an existing network and
assigned certain parameters. In this tutorial we will manually configure the XBee in
the network instead of joining networks.
9.8 Other XBee Features
Besides simply passing data between nodes for microcontrollers, the XBee has other
features that can aid in process monitoring and control. We will explore some of these in
the course of the tutorial.
68
1.
Digital & Analog I/O
As discussed in the XBee pinout section, the modules have digital I/O, analog inputs, and
PWM outputs that may be used in a variety of ways. Later chapters will explore these
capabilities in more depth.
•
Direct digital output control: Through AT commands, the I/O may be set to be
digital outputs and controlled as high or low. For example, the command ATD0 4
would set D0 to be a low output (0 V) and ATD0 5 would be a high output (3.3 V).
•
Digital and analog input for transmission: The inputs may also be set for digital
input or 10-bit analog-to-digital input. Using sampling, the values of the inputs are
sent as data to a receiving XBee in API Mode where the digital and ADC data is
extracted.
•
PWM/analog output: The 10-bit PWM value of an output may be set and
optionally filtered for analog output of the unit.
•
Line Passing: The digital inputs can control digital outputs on another node, and
analog inputs can control PWM outputs on the other node.
2.
Remote Configuration
Using AT commands, the configuration of a remote module may be changed by sending
thecommand in an API packet. This could be used to control digital or PWM outputs or
change other parameters of the Remote XBee.
9.9 SETUP
9.9.1
Parts Requied
1. 2 XBee radios
2. 1 adapter board
3. 1 breakout board
4. 10k resistor
5. 2 computers each running a serial terminal program
69
Figure 8.5
Figure 8.4
9.9.2
Configure the first radio:

Mark the first XBee you’re going to work on with an “A.”

Insert the XBee into the XBee Explorer and connect it to your computer with a USB
cable.\

To use the XBee Explorer, we need to install FTDI drivers onto your computer, which
will let your computer talk via serial to the board. Here is the download link to
install the drivers for your operating system:
http://www.ftdichip.com/FTDrivers.htm

The terminal program can be downloaded from the link given below:
http://freeware.the-meiers.org/
CoolTerm works on Windows, Mac, and Linux and it’s also free.
70
Figure 8.6
Open CoolTerm and click “Options”

Choose the serial port that starts with “usbserial…”

If you’re not sure which serial port to select, look at the list of available ports and
then disconnect the XBee Explorer from your computer.

Click “Re-Scan Serial Ports” and check which serial port disappeared.

Reconnect your XBee Explorer, click “Re-Scan Serial Ports” and choose that port.

Be sure Baudrate is set to 9600.

Be sure Data Bits is set to 8.

Be sure Parity is set to “none.”

Be sure Stop Bits is set to 1.

In the list on the left side of the options window, click “Terminal.”

Be sure “Local Echo” is activated. This will allow you to see what you’re typing
into
the
Figure 8.7
terminal.
71

Click OK to save those settings and close the Options window.

Click “Connect” on the toolbar

You should see “Connected” on the status bar at the bottom of the window.

Type “+++” to enter command mode. You should see the reply “OK.”

By default, the XBee will automatically leave command mode if it does not receive
any commands in a 10 second period.
Here’s a chart of the commands settings we’re going to set:

Type in each command followed by its parameter and hit enter.

You can verify the setting by typing the command without a parameter.

Your settings aren’t saved yet! Type ATWR to save the settings.

Here’s how the terminal session will look, starting with the “+++” to enter command
mode
72
Common Mistakes

An OK response must be received after issuing each command to set parameters,
and another
OK response when we write the changes to firmware. If we don’t
get an OK response, most likely you took more than ten seconds to issue the
command it means we have dropped out of command mode. This can happen quite
frequently when you’re starting out, but you’ll get better at it as you go along.

The other common mistake is not issuing the ATWR command to save your
changes, then losing your configuration when the radio is powered down.
Clicks disconnect in CoolTerm and remove the XBee A from the XBee Explorer.
9.9.3
Configure the second radio

Mark the second XBee with a “B.”

Place the XBee into the XBee Explorer and click “Connect” in CoolTerm.

Follow the same steps as before to program the second radio. However, ATMY
gets 2 and the ATDL gets 1.
Figure 8.8
As indicated in the chart below:
73

Remember to type ATWR and press enter to save the settings.

Here’s what your terminal session might look like:

Connect XBee “A” to the spare XBee Explorer and connect it to a different
computer in the same room. Load up CoolTerm and connect to it as outlined in the
previous steps.

If you’re still in command mode on either module, you can type ATCN to get out
of command mode without waiting for the 10 second timeout.

If everything is set up properly, the text that you type in the serial terminal program
on the first computer will be relayed to the second computer and appear on its
serial terminal screen as well.
74
9.10 Using Remote AT Commands to Toggle an IO on a Remote XBee
802.15.4 Radio
Using API mode it is possible to send commands from a transmitting radio to a receiving
radio. This allows for module parameter registers on a remote device to be queried or set.
One useful application of this feature is to toggle an IO on a remote radio from a high to a
low state. In this manner the radios can be used as a wireless relay to control a wide variety
of remote devices.
Setup

2 - XBee 802.15.4 RF modules.

2 - Interface boards (USB or RS232) *the use of Dev boards (XBIB-U-Dev or
XBIB-R-DEV) will allow the use of onboard LEDs to observe output.

1 - PC with X-CTU software installed

Serial or USB cables to connect interface boards to the PC.
Procedure
Select one radio to operate as Base and one to operate as Remote.
Both radios are programmed with the default settings with the following exception. API is
enabled on the Base radio (AP=1).
Example
D4 LOW:7E 00 10 17 01 00 00 00 00 00 00 FF FF FF FE 02 44 34 04 6E
D4 HIGH :7E 00 10 17 01 00 00 00 00 00 00 FF FF FF FE 02 44 34 05 6D
Where the UART API data stream can be broken down as:
7E
Start Delimiter
00 10 Length Bytes
75
17
API Identifier
00 00 00 00 00 00 FF FF Broadcast address
FF FF
02
broadcast to all devices including sleepy ED.
Cmd-Option
Command D4 (bytes 17 and 18) is issued as 44 and 34. 34 is the hex equivalent of the ascii
character 4. The setting for D4 (byte 19) is issued as 04 and 05. This is the hex equivalent
of decimal 4 and 5 respectively.
70
cheksum.
76
Chapter Ten
10 JENNET STACK
10.1 INTRODUCTION TO JenNet
The JenNet wireless network protocol has been developed to provide low-power, wireless
connectivity for a wide range of applications that perform monitoring or control functions.
It provides a simpler alternative to the ZigBee PRO protocol. JenNet simplifies and
streamlines application development, therefore reducing development costs and time-tomarket. JenNet overcomes the traditional limitations of low-power, wireless network
solutions - short range and restricted coverage, as well as vulnerability to node and radio
link failures. It achieves this by building on the established IEEE 802.15.4 standard for
packet-based, wireless transport. JenNet enhances the functionality of IEEE 802.15.4 with
integrated set-up intelligence, facilitating easy installation, as well as routing intelligence
and self-healing. JenNet incorporates listen-before-talk and can co-exist with other
wireless technologies (such as Bluetooth and Wi-Fi) in the same operating environment.
Wireless connectivity means that a JenNet network can be installed easily and cheaply,
and JenNet’s built-in intelligence and flexibility allow networks to be easily adapted to
changing needs by adding, removing or moving network devices. The protocol is designed
to allow devices to appear and disappear from the network, so devices can be put into a
power-saving mode when not active. This means that many devices in a JenNet network
can be battery-powered, making them self-contained and, again, reducing installation
costs.
10.2 RADIO FREQUENCY OPERATION
JenNet provides wireless, radio-based network connectivity operating in the 2400-MHz
radio frequency (RF) band. This band is available for unlicensed use in most geographical
areas.
Thus, JenNet offers a high data-rate and a large selection of channels. It also offers the
possibility of automatically selecting the best frequency channel at initialisation (the
channel with least detected activity) - this is achieved by setting the desired channel
number to 0.
77
10.3 BATTERY-POWERED OPERATION
There are many wireless applications that are battery-powered, e.g. light-switches, active
tags and security detectors. The JenNet and IEEE 802.15.4 protocols are specifically
designed for battery-powered applications. From a user perspective, battery power has
certain advantages:
•
Easy and low-cost installation of devices: No need to connect to separate
power supply.
•
Flexible location of devices: Can be installed in difficult places where there
is no power supply, and can even be used as mobile devices.
•
Easily modified network: Devices can easily be added or removed, on a
temporary or permanent basis.
Since these devices are generally small, they use low-capacity batteries and therefore
battery use must be optimised. This is achieved by restricting the amount of time for which
energy is required by the device - since the major power drain in the system is when the
radio transceiver is operating, data may be sent infrequently (perhaps once per hour or
even per week) which results in a low duty cycle (transmission time as proportion of time
interval between transmissions). When data is not being sent, the device reverts to a lowpower sleep mode to minimise power consumption.
A network device can also potentially use "energy harvesting" to absorb and store energy
from its surroundings - for example, the use of a solar cell panel on a device in a well-lit
environment.
10.4 EASY INSTALLATION AND CONFIGURATION
One of the great advantages of a JenNet network is the ease with which it can be installed
and configured. As already mentioned, the installation is simplified and streamlined by the
use of certain battery-powered devices with no need for power cabling. In addition, since
the whole system is radio-based, there is no need for control wiring to any of the network
devices. Therefore, JenNet avoids much of the wiring and associated construction work
required when installing cable-based networks.
78
10.5 RELIABLE RADIO COMMUNICATION
JenNet employs a range of techniques to ensure reliable communications - that is, to
ensure communications reach their destinations uncorrupted. Corruption could result, for
example, from radio interference or poor transmission/reception conditions. Routing The
basic operation in a network is to transfer data from one node to another. The data is
sourced from an input (possibly a switch or a sensor) on the originating node. This data is
communicated to another node which can interpret and use the data in a meaningful way.
79
Chapter Eleven
11 PROBLEMS/CHALLENGES FACED
Overview
Despite of all the hardships we faced during the project time spam, we are however able to
complete our project. Greenhouse monitoring system, uses Jennic JN-5148 Evaluation kit,
to sense temperature, humidity and light values from the environment. Let us discuss some
of the problems/challenges we faced while working with this kit.
1) WireShark:Wireshark is a network protocol analyser application. The main use of WireShark in our
project was to receive data packets from Jennic kit. As our Jennic kit senses
temperature,humidity and light values, we need these values in our PC for futher work.
Thus we connected our kit to PC via USB serial port and received data packets through
WireShark but the main problem faced here was we didn’t get the actual data values as all
the packets were encoded. Further, we tried to decode those packets in a number of ways,
posted our queries on different web forums yet didn’t receive any fruitful result. It took us
around 3-4 months in finding out some possible way to decode the data packets. We
contacted various professors over the Internet too, but it was of no good to us.
A snapshot of the data packet we were trying to decode is as follows:
80
2) Jennic Forum :Our Kit Jennic 5148 was dumped with an initial home automation code through which we
were receiving data packets on WireShark. When we were stuck in decoding the packets
we tried the following ways:
Firstly, we posted our queries on Jennic Website Forum for help, we did get
some assistance from them but then again it did not help us.

We searched for some other useful code that could helped us in getting the
values into the PC , and yet we found but we only got the binaries that
could be dumped into the kit not the original code.

We tried to contact Jennic website for providing us the actual code so that
we can make changes as per required, but we got a reply that their service
have ended.
The website and forum of NXP is not active , hence it was really difficult, rather
impossible for us to resolve our issues as no one actually had enough knowledge about
this kit that could help us.
3) Programming Issues :As Jennic 5148 evaluation kit is not issued from Pakistan , we faced a lot of problem using
it as we were unable to find any person who can help us regarding it since nobody has used
this kit. Initially when the home automation code was dumped into the kit , we tried to
change that code as per our requirement, but then again we failed because that code was
written by some really expertise programmers , however we did change some of the code
but then again we got errors as it has its own defined classes and structures.
In the end, however we somehow managed to make changes in the code that helped us in
getting live values of Temperature, Light and Humidity.
4) Eclipse:We have used Eclipse software to create binaries that could be dumped into the kit. But
often when we tried to build our program it used to give us some really unexpected errors
which were very difficult for us to understand and resolve.
81
APPENDIX A: FRAMES
This appendix details the different types of JenNet frame that can be exchanged
between nodes.
A JenNet frame is carried as the payload of an IEEE 802.15.4 MAC frame. A MAC
frame can contain a maximum of 127 bytes and comprises a header, payload and
footer, as shown below.
Frame Header
All JenNet frames have a header, consisting of 12 bytes and structured as shown below.
Frame Flags Field
The Frame Flags field of the header consists of a single byte and is structured as
shown below.
82
Data-to-Service Frame
A Data-to-Service frame is used to send data to a specific service on a remote node,
for which the IEEE/MAC address is known. Both the source address and destination
address are included in the frame (the source address is in the header).
The Data-to-Service frame structure is shown below.
Beacons
A JenNet beacon is a frame used by a routing node (Router or Co-ordinator) to
describe itself to other nodes of the network during a network scan. In fact, these
beacons are sent by the IEEE 802.15.4 MAC layer and not by the JenNet level, and
so are distinct from JenNet frames (and do not follow their structure).
The structure of a JenNet beacon is shown below:
83
12 REFERENCES
•
http://www.jennic.com/products/protocol_stacks/jennet
•
http://www.jennic.com/support/jennet/
•
http://www.jennic.com/support/forums/thread.php?forumID=b82nryshmgw9&post
=0000005718
•
http://www.jennic.com/support/forums/thread.php?forumID=b82nryshmgw9&post
=0000009414
•
http://www.jennic.com/support/forums/thread.php?forumID=b82nryshmgw9&post
=0000009283
•
http://www.jennic.com/support/forums/thread.php?forumID=b82nryshmgw9&post
=0000009402
•
http://www.jennic.com/support/forums/thread.php?forumID=ax75rzh802os&post=
0000009151
•
http://ask.wireshark.org/questions/22095/use-of-patch-file-with-pre-installedversion
•
http://learn.parallax.com/KickStart/32440
•
http://sourceforge.net/projects/wsd4wsn/files/
•
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconce
pts%2Fcdt_c_makefile.htm
•
http://www.jennic.com/files/support_documentation/JN-AN-1132-CustomerModule-Eval-Tool.pdf
•
http://tunnelsup.com/tup/2012/11/30/xbee-s2-quick-reference-guide-cheat-sheet/
•
http://whatismyipaddress.com/smtp
•
http://www.facweb.iitkgp.ernet.in/~agupta/IWT/SMTP-POP3_4.pdf
•
http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol
•
http://msdn.microsoft.com/en-us/library/aa480435.aspx
•
http://oldlight.wordpress.com/2009/06/16/tutorial-using-at-commands-to-send-andreceive-sms/
•
http://sharp-coders.com/microsoft-net/c-sharp/send-sms-using-at-commands-via-gsmmodemphone-in-c-c-sharp
•
http://www.smssolutions.net/tutorials/gsm/gsmerrorcodes/
•
http://weblogs.com.pk/khurram/archive/2009/05/02/sending-sms-using-at-commands.aspx
•
http://www.youtube.com/watch?v=GlHJckUDaUo
84
13 BIBLIOGRAPHY
•
Wireless Sensor Network for Greenhouse by S.U. Zagade, R.S. Kawitkar
(Department of E& TC, Sinhgad College of Engineering, Pune, India)
•
A Smart System for Garden Watering using Wireless Sensor Networks
o Constantinos
Marios
Angelopoulos
Research Academic Computer Technology Institute (CTI) and University
of
Patras
aggeloko@ceid.upatras.gr
o Sotiris
Nikoletseas
Research Academic Computer Technology Institute (CTI) and University
of
Patras
nikole@cti.gr
o Georgios
Constantinos
Theofanopoulos
University
of
Patras
theofan@ceid.upatras.gr





A Decision Tree for Weather Prediction
Elia Georgiana Petre
Universitatea Petrol-Gaze din Ploiesti, Bd. Bucuresti 39, Ploiesti, Catedra de
Informatică
Application of Computational Intelligence Methods to Greenhouse Environmental
Modelling P. M. Ferreira and A. E. Ruano
A Neural Network Model to Control Greenhouse Environment
Raquel Salazar1, Irineo López 1, Abraham Rojano1
Light and Lighting Control in Greenhouses
Understanding Humidity Control in GreenHouses
Download