© 2014 saket kumar - university of...
TRANSCRIPT
SCALABLE WIRELESS SENSOR NETWORK FOR HVAC CONTROL
By
SAKET KUMAR
A THESIS PRESENTED TO THE GRADUATE SCHOOL
OF THE UNIVERSITY OF FLORIDA IN PARTIAL FULFILLMENT
OF THE REQUIREMENTS FOR THE DEGREE OF
MASTER OF SCIENCE
UNIVERSITY OF FLORIDA
2014
© 2014 Saket Kumar
To my Parents
4
ACKNOWLEDGMENTS
I would like to express my sincere appreciation to my advisor Dr. Prabir Barooah
for his constant guidance, encouragement and key advice necessary for me to complete
my thesis. He always believed in me and supported me to shape my ideas. Under his
guidance I successfully overcame many difficulties and learned a lot.
I would also like to thank my committee members, Professor Herbert A. Ingley
and Professor John M. Shea for serving as my committee members.
I thank my colleagues Jonathan Brooks and Yashen Lin for their valuable time.
I would like to thank my parents and my family for their encouragement and best
wishes.
5
TABLE OF CONTENTS page
ACKNOWLEDGMENTS .................................................................................................. 4
LIST OF TABLES ............................................................................................................ 7
LIST OF FIGURES .......................................................................................................... 8
ABSTRACT ................................................................................................................... 10
CHAPTER
1 INTRODUCTION .................................................................................................... 12
1.1 Wireless sensor Network Design (V0) .............................................................. 12 1.2 Motivation ......................................................................................................... 13
1.3 Proposed Design for Range Extender .............................................................. 14 1.4 Wireless sensor Network Design (V1) .............................................................. 15
2 RANGE EXTENDER............................................................................................... 17
2.1 Design ............................................................................................................... 17 2.2 Connection Configurations ................................................................................ 19
2.3 Hardware .......................................................................................................... 21 2.4 Range Extender Access Point (RE_AP) ........................................................... 21
2.4.1 Overview ................................................................................................. 21 2.4.2 Software .................................................................................................. 22
2.5 Range Extender Relay Device (RE_RD) .......................................................... 22
2.5.1 Overview ................................................................................................. 22 2.5.2 Software .................................................................................................. 22
2.6 Proposed Design .............................................................................................. 23 2.6.1 Sequence of Connection ......................................................................... 24
2.6.1.1 One Range Extender ..................................................................... 24
2.6.1.2 A Pair of Range Extenders ............................................................. 25 2.7 Network Comparisons: ...................................................................................... 27 2.8 WSN with Proposed Range Extender vs. Zig-bee Network .............................. 28
3 END DEVICE .......................................................................................................... 29
3.1 Hardware .......................................................................................................... 29 3.1.2 Temperature Sensor................................................................................ 30 3.1.3 DS18B20 vs. LM35DZ ............................................................................. 32
3.2 Software Improvement ...................................................................................... 33 3.2.1 Auto Reconnect (End Device) ................................................................. 33 3.2.2 Auto Restart (End Device) ....................................................................... 35 3.2.3 Averaging the Samples (Temperature Measurement) ............................. 35
6
3.2.4 Code for DS18b20 ................................................................................... 35
3.2.4.1 Initiation: ......................................................................................... 36 3.2.4.2 Convert Temperature [13, 14]: ....................................................... 37
3.2.4.3 Read Data from scratchpad [13, 14]: ............................................. 37 3.2.5 Channel Hopping Capability for End Device ............................................ 37
3.3 Temperature Sensor Calibration ....................................................................... 38
4 ACCESS POINT ..................................................................................................... 40
4.1 Hardware .......................................................................................................... 40
4.2 Software ............................................................................................................ 40 4.2.1 Maximum Number of End Devices per Access Point .............................. 41 4.2.2 New End Point Connection ...................................................................... 41 4.2.3 Retaining LinkID ...................................................................................... 41
5 BASE STATION ...................................................................................................... 42
Hardware ................................................................................................................ 42
5.2 Software ............................................................................................................ 43 5.2.1 Previous Version ..................................................................................... 43
5.2.2 Improved Code ........................................................................................ 43
6 INSTALLATION & TESTING .................................................................................. 44
6.1 Location ............................................................................................................ 45
6.1.1 First Floor Plan (Before) .......................................................................... 45 6.1.2 First Floor (After) ..................................................................................... 45
6.1.3 Second Floor Plan (Before) ..................................................................... 46 6.1.4 Second Floor Plan (After) ........................................................................ 46
6.1.5 Third Floor Plan (Before) ......................................................................... 47 6.1.6 Third Floor Plan (After) ............................................................................ 47
6.2 Shortcomings .................................................................................................... 48
7 CONCLUSION AND FUTURE WORK .................................................................... 49
7.1 Summary .......................................................................................................... 49 7.2 Future Improvement .......................................................................................... 49
REFERENCES .............................................................................................................. 51
BIOGRAPHICAL SKETCH ............................................................................................ 53
7
LIST OF TABLES Table page 2-1 Connection Configuration ................................................................................... 20
2-2 Star vs. Tree Topology ....................................................................................... 27
2-3 Zig-bee vs. WSN with proposed range extender [7, 12] ..................................... 28
3-1 Comparison between DS18B20 and LM35DZ .................................................... 32
6-1 Number of Base Stations .................................................................................... 44
8
LIST OF FIGURES
Figure page 1-1 Wireless Sensor Network Design (V0) [7] .......................................................... 12
1-2 Proposed Range Extender Design ..................................................................... 15
1-3 Wireless Sensor Network Design (V1) ............................................................... 15
2-1 Range Extender Configuration 1 ........................................................................ 18
2-2 Range Extender Configuration 2 ........................................................................ 18
2-3 Modes of Connection .......................................................................................... 20
2-4 Proposed Range Extender ................................................................................. 23
2-5 Modes of Connection (Single Range Extender).................................................. 25
2-6 Modes of Connection (A Pair of Range Extenders) ............................................ 26
2-7 Star vs. Tree vs. Mesh Network topology ........................................................... 27
3-1 Different Components of an End Device [7] ....................................................... 29
3-2 Temperature Sensor (DS18B20) ........................................................................ 30
3-3 DS18B20 Wiring ................................................................................................. 32
3-4 DS18B20 vs. LM35DZ ........................................................................................ 33
3-5 Flowcharts for End Device [1, 8] ......................................................................... 34
3-6 Sequence of transaction by Master (Microprocessor) & Slave (DS18B20) ........ 36
3-7 Channel Hopping Sequence ............................................................................... 38
3-8 Sensor in Open Box Vs. Sensor in Closed Box .................................................. 39
4-1 Flow Chart for Access Point [1] .......................................................................... 40
5-1 Base Station ....................................................................................................... 42
6-1 Location of End Devices on 1st Floor (Before) ................................................... 45
6-2 Location of End Devices & Range Extender on 1st Floor (After) ........................ 45
6-3 Location of End Devices on 2nd Floor (Before) ................................................... 46
9
6-4 Location of End Device & Range Extender on 2nd Floor (After) .......................... 46
6-5 Location of End Devices on 3rd Floor (Before) .................................................... 47
6-6 Location of End Device & Range Extender on 3rd Floor (After) .......................... 47
10
Abstract of Thesis Presented to the Graduate School of the University of Florida in Partial Fulfillment of the Requirements for the Degree of Master of Science
SCALABLE WIRELESS SENSOR NETWORK FOR HVAC CONTROL
By
Saket Kumar
May 2014
Chair: Prabir Barooah Major: Mechanical Engineering
A wireless sensor network can be used effectively to monitor temperature, CO2
content, relative humidity & occupancy measurements for all rooms within a building.
The wireless sensor network uses radio transceivers for communication and data
transmission. The limited range of the radio transceivers is one of the primary concerns
in deployment and operation of such wireless sensor network. In order to achieve
desired results from such wireless sensor network, one need to ensure the robustness
of the network operation and to manage the time variation in the network due to power
recycling.
In a view to provide support to our ongoing research on Occupancy Based HVAC
Control, such a wireless sensor network was designed. However, while deploying such
a wireless sensor network, certain specific issues were faced, and the same can be
summarized as follows:
1. The coverage area of the wireless sensor network was curtailed due to the limited range of radio transceivers,
2. The temperature sensors used in the sensing node often gave erratic readings and hence they could not be used for control purposes with certainty;
3. In case of temporary power failure at the base station, a manual reset of each sensing node was required;
11
4. The number of sensing nodes per Access Point was limited to eight (8) only.
To overcome the above issues faced while deploying wireless sensor network,
we designed an improved version of wireless sensor network with following
improvements:
1. In order to deal with the limited range issue of radio transceivers, we developed a pair of Range Extenders to relay data from the sensing nodes to the Access Point;
2. A new temperature sensor was used to get accurate readings;
3. Sensing nodes were made capable of detecting lost connection to an Access Point and automatically re-establish the connection with the Access Point;
4. The number of sensing nodes per Access Point is now increased to thirty (30).
The present thesis paper deliberates the issues faced by the previous version of
the wireless sensor network as well as the corrective measures taken to effectively deal
with those issues.
12
CHAPTER 1 INTRODUCTION
1.1 Wireless sensor Network Design (V0)
Figure 1-1. Wireless Sensor Network Design (V0) [7]
Figure 1-1 shows the design of the wireless sensor network [7] installed in the
Pugh hall.
The salient features of the WSN Design were:
1. An End Device has been installed in each room that was to be controlled. It connects to the nearest access point and sends Temperature, Humidity, CO2 Content & Occupancy status of each room to the access Point.
2. The Access Point connects to all nearest End Devices and receives data from each End Device.
13
3. The remote computer (Base Station) uses a Python script to read the data from USB port sent by the Access Point. It then connects to a remote database server and saves all the data to the database.
1.2 Motivation
This thesis is motivated from the problems faced during deployment of a wireless
sensor network in Pugh Hall at UF as part of the “Smart & Energy Efficient Building” [3,
4, 5, 7, 12, 15] project. One of the applications that the wireless sensor network is
required to support is occupancy-based HVAC control. The wireless sensors, also
called as End Devices, were installed in each room to get occupancy measurements,
room temperature, CO2 content & relative humidity.
We identified following issues [10, 12] in the wireless sensor network (V0) [7] in
Pugh Hall:
1. The wireless sensor network was limited due to the short range of radio transceivers. Moreover, the signal strength of the radio transceivers for many rooms was further attenuated due to multiple walls and metal ducts between the End Devices and Access Point. Consequently, End Devices couldn’t be installed in many rooms due to poor signal strength. This issue was partially ameliorated by putting a large numbers of Base Stations.
2. The network used the temperature sensor which was not accurate and often gave erratic readings and hence they couldn’t be used for control purposes with certainty.
3. In case of power failure at the base station a manual restart was required for each End Device. This was very troublesome as one had to go to each room and reset the each End Device connected to that Base Station.
4. The number of End Devices per Access Point was limited to eight (8) only.
The present thesis deals in detail with the design of an improved wireless sensor
network. The improved design is intended to increase the robustness and reliability of
the wireless sensor network.
14
We made the following changes in the wireless sensor network:
1. To deal with the limited range issue of the radio transceivers and to increase the connectivity of the wireless sensor network, we developed a pair of Range Extenders, which acts as a relay between End Devices and Access Point. A key feature of the Range Extender is that it can be connected in series to get arbitrary large range. The developed Range Extender is tested, and its reliability was studied.
2. To get more accurate temperature readings, we retrofitted the existing End Device with a new temperature sensor (DS18B20). This temperature sensor was tested in different testing conditions and was found to give stable and accurate readings.
3. To avoid manual resetting of End Devices, we added ping capability to End Devices. End Devices are now capable of detecting a lost connection with an Access Point and automatically re-establish the connection with the Access Point.
4. The changes in the configuration file of an End Device were made to increase the number of End Devices per Access Point from eight (8) to thirty (30).
1.3 Proposed Design for Range Extender
15
Figure 1-2. Proposed Range Extender Design
Figure 1-2 shows the two possible configurations for Range Extender which can
be used depending on the distance between the End Devices and Access Point.
1.4 Wireless sensor Network Design (V1)
Figure 1-3. Wireless Sensor Network Design (V1)
The improved version of the wireless sensor network was installed in Pugh Hall.
The salient features of improved WSN design are:
1. The network now uses Range Extenders to relay data from the distant End Devices to the Access Points.
2. The network can use one or more Range Extenders depending on the distance between the End Devices and the Access Points.
16
3. The End Devices can now automatically re-establish the connection with their Access Point, if the connection is lost due to temporary power failure.
4. Thirty (30) End Devices can now connect to a single Access Point.
The above mentioned features of the new WSN design improved the range,
robustness, reliability and connectivity of wireless sensor network.
17
CHAPTER 2 RANGE EXTENDER
2.1 Design
The purpose of the Range Extender is to get data from the End Devices, which
are not able to connect to the Access Point directly due to the limited range of radio
transceivers, and relay it to the nearest Access Point.
Desired features of a Range Extender:
It should be able to connect to End Devices on the specified channel;
It should be able to transfer data at a good rate;
It should be capable of being used with another Range Extender in series;
It should be easy to program;
It should work reliably and consistently (without disconnection). Microprocessors (EZ430-RF2500) use ‘Simpliciti Network Protocol’ [9, 11, 16], a
low-power RF protocol aimed at simple, small RF networks. This network protocol is
intended to be used only for a certain class of hardware manufactured by Texas
Instruments. While using this network protocol, we realized that there were several
limitations on its use. According to Texas Instruments documents these limitations were
due to the fact that the EZ430-RF2500 has a very low memory and is only designed for
small-range operations. In the network protocol the support was mainly provided for
Access Points & End Devices. However, certain specific support was also provided for
Range Extenders as well. Their version of Range Extender used by the network
protocol was like a “fool” relay device, which would transmit anything it receives.
Moreover there was no option of using more than one Range Extender in series. Apart
from the above, there was also a limitation of using only four (4) Range Extenders per
Access Point. The Range Extender was free to receive data from any End Device in the
range. So, there was a possibility that it would get data from the End Devices that are
18
directly connected to the Access Point. The native Range Extender supported by Texas
Instruments would not have fulfilled our requirements for the wireless sensor network.
We started working on new design for the Range Extender using the same
network protocol, to meet our requirements. We tried and tested different designs of
Range Extenders and came up with a design which met most of our requirements.
The proposed Range Extender can be used in two different situations:
Use only the “Range Extender (Access Point)” to connect to all the End Devices which are just out of range of the Base Station.
If End Devices are much farther from the base station then two or more Range Extenders can be used together in series to relay data.
Figure 2-1. Range Extender Configuration 1
Figure 2-2. Range Extender Configuration 2
19
2.2 Connection Configurations
The design of the Range Extender was flexible as one or more Range Extenders
can be used depending on the distance of the End Devices from the Access Point. In
the case of more than one Range Extender, the Range Extenders are connected in
series.
First, we will explain how a connection is established between an Access Point
and End Devices. The basic concept of SimpliciTI [6, 9, 11] is peer-to-peer
communication, where the connection is established only between two nodes. To
establish the connection, a node has to initiate a link using the built-in
SMPL_Link(linkID_t *linkID) function and the other node shall listen to the link using the
built-in SMPL_LinkListen(linkID_t *linkID) function. Both functions have a parameter,
which is a pointer to a local buffer residing on the application side.
When the SMPL_Link() and SMPL_LinkListen() functions return successfully, the
local buffer will contain the handle of the established connection which can be used
later to send or receive messages from the other node. Therefore it is not necessary to
work with device addresses on the application level. Rather it shall only use the link ID
handle of the established connection.
We can see from Table 2-1 that how a connection is being established between
an Access Point and End Device. The most important information which has not been
mentioned explicitly in the supporting manual is that both the Access Point and End
Devices support the connection both ways. I.e. the End Device can connect to Access
Point as an End Device and it can also connect to an End Device & Access Point as an
Access point.
20
Table 2-1. Connection Configuration
Device 1 Device 2
while (SMPL_LinkListen(&sLID1) != SMPL_SUCCESS) { }
while (SMPL_SUCCESS != SMPL_Link(&sLinkID1)) { }
Device 1 Access Point Device 2 End Device
while (SMPL_SUCCESS != SMPL_Link(&sLinkID2)) { }
while (SMPL_LinkListen(&sLID2) != SMPL_SUCCESS) { }
Device 1 End Device Device 2 Access Point
Figure 2-3. Modes of Connection
From the Figure 2-3, it is clear that either an End Device or Access Point can
connect as both an Access Point and End Device.
21
In Figure 2-3:
Device 1, which possesses the basic configuration of an Access Point, connects to device 2 as an Access Point.
Device 2, which possesses the basic configuration of an Access Point, connects to the device 1 as an End Device and connects to the device 3 as an Access Point.
Device 3, which possesses the basic configuration of an End Device, connects to the device 2 as an End Device.
Likewise an End Device can connect to an Access Point as an Access Point.
Special care should be taken when an End Device is used as an Access Point,
because by default its Rx (Receive) setting has been disabled. Therefore its Rx setting
needs to be made active before any attempt at receiving data is made.
2.3 Hardware
The hardware used for the Range Extenders is the same microprocessor
(EZ430-RF2500) [1, 2, 7, 8] used for the End Devices and Access Points. The
difference between End Devices, Access Points & Range Extenders is the program
running on each.
2.4 Range Extender Access Point (RE_AP)
2.4.1 Overview
This is the first link in the Range Extender. This RE_AP can be used alone or in
conjunction with a Relay Device (RE_RD). The RE_AP is named as an access point as
it connects to more than one End Device at a time and then it gets data from each End
Device and sends it to the main Access Point.
It basically uses the configuration file of an Access Point. Hence it inherits all the
properties of an Access Point such as reconnecting to the End Devices and receiving
22
data from each End Device one by one. The only way it differs from the Access Point is
that it connects to the main Access Point as an End Device.
2.4.2 Software
The software for a RE_AP differs from the software for an Access Point. The
software for an Access Point sends data to a computer via serial port whereas the
software for a RE_AP relays it either to the main Access Point or to the second link of
Range Extender (RE_RD).
2.5 Range Extender Relay Device (RE_RD)
2.5.1 Overview
This is the second link in the Range Extender. This RE_RD can be used with any
RE_AP on the same channel. The RE_RD is named as relay device as it first connects
to and receives data from the RE_AP and sends it to the main Access Point.
It basically uses the configuration file of an End Device. Hence it inherits all the
properties of an End Device, but a RE_RD works as a relay between an Access Point &
RE_AP thus completing the path from End Device to the main Access Point. Being an
End Device, its Rx setting needs to be made active before any attempt at receiving data
is made.
2.5.2 Software
The program for a RE_RD is completely different from the program of a RE_AP.
The RE_RD only transmits data from the RE_AP to the main Access Point.
The programming complexity for the Range Extender is minimal and requires
only (minimal) changes in the code if the network changes in the following ways:
The number of End Devices it supports changes
The frequency channel changes
23
The first change applies only to RE_AP but the second change applies to both
RE_RD & RE_AP.
2.6 Proposed Design
After trying out several possible Range Extenders design, we came up with the
one which was more stable and reliable. The channel for the Range Extenders, Access
Point and End Devices is the same.
Figure 2-4. Proposed Range Extender
24
The Figure 2-4 shows the complete implementation of a Range Extender. It also
shows two possible uses of the Range Extender. If the distance between End Devices
and Access Point causes weak signal strength between them (i.e. they are just out of
range) then a RE_AP is enough to get the data from the End Device to the Access
Point. If even after including a RE_AP they are unable to connect, then we need to put a
RE_RD in between the RE_AP and Access Point as shown in the Figure 2-4.
2.6.1 Sequence of Connection
The Range Extender works on the same channel as of End Device & Access
Points. There is a sequence of connection, which has to be followed to make the Range
Extender work properly. This also explains how each device connects to each other.
2.6.1.1 One Range Extender
In Figure 2-5 the modes of each device are shown when the connection is made
while joining a network with a single Range Extender. The operation in the Figure 2-5
can be explained as:
Device 1, which is an Access Point, connects to device 2 as an Access Point.
Device 2 connects to device 1 as an End Device and connects to device 3 as an Access Point.
Device 3 connects to device 2 as an End Device
The sequence of powering up the Range Extender is also important as these
Range Extenders don’t have the capability to reconnect after being power cycled. The
Access Point is always ON.
The devices must be powered on in the following sequence:
Make sure that all End Devices are ON.
25
First plug in the RE_AP and wait until the green light on it blinks fast. This indicates that all End Devices have connected to the Access Point. The RE_AP will then connect to the main Access Point.
Figure 2-5. Modes of Connection (Single Range Extender)
2.6.1.2 A Pair of Range Extenders
This configuration uses a pair of Range Extenders to transmit data from End
Devices to an Access Point. Figure 2-6 shows that all these modes can co-exist in the
same network. Using a pair of Range Extenders helped us extend the range of the
wireless network to almost three times of its original range.
26
Figure 2-6. Modes of Connection (A Pair of Range Extenders)
Figure 2-6 shows the modes for each device when the connection is being made.
The operation in the Figure 2-6 can be explained as:
Device 1 connects as an Access Point to device 2.
Device 2 connects as an End Device to device 1 and as an Access Point to device 3.
Device 3 connects as an End Device to device 2 and as an Access Point to device 4.
Device 4 connects as an End Device to device 3
These devices must be powered on in the following sequence:
Make sure that the main Access Point and all End Devices are ON.
27
Then plug in the RE_AP (device-3); it will immediately connect to all End Devices and will give a green, fast-blinking light indicating that RE_AP has been connected to all the End Devices.
Now plug in the RE_RD (device-2); then the RE_RD will connect to the RE_AP first and then will connect to the main Access Point.
This completes the starting sequence and starts the data flow. The data will be
relayed through Range Extenders from the End Devices to the Access Point.
2.7 Network Comparisons:
The proposed Range Extenders will convert our wireless sensor network from a
star topology to a tree topology network.
Figure 2-7. Star vs. Tree vs. Mesh Network topology
Table 2-2. Star vs. Tree Topology
Star Topology (without Range Extender) Tree Topology (with Range Extender)
1) Limited range 1) Scalable
2) Easy to implement 2) Increased complexity
3) Single point of failure 3) Can have failure at multiple places
28
2.8 WSN with Proposed Range Extender vs. Zig-bee Network
The wireless sensor network with Range Extenders is working on a tree
topology. Another solution would be to use a mesh network such as a Zig-bee network.
But in our case the use of a Zig-Bee-based network would have been more expensive.
Table 2-3. Zig-bee vs. WSN with proposed range extender [7, 12]
Device Arduino + XBee EZ430-RF2500
Cost $85 $20
Range 100 ft. 15-30 ft.
Mesh Networking Capability Yes No
Communication Protocol Zigbee SimpliciTi
Using the Range Extender, we achieved almost the same reachability as would
have been achieved with a Zig-bee-based network. As we have installed 60 End
Devices in Pugh Hall, the cost of a Zig-Bee-based network would have been $3900
more as compared to that of an EZ430-based wireless sensor network with the
proposed Range Extenders.
The use of Range Extenders has improved our star topology-based network to
tree topology-based network. The star-based network doesn’t meet our requirement but
a tree-based network meets our requirements & design criteria.
29
CHAPTER 3 END DEVICE
The End Devices have been installed in several rooms in Pugh Hall. They have
sensors to monitor the following parameters:
Temperature
Occupancy status
Humidity
CO2 content 3.1 Hardware
Figure 3-1. Different Components of an End Device [7]
30
Figure 3-1 shows the ready-to-install End Device with all the sensors and
programmed microprocessor assembled inside a box. The Figure 3-1 also shows the
different components of an End Device. The End Device shown in Figure 3-1 was part
of an earlier version of the wireless sensor network (V0).
3.1.2 Temperature Sensor
The EZ430-Rf2500 comes with an inbuilt temperature sensor [13] for
demonstration purposes. In the earlier design of the End Device we relied on this inbuilt
temperature sensor and used it for temperature monitoring. Later on it was found that
this sensor on the chip was not accurate and gave erratic readings. Consequently we
were unable to use the temperature reading for any control purposes.
Figure 3-2. Temperature Sensor (DS18B20)
31
In the modified design we used a new temperature sensor (DS18B20) for
monitoring temperature in each room. The DS18B20 is manufactured by Maxim
Integrated.
Features of new temperature sensor (DS18B20):
Digital Output
Operating Range: -55 degrees Celsius to +125 degrees Celsius
Accurate up to +/- 0.5 degrees Celsius (over the range of -10 degrees Celsius to + 85 degrees Celsius )
Power Requirement: 3.0 Volts to 5.5 Volts
9-bit to 12-bit Celsius temperature measurement
The most striking feature of DS18B20 is that it gives temperature readings as
digital outputs—thus reducing the chances of noise getting into the readings. The
temperature readings from DS1820 are stable and change smoothly as the temperature
varies. The lower vulnerability to noise makes it a perfect choice for various applications
and that is why we decided to use it. Before finalizing on DS18B20, we also tried out
another temperature sensor (LM35DZ), but the results were not satisfactory.
Temperature readings for both sensors were compared. The readings of LM35DZ also
vary with reference voltage applied to it.
The DS18B20 has 3 pins namely Data Pin, Voltage Pin and Ground Pin. The
DS18B20 communicates over a 1-wire bus that by definition requires only one data line
(and ground) for communication with the microprocessor. It can derive power directly
from the data line (“Parasite Power”) eliminating the need for an external power supply.
32
Figure 3-3. DS18B20 Wiring
3.1.3 DS18B20 vs. LM35DZ
Table 3-1. Comparison between DS18B20 and LM35DZ
Figure 2-5 shows the comparison between temperature sensors DS18B20 &
LM35DZ in the same testing condition. The readings from LM35DZ are the averaged
sample for 30 readings. Even after averaging samples for LM35DZ, there was a great
deal of fluctuation in the readings. The readings from DS18B20 were more stable and
close to the actual temperature. The above plot of temperature readings in the same
testing condition helped us to choose DS18B20 over LM35DZ.
DS18B20 LM35DZ
Digital output Analog output
Less effect of noise on readings Vulnerable to noise
Readings not dependent on voltage level (long wires can be used to transmit temperature readings)
Readings depend on reference voltage (long wires may give inaccurate temperature readings)
Stable temperature readings Fluctuation in temperature readings
Programming effort increased Easily programmable
33
Figure 3-4. DS18B20 vs. LM35DZ
3.2 Software Improvement
The EZ430-RF2500 [1, 2, 8, 9] with all its peripherals has been programmed in
‘Code Composer Studio’, which is an IDE for developing applications for Texas
Instruments microprocessors. It uses concepts of C and assembly language. EZ430
also uses Simpliciti Network Protocol for wireless communication.
3.2.1 Auto Reconnect (End Device)
In the previous design of the wireless sensor network (V0), End Devices were
unable to reconnect to the Access Point after losing connection. The lost connection
between an End Device and Access Point could be due to the following reasons:
A power failure and restoration of power to the Access Point.
Signal interference
34
In case of power failure of an Access Point, a manual restart of each End Device
was required. In case of lost connection due to signal interference, a manual reset of
that particular End Device was required. The improvements described here enable End
Devices to reconnect to the Access Point by themselves without any manual
intervention. We looked at different options available to achieve this without overloading
the system.
Figure 3-5. Flowcharts for End Device [1, 8]
35
The Figure 3-5 shows the End Device’s code loop.
Outline of the proposed idea:
Each End Device pings the Access Point at a fixed interval
If the ping succeeds, the End Device continues to send data to the Access Point
If the ping fails, a watchdog timer is used to restart the code from the beginning. Thus End Device goes again to the SMPL_LINK loop, where it reestablishes connection with the Access Point.
The technique described above was tested for its accuracy, and it worked well in
various scenarios. All the End Devices in Pugh Hall have been updated with the new
code.
3.2.2 Auto Restart (End Device)
During testing it was observed that sometimes End Devices stopped sending
data to the Access Point for unknown reasons. It was assumed that it might be
happening due to a memory leak in microprocessor. To get rid of this issue, we made
the End Devices restart every 10 minutes. We used a software timer in the program to
count 10 minutes and then to reinitialize the program from the beginning. After
implementing the idea, we observed a reduction in lost connection and increase in the
connectivity of the network.
3.2.3 Averaging the Samples (Temperature Measurement)
To improve temperature readings from the temperature sensor, we took the
average of 30 temperature samples in each cycle. This technique helped us to reduce
the sudden fluctuations in the temperature readings.
3.2.4 Code for DS18b20
We used a new temperature sensor (DS18B20) for better measurement [13, 14].
This sensor returned temperature in digital form rather than in analog form. In the case
36
of analog temperature sensors, it is easy to read data using an analog-to-digital
converter (ADC). Data from ADC can be easily converted to temperature readings using
predefined formulae provided by the manufacturer. But in case of digital temperature
sensors the program must include code to read each bit, do bit operation and then
return the temperature readings.
Operation (Measuring Temperature [14]) with external power source:
Initiation
Convert Temperature
Read Data from scratchpad Master EZ430 (Microprocessor); Slave DS18B20
3.2.4.1 Initiation:
Initiation is the process in which the bus master transmits a reset pulse. If there is
a slave device active on the bus, it acknowledges its presence to the master by
transmitting a presence pulse.
Figure 3-6. Sequence of transaction by Master (Microprocessor) & Slave (DS18B20)
37
3.2.4.2 Convert Temperature [13, 14]:
To initiate a temperature measurement and A-to-D conversion, the master issues
a “Convert T [44h]” command. As we are powering the DS18B20 using external 3.3
volts power supply, the master can issue a command to read time slots after the
Convert T command, and the DS18B20 will respond by transmitting 0 while the
temperature conversion is in process and 1 when the conversion is done. After the
temperature conversion, the resulting temperature reading is stored in a 2-byte
temperature register in the scratchpad memory, and DS18B20 returns to idle state.
3.2.4.3 Read Data from scratchpad [13, 14]:
In order to receive data from slave, master issues a “read slot” command. Master
pulls the bus LOW for a minimum of 1 s and then releases it. Now master goes to the
reading mode. If slave tries to send 0, slave will pull down the bus to LOW otherwise it
will allow the bus to remain HIGH. The reading period is 15 s . Master reads LSB first.
The temperature data are stored as a 16-bit, sign-extended two’s complement
number in the temperature register in the slave device with the last 4 bits of the MSB
containing the sign bit for the reading. The above bit pattern is converted to a 16-bit hex
and then to decimal. For a 12-bit mode, the bit resolution is 0.0625 degree/bit.
Multiplying the decimal value with the resolution bit will give the current temperature.
3.2.5 Channel Hopping Capability for End Device
In the event of failure of the Access Point, all End Devices connected to it will get
disconnected from it. To prevent the effect of such failure, an extra Access Point on a
different channel is kept as a standby. Now, all End Devices have channel hopping
capability. In case of failure of the Access Point, the End Devices won’t be able to ping
38
the Access Point on the previous channel. After a preset time each End Device will
change channel and connect to the other Access Point.
Figure 3-7. Channel Hopping Sequence
Once the End Devices are connected to another Access Point, they will start
sending data to the new Access Point. This prevents downtime due to any problem with
the Access Point. This idea was tested successfully in the lab.
3.3 Temperature Sensor Calibration
During installation and testing of the temperature sensor (DS18B20), it was
observed that the temperature readings from the sensor inside and outside the
enclosure (box) were different. The box has been used to keep all the sensors and
39
microprocessor in place as a unit. We carried out the same test for different sensors,
and it was found that the difference in temperature existed with all other sensors too.
The temperature from the sensor inside the closed box was consistently higher than
that from the sensor in the open box (room temperature). Consequently an offset was
used in the code to reduce the bias due to enclosure. Figure 3-8 shows the temperature
readings from a temperature sensor in an open box and in a closed box in the same
testing conditions.
Figure 3-8. Sensor in Open Box vs. Sensor in Closed Box
40
CHAPTER 4 ACCESS POINT
The Access Points have been installed at each Base Station to get data from
End Devices and Range Extenders. These Access Points directly connect to the nearby
End Devices and through Range Extenders to the distant End Devices.
4.1 Hardware
The Access Point uses a single microcontroller (EZ439-RF2500). An FTDI Cable
has been used to power EZ430-RF2500 [1, 2, 8, 9] from the Base Station’s USB port.
4.2 Software
Figure 4-1. Flow Chart for Access Point [1]
41
4.2.1 Maximum Number of End Devices per Access Point
In the previous version of the wireless sensor network (V0), the maximum
number of End Devices connecting to an Access Point was limited to eight (8). This
limitation forced us to use more Access Points to cover all End Devices. Updating the
code and ‘Simpliciti Network Protocol’ [6, 9, 11, 16] increased the number of End
Devices per Access Point to thirty (30). The configuration file for the Access Point was
modified to increase the number of End Devices which can connect to it. The macro
“NUM_CONNECTIONS =30” was modified to make 30 End Devices connect to a single
Access Point.
4.2.2 New End Point Connection
The Access Point has the capability to re-establish connection in case of network
failure with an End Device. The Access Point gets an interrupt if any new End Device
tries to connect to it. It listens to the link and establishes the connection.
4.2.3 Retaining LinkID
When Access Point establishes a connection with an End Device, it stores a
LinkID for each End Device in its memory, and when the same End device for any
reason gets disconnected and tries to reconnect to the Access Point, the Access Point
assigns the same LinkID to the End Device. This is because the LinkID is assigned
based on the device address of the End Device, which doesn’t change when the End
Device is restarted. Access Point has the ability to retain the LinkIDs.
42
CHAPTER 5 BASE STATION
Hardware
The low-power computer (Dreamplug) running Debian Linux and the Access
Point (EZ430-RF2500) are collectively called a Base Station. This is the place where
the data received by the Access Point are processed by a Python script running on the
Dreamplug computer. The data are then written to the database.
Figure 5-1. Base Station
43
The Dreamplug is a compact and low-power computer running Debian Linux. In
our case it worked as a remote server, whose job was to run a Python script, which read
data from its USB port and wrote back to the database using Local Area Network.
5.2 Software
5.2.1 Previous Version
The previous version of the wireless sensor network used software running on
the Base Station computer, which had the following limitations:
The software didn’t make use of both USB ports available on the Dreamplug. This resulted in the use of two Dreamplug computers at the same place and each reading data only from one USB port.
The software would not allow it to re-establish the connection with the database if the database computer restarts or the database server gets back online after a brief period of shutdown.
5.2.2 Improved Code
The following significant changes were made to the software to improve its
efficiency:
Read data from both USB ports. The software was made to read data from
both USB ports. This means that now two Access Points can be put on a single
Dreamplug computer unlike in the previous version where one Dreamplug had only one
Access Point. The use of both USB ports reduced the overall cost of the complete
system. Now we need only two (2) Dreamplug computers instead of the previous four.
Smart code. Using several “Try-Catch–Exception” loops in the code, we made
sure that the code doesn’t break and continues to work in case of the following:
The database server goes down for a brief period of time
Any connection problem on USB ports occurs In both cases, the code prints the error and takes corrective actions.
44
CHAPTER 6 INSTALLATION & TESTING
Once the design of the Range Extender was completed, we started planning
deployment of End Devices and Range Extenders. The idea was to reduce the number
of Base Stations with the use of Range Extenders and make the complete system more
compact and manageable. We installed Range Extenders on the 2nd & 3rd floors. As
shown in Figures 6-1 to 6-6, after installing the Range Extenders the required number of
Base Stations decreased from 8 to 3. This reduced the overall cost significantly. We
also managed to install End Devices in rooms, where we couldn’t install them earlier
due to limited range issue. There was a section of rooms on 3rd floor, where we couldn’t
put a Base Station due unavailability of Ethernet connection. Consequently, end
Devices were not installed in those rooms. Now, with the use of Range Extender, we
were able to put End devices in those rooms to collect sensor data.
Range Extenders were installed on 2nd & 3rd floor for testing in Pugh Hall. With
the use of range extenders we received data for our ongoing experiments on
Occupancy Based HVAC Control for buildings. The range extenders provided sensor
data from specified rooms for our experiments without any interruption for last one
month.
Table 6-1. Number of Base Stations
Floor No. of Base Stations (Before) No. of Base stations (Now)
1st Floor 2 1
2nd Floor 3 1
3rd Floor 4 1
45
6.1 Location
6.1.1 First Floor Plan (Before)
Figure 6-1. Location of End Devices on 1st Floor (Before)
6.1.2 First Floor (After)
Figure 6-2. Location of End Devices & Range Extender on 1st Floor (After)
46
6.1.3 Second Floor Plan (Before)
Figure 6-3. Location of End Devices on 2nd Floor (Before)
6.1.4 Second Floor Plan (After)
Figure 6-4. Location of End Device & Range Extender on 2nd Floor (After)
47
6.1.5 Third Floor Plan (Before)
Figure 6-5. Location of End Devices on 3rd Floor (Before)
6.1.6 Third Floor Plan (After)
Figure 6-6. Location of End Device & Range Extender on 3rd Floor (After)
48
6.2 Shortcomings
We faced the following problems during testing and installation:
As these Range Extenders are wall-powered, it took some time to find the right locations for the Range Extenders due to the limited wall power available in Pugh Hall.
The Range Extender needs to be restarted manually in a specific sequence every time if the complete network goes through a power cycle.
The wall outlets for Range Extenders were available only close to the ground. This forced us to use these outlets for the Range Extenders. Consequently, the range of the Range Extenders was greatly affected. Putting the radio transceivers at a height greatly improves their range.
49
CHAPTER 7 CONCLUSION AND FUTURE WORK
7.1 Summary
In this thesis, we have made various important improvements to the wireless
sensor network (V0) as summarized below:
1. With the use of Range Extenders the network was expanded into the entire Pugh Hall. We also reduced the number of Base Stations in Pugh Hall from eight (8) to three (3). The usefulness of Range Extenders became more evident when we replaced four Base Stations with four Range Extenders. The Range Extenders worked as a good replacement for Base Stations. Replacing Base Stations with Range Extenders reduced the overall cost of the project.
2. New temperature sensors were used in the End Devices to increase the accuracy of temperature measurements.
3. End Devices were enabled to reconnect to the network automatically.
4. The maximum number of End Devices per Access Point was increased from eight (8) to thirty (30).
5. The Python script running on the Dreamplug computers was improved for better performance.
6. Channel hopping capability of End Devices was demonstrated.
We are carrying out the tests to ensure the robustness and reliability of the
improved wireless sensor network.
7.2 Future Improvement
There are always areas of improvement. The future work on this project may
include the following:
1. Improvement in the Range Extender code to make it auto-sustainable in the event of power disruption or network failure. This step will ensure that the whole wireless system will join the network by itself and start sending data without any manual intervention.
2. The enclosure used for End Devices was found to reduce the range of the radio transceivers. If the future work looks at the End Device’s design from scratch, then it should look at the orientation and positioning of the EZ430-RF2500 so that we get the maximum possible range when deployed.
50
3. The range has been the biggest issue in our wireless sensor network. In the future work we would like to use an Access Point with an external antenna. Using an external antenna for the Access Point will definitely increase the range of the wireless network and thus will increase the connectivity.
4. The software reset of EZ430-RF2500 doesn’t reset all registers, but ideally it should reset all the registers. A power-on-reset is required for an End Device to reset all the registers of a microprocessor. To achieve POR, we plan to use a small relay controlling power to the microprocessor. The small relay can be powered from a digital output pin of the microprocessor to complete a Power-On-Reset. If this is achieved this will reduce memory leakages in microprocessor and will also not require manual intervention every time to do a POR manually on an End Device.
5. The detailed analysis of offset calibration for the temperature sensor inside and outside the box is to be done.
51
REFERENCES
[1] Texas Instruments EZ430-RF2500 user’s guide, April 2009.
Available from: http://www.ti.com/lit/ug/slau227e/slau227e.pdf
[2] Beginning microcontrollers with MSP430 – Tutorial V0.4 by Gustavo Litovsky
Available from: http://www.glitovsky.com/Tutorialv0_4.pdf
[3] American Society of Heating, Refrigerating and Air-Conditioning Engineers, Inc.
ANSI/ASHRAE standard 62.1-2007, ventilation for acceptable air quality, 2007.
Available from: www.ashrae.org.
[4] Refrigerating American Society of Heating and Inc. Air-Conditioning Engineers.
Ansi/ashrae standard 55-1981, thermal environmental conditions for human
occupancy, 1992. Available from: www.ashrae.org
[5] S. Goyal, H. Ingley, and P. Barooah. Zone-level control algorithms based on
occupancy information for energy efficient buildings. In American Control
Conference (ACC), pages 3063–3068, 2012.
[6] L. Friedman, “SimpliciTI: Simple Modular RF Network Specification”, Texas
Instruments, 2009.
[7] Rahul Subramany “Wireless Sensor Network for HVAC Control”
Wireless Sensor Network [V0]
[8] MSP430X22X4 Family User’s Guide, Texas Instruments, July 2013
Available from: http://www.ti.com/lit/ug/slau144j/slau144j.pdf
[9] Wireless Sensor Network using EZ430-RF2500, Texas Instruments April 2011
Available from: http://www.ti.com/lit/an/slaa378d/slaa378d.pdf
[10] Deepak Ganesan, Alberto Cerpa, Wei Ye, Yan Yu, Jerry Zhao, Deborah Estrin
Networking Issues in Wireless Sensor Networks
[11] CC2500, Low-Cost Low-Power2.4 GHz RF Transceiver, Texas Instruments
Available from: http://www.ti.com/lit/ds/symlink/cc2500.pdf
[12] Hu Bing, Fan Wenyao, “Design of wireless temperature monitoring and control
system based on Zigbee technology in communication room”, Internet Technology
and Applications 2010.
52
[13] Datasheet for temperature sensor, DS18B20, Maxim Integrated
Available from: http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
[14] Ishan Karve, Illustrated guide to interfacing Maxim One Wire (1-Wire) devices
DS18B20 on TI Launchpad MSP-EXP430G2 http://karve.in/?p=1408
[15] Rahul Subramany, Chenda Liao, and Prabir Barooah. Performance comparison of
sensing systems for building occupancy measurement. Energy and Buildings,
2012.
[16] Low Power RF Hardware & Tools Forum, Texas Instruments
http://e2e.ti.com/support/low_power_rf/f/155.aspx
53
BIOGRAPHICAL SKETCH
Saket will graduate with a Master of Science in mechanical engineering from the
University of Florida, Gainesville in May 2014. Since June 2013, he has been a
Research Assistant in the Distributed Control Systems Lab at the University of Florida
under Dr. Prabir Barooah. His research focused on developing wireless sensor
networks for Heating and Air Conditioning Systems for smart buildings.
Saket earned his Bachelor of Engineering degree in marine engineering from
Marine Engineering & Research Institute, Kolkata, India. He has worked as Marine
Engineer onboard ship for four years with Anglo Eastern Ship Management.