Spectrum Sensing Through Implementation Of USRP2 Computer Science Essay

Published:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Scarcity of the wireless spectrum has led to the development of new techniques for better utilization of the wireless spectrum. Demand for high data rates and better voice quality is resulting in the development of new wireless standard making wireless spectrum limited than ever. In this era of wireless communication, service providers and telecom operators are faced with a dilemma where they need a large sum of the wireless spectrum to meet the ever increasing quality of service requirements of consumers. This has led to the development of spectrum sensing techniques to find the unused spectrum in the available frequency band.

The results presented in this thesis will help out in developing clear understanding of spectrum sensing techniques. Comparison of different spectrum sensing approaches. The experiments carried out using USRP2 and GNU radio will help the reader to understand the concept of underutilized frequency band and its importance in Cognitive Radios.

Keywords: Cognitive Radio, Spectrum sensing, GNU Radio, USRP2.

Contents

Bibliography.......................................................................................................................... 40

Appendix A............................................................................................................................ 42

Appendix B............................................................................................................................ 46

Appendix C............................................................................................................................ 50

List of abbreviations

Acronym Description

A Ampere

ADC Analogue to Digital Converter

CPC Cognition enabling pilot channel

CPU Central processing unit

DAC Digital to analogue converter

dBm Milliwatt-decibel

DC Direct current

DDC Digital down converter

DSSS Direct sequence spread spectrum

DUC Digital up converter

F Frequency

FFT Fast Fourier transforms

FPGA Field programmable gate arrays

GHz Giga hertz

GUI Graphical user interface

HPSDR High power software defined radio

IEEE Institute of Electrical and Electronic Engineer

IF Intermediate frequency

IP Internet protocol

ISM Industrial Scientific Medical

ITU-T International telecommunication union

MAC Media access control

MHZ Mega hertz

MIMO Multi input multi output

Mm Millimeter

MS Mega samples

OSSIE Open source SCA implementation embedded

PU Primary user

PHY Physical

RADAR Radio detection and ranging

RF Radio frequency

SCA Software Communication Architecture

SDR Software defined radio

SNR Signal to noise ratio

SU Secondary user

SWIG Simplified wrapper and interface grabber

UBCR Unlicensed based cognitive radio

Acronym Description

UDP User datagram protocol

UHD Universal hardware devices

USB Universal serial buss

USRP Universal software radio peripheral

WiFi Wireless Fidelity

WPAN Wireless personal area network

WT Wavelet transforms

List of Figures

Figure2.1 Cognitive Radio spectrum sensing 4

Figure 2.2 Cognitive Radio operation 5

Figure 2.3: Energy Detection method 6

Figure 2.4: Cyclostationary Detection 7

Figure 2.5: Wavelet Detection method 7

Figure 2.6: Channel allocation in 2.4GHz ISM band 9

Figure 3.1: GNU Radio software architecture 12

Figure 3.2: GNU Radio Modules 13

Figure 3.3: Typical Software Radio 14

Figure 3.4: USRP2 Motherboard and RF daughter card XCVR 2450 15

Figure 3.5: USRP2 Front end 16

Figure 3.6: USRP2 operation with GNU Radio 17

Figure 4.1: USRP2_probe.py Output 20

Figure 4.2: Experimental Setup 20

Figure 4.3: USRP2_fft.py output 21

Figure 4.4: gr_plot_fft.py output with USRP2_rx_cfile.py data file 22

Figure 4.5: USRP2_spectrum.py flow chart 23

Figure 5.1: FFT magnitude plot for 2.4GHz band with 20MHz frequency step 27

Figure 5.2: Frequency vs. Gain plot for 2.4-2.5GHz ISM band 28

Figure 5.3: Time, Frequency, and Gain 3D plot for 28

2.4GHz-2.5GHz using 20MHz frequency step

Figure 5.4: Frequency and Magnitude plot with 10MHz step 29

Figure 5.5: Frequency and Magnitude plot with 10MHz step at 2.4GHz ISM band 29

Figure 5.6: Time, Frequency, Magnitude plot using 10MHz step 30

Figure 5.7: Spectrogram plot using 10MHz step 30

Figure 5.8: Frequency vs. magnitude plot with Frequency step of 5MHz 31

Figure 5.9: Time, Frequency, gain 3D plot with frequency step of 5MHz 32

Figure 5.10: Spectrogram plot using 5MHz step 32

Figure 5.11: Frequency Vs. Gain plot using 1MHZ step 33

Figure 5.12: Time, Frequency, Gain 3D plot using 1MHz step 33

Figure 5.13: Frequency Vs. Gain plot @ microwave oven range 34

Figure 5.14: Time, Frequency, Gain 3D plot @ microwave oven frequency 35

Figure 5.15: Spectrogram for microwave oven frequency 35

Figure 5.16: Frequency vs. gain plot for 5.8GHz ISM band 36

Figure 5.17: Frequency, Time, Gain plot for 5.8GHz ISM Band 36

Figure 5.18: Spectrogram for 5.8GHz ISM band 37

List of Tables

Table1. Spectrum sensing techniques comparison 8

Table2: ITU-R allocation of ISM Frequency bands 9

Table 3: Main features of USRP2 16

Chapter 1

Introduction

Introduction

The thesis presents the implementation of spectrum sensing through energy detection and wavelet transformation algorithm using GNU Radio and Universal Software Radio Peripheral2 (USRP2). Furthermore comparison of all available spectrum sensing techniques is presented to identify the most efficient method. Spectrum sensing is considered as the prime element of any Cognitive radio (CR). By finding the underutilized frequency in the available spectrum, the radio spectrum scarceness issue can be resolved effectively.

Aims and objectives

The main aims and objectives of this project are:

To analyze different spectrum sensing techniques and find out which one is the most precise in terms of finding spectrum holes in available radio resource.

To develop a spectrum sensing algorithm and implement it over Universal Software Radio Peripheral 2(USRP2). Capture the raw data frames for ISM bands specifically 2.4GHz and 5.8GHz in the campus environment at different times according to the traffic intensity.

Extraction of raw data from '.bin' and '.dat' files and recompile it using graphic modeling tools.

To convert data to graphical form so that results can be analyzed and new decision making algorithm can be proposed later based on analysis of graphical results.

Research Questions

The main research questions for our thesis are as follows:

Which spectrum sensing technique is the most robust in terms of available radio resource or wireless spectrum?

Is it possible to sense the spectrum without having any prior information about it?

How to monitor and sense the spectrum in an efficient way so that spectrum holes can be identified in the defined frequency range?

How to find the precise threshold level for sensed spectrum?

How to collect the received signals as close as possible to the USRP2 hardware with minimum overhead?

What is the most suitable graphical method to analyze the raw data collected through USRP2?

Thesis outline

The thesis report constitutes of 6 chapters.

Chapter 2 gives insight of technical background and related work done in the area of spectrum sensing.

Chapter 3 provides familiarity with the software tools and hardware used in the research.

Chapter 4 presents the complete experimental setup.

Chapter 5 gives results and the synopsis of results.

Chapter 6 Conclusion and future work related to the topic under consideration.

CHAPTER 2

Spectrum Sensing

Spectrum Sensing

Cognitive Radio (CR) is a paradigm for radio communication in which a wireless system alters its transmission or reception to effectively communicate with end user avoiding interference from other users present in the spectrum [3]. CR continuously learns about the radio spectrum by sensing the spectrum and changes its transmission or reception parameters according to the user behavior. The spectrum sensing principals of cognitive radio is shown in Figure2.1.

Figure2.1 Cognitive Radio spectrum sensing

CR finds the free spectrum holes in the available spectrum range through sensing and learning. CR adapts to the changes in available radio spectrum and varies transmit or receive parameters according to the network condition. In the CR paradigm, there are two types of users known as Primary Users (PU) and Secondary Users (SU). Primary users are the licensed spectrum users who have direct access to the network whereas SUs are the users who rely on the CR decision for spectrum access [18]. There are two main types of spectrum sensing CRs

Licensed Band Cognitive Radios (LBCR): in which CR is capable of using licensed frequency bands assigned to users [23].

Unlicensed Band Cognitive Radios (UBCR): which can only make use of the unlicensed part of Radio Frequency (RF) spectrum [23].

The rest of the discussion in this thesis focuses only on the second category of Cognitive Radios referring to it as CR.

Cognitive Radio Operation

CR emerged as an answer to spectrum crowding problem. Any CR's operation comprises of four states as shown in the Figure 2.2. First the available spectrum is sensed and analyzed to find any available spectrum holes. On the basis of spectrum analysis a decision is made to opportunistically assign the available frequency to the secondary user. Spectrum sensing is the most integral part of CR because all the remaining operations of CR rely on precise sensing of available spectrum [18].

Figure 2.2 Cognitive Radio operation

Types of Spectrum Sensing

The most important task of spectrum sensing is transmitter detection. Spectrum sensing plays a key role in the decision making part of CR. There are several different ways to sense the spectrum. Some of the key methods used for spectrum sensing are as follows:

Energy Detection

Cyclostationary Method

Matched Filter detection

Wavelet detection

Explanation and comparison of all four methods is given below.

Energy Detection

In energy detection method we measure the energy of available radio resource and compare it against a predefined threshold level. If the measured energy falls below the defined threshold level spectrum is marked as available. When the measure energy level is above the defined threshold, it's considered as occupied. Energy detection method does not require any prior information of the signal. In simple words it does not care about the type of modulation used for transmission of signal, phase or any other parameter of signal. It simply tells if the radio resource is available at any given time instant or not without considering the PU and SU [3]. Hypothetically, energy detection can be considered as a method based on binary decision, which can be written as follows:

(1)

(2)

Where s(t) is the received signal and n(t) is the additive white Gaussian noise with zero mean i.e. equally distributed all over the signal. H0 and H1 represent the two outcomes of the energy detection method [4]. The energy detection method's working principal can be explained with the Figure2.3 below:

Figure 2.3: Energy Detection method

Cyclostationary Method

A Cyclostationary process is defined as the statistical process which repeats itself cyclically or periodically [6]. Communication signals are Cyclostationary with multiple periodicities. Mathematically Cyclostationary detection can be performed as given in equation (3):

(3)

The equation shows the autocorrelation of the observed signal x(t) with periodicity T, E represents the expectation of the outcome and α represents the cyclic frequency [6]. After autocorrelation Discrete Fourier Transform over resulting correlation is performed to get the desired result in terms frequency components. The peaks in the acquired data give us the information about the spectrum occupancy. The Cyclostationary detection method requires prior knowledge of periodicity of signal and it can only be used with the signal possessing Cyclostationary properties. The implementation of Cyclostationary method is shown in Figure2.4 below:

Figure 2.4: Cyclostationary Detection

Matched filter detection

In the matched filter detection method a known signal is correlated with an unknown signal captured from the available radio resource to detect the presence of pattern in the unknown signal [6]. Matched filter detection method is commonly used in Radio Detection and Ranging (RADAR) communication. The use of matched filter detection is very limited as it requires the prior information about the unknown signal. For example in case of GSM, the information about the preamble is required to detect the spectrum through matched filter detection method. In case of WiMAX signal prior information about the Pseudo Noise (PN) sequence is required for detection of spectrum.

Wavelet Detection

To detect the wideband signals, wavelet detection method offers advantage over the rest of the methods in terms of both simplicity and flexibility. It can be used for dynamic spectrum access. To identify the white spaces or spectrum holes in the available radio resource, the entire spectrum is treated as the sequence of frequency sub-bands. Each sub-band of frequency has smooth power characteristics within the sub-band but changes abruptly on the edge of next sub-band. By using the wavelet detection method the spectrum holes can be found at a given instance of time by finding the singularities in the attained result [5]. The Figure 2.5 shows the wavelet detection implementation for spectrum sensing.

Figure 2.5: Wavelet Detection method

Qualitative analysis of spectrum sensing techniques

All of the above mentioned spectrum sensing techniques have certain advantages and disadvantages. Some of the techniques are suitable for sensing of licensed spectrum whereas others are suitable for unlicensed spectrum. The qualitative analysis of above mentioned spectrum sensing techniques are presented in Table1.

Table1. Spectrum sensing techniques comparison

Sensing technique

Advantages

Disadvantages

Energy Detection

Does not require prior information, Efficient, less complex

Limited functionality in low SNR areas, cannot differentiate between PU and SU

Cyclostationary

Works perfectly in low SNR areas, robust against interference

Requires fractional information about the PU, less efficient in terms of computation cost

Matched Filter

Low computation cost, accurate detection

Requires prior information about PU

Wavelet Detection

Works efficiently for wideband signal detection

Does not work for DSSS, more complex

It can clearly be seen from table1 that energy detection is the most suitable technique for unlicencessed spectrum bands as it does not require any prior information abou the PU and SU.

Radio spectrum overview

Radio spectrum comprises of electromagnetic frequencies ranging lower than 30GHz or having wavelength larger than 1milimeter (mm). Various parts of the radio spectrum are allocated for different kinds of communication application varying from microphones to satellite communication. Today, in most of the countries radio spectrum is government regulated i.e. governments and some other governing bodies like International Telecommunication Union (ITU-T) assign the radio spectrum parts to communication services [1].

There are several different frequency bands defined inside the radio spectrum on the basis of wavelength (λ) and frequency (f). Generically radio spectrum can be classified into two categories as licensed spectrum and unlicensed spectrum. Licensed spectrum comprises of frequency bands governed by government regulated agencies. It is illegal to use licensed frequency spectrum without taking permission from the regulatory bodies. Unlicensed frequency bands can be used by anyone for any scientific or industrial research.

One of the known unlicensed frequency band is Industrial, Scientific and Medical (ISM) frequency band or spectrum. It comprises of several different frequency bands. The ISM band defined by ITU-Regulation is given in the Table2.

Table2: ITU-R allocation of ISM Frequency bands

Frequency Range

Center Frequency

Availability

6.765-6.795 MHz

6.785MHz

13.553-13.567 MHz

13.560 MHz

26.957-27.283 MHz

27.120 MHz

40.66-40.70 MHz

40.68 MHz

433.05-434.79 MHz

433.92 MHz

902-928 MHz

915 MHz

ITU Region2 only

2.400-2.500 GHz

2.450 GHz

5.725-5.875 GHz

5.800 GHz

24-24.25 GHz

24.125 GHz

61-61.5 GHz

61.25

122-123 GHz

122.5 GHz

244-246 GHz

245 GHz

Most commonly used ISM bands are 2.4GHz and 5.8GHz band. Though these ISM bands were reserved for the purpose of research but currently these bands are used for different wireless communication standards. Examples of these bands are Wireless Local Area Network defined by Institute of Electrical and Electronics Engineers (IEEE) as 802.11a/b/g/n, Wireless Personal Area Network (WPAN) defined by IEEE as 802.15 and Cordless phones which operate in the range of 915MHz, 2.4GHz, and 5.8GHz. The research carried out in this thesis is performed using the 2.4GHz and 5.8GHz ISM band commonly used for WLAN and defined by IEEE as 802.11. 802.11 standards have defined 13 channels in the range of 2412MHz to 2472MHz [23]. Each channel is 5MHz apart from each other and all the adjacent channel overlap with each other as each channel is 22MHz wide as shown in Figure 2.6.

Figure 2.6: Channel allocation in 2.4GHz ISM band [23]

Related work

The recent focus on CR technology and advent of Software Defined Radio (SDR) such as GNU Radio has led to the implementation of GNU Radio in terms of Cognitive Radio [3]. There are hundreds of citations available on IEEE explore investigating different aspects of spectrum sensing and CR. Most of the ongoing debate is concerned about finding the right spectrum sensing techniques for CR, channel allocation and transmission power handing for the Media Access Control (MAC) and Physical (PHY) layer implementation [5]. Underutilized bandwidth detection is key element of any spectrum sensing technique [9].

There are number of different platforms available for the implementation of CR in terms of SDR. One of these platforms include Open source Software Communication Architecture (SCA) implementation-Embedded (OSSIE) by Virginia Tech [24]. OSSIE is an open source software radio suite which can be used to model any of SDR and CR applications. Other platforms include High Power SDR (HPSDR) [25] and Flex Radio [26].

There are some other technique that could be considered as alternative to spectrum sensing. One of these techniques is cognition enabling pilot channel (CPC) [6]. According to CPC, a database of licensed users can be created which will monitor the use of spectrum by creating another channel and by advertising the spectrum opportunities in timely manner. But this will restult in additional infrastructure and use of another channel known as CPC. It is not the best approach to overcome spectrum scarcity as it will result in extra overhead in terms of radio resource.

CHAPTER 3

GNU Radio and Universal Software Radio Peripheral 2 (USRP2)

GNU Radio and USRP2

GNU Radio Overview

GNU Radio is an open source development platform for signal processing and communication applications focusing on implementation of SDRs with low cost external RF hardware. It contains tons of libraries with signal processing routines written in C/C++ programming language. It is widely used in the wireless communication research and real time implementation of software radio systems [16].

GNU Radio applications are mainly written and developed by using Python programming language. Python provides a user friendly frontend environment to the developer to write routines in a rapid way. The performance critical signal processing routines are written in C++ [22]. Python is a high level language; it acts as a glue to integrate the routines written in C++ and executes through python. Python uses simplified wrapper and interface grabber (SWIG) for the purpose of interfacing C++ routines with python frontend application as shown in Figure 3.1 below. Very high speed integrated circuits hardware description language (VHDL) is a hardware descriptive language. This part of the code is executed in the Field Programmable Gate Array (FPGA) of front end hardware which is USRP2 in our scenario.

Figure 3.1: GNU Radio software architecture

GNU radio applications can be developed using both Object Oriented Approach and Procedural Approach depending upon the complexity of the problem under consideration. Some of the modules available in the current release of GNU Radio are shown in Figure 3.2 below:

modules.jpg

Figure 3.2: GNU Radio Modules [22]

GNU Radio Flow graphs, Sources and Sinks

Any GNU Radio application can be presented as a collection of flow graphs as in graph theory. The nodes of such flow graphs are called processing blocks. Processing blocks are the code routines written in C++. These processing blocks are tied together through flow graphs or lines connecting blocks. Data flows from one block to another through these flow graphs. All data types which are available in C++ can be used in GNU Radio applications e.g. real or complex integers, floats, etc [22]. Each block connecting one end of flow graph performs one signal processing operation for example encoding, decoding, hardware access etc. Every flow graph in GNU Radio requires at least one source or sink. Source and Sinks can be explained with the example of spectrum sensing scenario explained later in this chapter. In case of spectrum sensing our command line interface acts as sink whereas USRP2 acts as a source. When we use input command line parameters to tune USRP2 in this scenario, the interface acts as a source and USRP2 acts as a sink.

Typical Software Radio

A typical software radio consists of RF front and Analogue to Digital Converter (ADC) and Digital to Analogue Converter (DAC) interfaced with Central Processing Unit (CPU) and software. Receive and transmit path of typical software radio is shown in Figure3.3 below:

Figure 3.3: Typical Software Radio

USRP2 Architecture and Overview

USRP2 allows the creation of a software radio with any computer having gigabit Ethernet interface. It's the upgraded version of its earlier release USRP. USRP has a USB interface limiting the data throughput from USRP to Computer at a maximum bandwidth of 8MHz. The design of USRP and USRP2 is open source and all schematics and component information can be downloaded from the website of the manufacturer [2]. USRP2 contains field programmable gate arrays (FPGA) and RF transceiver board which is connected over FPGA.

The main idea behind the design of USRP is to perform all the signal processing tasks for example modulation and demodulation, filtering at the host computer. All the general purpose tasks such as decimation, interpolation, digital up conversion and down conversion are performed inside the FPGA of USRP2. The Figure below shows the image of USRP2 with RF daughter board. USRP2 contains gigabit Ethernet controller, SD card slot and MIMO expansion slot at the front end with 8 LED indicators. SD card contains the driver for USRP2 mother board and RF transceiver. It requires 5V DC and 6A to power up USRP2 [2]. The main features of USRP2 are given in table 3.

C:\Users\Hunny\Desktop\untitled.jpg

Figure 3.4: USRP2 Motherboard and RF daughter card XCVR 2450

Figure 3.5: USRP2 Front end

Table 3: Main features of USRP2

Interface

Gigabit Ethernet

FPGA

Xilinx Spartan 3 2000

RF Bandwidth

25MHz

ADC

14 bits, 100MS/s

DAC

16 bits, 400 MS/s

Daughterboard slots

1 Tx, 1 Rx

SRAM

1 MB

Power

5V DC, 3A

USRP2 Operation with GNU Radio

USRP2 operation with GNU Radio can be explained with the help of Figure 3.6. RF transceiver fetches the RF signal from real time environment and converts it to Intermediate Frequency (IF) around direct current (DC) using digital down converter (DDC). After converting it to IF the signal is passed to ADC. USRP2 contains 14-bit ADC converter which provides sampling rate of 100MS/s [2]. The ADC after sampling passes the data to FPGA. The main task for the FPGA is the down conversion of remaining frequency and data rate conversion. After processing, FPGA transfers the results to gigabit Ethernet controller which passes it over to the host computer where the rest of the signal processing tasks are performed.

In case of transmission the same procedure is repeated in reverse order. Firstly gigabit Ethernet controller of host computer passes the input parameters to USRP2. After receiving, the complex signal, digital up converter (DUC) converts the signal to IF before passing it to DAC. The DAC passes the IF converted signal to the RF transceiver where it is converted to RF signal and transmitted over the air.

Figure 3.6: USRP2 operation with GNU Radio

Chapter 4

Energy detection implementation using USRP2 and GNU Radio

Energy detection implementation using USRP2 and gnu radio

Project Setup

The project setup was created by using GNU Radio installed on Ubuntu Linux 10.10 on personal computer (PC) with the specifications; core 2 Duo, 4 GB ram, 320 GB hard drive, Gigabyte Ethernet interface and ATI Radeon 512 MB graphics card. USRP2 device was used to physically receive the signal from real time environment. The USRP2 was connected to the Ethernet port of Host PC gigabit Ethernet card through CAT6 cable carrying RJ-45 jack at both ends. The USRP2 differs from its predecessor in a way that it requires certain configurations for boot up process unlike USRP which connects through USB port. It requires certain configuration at Linux terminal to make it work with GNU Radio. First the drivers were updated for USRP2 with XCVR2450. Universal Hardware Devices (UHD) provides complete support for the drivers of USRP2 product line. UHD provides both host drivers and Application programming Interface for standalone application development without GNU radio suite. USRP2 communicates at IP/UDP layer. The default IP address for USRP2 is 192.168.10.2, so to make it work Host PC should be assigned an IP address in the same subnet, for example 192.168.10.1. When USRP2 is not assigned an IP address, it communicates with the host pc using UDP broadcast packets, so it is essential to turn off the firewall before establishing the connection with USRP2 [2]. USRP2 can be found on the terminal by entering the following command provided by UHD.

$ sudo find_usrps

00:50:c2:85:35:14 hw_rev = 0x0400

The command returns the MAC address of the USRP2 showing it is available and connected to the interface. GNU radio provides a python routine named USRP2_probe.py which acts as a software RF probe. It is a graphical user interface (GUI) application which returns the frequency range for the transceiver board and its gain in milliWatt-decibel (dBm). The output of the USRP2_probe.py for XCVR2450 dual band transceiver is given in Figure 4.1.

Figure 4.1: USRP2_probe.py Output

After connecting the USRP2 with GNU radio and bringing it to up and running condition now we can execute any GNU Radio application by writing a routine in python or by using GNU Radio Companion (GRC). The experimental setup is shown in Figure 4.2 below:

IMG_2708.JPG

Figure 4.2: Experimental Setup

In this project we developed a routine called USRP2_spectrum.py which is based on usrp_spectrum_sense.py a standard routine available in GNU Radio latest release. The routine works as a software spectrum analyzer and is flexible enough to monitor any RF spectrum. The routine provided in GNU radio libraries was written for USRP first release and has certain limitation in terms of data rate and bandwidth due to USB interface of USRP. It can only monitor a maximum of 8MHz bandwidth at any given time whereas USRP2 has a gigabit Ethernet making it flexible enough to monitor the 25MHz of bandwidth at any given time [2]. Hence we modified the routine to make it work with the USRP2.

There are some other routines (written in python) available in GNU Radio but none of these routines are flexible enough to monitor the whole spectrum for a long interval of time. One of these routines is USRP2_fft.py. This is a GUI application which takes the FFT of the received signal in real time and displays it over interface. The limitation with USRP2_fft.py is that, it only provides us with the gain at a given frequency without displaying the spectrum holes. Secondly it is a GUI application and it can only be executed using a low decimation rate, otherwise system specs should be very high. The output of the USRP2_fft.py is shown in Figure 4.3 showing the utilization of channel 1 of 2.4 GHz ISM band in BTH, Karlskrona Campus.

Figure 4.3: USRP2_fft.py output

Similarly, there is another application USRP2_rx_cfile.py. The application works as a broad band receiver, it fetches the signal from the external source environment and dumps the Digital down converter output in form of I and Q data directly into the appended file. The data collected at particular time t can be plotted using another GNU radio application named gr_plot_fft.py. The gr_plot_fft.py plots the raw data collection in terms of FFT as shown in Figure 4.4 below. USRP2_rx_cfile.py has a limitation in terms that it can only extract the data for a given center frequency as shown in Figure4.4. The Figure show the utilization of RF spectrum at 2.437GHz i.e. channel 6 of 2.4GHz ISM band.

Figure 4.4: gr_plot_fft.py output with USRP2_rx_cfile.py data file

The modified spectrum sensing routine implemented by us overcomes the deficiencies which we have mentioned in available standard routines.

Spectrum sensing Algorithm implementation

Implementation of spectrum sensing algorithm can be explained with the help of flow graph presented in Figure 4.5. Flow chart shows the flow of data from source i.e., USRP2 to SINK which is Linux command line interface in our scenario. Source i.e. USRP2 fetches the signal of the desired frequency passed to it as a tuning parameter. After passing through USRP2 the raw data bit streams are converted to vectors or arrays of data. FFT is performed on the received raw data with the help of signal processing blocks and it is passed through the Blackman-Harris window to overcome the spectral leakage effect. When the FFT routine is implemented on a non periodic data, it results into spectral leakage i.e. the energy of the signal spreads out to a larger band of frequencies. Window functions helps out in reducing the effect of spectral leakage. After performing the FFT magnitude, decimation of the data is performed. Decimation is the inverse of interpolation. Decimation reduces the sample rate of data by performing down sampling to the desired rate and send to USPR2 as a tuning parameter. After performing decimation the obtained data is appended into a file or it can be plotted on the go through a GUI tool. The data collected is in the form of FFT magnitude bins. By plotting these magnitude bins against the given frequency range the frequency envelop of the signal can be monitored to find the white spaces or spectrum holes. By taking the Power Spectral Density of received FFT magnitude bins we can use the same algorithm for wavelet detection method.

Figure 4.5: USRP2_spectrum.py flow chart

The spectrum sensing algorithm steps across the RF spectrum and takes the measurement in terms of FFT magnitude bins. The number of FFT bins, gain, decimation, time delay, dual delay and frequency range are forwarded to the USRP2_spectrum.py as tuning parameters.

The minimum number of bins is 3 and the maximum is 1024 bins. The FFT magnitude bins received at a certain frequency consist of 2 parts. First half of the bins i.e. FFT X[1] to FFT X[N/2 - 1] corresponds to the pass band spectrum from the center frequency (fc) to +Fs/2. Whereas the rest of the bins from X [N/2 - 1] to X [N-1] contains spectrum from center frequency to -Fs/2. Here X[1] represents the first bin value as shown in appendix B and X[N/2 - 1] represents the middle bin value. For example if we have 256 bins at 2402 MHz with 8MHz frequency step, the bin 0 to 127 corresponds to 2398 MHz to 2402 MHz and the rest of the bins correspond to 2402 MHz to 2406 MHz.

The gain parameter sets the gain of tuner card. By default the gain of the card is set to half of maximum gain which is 45dBm in case of XCVR2450. The time delay and dual delay parameters depends upon the decimation rate and length of FFT. By default decimation rate is set to 16 with 256 FFT bins and with time delay of 1ms. Time delay is a key parameter without setting the correct time delay the results could be altered or false. The reason for it is time delay displaying the amount of FFT frames from the source to sink should be forwarded in the defined time. Time delay for a given decimation rate and FFT size can be calculated as follows:

No. of FFT Frames = (Decimation Rate * Time delay) / FFT window Size (4)

In practice to reduce the non linear response of the DDC we performed FFT overlapping. Without FFT overlapping we were getting white spaces at the end of every sweep. We choose an overlap minimum of 25% i.e. we defined the step size to 8MHz for every step. In some cases we even choose overlapping of 0.75% to get the step size of 1MHz, so that we can get as accurate results as possible. The USRP2_spectrum.py is invoked in the following manner:

$ Sudo python USRP2_spectrum.py -a2.4G -b2.5G -g45 -d8 >rx.dat

The time delay parameter is set to 1ms in the code by default. -a represents the starting frequency and -b represents the last frequency, -g is used to set the gain parameter and-d8 represents that we are using decimation of 8.Decimation rate of 8 means that USRP2 processed 12.5MS/sec during execution of code. The USRP2_spectrum.py is provided in appendix A at the end of the thesis. The typical output of running USRP2_spectrum.py will give us the FFT magnitude bins at a given center frequency. The gain at any given center frequency can be calculated by summing the values of all the bins and by taking square root of the result. After that by taking 20*log(x), where x is the square root of the sum of the bins, we can get the result in dBm.

The experiments were carried out in Room G403 of Building2 at Blekinge institute of technology (BTH) in Karlskrona, Sweden. Most of the results were collected during the same project room except a few instances where the results were collected in the cafeteria while turning on the microwave to check the performance of the algorithm in presence of high noise.

Project Limitations

Project limitations can be classified into two categories i.e.

Hardware limitations

Energy Detection Algorithm limitations

Hardware Limitations

The results were attained using decimation rate of 8.i.e 12.5MS/sec. More precise results can be obtained by using lower decimation value. USRP2 can monitor maximum bandwidth of 25MHz. The receiver sensitivity can be increased by using a high gain antenna with the tuner card.

Energy detection Algorithm limitations

As previously mentioned energy detection based algorithms cannot differentiate between PU and SU [11]. The results are solely based on the threshold level received, or the energy level measured from the environment. Energy detection method cannot be used in a low noise setup.

The implemented routine can sense large bandwidth but not at the same time as it steps across the RF spectrum with the change in time domain.

Chapter 5

Results

Results

The raw data collected by executing the USRP2_spectrum.py routine is appended into .dat and .bin files. These file can be loaded directly into MATLAB or any other plotting tools like octave, SigView or wavelet toolbox software. All the results in this chapter are plotted using Matlab2010 and Sigview. The sample raw data extracted in the '.dat' file is shown in appendix B. The results obtained show the usage of 2.4GHz WiFi channels in the campus as well as free channels and spectrum holes. The results are collected using both 2.4 GHz ISM band and 5.8 GHz ISM band. The 5.8 GHz band is not used within the campus environment which can easily be observed by looking at frequency and magnitude plot. We have used three different types of plots to verify our results. These are frequency, magnitude and time, frequency, gain 3-dimensional (3D) plots and time, frequency spectrograms.

Figure 5.1 shows the results obtained for 2.4GHz ISM band by using a frequency step of 20MHz i.e. the above defined routine steps across the ISM band in steps of 20MHz starting from 2.4GHz and ending at 2.502G. As it can be observed from the graph, it is hard to find the exact channel utilization of 802.11 WiFi spectrum due to large sweeps across the spectrum. Figure 5.3 shows the same results in 3-dimensions (3-D) by using another axis for time. The advantage of time axis is that we can monitor the results at any given instance of time.

20mhzmagnitude.jpg

Figure 5.1: FFT magnitude plot for 2.4GHz band with 20MHz frequency step

20mhzgain.jpg

Figure 5.2: Frequency vs. Gain plot for 2.4-2.5GHz ISM band

20mhz2dplot.jpg

Figure 5.3: Time, Frequency, and Gain 3D plot for 2.4GHz-2.5GHz using 20MHz frequency step

The results obtained using a smaller step of 10MHz is shown in Figure 5.4. We can easily find the channel utilization of campus WLAN by looking at Figure 5.4 and Figure 5.5. The spikes around 2.43x109 Hz in the plot show the use of Channel 7 at the time of data collection. Frequency and magnitude plots provide us gain at a given frequency but still it's not good enough to find the threshold level or to decide which part of spectrum is free because it does not has the time-axis. For this purpose we have used spectrograms.

10mhzmagdb.jpg

Figure 5.4: Frequency and Magnitude plot with 10MHz step

10mhzgain.jpg

Figure 5.5: Frequency and Magnitude plot with 10MHz step at 2.4GHz ISM band

10MHz3d.jpg

Figure 5.6: Time, Frequency, Magnitude plot using 10MHz step

Spectrogram shown in Figure 5.7 displays the time frequency relationship with respect to gain. The color bar presented at the right side of the plot shows the different level of energy or gain values. To find the spectrum holes or availability at the defined threshold at any instant, we can compare the color with time and frequency axis. The color red in this

10MHz spectrogram.jpg

Figure 5.7: Spectrogram plot using 10MHz step

Spectrogram shows the spectrum holes or underutilized bandwidth at a given instance of time and Frequency. Due to large frequency step it is hard to differentiate between the colors and it is hard to find the white spaces at the exact location.

To gather even more accurate results we repeated the experiment with 5 MHz frequency step and sweep across the spectrum again. The results obtained are shown in Figure 5.8-5.10. Here we can easily observe the use of channel 1,6,11 in the campus WLAN environment by looking at Figure 5.8 and Figure 5.9.

5mhzgain.jpg

Figure 5.8: Frequency vs. magnitude plot with Frequency step of 5MHz

The spectrogram given in Figure 5.10 is more precise in terms of clarity showing spectrum holes in terms of red tiled surface in the presence of other colors representing different gain values of energy spectrum.

5mhz3d.jpg

Figure 5.9: Time, Frequency, gain 3D plot with frequency step of 5MHz

5Mhzspectrogram.jpg

Figure 5.10: Spectrogram plot using 5MHz step

Similarly we gathered the results using 1MHz step. The results obtained are shown in Figure 5.11 and Figure 5.12 showing the utilization of channel 1, 7 and 11 in the WiFi network of the campus.

1MHZgain.jpg

Figure 5.11: Frequency Vs. Gain plot using 1MHZ step

1MHZ3d.jpg

Figure 5.12: Time, Frequency, Gain 3D plot using 1MHz step

To check the limitations of our project we conducted another experiment by placing the USRP2 and host PC near microwave ovens to check if energy detection method is susceptible to the high signal strength environment or not. The results attained are shown in Figure 5.13, 5.14 and 5.15. The results clearly show increase in gain in less than 1 second. We received gain values as high as 50dBm and energy detection algorithm didn't identify any other WiFi channel though the university café is a hotspot and it has a number of wireless routers placed in the vicinity. The spectrogram in Figure 5.15 shows the use of only microwave oven frequency i.e. 2.45 GHz in different colors the rest of the frequency range is red proving microwave frequency magnitude to be high enough to suppress any other signal in the vicinity of cafeteria.

microgain.jpg

Figure 5.13: Frequency Vs. Gain plot @ 2.45 GHz microwave oven range

micro3d.jpg

Figure 5.14: Time, Frequency, Gain 3D plot @ microwave oven frequency

microspectrogram.jpg

5.15: Spectrogram for microwave oven frequency

.

ad58gain.jpg

Figure 5.16: Frequency vs. gain plot for 5.8GHz ISM band

ad583d.jpg

Figure 5.17: Frequency, Time, Gain plot for 5.8GHz ISM Band

58_spectrogram.jpg

Figure 5.18: Spectrogram for 5.8GHz ISM band

Final experiment was conducted over 5.8GHz ISM band. Since 5.8GHz frequency band is not used inside the campus, the whole spectrum range appears as white space or underutilized. It can be observed by looking at the Figure 5.17-5.18. A few colored spots in the spectrogram are due to the thermal noise or other hardware noise figure.

Chapter 6

Conclusion and Future Work

Conclusion and Future work

The report presents implementation of energy detection and wavelet based spectrum sensing implementation and analysis of different spectrum sensing techniques. Different experiments were performed to find out the spectrum holes in the occupied 2.4GHz ISM band. The raw data collected by USRP2_spectrum.py is plotted using different plotting techniques to find the spectrum holes. The qualitative analysis of different spectrum sensing methods shows that energy detection is the most reliable and authentic method for the spectrum sensing. The raw data collected in the form of FFT bins is the most efficient way of collecting data for spectrum sensing as it requires just a few signal processing operations. Rest of the work is performed inside the USRP2, This is closest one can get to the hardware for precise results. The results obtained proved that it is possible to find the underutilized bandwidth in a spectrum without having prior knowledge of PU and SU. Wavelet methods though often used in astronomy and acoustics can be used to identify the spectrum holes as shown in the result by plotting spectrograms. The threshold level for any given spectrum of frequencies depends upon several factors such as receiver sensitivity and the number of energy transmitting/receiving nodes.

Future work

Cognitive radio is relatively new area of research as compared to the rest of communication theory. There are several other methods of spectrum sensing which need to be explored. Energy detection method results can be improved through the use of the Multiple Input Multiple Output (MIMO) approach. This can be done by connecting multiple USRP2 together and sensing the spectrum for a large area. Another way to sense the spectrum is by using cooperative communication and by taking antenna diversity and other factors under consideration. This study could be extended by repeating the same experiment for licensed frequency bands and the results obtained can be compared with ISM band results to get the better understanding of the area of research.

Writing Services

Essay Writing
Service

Find out how the very best essay writing service can help you accomplish more and achieve higher marks today.

Assignment Writing Service

From complicated assignments to tricky tasks, our experts can tackle virtually any question thrown at them.

Dissertation Writing Service

A dissertation (also known as a thesis or research project) is probably the most important piece of work for any student! From full dissertations to individual chapters, we’re on hand to support you.

Coursework Writing Service

Our expert qualified writers can help you get your coursework right first time, every time.

Dissertation Proposal Service

The first step to completing a dissertation is to create a proposal that talks about what you wish to do. Our experts can design suitable methodologies - perfect to help you get started with a dissertation.

Report Writing
Service

Reports for any audience. Perfectly structured, professionally written, and tailored to suit your exact requirements.

Essay Skeleton Answer Service

If you’re just looking for some help to get started on an essay, our outline service provides you with a perfect essay plan.

Marking & Proofreading Service

Not sure if your work is hitting the mark? Struggling to get feedback from your lecturer? Our premium marking service was created just for you - get the feedback you deserve now.

Exam Revision
Service

Exams can be one of the most stressful experiences you’ll ever have! Revision is key, and we’re here to help. With custom created revision notes and exam answers, you’ll never feel underprepared again.