Implementation and Evaluation of Cognitive Radio by FPGA for IoT Applications Ahmed A. Thabita and Mikolaj Karpinskib a Al-Rafidain University College, Baghdad, Iraq b Department of Computer Science and Automatics, University of Bielsko-Biala, Poland Abstract The receivers have problems in the detection of signals from noisy signals at high frequencies. The object from this work is to evaluate of implemented cognitive radio to make a difference between signal and noise by FPGA and Arduino. The basic goal of this paper is the implementation of cognitive radio at high frequency for IoT applications based on FPGA and Arduino. A model that has been proposed is a detection system to distinguish the signal from the noise. The model depends on cognitive radio (CR) to work at high frequencies in wireless communication applications and IoT applications. The design was based on the use of a variety of types of modulation most commonly used in communication systems, namely MFSK, MPSK and MQAM. Different and varied levels up to 256QAM and at high frequencies are used to simulate the existing reality and using the Matlab program for the purpose of simulating the proposed system in the work, where signals of various lengths and different types of noise were taken, such as AWGN and also FADING. After that, the system was trained based on Monte Carlo simulation and the use of neural networks. The practical implementation relied on the use of programmable chips such as FPGA and also ARDUINO, in order to achieve the principle of Internet of Things or device to device communication. The proposed system have been implemented in software by matlab and practically using programmable digital devices (FPGA and ARDUINO) to evaluate the results. High detection probability are obtained with very low sensing time at low SNR value. The proposed system provide excellent results as shown in the paper that shows higher detection probability at minimum SNR. There is a good compatible of the results between the simulation and the practical results. Keywords 1 Cognitive radio, internet of things, statistical features, neural network, probability of detection. 1. Introduction CR is an exciting emerging technology that has the ability to deal with the requirements of the frequency spectrum. This new technology illustrates new developments in communications systems, because CR allows usage of the frequency spectrum more efficiently. As an example of the challenges related to CR system is the detection of the founded authorized users over a large range of frequency band at a precise time. To increase the detection reliability of the primary users, a CR system have been built in this paper based on IoT to distinguish between signal and noise and implemented on FPGA. By a static frequency spectrum assignment, policy wireless networks are characterized today. At present, the rapid growth, increasing of multimedia, short messages, On the other hand, major licensed bands, like for TV broadcasting have been found to be grossly underutilized, resulting in spectrum wastage [1–4]. Federal Communications Commission (FCC) studies conclude that the utilization of spectrum for 0–6 GHz band varies by 15% to 85%. This is the basic task of CR [5, 6]. Fig. 1 represents the IoT Network with different technologies and standards. Emerging Technology Trends on the Smart Industry and the Internet of Things, January 19, 2022, Kyiv, Ukraine EMAIL: ahmed.thabit@ruc.edu.iq (A. A. Thabit); mkarpinski@ad.ath.bielsko.pl (M. Karpinski) ORCID: 0000-0002-5537-4312 (A. A. Thabit); 0000-0002-8846-332X (M. Karpinski) ©️ 2022 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings (CEUR-WS.org) 50 Figure 1: IoT network with different technologies The representation of the CR design steps can be seen in Fig. 2 Figure 2: CR-based IoT system design flow The authors focused on the practical implementation of a Cognitive radio system and the energy of signals are calculated and compared with a threshold value to estimate the presence of PU signal [7]. Another researchers proposed adaptive sensing algorithms considering noise uncertainty. The simulation results showed a constant detection probability has been achieved under noise uncertainty [8]. Numerical results show that the proposed schemes increases SU utility and avoiding interference with PU in the adverse environment [9]. During the sensing period of SU, derivations are performed assuming random arrival and departure of the principal user signal. To reduce detection error rate, the authors choose the threshold. The performance gain of the ED method is compared to the conventional ED method with and without the use of the optimal threshold [10]. It was proposed to use a second-order blind identification algorithm. Simulation findings show that the proposed blind source separation based ED overcomes noise uncertainty in unfriendly sensing systems [11]. For CR, a two-stage detector was conceived and implemented. The first stage is made up of several ED, each of which has a single antenna with a defined threshold for decision-making. The second step, which consists of an ED with an adaptive double threshold, is recommended [12–15]. 51 Spectrum sensing using DCAED is also implemented. DCAED adjusts the threshold by taking use of the relationship between Pf and Pd. In a tradeoff between Pf and Pd, DCAED overcomes a deficiency of ED and AED [16, 17]. The location in which the observed energy is located determines whether the CR delivers local decisions or observed energy to a Fusion Center (FC). The detection is done using FC. At -8 dB, there is a 10% improvement in the cooperative likelihood of detection [4]. In [19] novel applications of CR technology for the Internet of Things (IoT) are investigated, as well as relevant answers to real-world difficulties in CR technology that will make IoT more inexpensive and applicable. The authors also classify spectrum sensing and sharing approaches, as well as evaluate their benefits and drawbacks. Furthermore, they cover the design considerations of CR-based IoT as well as the criteria used to identify the appropriate SS and access mechanisms. They also look at integrating newly developing technologies with CR-based IoT systems. Finally, they discuss some new obstacles and make recommendations for future research areas and unresolved topics. The authors also classify spectrum sensing and sharing approaches, as well as evaluate their benefits and drawbacks. Furthermore, they cover the design considerations of CR-based IoT as well as the criteria used to identify the appropriate SS and access mechanisms. They also look at integrating newly developing technologies with CR-based IoT systems. Finally, they discuss some new obstacles and make recommendations for future research areas and unresolved topics [20]. An upgradable cross-layer routing protocol based on CR-IoT is presented in a study to improve routing efficiency and data transmission in a reconfigurable network. In this context, the system is creating a distributed controller that is designed to perform a variety of tasks, including load balancing, neighborhood sensing, and path construction using machine learning. The proposed method is based on network traffic and load, as well as a variety of other network metrics such as energy efficiency, network capacitance and interference [21, 22]. A discussion of the Internet of Things, including its definition, prospective applications, obstacles, and enabling technology. Cognitive radio is one of these technologies that has received a lot of attention. The general goal of this article is to provide a global overview of the incentives for integrating cognitive radio into IoT, as well as the obstacles that will be raised, in order to serve as self-reconfigurable solutions for a variety of IoT applications [23]. 2. Problem Statement The frequency spectrum became crowded day by day via the huge developments of wireless communication and the new concepts such as the device to device communication (IoT). It is so difficult to identify between the noise and the signals, especially at high frequency. These circumstances create challenges to the searchers, therefore; one of the promising solutions is the cognitive radio (CR) that implemented on field programmable gate array (FPGA) with Arduino. 3. Materials and Methods NN consist of interconnected artificial neurons to construct a programming combination close to the behavior and processing of biological neurons. Pattern recognition, time-series prediction and modeling, classification, adaptive control, and other domains have effectively used NN. The CR-IoT are suitable to deal with NNs. For instance, through the analysis of spectrum, temporal statistics of a radio environment it used to identify distinct properties that will mean different modulations. Then these properties can forward to a NN to identify signal [24]. CR systems use on clever software packages to provide their transceiver with adaptability and learning capability. CR with IoT have the ability to learn then store the results on a knowledge to future decisions and actions. Various learning methods are used by a CR ranging from lookup tables to arbitrary structures of machine learning techniques that include ANNs [25]. Two of these learning rules of the NN are the multilayer perceptron and NVG RAM. 52 Generally the statistical features are used in the proposed system. The experiments shows that the statistical features are more powerful than instantaneous features, however, statistical features include the moment and Cumulants. Statistical moments represent a predictable amount of an arbitrary variable raised to the power showed by the number of the moment. The first order 𝑥̅ is the statistical mean of the arbitrary variable x: star (*) refers to the complex conjugate. '   i. * j E i, j  x ( x )  (1) The moments will founded by samples (N) using numerical mean by raising the sample to a power equal to moment number as seen in Eq. (2): 1 N i Ei, j N  j  * (2) ' K 1 xk .( x k ) Cumulants may be written with respect to moments as shown in [25]: - All generated modulation types used in this paper are defiled by AWGN and fading. Then tested for various SNR values to choose the best for the detection. Because of the basic arithmetic operation utilized in this technique, the NVG-RAM is a simple algorithmic that can be produced by FPGA. This is a sort of identifier that may be learned in a single sitting. The input-output pairs are simply stored in RAM. The smallest Manhattan distance between the unknown pattern and all pairs stored in the RAM determines the recall phase of this network. This is demonstrated in Fig. 3, which depicts the work of the minimal Manhattan distance between the unknown pattern and all pairs stored in the RAM. Equation (3) is used to calculate the Manhattan distance. The number of the class in the output field is assigned the index of the minimum distance. The desired class is retrieved from the network output. [26]. n d ( p, q )   p  q (3) i i i 1 Where: d(p, q) is the Manhattan distance between two vectors p, q and n is the number of elements in each vector. The NVGRAM help the CR system to enhance and increase the probability of detection using the minimization of errors by selecting the minimum distance between vectors. The following flowchart represents the recall phase of NVG-RAM. There is a learning phase and a recall phase in any detecting procedure. The learning phase's goal is to improve network's weights value. For each input training pattern, the output of the learning phase's feed forward neural network is calculated. The back propagation algorithm uses the difference between the calculated and intended output to upgrade the network's weight. At 104 epochs, the Mean Square Error performance reached its greatest resolution, as illustrated in Fig. 4. 53 Figure 3: Flowchart of recall phase of NVG-RAM Figure 4: Training performance of NVG-RAM 54 4. Results and Discussion The proposed system uses the NVGRAM neural network identifier because it is a simple algorithm can be built by FPGA. Signals are required to be detected from noisy channel by the NVGRAM network with two Cumulants of (C11 and C20). The training set is made for fifty one vectors for signals and the same for noise for SNR (-40 dB to 10dB) therefore, the number of vectors in the training set is 102. Each vector has three elements: the first and second fields record the level of the Cumulants C11 and C20, respectively, while the third field holds the class number. As a result, the RAM of this network has 102 locations, each of which has three fields. If an undefined signal is received, the features C11 and C20 for this signal are calculated. These characteristics are then provided to the NVGRAM. Based on Manhattan distance, the identifier determines the closest pairs in training sets to the extracted feature. The detector can detect the signal with a high chance of detection at a short distance. NVG-RAM networks are built for detection systems. To evaluate the performance of NVGRAM detection system, matlab simulation program is used to obtain the results. Fig. 5 represents SNR versus Pd for NVGRAM when message length is from 1000 to 6000 samples. It's shown that Pd is equal to 100% when SNR >= –36dB for message length equal 1000 samples. The Pd is increased when message length is increased. Figure 5: SNR versus Pd, for NVGRAM It is important to check the sensing time that needs to test the performance of the speed of the detection as shown in Fig. 6. 55 Figure 6: Ts versus Pd, for NVGRAM Different noisy channels are shown in Fig. 7 to evaluate the performance of the system in various environments. It is seen that for SNR= –38dB, the Pd=100% for AWGN, 80% for Rician and 70% for Rayleigh. Figure 7: Different noisy channels for CR based on NVGRAM This paper deals with FPGA implementation of the system at intermediate frequency stage of 20 MHz. The hardware implementation also includes the extraction features and shows the output of the decision stage to check whether the output is signal or noise. The proposed CR-IoT detection system is broken down into subsystems that will be implemented in an FPGA. Each subsystem is in charge of a distinct duty. The majority of the subsystems are written as VHDL models in Xilinx ISE 14.6, while some of them are found as function blocks in MATLAB/Xilinx Simulink's System Generator block sets. The ISE-created VHDL source files are exported to System Generator through a black box block and simulated using MATLAB/Simulink and the Xilinx System Generator (XGS). The proposed detecting systems are implemented using Spartan-3A DSP 3400A as shown in Fig. 8. 56 Figure 8: Spartan-3A DSP board and Arduino Uno Connection Fig. 9 depicts the simulation behavior of all inputs and outputs of this Black Box, with Wr representing the system clock. To evaluate the desired features, this Box requires 4096 clock pulses. The needed Cumulants are produced in the output signal when the Rd signal is triggered, and are ready to be collected from the detector. The Rd signal rises high when the sigr and sigi ends, as seen in the figures. The values of Cumulants C11 and C20 are generated at this point. Fig. 10 shows the FPGA implementation of the proposed NVG-RAM detector. Figure 9: Simulation behavior of proposed NVG-RAM detector when wr input signal is activated 57 Sy stem Generator Out Wr In Wr Rd Wr Signal_Detector_Display Wr Rd sys_wr sigr Sigr C11 C11 Y 1 In Out Sigr C11 Y msg_r Signal_Detector Display sigi In Sigi C20 C20 Sigi C20 msg_i Black Box TD msg_i Point-to-point 1 msg_r Signal_Detector Ethernet Display1 sys_wr TD_Detector hwcosim Figure 10: Overall CR system based on NVG-RAM detector The hardware co-simulation is seen from Fig. 11. Figure 11: The connection of the device & HW Co-simulation As illustrated in Fig. 8, the LCD is operated by the Arduino Uno Board, which receives the signal detector display value from the Spartan-3A DSP 3400A board via the PS/2 ports. The microcontroller Arduino is configured to display the needed text based on the input pins from the hardware platform's PS/2 connectors. As it evident from the obtained results, from Fig. 5 the probability of detection is 100% at SNR= – 38dB with error rate equal to 5.5*10–13 at very low sensing time approximately 6.25*10–4 sec as seen on Fig. 6. The selected channels are different (AWGN, Fading [Rician and Rayleigh]). The implementation by FPGA provide more reliability for the system with the minimum sensing time at very low SNR value. 58 5. Conclusions Through the proposed system, a high detection rate was achieved and different types of signals were also dealt with. The scientific novelty of obtained results is the method of choosing the static property of the received signals, as the traditional and common methods are the use of instantaneous properties, but the use of statistical features saved the time of sensing and gave the system a high detection rate using the concepts of the Internet of Things. The practical implementation of the system has earned the system high credibility and reliability, as the practical and theoretical results are very close, which gives the system high reliability. The practical importance of the obtained results is that the practical implementation gave great reliability to the proposed system and also gave an important addition to the researchers, as the practical implementation of CR-IoT using FPGA chips proved the validity of the proposed results. Prospects for further research are to try implementation the proposed system with 5G technology. 6. Acknowledgements The work is supported by Al-Rafidain University College/ Department of Computer Communication Engineering. 7. References [1] N. T. Do, L. T. Dung, B. An and S. Y. Nam, “Connectivity Of Hybrid Overlay/Underlay Cognitive Radio Ad Hoc Networks”, National Research Foundation Of Korea, 2012. [2] W. Y. Lee And I. F. Akyildiz, “Optimal Spectrum Sensing Framework For Cognitive Radio Networks”, Ieee Transactions On Wireless Communications, Vol. 7, No. 10, 2008. [3] F. Wang And X. Zhang, “Joint Resource Allocation And Admission Control For Energy Harvesting Based Cooperative Overlay Cognitive Radio Networks”, Ieee Conference On Computer Communications Workshops, 2016. [4] J. Ma, G. Y. Li and B. Hwang, “Signal Processing In Cognitive Radio”, Vol. 97, No. 5, Ieee, 2009. [5] B. Wang And K. J. R. Liu, “Advances In Cognitive Radio Networks: A Survey”, Ieee Journal Of Selected Topics In Signal Processing”, Vol. 5, No. 1, 2011. [6] M. C. Filippou, G. A. Ropokis, D. Gesbert, And T. Ratnarajah, “Joint Sensing And Reception Design Of Simo Hybrid Cognitive Radio Systems”, Ieee Transactions On Wireless Communications, Vol. 15, No. 9, 2016. [7] E. R. Lavudiya, Dr. K.D. Kulat And J. D. Kene, “Implementation And Analysis Of Cognitive Radio System Using Matlab”, International Journal Of Computer Science And Telecommunications, Vol. 4, Issue 7, 2013. [8] Ahmed A. Thabit. “Design And Implementation Of Cognitive Radio Based On Xilinx Fpga”, Arpn Journal Of Engineering And Applied Sciences, Vol.14, No.4, 2019. [9] X. Xie, T. Song, B. Ma, and X. Hu, “A New Adaptive Sensing Scheme For Low Snr And Random Arrival Of Pu Environment”, Journal Of Communications, Vol. 9, No. 3, 2014. [10] Ahmed A. Thabit. “A Proposed Cognitive Radio To Minimize The Sensing Time For High Frequency Receivers Based On Neural Network”, Ieee, 2021. [11] H. Liu, T. Fujii, ’’Single-Channel Blind Identification Based Advanced Energy Detection For Cognitive Radio’’ Icufn, Ieee, 2016. [12] W. Yue And Baoyu Zheng, “A Two-Stage Spectrum Sensing Technique In Cognitive Radio Systems Based On Combining Energy Detection And One-Order Cyclostationary Feature Detection”, International Symposium On Web Information Systems And Applications Nanchang, P. R. China, Pp. 327-330, 2009. [13] C. Song, Y. D. Alemseged, H. N. Tran, G. V.I, Sun, S. Filin And H. Harada, “Adaptive Two Thresholds Based Energy Detection For Cooperative Spectrum Sensing”, Ieee , 2010. 59 [14] A. Puttupu, “Improved Double Threshold Energy Detection in Cognitive Radio Networks”, M.Sc. Thesis, Department Of Electrical Engineering, National Institute Of Technology, 2014. [15] A. Bagwari, , G. S.H. Tomar And S. Verma, “Cooperative Spectrum Sensing Based On Two- Stage Detectors With Multiple Energy Detectors And Adaptive Double Threshold In Cognitive Radio Networks”, Canadian Journal Of Electrical And Computer Engineering, Vol. 36, No. 4, 2013. [16] J. C. Clement, T. Nadu, K. V. Krishnan And A. Bagubali, “Cognitive Radio: Spectrum Sensing Problems In Signal Processing”, International Journal Of Computer Applications, Vol. 40, No.16, 2012. [17] K. Srisomboon, A. Prayote And W. Lee, “Double Constraints Adaptive Energy Detection For Spectrum Sensing In Cognitive Radio Networks”, International Conference On Mobile Computing And Ubiquitous Networking (Icmu), 2015. [18] P. Verma and B. Singh, “Simulation Study of Double Threshold Energy Detection Method for Cognitive Radios”, 2nd International Conference On Signal Processing And Integrated Networks, IEEE, 2015. [19] M. A. Shah, S. Zhang, C. Maple, "Cognitive Radio Networks For Internet Of Things: Applications, Challenges And Future"19th International Conference On Automation And Computing (Icac), 2013 [20] F. Awin, Y. Alginahi, E. Abdel-Raheem And K. Tepe, "Technical Issues On Cognitive Radio- Based Internet Of Things Systems: A Survey" August 2019, Ieee Access 7(1) Doi: 10.1109/Access.2019.2929915 [21] Y. Natarajan, Ect. El, "An Iot And Machine Learning-Based Routing Protocol For Reconfigurable Engineering Application" 05 August 2021, Https://Doi.Org/10.1049/Cmu2.12266 [22] Qasim, N. H. Shevchenko, Yu. P., V. V. ,2019, Begell House, ANALYSIS OF METHODS TO IMPROVE ENERGY EFFICIENCY OF DIGITAL BROADCASTING, 1457-1469,2019. DOI:10.1615/TelecomRadEng.v78.i16.40 [23] B. Benmammar, "Internet of Things and Cognitive Radio: Motivations and Challenges"International Journal Of Organizational And Collective Intelligence (Ijoci) 11(1), 2021. [24] S. Ciftci and M. Torlak, “A Comparison of Energy Detectability Models For Spectrum Sensing”, Ieee, 2008. [25] I. A. Hashim, “Automatic Digital Modulation Identification For Software Defined Radio Based On Fpga”, Phd Thesis, University Of Technology, 2015. [26] K. Tsagkaris and A. Katidiotis, “Neural Network-Based Learning Schemes For Cognitive Radio Systems”, University Of Piraeus. P. 113–121. Doi: 10.3103/S0146411613030073. 60