# SDR Based Energy Detection Spectrum Sensing in Cognitive Radio for Real Time Video Transmission

Authors: Rupali B. Patil; K. D. Kulat; A. S. Gandhi
Journal: Modelling and Simulation in Engineering
 (2018)

---

## Abstract

Cognitive radio is a budding approach which helps to address the imminent spectrum crisis by dynamic spectrum allocation and support the increased data traffic with an intelligent mechanism of Software Defined Radio (SDR). SDR avoid the frequent modifications in the hardware structure with the use of software defined protocols. The main novelty of the paper is an effective implementation of CR using energy based spectrum sensing method which is done on GNU radio for real time transmission of video as a primary user. From evaluation results, one can see that the proposed system can indicate the frequency band occupancy by setting the detection output. Detection output changes to one with start of video transmission. Motivation behind this work is design of a spectrum sensing method which is best suited for detection of white spaces during the transmission of video as a primary user on SDR platform.


---

## Body

## 1. Introduction

According to spectrum, survey conducted by the Federal Communication Commission (FCC) has indicated that the actual licensed spectrum is not utilized properly for various time, frequency, and geographical locations [1]. Also the demand of allocating and using the radio frequency spectra is rapidly growing due to increasing number of wireless applications [2]. An unlicensed user or secondary user may utilize this band when licensed user is absent. To encourage the proficient use of spectrum, concept of cognitive radio (CR) has been proposed in [3]. CR fundamentals and the challenges involved in dynamic spectrum allocation and sharing in CR are discussed in [4]. CR allows opportunistic usage of frequency bands that are not used by licensed users. Thus, CR relies on efficient spectrum sensing to detect vacant spectrum bands. Also deployment of new wireless devices and applications has increased more expensive hardware structure to be dealt with these types of signal processing. So, this requires reconfigurable hardware platforms. A best solution to these problems is SDR platforms. GNU radio along with SDR provides the cost effective and flexible platform. A major challenge for SDR is to equal the proficiencies of purely hardware solutions while providing intelligence that software can offer. The employment of GNU radio and Universal Software Radio Peripheral (USRP) for developing software based wireless transmission system, that is, SDR, is discussed in [5]. CR is having the capability to optimally adapt their operating parameters according to the trades of the surrounding radio environment. CR can detect the spectrum white space, that is, a portion of frequency band that is not being used by the primary users (licensed users) and utilize the same for secondary user (SU) transmission. But when licensed users start using the spectrum again, CR can detect their activity through spectrum sensing and hold the transmission generated due to secondary user’s transmission. Moreover, the ability of CR to identify and exploit the unused spectrum band allows them to coexist with inheritance radio systems, improving spectrum utilization without impairing the primary users (PU). So mainly CR comprises two types of users. First one is PU who has the license to use the given frequency band and second one is SU who is not a licensed user of the given frequency band but can use band whenever it is vacant. As soon as the PU or licensed user returns to the frequency band, SU has to vacate it and find another vacant frequency band. To detect whether a frequency band is unoccupied or not, SU needs to perform spectrum sensing. So sensing is identified as the key aspects of a CR which means a CR must be able to identify the unused spectrum band. Competencies of CR are combined with SDR. SDR enhances the functionality of CR through smart mechanism using GNU radio that would automatically reconfigure the radio parameters and senses the spectrum. There are various detection techniques available for spectrum sensing. The momentous amount of study is performed on spectrum sensing for CR based system in [6]. Energy detection constitutes a favored approach for spectrum sensing in CR due to its simplicity and applicability. The traditional energy detection technique [7], which is based upon fixed threshold, is sensitive to noise uncertainty which is unavoidable in practical cases. So in this paper, an efficient energy detector is proposed for optimum CR performance. In the proposed scheme, under a practical scenario, some parameters are measured and these parameters are used to calculate the threshold of energy based sensing method. The purpose of thresholds calculation is to maximize the probability of detection (PD) and minimize the probability of false alarm (PFA). Theoretical analysis and simulation results show the efficiency of the proposed scheme in comparison to the traditional energy detection method with less increase in complexity.Also data traffic in air has increased beyond limit which develops the growing demand for the transfer of data, images, and video using the same medium which is used for voice transmission. So for testing instead of random data real time video signal is transmitted and at the receiver CR based energy detection of this video signal is done. This video signal is acting as a primary user and energy detector is able to detect the availability of this video signal on given frequency by setting parameter detection output.Most research currently emphasizes on spectrum sensing in CR, but theoretical detection algorithms are not enough. As discussed in [8], SDR is an important convenient base technology for the future context-sensitive, adaptive, and learning radio units referred to as CRs. SDR requires the blending of software-based signal processing and the enabling hardware components. The overview of the criteria for such platforms and the current state of development and upcoming trends in this area are presented in [9].A hardware test platform is required to test and check the performances of the CR. This problem can be resolved using emergent technology of SDR which gives easiness in the implementation process by replacing the hardware by software in addition to cost effectiveness. Several benefits like faster execution time and extensibility to meet new requirements are given by SDR.A large number of experimental SDR platforms are available to support individual research projects [10]. GNU radio [11] is one of the most popular and an interesting software platform for radio network which is introduced by Blossom. It is a free software toolkit for building software radio and is compatible with SDR kits [12]. The whole GNU radio project is available under GNU license which does not limit free use of GNU radio components in research projects. This GNU radio project contains a large library of functions written in C++/python language for the SDR system and the library of several basic components for implementing basic functions of a digital radio receiver. Moreover, GNU radio is designed to work with an inexpensive hardware device.For testing of the above project SDR-Lab kits having transmit and receive frequency range of 0.4–4 GHz are used. The SDR-LAB is a powerful software programmable hardware transceiver.To support high date rate and good spectral efficiency are the requirements in the case of transmitting multimedia data. Gaussian Minimum Shift Keying (GMSK) is a modulation scheme which proves to be effective in wireless scenario. GMSK is derived from Minimum Shift Keying (MSK) which replaces the rectangular pulse with a sinusoidal pulse. This method will apply Gaussian filter for pulse-shaping. A Gaussian-shaped impulse response filter has an advantage that it generates a signal with low side lobes and narrower main lobe than the rectangular pulse. As it uses Gaussian filter for pulse-shaping, this modulation is called GMSK modulation. The relationship between the premodulation filter bandwidth,W, and the bit period, Tb, defines the bandwidth of the system. Global System for Mobile Communications (GSM) designers used a WTb=0.3. This compromises between a bit error rate and an out-of-band interference since the narrow filter increases Intersymbol Interference (ISI) and reduces the signal power [13]. The GMSK modulation has been preferred for video transmission in wireless communication because it compromises between spectrum efficiency, complexity, and low spurious radiations which lessen the possibilities of adjacent channel interference.The paper is organized as follows. Section2 contains system outline. Section 3 considers theoretical aspects of energy based spectrum sensing. In Section 4 we investigate energy based spectrum sensing method on SDR for detection of primary user’s presence and its implementation issues. Section 5 is dedicated to theoretical analysis and numerical calculation of threshold. Section 6 presents the results from energy detector sensing method. Finally, conclusions and future scope are presented in Section 7.


## 2. System Outline

A block diagram of the CR-GMSK system considered in this article is shown in Figure1. The cognitive engine is responsible for making intellectual decisions and configuring the radio and physical layer (PHY) parameters. The transmission prospects are identified by the decision unit based on the information from the policy engine, as well as local and network spectrum sensing data. As far as the PHY layer is concerned, CR can communicate with various radio-access technologies in the environment, or it can improve the quality of communication depending on the environmental characteristics, by simply changing the configuration parameters of the GMSK system and the SDR interface. Note that spectrum sensing and detection is done on single carrier frequency.Figure 1
Overall system block diagram.The overall block diagram of transmitter and receiver for energy based spectrum sensing is shown in Figure2. The input to the system is a real time video captured by webcam and modulated by GMSK. It is processed through the code written in python language using GNU radio software. After this processing it is transmitted wirelessly on 1.234 GHz frequency using a SDR-LAB device. The receiver is tuned to transmitted frequency. Transmitted signal is received by another SDR-LAB Trans receiver which hands over the incoming information to the GNU radio software which has two parts; one is GMSK demodulation used for detection of video signal and another is energy based spectrum sensing which gives detection output along with signal to noise ratio (SNR) calculations. We are trying to display the received video and simultaneously trying to detect the white spaces at this frequency using energy based spectrum sensing. Testing is done by switching the video transmission on and off.Figure 2
Overall block diagram transmitter and receiver for energy based spectrum sensing.Project setup with SDR-Lab with Laptop is shown in Figure3. One SDR connected to laptop is acting as transmitter and the other is acting as receiver.Figure 3
Project setup for transmitter and receiver of energy based spectrum sensing.


## 3. Theoretical Aspects of Energy Based Spectrum

Energy detection is the simple spectrum sensing method because it is easy to implement and requires no prior knowledge about the primary signal. Let us assume the hypothesis model of the received signal given by the following:(1)H0:zt=nt,H1:zt=hxt+nt.Here x(t) is the primary user’s signal to be detected at the local receiver of a secondary user, n(t) is the additive white Gaussian noise, and h is the channel gain from the primary user’s transmitter to the secondary user’s receiver. H0 is a null hypothesis which means there is no primary user present in the band, while H1 means the primary user’s presence. The detection statistics of the energy detector can be defined as the average energy of N observed samples ztand is given by(2)T=1N∑t=1Nzt2.The decision regarding the occupancy of the spectrum is given by comparing the detection statistics with a predetermined threshold (λ). PFA, the probability of false alarm, and PD, the probability of detection, are two probabilities which are used to characterize the performance of the detector. PFA denotes the probability that the test decides H1, while it is actually H0 given by(3)PFA=PrT>λ∣H0.PD denotes the probability that the test correctly decides H1, given by(4)PD=PrT>λ∣H1.A good detector should ensure a high detection probability PD and a low false alarm PFA, or it should optimize the spectrum usage efficiency. The efficiency of energy detector based spectrum sensing can be improved by the development of various approaches.An efficient energy detector is proposed in which under a practical scenario some parameters are measured and these parameters are used to calculate the threshold for this system. Design of this energy detection uses a squaring device followed by an integrator, the output of which gives the decision variable. This variable is then compared with a threshold and if it is above the predefined threshold, then the result of the detector specifies that a PU is present. An energy detector sets a threshold according to the noise floor and compares it with the energy of the data stream in input. The input signal selects the required bandwidth by a band pass filter; then it is sampled. The digital implementation of this method uses the Fast Fourier Transform (FFT), so the absolute value of the samples is squared and integrated over the observation band. Finally, according to a comparison between the output of the integrator and threshold, the presence or absence of the primary user can be detected. The block diagram of this method is given in Figure4.Figure 4
Block diagram of energy based spectrum sensing.


## 4. Energy Based Spectrum Sensing on SDR

The GNU radio based transmitter flow graph shown in Figure5 is designed to transmit a real time video signal which is acting as a PU. The modulation used for the transmission for this video signal is GMSK. This wirelessly transmitted signal is received by the GNU radio based receiver shown in Figure 6. The design of the receiver flow graph is done as per the block diagram shown in Figure 4. To measure the signal energy, selected band data is sampled with stream to vector, complex to mag blocks which perform the task of squaring and averaging. Further it is compared with a predefined threshold. The sensing method gives the output of PU signal detection by setting output flag named detection output and calculation of SNR with an assumption that no user other than PU is present on the channel. SU transmission is decided based on the detection output flag status of the PU.Figure 5
Transmitter flow graph for video transmission designed using GNU radio.Figure 6
Receiver side flow graph for video reception and detection of signal designed using GNU radio.


### 4.1. Transmitter Side Implementation

The flow graph of transmitter is shown in Figure5. The process which is followed for the implementation and execution firstly opens the terminal window using keyboardsctrl + alt + T. Type GNU radio companion (GRC) in opened window. In untitled GRC window, double click on the option block. Set the parameters for the flow graph. And open the other block named variable in flow graph and set the sample rate value. Generate a flow graph as per shown in Figure 5 ofTx_video, by simply putting already generated GNU blocks in GNU radio companion window. To transmit a live video from webcam, input to the GMSK modulator block is fed through File Sink. To specify the rate at which the frames are to be transmitted and their size, create a new shell fileVideo_tx.sh in home folder. This file when executed will create a queue of First In First Out (FIFO) type to transmit data. Execute this file later on. Open the file operators category and double click on file source.Set the address and arrange the overall flow-graph to complete video transmitting section of GMSK modulator. Now execute the Shell FileVideo_tx.sh and then execute this flow graph by pressing F6.


### 4.2. Receiver Side Implementation

The flow graph of receiver is shown in Figure6. The process which is followed for the implementation and execution on receiver side is creating a file calledVideo_rx.sh in the home folder with instructions to generate queue to receive the data in FIFO manner and store the received video with extensionfilename.ts. Then open a terminal window usingCtrl + alt + T. At the receiver side terminal, typegnuradio-companion. Then double click on options block set the parameters and close the properties window. Open the other block named variable in flow graph and set the sample rate value as 1e6. Arrange all the blocks and logically connect them as per the flow graph as shown in Figure 6.Then open another command prompt and type the following command after the $sign./Video_rx.sh.Execute the flow graph by pressing F6. Receiver side flow graphs have added blocks required for demodulation as well as the implementation of energy sensing based spectrum sensing as per the block diagram shown in Figure4.


## 4.1. Transmitter Side Implementation

The flow graph of transmitter is shown in Figure5. The process which is followed for the implementation and execution firstly opens the terminal window using keyboardsctrl + alt + T. Type GNU radio companion (GRC) in opened window. In untitled GRC window, double click on the option block. Set the parameters for the flow graph. And open the other block named variable in flow graph and set the sample rate value. Generate a flow graph as per shown in Figure 5 ofTx_video, by simply putting already generated GNU blocks in GNU radio companion window. To transmit a live video from webcam, input to the GMSK modulator block is fed through File Sink. To specify the rate at which the frames are to be transmitted and their size, create a new shell fileVideo_tx.sh in home folder. This file when executed will create a queue of First In First Out (FIFO) type to transmit data. Execute this file later on. Open the file operators category and double click on file source.Set the address and arrange the overall flow-graph to complete video transmitting section of GMSK modulator. Now execute the Shell FileVideo_tx.sh and then execute this flow graph by pressing F6.


## 4.2. Receiver Side Implementation

The flow graph of receiver is shown in Figure6. The process which is followed for the implementation and execution on receiver side is creating a file calledVideo_rx.sh in the home folder with instructions to generate queue to receive the data in FIFO manner and store the received video with extensionfilename.ts. Then open a terminal window usingCtrl + alt + T. At the receiver side terminal, typegnuradio-companion. Then double click on options block set the parameters and close the properties window. Open the other block named variable in flow graph and set the sample rate value as 1e6. Arrange all the blocks and logically connect them as per the flow graph as shown in Figure 6.Then open another command prompt and type the following command after the $sign./Video_rx.sh.Execute the flow graph by pressing F6. Receiver side flow graphs have added blocks required for demodulation as well as the implementation of energy sensing based spectrum sensing as per the block diagram shown in Figure4.


## 5. Theoretical Analysis and Numerical Calculations of Threshold

To decide the threshold value for energy based spectrum sensing for flow graph shown in Figure6 is another challenging task. So there is a necessity to carry out the theoretical analysis and numerical calculations based on the practical conditions. The essence of energy based spectrum sensing is a binary hypothesis testing problem. Theoretical analysis is done for the same as follows:(5)yn=wnunderH0xn+wnunderH1,where y(n), x(n), and w(n) are the received signals at CR nodes, transmitted signals at primary nodes, and white noise samples, respectively. The above two hypotheses are taken to decide the signal is present or not. The w(n) noise is assumed to be additive white Gaussian noise (AWGN) with zero mean and is a random process. The signal to noise ratio is(6)SNR=SpowerNpower,where Spower is signal power and Npower is noise power.The energy detection algorithm is semiblind detection under the assumption of absolutely no deterministic knowledge about the signalx(n). Let us assume that we know only the average power of the signal. The optimal detector is the correlation detector [14]. The decision model is(7)Dy=1N∑n=0n-1ynxn>γunderH11N∑n=0n-1ynxn<γunderH0,where D(y) is decision variable and γ is the threshold. If the noise variance is completely known then from Central Limit Theorem, the following approximation can be made(8)DyH0=Nσn2,2σn4N,DyH1=NP+σn2,2P+σn22N,where P is the average signal power, N are the number of samples, and σn2 is the noise variance. N symbol is used for approximation. The energy detector decides H1 if(9)Tx=∑n=0N-1x2n>γ.If N is large, then T(x) can be approximated by a Gaussian random variable since it is the sum of N independent, although not identically distributed, random variables. Thus, we need only to find out first two movements to characterize the detection performance. To do so(10)T′x=Txσ2=x2nunderH0x2λunderH1,where λ=∑n=0N-1s2n/σ2=ϵ/σ2.This is because underH1(11)T′x=∑n=0N-1sn+wnσ2.And hence mean of x(n)/σiss(n)/σ. Using the properties of chi-squared random variables we have(12)ET′x;H0=N,ET′x;H1=λ+N,var⁡T′x;H0=2N,var⁡T′x;H1=4λ+2N.PFA, the probability of false alarm, and PD, the probability of detection, are given by(13)PFA=Qγ′/σ2-N2N,(14)PD=Qγ′/σ2-λ+N4λ+2N,where Q(·) is the standard Gaussian complementary Cumulative Distribution Function (CDF) and γ′ is the threshold which is γN.RearrangingPD(15)PD=Qγ′/σ2-λ-N4λ+2N.Rearranging and multiplying and dividing by 2N(16)PD=Qγ′/σ2-N2N/2N-λ4λ+2N.Taking Q-1 of PFA in (13),(17)Q-1PFA=Q-1Qγ′/σ2-N2N,(18)Q-1PFA=γ′/σ2-N2N.Putting (18) in (16), modified equation of PD is(19)PD=Q2NQ-1PFA-λ4λ+2N,PD=QQ-1PFA-N/2λ/N1+2λ/N,where Q-1(·) is the inverse standard Gaussian complementary CDF. The last approximation is valid for large N. Finally we have(20)PD=QQ-1PFA-N2λN,PD=QQ-1PFA-λ22N.This equation will be recognized as the performance of the Neyman-Pearson detector. Thus, threshold formula for the energy detector based on the probability of the false alarm PFA is derived as given in(21)γ′=Q-1PFA×2N+N×σ2.Under the practical condition some parameters are measured and these parameters are used to calculate the threshold of the project. The gain of the RF signal and energy of the signal are selected as 10 and 0.0364, respectively. Also number of samples are taken as 150000. The variance is calculated as per (22):(22)σ2=1N∑n=0N-1x2n,(23)σ2=0.0364150000=242.67×10-9.Put σ2 in(24)γ′=Q-1PFA×2N+N×σ2,γ′=0.0889×2×150000+150000×242.67×10-9,(25)γ′=0.0336.The threshold calculated in (25) is set in flow graph of receiver side energy based spectrum sensing for detection of video signal.


## 6. Results of Energy Detection Method

The energy detection spectrum sensing in cognitive radio is implemented efficiently with GNU Radio and SDR-LAB kit for the real time video signal acting as a primary user.The input real time video captured by webcam is modulated by GMSK. This processing is done on transmitter side in GNU radio. The detection algorithm is implemented in GNU radio on receiver side as per the the block diagram shown in Figure4. Initially transmitted frequency is set at 1.2345 GHz but we can also adaptively change the frequency of transmission. This transmitted video signal is received by another SDR-LAB transreceiver which is tuned to transmitter, processed using GNU radio and GMSK demodulated. It is also played using VLC media player simultaneously. The same received video signal is also given to energy based spectrum sensing blockset designed using GNU radio software. The code is written in python. The threshold calculated in (25) of Section 5 is used in thethreshold block of GNU radio receiver side flow graph for the detection of the real time video signal.Energy based spectrum sensing block gives the output of video signal detection in the form of flag nameddetection output. The SNR and energy of signal are also measured on receiver side for the transmitted video signal with the help of energy detector spectrum sensing method. If video is present energy of the signal becomes higher than the threshold anddetected outputbecomes one. But if the signal transmission stops then the energy of the signal becomes less than threshold anddetected output becomes zero. Here video signal is acting as primary user. This shows successful implementation of energy based detector which detects the primary user’s presence on given frequency by setting thedetection output. Fast Fourier Transforms (FFT) and scope plots are used to observe the signals at each point. Initially the working of only energy detector is also tested under noise condition with no signal; results clearly show that noise is detected as no signal present by thedetection outputflag in Figure 7. Figure 8 shows the results when video transmission stops with status ofdetection outputand energy of the signal. Thedetection output and the energy of the signal becomes zero as transmission of video stops, while Figure 9 shows the result of energy detector when the video transmission is going on. The detector output is one and energy of received signal is measured at the output when the video transmission is going on. Figure 10 shows the FFT plot specifying amplitude in decibel (dB) versus frequency (KHz) at 1.23 GHz. The received signal is represented with FFT plot in GUI of GNU radio companion. The results of the energy detector are tested and verified by varying the distance between transmitter and receiver from one to ten meters.Figure 7
Energy based detector output is zero under only noise no signal condition.Figure 8
Energy based detector output is zero as the transmission stops.Figure 9
Energy based detector output is one as the transmission starts.Figure 10
Spectrum of received signal (FFT plot).


## 7. Conclusion and Future Scope

GNU radio based innovative approach has been designed for detection of transmitted live video using energy based spectrum sensing of CR and implemented on SDR platform. Transmitted signal is modulated with GMSK and energy detector is implemented successfully with averaging blocks. In conclusion, this work has produced a significant amount of theoretical and algorithmic results for energy detector; moreover, the SDR implementation along with GNU radio offers a set of tools that allow the creation of a realistic CR system with real time spectrum sensing capabilities. So we have successfully designed and implemented CR based communication system for real time video transmission.Future work focuses on experimentation of same spectrum sensing techniques for improving the performance in cognitive radio and also finding out the one which is more suitable to work in wireless environment. Further this can be extended for simultaneous transmission of multiple signals and use of multiple frequency bands. Also this work will be quite helpful for implementation of real time projects such as traffic control which can use this spectrum sensing method for wireless transmission and detection of traffic video signals data from multiple signal posts to one master check post. This can be further transferred to control unit which will use this information for controlling the traffic. So decisive aim of this system is design and implementation of CR based traffic control system for real time video transmission.



---

*Source: 2424305-2018-04-29.xml*