Keywords

1 Introduction

In recent decades, the demand for spectrum resources has augmented rapidly with the fast development of wireless communication services and the propagation of the Internet of Things (IoT). The traditional static allocation of spectrum causes numerous challenges to the recent wireless industry. Since IoT enables many autonomous devices to share information, spectrum scarcity is one of the main challenges due to the limited natural radio spectrum resource that helps wireless communications [1]. The statistics of spectrum allocation around the world show that the radio spectrum has been almost fully allocated, and compared to the demands of high data-rate devices, it was evident that the current fixed spectrum allocation leads to an inefficient spectrum utilization [2, 3]. Additionally, some frequencies bands are not used all the time by their owners, and others are highly utilized. The unused frequencies are termed as white spaces or spectrum holes. A spectrum hole is a spectrum band assigned to a licensed user, also known as primary user (PU), but it is momentarily unoccupied by this PU. Therefore, due to this static allocation and user-needs growth, the radio spectrum is inefficiently exploited while a secondary utilization is possible.

The underutilization of the allocated spectrum, a high-efficient spectrum sharing, and access are recommended to exploit the radio spectrum effectively. In this context, Cognitive Radio (CR) Networks is introduced in [4, 5] as an emerging paradigm that ensures efficient spectrum allocation to address spectrum scarcity. In CR networks, the unlicensed users, also known as secondary users (SUs), can access the spectrum of authorized users (PUs) if the primary spectrum is idle or simultaneously share PUs long as the PUs services can be completely protected. By doing this, the SUs can gain transmission opportunities without requiring a dedicated spectrum. Therefore, CR is considered as a critical enabling technology for dynamic spectrum access (DSA) [6]. To enable the DSA, a cognitive user (SU) needs to obtain the correct information of the spectrum (Free or Occupied), so that the quality of services (QoS) of the PUs can be guaranteed. Two methods can be adopted by SUs to detect spectrum holes. The first is the Geolocation Database that can be used when the PU’s activity is regular and highly predictable. The second is Spectrum Sensing, in which the SU can carry out spectrum sensing, periodically or consistently, to observe the primary spectrum and detect the spectrum holes. Figure 1 illustrates a typical cognitive cycle for a CR, as introduced by Haykin in [7]. Although enabling DSA with CR is a technical issue that involves multidisciplinary efforts from various research communities, such as signal processing, information theory, communications, computer networking, and machine learning.

Fig. 1.
figure 1

Basic cognitive cycle (The figure focuses on three fundamental cognitive tasks).

As shown in the above figure, the CR cycle’s essential phase is spectrum sensing operation (radio-scene analysis). Its objective is to sense the spectrum holes to obtain the band state (free/occupied), and based on this result. Data transmission is adapted to optimize the performance by maximizing the throughput and minimizing the interference. Different spectrum sensing techniques have been discussed in the literature [8, 9], such as the cyclostationarity feature detection technique [10], Energy detection techniques [11], and Matched filter detection method [10]. Efficient spectrum sensing can be achieved by adopting strategies that can classify signals, with high accuracy, to PU signals or noise signals. Deep learning has recently gained popularity in signal processing into applications involving signals/time-series data such as voice assistants, digital health, radar, and wireless communications. In our context, we propose a deep learning model for spectrum sensing operation, in which we use real-world signals that represent the PU signals. The evaluated performance of our proposed model is compared with our previous proposed classifiers in [12].

The remainder of this paper is organized as follows. In Sect. 2, we describe the proposed system model for spectrum sensing, and we present the generation and acquisition of the used database. Section 3 gives more detailed descriptions of the system model implementation and presents the results and discussions. Finally, Sect. 5 concludes the paper.

2 System Model

In this paper, we consider a spectrum sensing model that classifies the received signals from a single antenna (RTL-SDR device) to PU signals or Noise signals. Our proposed platform can operate in a dynamic spectrum access environment to identify the spectrum holes to attain higher spectrum utilization. With Matlab and Python 3 language, we can developpe a deep learning model and build real-world smart signal processing systems. In general, there are four steps involved. The first step in building a deep learning model is to access and manage the data. Using Matlab, we can acquire signals from a variety of hardware devices. We can also generate synthetic data via simulation or use data augmentation techniques. We proposed a model that transmits real ASK/FSK signals by using the Arduino Uno card and the 433 MHz transmitter. The transmitted signals are collected by an RTL-SDR device connected to the Matlab environment. The received signals are processed as features and fed into a CNN classifier developed in Python language to decide the PU availability.

Once the data is collected and ready, we interpret the signal data and label it. We visualize and analyze the received signals with attribute regions. We use the domain-specific tools to label all our signals to prepare our data for training. There are two main approaches to performing deep learning on signals. The first approach involves converting signals into time-frequency representations and training custom convolutional neural networks to extract patterns directly from these representations. A time-frequency presentation is a view of a signal represented over both time and frequency. More specifically, it describes how spectral components in signals evolve as a function of time [13]. This approach enhances the patterns that may not be visible in the original signal. There are various techniques generating time-frequency representation from signals and saving it as images, including spectrogram, continuous wavelet transforms (or scalograms), and constant Q transforms.

The second approach involves feeding signals directly into deep networks, such as Long Short-Term Memory (LSTM) networks. To make the deep network learn the patterns more quickly, a reduction of the signal dimensionality and variability is needed in this approach. We have two options, we can manually identify and extract features from signals, or we can automatically extract features using invariant scattering convolutional networks, which provide low variance representations without losing critical information. We adopt the first approach for our signals in our work, and we follow the described steps in Fig. 2 for training and testing the proposed deep network.

Fig. 2.
figure 2

The proposed model.

2.1 Database Generation

Deep learning is a part of machine learning methods that, based on artificial neural networks, enables computers to learn from experience and understand the world in terms of a hierarchy of concepts. Generally, learning can be supervised, semi-supervised, or unsupervised [14, 15]. In our context, we have supervised learning. Supervised learning methods are generally composed of two main phases: training/learning and classification. To make our work more independent and realistic, we will create our signals data. For these reasons, we have constructed a real signal-emitter by using an Arduino Uno card and a 433 MHz wireless device that transmits signals in ASK/FSK modulation type.

The Arduino Uno is a microcontroller board [16] used to construct and program electronics projects. It is flexible, inexpensive, and can present a diversity of digital and analog inputs. Arduino Uno, enabled by a software program (Simplified C ++), can send and receive information to most devices, in our case, the 433 MHz ASK/FSK, and even though the internet to control the specific electronic devices. The 433 MHz ASK/FSK is an electronic module that operates at 434 MHz to transmit radio signals. It is commonly used in wireless data transfer applications such as mobile robots and remote control. It receives programmed serial data from a specific platform and transmits it wirelessly over the radio frequency via its antenna connected at pin4 of the Arduino Uno.

2.2 Database Acquisition

Spectrum sensing is based on a famous technique called signal detection, which allow us to determine whether a given frequency band is being used. In our work, we consider an SU spectrum sensor with 1 antenna (represented by the RTL-SDR in Fig. 2). Mathematically, signal detection can be reduced to a simple identification problem, formalized as a hypothesis test [17, 18]. There are two hypotheses: H0, the PU is inactive; and H1, the PU is active. The received signal at the antenna is given by:

$$ y\left( k \right) = \left\{ {\begin{array}{*{20}c} {n\left( k \right)\;\;\;\;\;\;\;\;\;} & {H_0 } \\ {s\left( k \right) + n\left( k \right)} & {H_1 } \\ \end{array} } \right. $$
(1)

Where \( y\left( k \right) \) is the sample, the detected signal in the licensed channel, to be analyzed at each instant \( k \), and n \( \left( k \right) \) is the received noise plus possible interference (not necessarily white Gaussian noise) of variance \( \sigma^2 \). At hypothesis \( H_1 \), \( s\left( k \right) \) represents the signal that the network wants to detect, which is the transmitted signal through the wireless channel. Generally, the receiver reconstructs the message sent from the captured signal by the inverted processing operations done on transmission. Those processes can be performed using a single RTL-SDR hardware and MATLAB software. RTL-SDR or Software Defined Radio is a radio communication system, wherein the traditional hardware components (e.g. mixers, filters, amplifiers, modulators/demodulators, detectors, etc.) are instead implemented by means of software on an embedded system [19,20,21,22,23,24,25,26,27]. RTL-SDR is capable of receiving any signal in its frequency range. This range varies depending on the type of device used. In this work, the used dongle has a frequency capability of approximately 25 MHz–1750 MHz. The RTL-SDR software provides the same functions of a traditional receiver: Selection of the desired frequency and bandwidth, Demodulation of the received signal and Interference suppression (Noise blanker). Figure 3 shows the block diagram of the different processing stages of an RTL-SDR dongle.

Fig. 3.
figure 3

Synoptic diagram of SDR card.

3 Implementation and Results

3.1 Description of the Used Data

In the proposed sensing model, the used database is collected in the SIRC/LAGES laboratory of HASSANIA school of public works, for different distances between the transmitter and the receiver. It consists of 2000 ASK/FSK signals. Table 1 shows how we have organized the used database in the learning phase and test phase.

Table 1. The used Data-base in learning and testing phases

This data is generated for several distances between the sender and the receiver because SUs which are close to the PU (e.g., SU1 and SU2 in Fig. 4) are probably can detect the PU presence more reliably than SUs which are far away from the PU (e.g., SU3 in Fig. 4). Moreover, SUs close to each other (SU1 and SU2 in Fig. 4) are likely to report the same sensing results.

Fig. 4.
figure 4

The effect of distance on spectrum sensing results

3.2 Performance Evaluation

As previously mentioned, \( H_0 \) and \( H_1 \) are the sensed states for absence and presence of signal, respectively. Therefore, as presented in Fig. 5, we can define four possible scenarios in detecting a signal. The first is declaring \( H_0 \) when \( H_0 \) is true \( \left( {H_0 /H_0 } \right) \), the second is declaring \( H_1 \) when \( H_1 \) is true \( \left( {H_1 /H_1 } \right) \), the third is declaring \( H_0 \) when \( H_1 \) is true \( (H_0 /H_1 \)), and the fourth is declaring \( H_1 \) when \( H_0 \) is true \( \left( {H_1 /H_0 } \right) \).

Fig. 5.
figure 5

Hypothesis test and possible scenarios with their corresponding probabilities.

The first and the second scenarios are known as a correct detection of a PU signal and a spectrum hale, respectively. Whereas scenarios 3 and 4 are known as a missed detection and a false alarm, respectively. The performances of our proposed spectrum sensing model are characterized by: the probability of detection \( P_d \) and the false alarm probability \( P_{fa} \).

\( P_d \): The probability of detecting the PU as being present when the PU is truly present (the band is occupied \( H_1 \)). It is desirable to keep the detection rate as high as possible for spectrum sensing, since low \( P_d \) value (Failed detection) causes interference with the PU. We calculated \( P_d \) by (2):

$$ P_d = P \left( {decision H_1 /H_1 } \right) = \frac{Nc}{N} \times 100 $$
(2)

\( P_{fa} \): the probability of detecting the PU as being present (the band is occupied H1) when the PU is actually absent (the band is not occupied \( H_0 \)). It is desirable to keep the false alarm rate as low as possible for spectrum sensing, since high \( P_{fa} \) value (Failed detection) reduces the efficiency of spectrum use. We calculated \( P_{fa} \) by (3):

$$ P_{fa} = P \left( {decision H_1 /H_0 } \right) = \frac{Ne}{N} \times 100 $$
(3)

Where:

\( N_c \): The number of times in which the PU presence is declared, while hypothesis \( H_1 \);

\( N_e \): The number of times in which the PU signal is detected, while hypothesis \( H_0 \);

\( N \): The number of all captured signals.

3.3 Results

The data acquirement part is implemented in MATLAB 9.4.0 (R2018a) for a 64-bit computer with core i5 processor, clock speed 2.4 GHz, and 8 GB RAM. The used energy detector is described in our previous work [12], whereas, for ANN, SVM and DNN detectors are implemented in python 3. For SVM detector, the used parameters are: C = 1.0, break_ties = False, cache_size = 200, class_weight = None, coef0 = 0.0, decision_function_shape = ‘ovr’, degree = 3, gamma = ‘scale’, kernel = ‘rbf’, max_iter = −1, probability = False, random_state = None, shrinking = True, tol = 0.001, verbose = False. While, the used parameters for the ANN detector are: activation = ‘relu’, alpha = 1e−05, batch_size = ‘auto’, beta_1 = 0.9, beta_2 = 0.999, early_stopping = False, epsilon = 1e−08, hidden_layer_sizes = (6,2), learning_rate = ‘constant’, learning_rate_init = 0.001, max_fun = 15000, max_iter = 200, momentum = 0.9, n_iter_no_change = 10, nesterovs_momentum = True, power_t = 0.5, random_state = 1, shuffle = True, solver = ‘lbfgs’, tol = 0.0001, validation_fraction = 0.1, verbose = False, warm_start = False.

For the deep learning-based detector, we have used a fully-connected network structure with three layers. Due to the high performance that can achieve, we have used the rectified linear unit activation function, referred to as ReLU, on the first two layers. While, the Sigmoid function in the output layer to ensure our network output is between 0 and 1, where 0 for H0 and 1 for H1. The first hidden layer has 1024 nodes, uses the relu activation function, and expects rows of data with 1024 variables (the input_dim = 1024 argument). The second hidden layer has 8 nodes and uses the relu activation function. The output layer has one node and uses the sigmoid activation function. Table  2 shows the comparison between the obtained results by the proposed detection techniques.

Table 2. Performance evaluation of the proposed sensing techniques.

In a radio channel, the received signal at CR devices is processed as a feature vector and fed into a classifier to decide the channel availability. The classifier categorizes each processed signal into either one of the two classes, namely, H0: the “channel available class” and H1 the “channel unavailable class”. The obtained values of \( {\varvec{P}}_{\varvec{d}} \) and \( {\varvec{P}}_{{\varvec{fa}}} \) are shown in Table 2.

3.4 Discussion

The obtained results manifest the capability of the proposed classifiers in detecting the PU presence. As we can see, the artificial intelligent-based techniques are significantly outperforming the traditional methods (ED) on spectrum sensing. Therefore, we can obtain the spectrum state with high efficiency with machine learning and deep learning techniques. Compared to all other classifiers, the supervised CNN classifier performs well in terms of the detection probability. Its higher detection efficiency compensates for the computational complexity of this classifier. Moreover, the proposed deep learning classifier shows the most elevated and perfect sensing accuracy. This sensing accuracy is crucial in the protection of primary users and the detection of spectrum holes.

The plot of our proposed deep learning classifier’s accuracy history is represented in Fig. 6. From the classification accuracy plot, we can see that the model achieves high accuracy in a low number of epochs. On the other hand, Fig. 7 shows the classification loss curve for the training and the testing. The obtained results show that the proposed classifier improves radio signal classification accuracy and efficiency compared with other methods, including energy detection, ANN, and SVM.

Fig. 6.
figure 6

Model accuracy in the training and testing phases.

Fig. 7.
figure 7

Model loss in the training and testing phases

In the future we will evaluate the cognitive radio for Vehicular Ad hoc Networks (CRVs or CR-VANETs). The CR-VANETS is a new trend in the automotive market. Recent and future vehicles will offer functionalities for the transmission of intra-vehicular commands and dynamic access to wireless services, while the car is in transit [28, 29].

4 Conclusions

In this paper, we used a deep learning model for spectrum sensing in cognitive radio networks. The proposed model allows us to identify the spectrum state by classifying the captured signals into PU signals or Noise signals. Therefore, a simplified spectrum sensing implementation has been proposed based on real signals generated by an Arduino Uno card and 433 MHz Wireless transmitter. Then, the transmitted signals are detected in MATLAB software by RTL-SDR dongle using the deep learning model. The system performance is evaluated by two metrics, the probability of detection and the probability of false alarm. Then, the obtained results are compared with three other techniques, such as energy detection (ED), artificial neural networks (ANN), and support vector machine (SVM). The experimental results showed that the deep learning model using a convolutional neural network (CNN) possessed better classification accuracy and faster training speed than other methods, including ED, ANN, and SVM.