T.C YEDITEPE UNIVERSITY
FACULTY OF ENGINEERING AND ARCHITECTURE
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
MULTI-HOP COMMUNICATION IN WIRELESS SENSOR NETWORK
AND
LOCALIZATION
BY
20120701021
MERVE MELİS DOĞANER
EE 492 – ENGINEERING PROJECT REPORT
ISTANBUL, 2017
ABSTRACT
In this thesis, the implementation of multi-hop network topology is examined by using sensor nodes which are composed of MSP430G2553 microcontroller, nRF24L01 + radio transceivers and LDR sensor. An appropriate algorithm is created for the communication protocol based on multi-hop transmission in wireless sensor network. Also, localization techniques which are the weighted average (WA) and triangulation, (trilateration) which are done by using sensor data is demonstrated(performed).
ÖZET
TABLE OF CONTENTS
A MSP430G2553 AND RF ANTENNA BASED WIRELESS SENSOR NETWORK FOR LIGHT EMITTING OBJECT LOCALIZATION ii
ACKNOWLEDGEMENTS iii
ABSTRACT iv
ÖZET v
TABLE OF CONTENTS vi
TABLE OF ILLUSTRATIONS viii
LIST OF FIGURES viii
LIST OF TABLES ix
LIST OF GRAPHS ix
LIST OF SYMBOLS & ABBREVIATIONS x
1. INTRODUCTION 1
2. NETWORK TOPOLOGIES 5
2.1 SERIAL NETWORKS 5
2.2 PARALLEL NETWORKS 7
2.3 HYBRID / TREE NETWORKS 9
3. LITERATURE REVIEW 10
4. PROJECT DESIGN 15
4.1 HARDWARE 15
4.1.1 MSP430G2553 MICROCONTROLLER WITH LAUNCH PAD 17
4.1.2 RF TRANSMITTER 20
4.1.3 RF RECEIVER 22
4.1.4 LM358P – DUAL OPERATIONAL AMPLIFIER 23
4.1.5 LDR 24
4.1.6 POTENTIOMETER 26
4.1.7 OSCILLOSCOPE 28
4.1.8 DC POWER SUPPLY 29
4.1.9 OTHER COMPONENTS 30
4.2 SOFTWARE 31
4.3 DESIGN PROBLEMS 34
4.4 COST OF THE SYSTEM 40
4.5 TIME CONSUMPTION OF THE PROJECT 41
5. TESTS & RESULTS 42
5.1 ENERGY CONSUMPTION OF THE COMPONENTS 43
5.2 LOCALIZATION 45
5.3 TRACKING 51
6. CONCLUSION 55
7. FUTURE WORK 58
8. REFERENCES 59
TABLE OF ILLUSTRATIONS
LIST OF FIGURES
Figure 1 : Information about the Names of MSP430 Family Microchips [1] 3
Figure 2 : The Schematic of Communication Procedure in Serial Networks 7
Figure 3 : The Schematic of Communication Procedure in Parallel Networks 8
Figure 4 : The Schematic of Communication Procedure in Hybrid Networks 9
Figure 5 : The Circuit Schematic of a Sensor Node for All Network Topologies 16
Figure 6 : MSP430G2553 Microcontroller with Launch Pad 18
Figure 7 : Functional Block Diagram of the MSP430G2x53 19
Figure 8 : 433MHz RF Transmitter 21
Figure 9 : 433MHz RF Receiver 22
Figure 10 : The Inside Schematic of LM358P Dual Operational Amplifier 23
Figure 11 : LM358P Dual Operational Amplifier 24
Figure 12 : The LDR with 10mm diameter 25
Figure 13 : 10 kOhm Potentiometer 27
Figure 14 : The Front View of an Oscilloscope 28
Figure 15 : The DC Power Supply which gives a variable voltage from 0V to 30V and current max 1A 29
Figure 16 : The View of Resistor 30
Figure 17 : The Flowchart of the Serial Network 32
Figure 18 : The Flowchart of the Parallel Network 33
Figure 19 : The Random Signals in the Air 36
Figure 20 : The appearance of the signal isolation room 36
Figure 21 : The View of the Testbed of the Overall System from the Top 42
Figure 22 : The View of the Testbed of the Overall System in Perspective 43
Figure 23 : The View of the Torch of IPHONE5C used as Localizing and Tracking Object 46
Figure 24 : The Experiment Area of the System 49
Figure 25 : The Screen-View of CCS – GUI Composer 51
Figure 26 : Tracking the Object with ‘ > ’ Pattern 52
Figure 27 : Tracking the Object with ‘ > ’ Pattern 53
Figure 28 : Tracking the Object with Straight Line ‘ \ ’ Pattern 53
Figure 29 : Tracking the Object with Curved Pattern 54
LIST OF TABLES
Table 1 : Package Configuration of the Data Package 34
Table 2 : The Cost of a Sensor Node 40
Table 3 : Time Consumption of the Project 41
Table 4 : The energy consumption values with respect to different voltage applied after the code is debugged to the MSP430 Launchpad and ready to work 44
Table 5 : The energy consumption values with respect to different voltage applied while MSP430 Launchpad is working 45
Table 6 : The Table Includes H, Averages, MSE and Errors 48
LIST OF GRAPHS
Graph 1 : MSE vs H (cm) 49
Graph 2 : Percentage Error versus Error in X Axis and Error in Y Axis 50
LIST OF SYMBOLS / ABBREVIATIONS
WSNS Wireless Sensor Network Systems
LDR Light Dependent Resistor
RF Radio Frequency
FC Fusion Center
GHz Gigahertz
MHz Megahertz
ISM band Industrial Scientific Medical band
LCD Liquid – Crystal Display
PC Personal Computer
TCP/IP Link Transmission Control Protocol/Internet Protocol Address Link
GPRS General Packet Radio Service
GSM Global System for Mobile Communications
MCU Microcontroller Unit
IEEE Institute of Electrical and Electronics Engineers
I/O Input / Output
ADC Analog-to-Digital Converter
SPI Serial Peripheral Interface
UART Universal Asynchronous Receiver/Transmitter
OS Operating System
GPS Global Positioning System
RSSI Received Signal Strength Indicator
PIR Sensor Passive Infrared Sensor
TI Texas Instruments
USCI Universal Serial Communication Interface
MAB Memory Address Bus
MDB Memory Data Bus
VCC IC Power-Supply Pin
IC Integrated Circuit
AC Alternating Current
DC Direct Current
PCB Printed Circuit Board
CCS Code Composer Studio
LPM Low Power Mode
WA Weighted Average
MSE Mean Squared Error
INTRODUCTION
Wireless sensor Networks
Benefits
Apllication areas
Multi-hop transmission in wsns
-Why?application areas?
-advantages: to reach further distances
-disadvantage:cluster head
-applications,areas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PROJECT DESIGN
In this section, the hardware and design of the sensor node, and communication protocol of the proposed system will be presented.
Sensor node design-hardware of sensor node
A sensor unit mainly consists of microprocessor, communication and a sensor unit (temperature, pressure, light, etc.) that receives data from the medium.
Each sensor unit in this study mainly consists of MSP430G2553 Microprocessor, nRF24L01 + wireless communication unit and light sensor unit (Light Dependent Resistance,
LDR).
In this study, sensor node is composed of a Msp430G2553 microcontroller, Nrf, a Ldr sensor , resistor. The sensor node is shown with all units in figure.
Each sensor unit in this work consists of MSP430G2553 microprocessor, nRF24L01 + communication unit, sensor (LDR) and 2 rechargeable AA pen batteries which feed the whole system.
Microprocessors (MSP430G2553) in the sensor nodes were programmed in the Code Composer Studio (CCS) environment using the C ++ language.
FOTO SENSOR NODE
SENSOR NODE SHMEATI
MSP430G2553 MICROCONTROLLER WITH LAUNCHPAD
Foto msp
Figure : MSP430G2553 Microcontroller with LaunchPad
The MSP430G2553 with its low price has enough memory and Processor speed.
MSP430G2553 has enough memory (16 KB) to process and / or store the data obtained from the sensors and 24 I/O capacitive-touch enabled pins in terms of circuit devices such as the sensor and communication unit to which the processor is connected.
The MSP430G2553 microprocessor operates between 1.8V and 3.6V and has a working frequency of up to 16 MHz. The microprocessor frequency for this operation is set to 1 MHz.
In itself there is a serial communication unit for connecting to other devices. This unit includes one UART, two SPIs, and one I2C communication Protocols. The microprocessor has an 8-channel 10-bit analog-to-digital converter (ADC) unit. In addition, there are four low power modes (LPM) to reduce the most energy consumed by the microcontroller. When the microprocessor is in the low power consumption mode, it can wake up within 1µs [22],[23].
The microprocessor has a 10-bit precision ADC unit. Thus, the value of the light intensity measured from LDR is read between 0 and 1023. Typical applications include low-cost sensor systems that capture analog signals, convert them to digital values, and then process the data for display or for transmission to a host system.
There is one LDR as the sensing element and one calibration resistor in the sensor node.
LDRs were calibrated by choosing resistance values to give values close to each other under the same light intensity.
The USCI module is used for serial data communication. The USCI module supports synchronous communication protocols such as SPI (3 or 4 pin) and I2C, and asynchronous communication protocols such as UART, enhanced UART with automatic baudrate detection (LIN), and IrDA. Not all packages support the USCI functionality
USCI_A0 provides support for SPI (3 or 4 pin), UART, enhanced UART, and IrDA. USCI_B0 provides support for SPI (3 or 4 pin) and I2C.
The communication unit nRF24L01 + communicates with the MSP430G2553 microprocessor via the Serial Peripheral Interface (SPI).
The carrier frequency of the communication unit (nRF24L01 +) is used as 2.4 GHz and the data transmission speed (data Rate) was selected as 1Mbps in this study.
In the nRF24L01 +, which uses GFSK (Gaussian Frequency Shift Keying) modulation, 0 dBm is selected as the output power.
Finally, a series of two rechargeable 2500 mAh AA pouch batteries connected in series, the resulting nominal 2.4Volt voltage feeds a sensor node unit.
To reduce energy consumption in the sensor unit, LDRs are fed only when measurement is to be taken.
The Texas Instruments MSP430 family of ultra-low-power microcontrollers consists of several devices featuring different sets of peripherals targeted for various applications. The architecture, combined with five low-power modes, is optimized to achieve extended battery life in portable measurement applications. The device features a powerful 16-bit RISC CPU, 16-bit registers, and constant generators that contribute to maximum code efficiency. The MSP430G2x13 and MSP430G2x53 series are ultra-low-power mixed signal microcontrollers with built-in 16- bit timers, up to 24 I/O capacitive-touch enabled pins, a versatile analog comparator, and built-in communication capability using the universal serial communication interface. In addition the MSP430G2x53 family members have a 10-bit analog-to-digital (A/D) converter. It has a16mhz cpu, 16kb flash memory, 512bytes ram, two input and output ports, two timer modules and a watchdog timer, ADC and comparator modules, digital communication module with USCI(Enhanced UART Supporting Auto Baudrate Detection (LIN), IrDA Encoder and Decoder, Synchronous SPI,I2C)
NRF
In this study, the nRF24L01 + was chosen as the communication unit because it is less costly and consumes less power.
The basic features of the nRF24L01+ include:
• Radio X Worldwide 2.4GHz ISM band operation X 126 RF channels X Common RX and TX interface X GFSK modulation X 250kbps, 1 and 2Mbps air data rate X 1MHz non-overlapping channel spacing at 1Mbps X 2MHz non-overlapping channel spacing at 2Mbps • Transmitter X Programmable output power: 0, -6, -12 or -18dBm X 11.3mA at 0dBm output power • Receiver X Fast AGC for improved dynamic range X Integrated channel filters X 13.5mA at 2Mbps X -82dBm sensitivity at 2Mbps X -85dBm sensitivity at 1Mbps X -94dBm sensitivity at 250kbps • RF Synthesizer X Fully integrated synthesizer X No external loop filer, VCO varactor diode or resonator X Accepts low cost ±60ppm 16MHz crystal • Enhanced ShockBurst™ X 1 to 32 bytes dynamic payload length X Automatic packet handling X Auto packet transaction handling X 6 data pipe MultiCeiver™ for 1:6 star networks • Power Management X Integrated voltage regulator X 1.9 to 3.6V supply range X Idle modes with fast start-up times for advanced power management X 26µA Standby-I mode, 900nA power down mode X Max 1.5ms start-up from power down mode X Max 130us start-up from standby-I mode • Host Interface X 4-pin hardware SPI X Max 10Mbps X 3 separate 32 bytes TX and RX FIFOs X 5V tolerant inputs • Compact 20-pin 4x4mm QFN package
The nRF24L01 is a highly integrated, ultra low power (ULP) 2Mbps RF transceiver IC for the 2.4GHz ISM (Industrial, Scientific and Medical) band. With peak RX/TX currents lower than 14mA, a sub μA power down mode, advanced power management, and a 1.9 to 3.6V supply range, the nRF24L01 provides a true ULP solution enabling months to years of battery lifetime when running on coin cells or AA/AAA batteries. The Enhanced ShockBurst™ hardware protocol accelerator additionally offloads time critical protocol functions from the application microcontroller enabling the implementation of advanced and robust wireless connectivity with low cost 3rd-party microcontrollers.
The nRF24L01 integrates a complete 2.4GHz RF transceiver, RF synthesizer, and baseband logic including the Enhanced ShockBurst™ hardware protocol accelerator supporting a high-speed SPI interface for the application controller. No external loop filter, resonators, or VCO varactor diodes are required, only a low cost ±60ppm crystal, matching circuitry, and antenna.
The Nordic nRF24L01 is available in a compact 20-pin 4 x 4mm QFN package.
Low cost single-chip 2.4GHz GFSK RF transceiver IC
Worldwide license-free 2.4GHz ISM band operation
1Mbps and 2Mbps on-air data-rate
Enhanced ShockBurst™ hardware protocol accelerator
Ultra low power consumption – months to years of battery lifetime
On-air compatible with all Nordic nRF24L Series in 1 and 2Mbps mode
On-air compatible with Nordic nRF24E and nRF240 Series in 1Mbps mode
Nrfin pinleri tanımları
Pin Name Pin function Description
1 CE Digital Input Chip Enable Activates RX or TX mode
2 CSN Digital Input SPI Chip Select
3 SCK Digital Input SPI Clock
4 MOSI Digital Input SPI Slave Data Input
5 MISO Digital Output SPI Slave Data Output, with tri-state option
6 IRQ Digital Output Maskable interrupt pin. Active low
7 VCC Power Power Supply (+1.9V – +3.6V DC)
8 GND Power Ground (0V)
Table 3: Pin definitions of nRF24L01 +
the nRF24L01+ radio transceiver’s operating modes
Nrf foto
Msp430G2553 and nRF24L01+ are powered by the battery. The LDR, which is used as a light sensor, is fed through the microprocessor. The LDR, which is used as a light sensor, is powered by the microprocessor and energy is saved by turning off the LDR when no measurement is made. In this way, when no measurement is made, LDR is closed to save energy.
Figure shows the connection diagram of a sensor node.
Figure : Node schematic
Ldr
Finally, the LDR is added to the sensor node which is designed, and a rechargeable battery (2xAA) is added to the sensor node to allow each sensor to operate on its own. The sensor measures light intensity in the environment through LDR.
LDR is a sensor model that can be used quite easily in robot projects and automation systems where light control is required.
LDR is the simplest type of optical sensor that can adjust the value of resistance depending on the intensity of the light in the environment.
LDR is the simplest type of optical sensor that can adjust inversely proportional the value of the resistance over the intensity of the ambient light. In other words, the resistance of LDR is minimum for the maximum light intensity and maximum for the minimum light intensity. By using this feature of the LDR, additional resistors were connected to the LDR in serial for the LDR calibration. Each LDR was calibrated seperately in the same way so that they give same light intensity under the same lignt conditions.
Thus, microcontrollers reads the voltage level low at dark medium and the voltage level high at bright medium.And, it assigns 0 for the low voltage level and VCC for the maximum voltage level using Analog to Digital Converter (ADC) Module. ADC divides the voltage difference between these minimum and maximum voltage level to the same equal ranges. Because it has a 10-bit analog-to-digital (A/D) converter. This means that
The microprocessor has a 10-bit precision ADC unit. Thus, the value of the light intensity measured from LDR is read between 0 and 1023. Typical applications include low-cost sensor systems that capture analog signals, convert them to digital values, and then process the data for display or for transmission to a host system.
Other components
Sensor foto
COMMUNICATION PROTOCOL
Söze başla,
NETWORK TOPOLOGY-fusion center trigger transmission
Topology resmi ışık,pc, okların anlamları
Olayı anlat
COMMUNİCATİON PACKET FORMAT-anlat,tablo
FLOWCHARTS-anlat
Anlatırken send yerine transmit kullan
Has an interrupt
Adreslerden bahset
The algorithm schematics of the parts of the proposed network topology are shown in Fig. X and Fig. Y below.
Figure x: Flowchart of Matlab Code-PC??
Ekleme yap timer kısmını ,, get data which comes from.. düzelt.
Figure x: Flowchart of Fusion Center
Figure x: Flowchart of a clusternode
Figure x:The Flowchart of a sensornode
TEST RESULTS
TABLOS,
10 ölçüm al data2,data 3,data5 tablosu
time tablo ve histogramı
LOCALIZATION
-WEİGHT
Location of an object are calculated by using information of each sensor nodes which are light intensity value and the coordinate values. The formulas [2] are shown below calculate average x and average y coordinates of the object by using sensor data
x ̂= (∑_(i=1)^N▒〖D_i x_i 〗)/(∑_(i=1)^N▒D_i ) (1)
y ̂= (∑_(i=1)^N▒〖D_i y_i 〗)/(∑_(i=1)^N▒D_i ) (2)
where
x ̂ and y ̂ are the weighted averages that define coordinates of the light source in the coordinate system.
N is the number of sensor nodes in the system.
D_i is the data of the i-th sensor node.
x_i and y_i are the real coordinate values of i-th sensor node in the system.
x and y are the real coordinate values of light sensor.
which is light source used in this study
In the case of continuous operation, as the data package which includes data of sensor nodes and cluster node measurement is updated, the estimated (x ̂ , y ̂) coordinates are being updated.
Trial number avg x (cm) avg y (cm) Data of Cluster Node Data of Sensor Node 1
1
2
3
4
5
6
7
8
9
10
x,y koordinat tablosu 10 ölçüm için ve grafik for 10 ölçüm al data2,data 3,data5 tablosu
tablo,MATLAB WİEW, bir koordinat weight
-TRİANGULAR, LDR CALİBRATIONS, GRAPHS, tablosu, bir koordinat için triangular
LDR kalibrasyon hardware-software kalibrasyon for triangular loc.
bir koordinat için triangular ve weight karşılaştırması
CONCLUSION AND FUTURE WORK
References
[22] Texas Instruments. “MSP430G2553”. http://www.ti.com/product/msp430g2553?keyMatch= msp430g2553&tisearch=Search-EN-Everything (17.03.2016).
[23] Ünsalan C, Gürhan HD. Programmable Microcontrollers with Applications. 1st ed. New York, USA, McGraw-Hill, 2013.
[]NORDIC SEMICONDUCTOR Available: http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRF24L01
[2]Niu R, Varshney PK. "Target location estimation in sensor networks with quantized data". IEEE Trans. Signal Processing, 54(12), 4519-4528, 2006.