You are on page 1of 6

Spectrum Sensing Based on Time Covariance Matrix

Using GNU Radio and USRP for Cognitive Radio


Abhijeet Mate, Kuo-Hao Lee, and I-Tai Lu
Department of Electrical and Computer Engineering,
Polytechnic Institute of New York University, Brooklyn, New York, USA
amate01@students.poly.edu, klee03@students.poly.edu, itailu@poly.edu
Abstract— Cognitive radio (CR) is a critical issue to solve the unused segments then can be used by secondary user without
spectrum scarcity and to improve frequency spectrum utilization interfering the primary user. Therefore, CR needs precise
in wireless communication. Spectrum sensing is the first step for algorithms to find the presence of primary signal in a given
cognitive radio and it needs to detect signals presence under strict frequency band to avoid the collision.
requirement such that secondary users (unlicensed users) can use Detecting the presence of primary signal, i.e., Spectrum
the licensed spectral band without interfering primary users
Sensing is practically a challenging task in CR. There are
(licensed users). In this paper, we implement spectrum sensing in
real environment and verify two present algorithms based on the different methods proposed for spectrum sensing [2] but they
time-covariance matrix. For the capability of sensing the have limitations and requirements in real environment. Fading
spectrum, we make use of Software Defined Radio (SDR), which or increased distance between transmitter and receiver makes
provides the ability to modify the hardware characteristics of the the primary signal power near to the ground. Very low Signal
system and the flexibility for programming. Moreover, GNU to Noise Ratio (SNR) e.g. -20dB makes detection harder. Also
Radio is an open source software toolkit which provides different detection of signal in short duration is another task.
functions that supports SDR. The need for low cost hardware Importantly, there is no prior information for the noise power
platform for an SDR necessitated development of Universal and that makes all above situations more difficult in real
Software Radio Peripheral (USRP). Combining GNU Radio and
environment [3].
USRP, can be a very powerful tool to develop SDR based wireless
communication systems and to carry out various experiments There are various spectrum sensing methods available [2]
and testing. With the premise of high correlations of primary such as Energy Detection, Matched Filtering, Cyclostationary
users and low correlations of additive white Gaussian noise Detection etc. Energy Detection (ED) is a widely used method
(AWGN) between two different samples, we evaluated two kinds because of its low complexity and it does not need information
of present methods based on time-covariance matrix called of the primary signal. But ED is vulnerable to noise
Covariance (COV) method and Maximum-to-Minimum uncertainty and performs poor as compared to other methods
Eigenvalue (MME) method. To combat the noise uncertainty, at low SNR [4] [5]. Maximum to Minimum Eigenvalue
COV uses the ratio between the time correlation and the signal method (MME) [6] and Covariance method (COV) [7] are the
energy as the signal detection indicator; and MME uses the ratio
methods which overcomes the difficulty with ED. MME
of maximum to minimum eigenvalues of the covariance matrix to
detect the signal presence. We analyze the performance of these method uses the covariance matrix of the received samples to
methods on GNU radio with USRP. Unlike energy detection find the eigenvalues and then the ratio between maximum and
(ED), COV and MME can do spectrum sensing without any prior minimum eigenvalue is compared with the threshold to make
knowledge of primary signal and noise power. Furthermore, it the decision. COV also uses statistical covariance of the
can combat noise uncertainty, of which ED is devoid. We present received samples and makes the decision. Both these methods
the performance of these two methods compared with ED for overcome the noise uncertainty problem and do not require
BPSK modulation as a primary signal to check the feasibility of knowledge of primary signal, channel and noise power.
these two algorithms. Performance of both COV and MME methods has been
Keywords: Cognitive Radio, Energy Detection, Covariance checked through simulation but it is important to check their
Method, Eigenvalue Based Method, GNU Radio, Software Defined feasibility in real environment. In this paper, we implement
Radio, Spectrum Sensing, USRP. spectrum sensing in real environment and verify both COV
and MME methods. The performance of COV and MME
I. INTRODUCTION
method is compared with the ED method. For the capability of
The demand for wireless communication capacities is sensing the spectrum, we make use of Software Defined Radio
continuously growing and there is a limitation on the spectrum (SDR), which is getting popular in wireless technologies. SDR
availability. So it is important to make use of the available provides the ability to modify the hardware characteristics of
spectrum efficiently by making use of underutilized frequency the system and the flexibility for programming. Moreover,
bands. Technology that holds the key to solve this spectrum GNU Radio [8] is an open source software toolkit which
scarcity problem is called as Cognitive Radio (CR) [1]. It is a provides different functions that supports SDR. The need for
technology that is capable of dynamically sensing and locating low cost hardware platform for an SDR necessitated
unused spectrum segments in a target frequency band. These development of Universal Software Radio Peripheral (USRP)

978-1-4244-9877-2/11/$26.00 ©2011 IEEE


[9]. Combining GNU Radio and USRP, can be a very systems and to carry out various experiments and testing.
powerful tool to develop SDR based wireless communication
research and real time implementation of software radio
The rest of the paper is organized as following: systems [12]. Signal processing blocks are written in C++
Fundamental background information about Software Defined programming language. Python is used to connect these signal
Radio, GNU Radio and USRP is provided in Section II. processing elements together to form a flow graph. Python
Spectrum sensing algorithms are presented in Section III. uses simplified wrapper and interface grabber (SWIG) for the
Section IV explains the experimental setup and detail purpose of interfacing C++ routines with python front end
implementation of the experiment. Experiment results and applications.
performance comparison of all three methods are presented in Connected through USB interface to GNU Radio, USRP
Section V. Conclusions are drawn in Section VI. consists of a motherboard and up to four daughterboards. It is
developed by Matt Ettus [9] as a flexible low-cost platform for
II. SOFTWARE DEFINED RADIO (SDR)
SDR. It can function as both transmitter and receiver for
SDR is a radio communication system where different different frequencies depending on the daughterboards.
components (e.g. amplifiers, mixers, filters, modulator, Motherboard has four 12-bit Analog to Digital Converters
demodulator etc.) are implemented in software instead of (ADCs) with sampling rate 64 MS/s, four 14-bit Digital to
hardware (see Figures 1-3). In SDR, the operating parameters Analog Converters (DACs) with speed up to 128 MS/s, two
of frequency range, modulation type, or maximum output Digital Up Converters (DUCs) to up convert the baseband
power (either radiated or conducted), or the circumstances signal before transmitting it to the selected output frequency
under which the transmitter operates in accordance with and four Digital Down Converters (DDCs) to decimate IF
Commission rules, can be altered by making a change in before sending it to ADC. ADC and DAC are connected to an
software without making any changes to hardware Altera Cyclone EP1C12 FPGA. FPGA is connected to a USB2
components that affect the radio frequency emissions [10, 11]. interface chip and to GNU Radio [13]. High speed digital
In this paper, SDR is implemented using GNU radio and signal processing (DSP) is performed in the FPGA [13]. USRP
USRP. is capable to operate in full duplex mode in real time.
RF Front-end IF Section Baseband Daughterboards are mounted on motherboard providing a fully
Section flexible integrated front-end. Wide varieties are available to
use different frequencies for a broad range of applications.
DUC DAC

DSP

DDC ADC

Figure 1. Software Defined Radio Figure 3. Universal Software Radio Peripheral (USRP)

III. SPECTRUM SENSING ALGORITHMS


C ++ C ++ C ++ Spectrum sensing can be described as how to distinguish
G
Python Glue N signals existence with absence. However, the approaches can
U be divided into two categories: blind test or non-blind test. The
SWIG prior knowledge sometimes will be sent by transmitter which
R
a contained useful information for non-blind approaches.
C ++ C ++ Signal Processing
d However, the channel state information is not always
i
Blocks o available; this paper considers the blind approaches. We first
C ++ define two hypothesis of a received signal in the Additive
White Gaussian Noise (AWGN) channel:
Figure 2. GNU Radio Components H 0 : R ( n) = W ( n) n = 1,..., N (1)
GNU Radio (see Figure 2) is an open source software H1 : R(n) = S (n) + W (n) n = 1,..., N (2)
toolkit which is a collection of signal processing blocks that
can be used for building SDR with low cost external RF where N is the number of samples, S(n) is the transmitted
hardware. It is widely used in the wireless communication signal, W(n) is the AWGN and R(n) is the received signal. H0

978-1-4244-9877-2/11/$26.00 ©2011 IEEE


denotes that the signal is absent and H1 does that signal is −1
⎛ 2 ⎞⎛ 2 ⎞
transmitted. Furthermore, we assumed W(n) is zero mean with K COV = ⎜ 1 + ( L − 1) −1
⎟⎟ ⎜⎜ 1 − Q ( Pfa ) ⎟ . (11)
the variance σw2. ⎜ NSπ N S ⎟⎠
⎝ ⎠⎝
Energy Detection [4] [5]: If TCOV ≥ KCOV, we claim that the primary user is present; and if
For ED, by using hypothesis in (1) and (2) the received TCOV < KCOV the primary signal is absent.
power is estimated by ,
N
[ R(n)]2 Eigenvalue based Detection [6]:
TE = ∑
n =1
N
. (3) MME method is based on the ratio of maximum and
minimum eigenvalue. Assuming the hypothesis (1), (2) and by
using the covariance matrix provided in (9). The estimator of
The threshold can be chosen by theoretical computation [11].
MME is given by [6]
ED involves the least computation but it requires high SNR α = λ Max / λ Min . (12)
environment. For when it comes to low signal power, the noise Here, we call α as the radio of maximum to minimum
uncertainty would affect the accuracy of detection. eigenvalue; the theoretical threshold γ can be derived from [6]
Covariance Based Detection [7]:
( ) ⎛
( ) ⎞
2 −2/ 3
N s + ML N s + ML
Unlike the ED, COV and MME utilize the time correlation γ= × ⎜⎜ 1 + F −1 (1 − Pfa ) ⎟⎟ (13)
( − ML ) ( N s ML )
2 1/ 6
of received signal. In ideal situation, the correlation of noise Ns ⎜ ⎟
⎝ ⎠
samples should be zero due to AWGN channel, whereas the
Where, M=1 is applied here. The probability of false alarm can
correlation would not be equal to zero if the time separation
be written by [6]
within different samples are smaller than data symbol duration.
Threshold of both COV and MME method have no relation
with SNR. Pfa = 1 − F1 ⎜
s (
⎛γ ⋅ N − L 2 −μ ⎞
⎜ ⎟
(14)
)
ν ⎟
Considering the consecutive samples we received and ⎜ ⎟
hypothesis (1) and (2), the covariance matrices of received ⎝ ⎠
Where, μ = ( N s − 1 + L ) , ν = ( N s − 1 + L )(1 N s + 1 L )
2 13
samples could be written as: and
rR = E[ R(n) R H (n)] (4) F1 is the Tracy-Widom distribution for the order 1 (Eq. (24),
[6]). If α > γ then channel is occupied with a primary signal
rS = E[ S (n) S H (n)] (5) else channel is free for secondary user.
and
IV. EXPERIMENTAL SETUP
H1 : rR = rS + σ w2 I(6)
For the spectrum sensing algorithms previously mentioned
H0 : rR = σ w I
2
(7)
in section III, Figure 4 shows the experimental setup. GNU
Where, rR can be estimated by (4) and rS by (5). The Radio and USRP were used for the experiment to find out the
autocorrelation can be estimated as following [7]: performance of ED, COV and MME method in real
N s −1 environment. A desktop and a laptop installed with GNU
1
χ (l ) =
Ns ∑ r ( n) r (n − l )
n =0
R R l = 0,1,..., L − 1, (8) Radio and two USRP are used to run these experiments.
Laptop connected with one USRP acted as the transmitter
while computer and another USRP used as the receiver.
Where, NS is the number of samples and L is smooth factor [7]. Daughter board mounted on both USRP is RFX900 which is
rR would become a toeplitz and symmetric matrix, i.e.
tunable from 800 MHz to 1000 MHz. All the experiments are
⎛ χ (0) … χ ( L − 1) ⎞ performed indoor and the distance between two USRP is
⎜ ⎟ 70cm.
rR = ⎜ ⎟. (9)
At the transmitter, GNU Radio Companion is used to build
⎜ χ ( L − 1) χ (0) ⎟
⎝ ⎠ the transmitter block. BPSK modulation scheme is used with 8
samples/symbol and the amplitude of the carrier is varied to
The correlated estimator can be written by (see [7])
find the efficiency of different methods at different SNRs. The
−1 modulated signal is then passed to USRP via USB2.0
⎛ L L ⎞⎛ L ⎞
TCOV =⎜ ∑∑
⎜ i =1,i ≠ j
(rˆR )ij ⎟ ⎜∑
⎟ ⎜⎝ i =1
(rˆR )ii ⎟


. (10)
communication and the digital up conversion and digital to
analog conversion is done inside USRP to send the signal at
⎝ j =1 ⎠ 904MHz frequency. The transmitter for all three spectrum
Theoretically, with the presence of signal, TCOV is larger than 1, sensing method remains the same.
whereas TCOV=1. However, in real work, TCOV won’t be equal to At the receiver, signal is received through the (RFX900
1 as the signal is absent. Thus, we still need to resort to the board) USRP and is converted to Intermediate Frequency (IF).
theoretical threshold [7] This IF is then passed to DDC for decimation and to ADC.
Finally this digital data is passed to GNU Radio through
USB2.0 communication for further detection. The data
received through USRP is in complex form and we converted receiver only to collect noise samples and pass it through
it into float before sending it to detector block. The structure detector block to apply algorithm and calculate the ratios in
of the receiver is the same for all the three methods and three (10) and (12). For COV or MME, from the collected number
different detector blocks are built each implemented with of ratios using (10) or (12), respectively, we decide one value
respected algorithm. In ED method, we have calculated the which is greater than 90% of the other collected ratios. This
strength of received samples using (3) and then the output is value is used as new threshold. Same procedure is followed in
compared with the threshold to make the decision. In MME both the methods. After setting the new threshold we collect
method, the received data samples are passed to the MME signal samples and compare its ratio with new threshold to
detector block. The sample covariance matrix is drawn from check how COV and MME method works.
the received samples and eigenvalues are calculated from Figure 5 shows the probability of detection Pd as function
covariance matrix. The ratio of maximum and minimum of SNR where the smoothing factor L=8, the number of
eigenvalue (12) is compared with the threshold (13) to detect samples NS =1000 or 3000, and the number of receive antennas
the presence of primary signal. For COV method the sample M= 1. For a given approach, the result with NS = 3000 is better
covariance matrix is used to calculate the ratio of sum of than the result with NS =1000. This is due to the fact that
diagonal elements and sum of non-diagonal elements (10). statistics such as correlations can be derived more accurately
Threshold (11) is compared with the ratio (10) to make the as the number of samples increases. Comparing different
decision. approaches, we observe that MME slightly outperforms COV
and both MME and COV outperform ED with large margins.
Note that the ED results with NS =1000 is very poor and is not
shown here. It is possibly due to noise uncertainty.

Figure 4. Experiment Setup

V. EXPERIMENTAL RESULTS
The experiments are designed to sense the spectrum at a
mentioned frequency and find the performance of the COV
and MME methods at low SNRs. ED method is also
implemented as a benchmark. The false alarm rate Pfa is set as
0.1. Initially COV and MME method blocks are designed Figure 5. SNR vs. Pd plot for practical implementation
according to the algorithms and the ratios (10) and (12) are Figure 6 shows comparison of the implementations of both
compared with the thresholds (11) and (13), respectively, for MME and COV method on WARP [14] and GNU
the decision. While collecting results, both these methods were Radio/USRP. With NS = 3000 and L=8, it shows that the
showing implausible performance at lower SNR. We performance of both the methods is similar even if the
attempted to discover the reason and we came to the implementation platforms are different.
conclusion that it is due to high correlation between noise
samples. These spectrum sensing algorithms presumes the
channel as AWGN and noise samples are statistically
uncorrelated. Nevertheless, both the methods can be still used
as spectrum sensing algorithm as average correlation values of
signal and noise have difference. But this problem forced us
not to use the theoretical thresholds in (11) and (13) as it
would be inappropriate.
Incorrect threshold problem can be solved by finding new
threshold experimentally. In all experiments we have
considered Pfa equal to 0.1, which means we can have one
wrong decision out of 10 decisions. After setting Pfa we use
Figure 6. SNR Vs Pd plot for practical implementation with WARP Figure 7. SNR Vs Pd Plot for theoretical and experimental simulations
Figure 7 shows all three methods implemented Comparing experiment with simulation results, MME
theoretically and experimentally with NS =3000. Here, simulation is 2dB better than MME experiment, COV
“theory” denotes numerical results with uncorrelated noises simulation is around 4 dB better than COV experiment, and
where the thresholds are estimated using theoretical formulas ED simulation is around 11dB better than ED experiment.
such as (11) and (13); “simulation” also denotes the numerical Note that only slight degradation occurs at MME experiment
results with uncorrelated noises but the thresholds are derived comparing to the MME simulation. Since most spectrum
using numerical simulations; and “experiment” denotes the sensing methods including COV and MME assume an AWGN
experimental results where noises are correlated and channel where noise samples at different times are statistically
thresholds are derived experimentally. (Note that the received independent and uncorrelated, it is remarkable that COV and
signals used to obtain results denoted by either “theory” or MME work with correlated noises. It seems that, if the average
“simulation” are generated numerically.) correlation values of noise and signal are significantly
Comparing the theoretical results of the three methods, it is different, both MME and COV should be still functional. It is
surprising that COV theory is the best and MME theory is the also remarkable that there is a large discrepancy between ED
worst at low SNR. This is partly due to the facts that the simulation and experiment results since the ED approach is
threshold for COV derived using (11) is underestimated and not sensitive to the noise correlation. The bad performance of
the threshold for MME derived using (13) is overestimated at ED experiment may be due to noise uncertainty.
low SNR. This misrepresentation of theoretical results can be
corrected if the thresholds are derived numerically. As shown VI. CONCLUSION
in Fig. 7, COV simulation is similar to MME simulation; and Two methods based on time covariance matrix are
both COV and MME simulation are 2dB better than ED proposed and implemented using GNU Radio and USRP to
simulation when Pd=0.9. check their performance in real environment as well as to
Comparing the experiment results of the three methods, as solve spectrum sensing problem at low SNRs. Since the key
shown in Fig. 5, MME experiment is around 2dB better than assumption of these two methods is low correlation of the
COV experiment and COV experiment is around 9dB better received noises, it is remarkable that the two methods still
than ED experiment when Pd=0.9. works with practical experiments using GNU/USRP where
noises are not uncorrelated. The important contribution of this
paper is that we have demonstrated experimentally that both
MME and COV methods outperform the conventional ED
method in practical implementations.
REFERENCES
[1] J. Mitola and G. Q. Maguire, “Cognitive radio: Making
software radiosmore personal,” IEEE Pers. Commun., vol.
6, no. 4, pp. 13–18, Aug. 1999.
[2] T. Ycek and H. Arslan, “A survey of spectrum sensing
algorithms for cognitive radio applications,” IEEE
Communications Surveys & Tutorials, vol. 11, no . 1, pp.
116–130, Mar. 2009.
[3] D.Cabric, S. M. Mishra, R.W. Brodersen,
“Implementation Issues in Spectrum Sensingfor Cognitive
Radios”, IEEE, 2004.
[4] W. Lin, Q. Zhang, “A Design of Energy Detector in
Cognitive Radio under Noise Uncertainty”,
Communication Systems, ICCS, 11th IEEE Singapore
International Conference, 2008.
[5] A. Sonnenschein and P. M. Fishman, “Radiometric
detection of spread-spectrum signals in noise of
uncertainty power,” IEEE Trans. Aerosp. Electron. Syst.,
vol. 28, no. 3, pp. 654–660, Jul. 1992.
[6] Y. Zeng, Y. C. Liang, “Eigenvalue based Spectrum
Sensing Algorithms for Cognitive Radio”, IEEE
Transactions, Communication, vol. 57, pp. 1784, Jun.
2009.
[7] Y. Zeng, Y.C. Liang, “Spectrum-Sensing Algorithms for
Cognitive RadioBased on Statistical Covariances”, IEEE
Tr. Veh. Tech., vol. 58, no.4, pp. 1804-1815, May 2009.
[8] GNU Radio Trac, http://gnuradio.org/trac/wiki
[9] Matt Ettus. Universal software radio peripheral.
http://www.ettus.com.
[10] Chinnam, D.M.; Madhusudhan, J.; Nandhini, C.;
Prathyusha, S.N.; Sowmiya, S.; Ramanathan, R.; Soman,
K.P.; , "Implementation of a low cost synthetic aperture
radar using Software Defined Radio,"Computing
Communication and Networking Technologies (ICCCNT),
2010 International Conference on , vol., no., pp.1-7, 29-31
July 2010
[11] "IEEE Standard Definitions and Concepts for Dynamic
Spectrum Access: Terminology Relating to Emerging
Wireless Networks, System functionality, and Spectrum
Management," IEEE Communications Society, vol. IEEE
Std 1900.1 TM, September 2008.
[12] GNU Software Radio project.
http://www.gnu.org/software/gnuradio/.
[13] USRP User’s and Developer’s Guide
http://home.ettus.com/usrp/usrp_guide.html
[14] K.Lee K. Lee, A. Mate, I-Tai Lu. “Practical
Implementations of Time Correlation Based Spectrum
Sensing methods: WARP for Cognitive Radio”, LISAT
2011, Farmingdale, NY.

You might also like