{"id":30566,"date":"2024-03-21T11:17:47","date_gmt":"2024-03-21T18:17:47","guid":{"rendered":"https:\/\/digilent.com\/blog\/?p=30566"},"modified":"2024-04-02T05:30:38","modified_gmt":"2024-04-02T12:30:38","slug":"setting-up-gnu-radio-python-with-ettus-sdr-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/setting-up-gnu-radio-python-with-ettus-sdr-on-ubuntu-22-04\/","title":{"rendered":"Setting Up GNU Radio &amp; Python with Ettus SDR on Ubuntu 22.04"},"content":{"rendered":"<p><span data-contrast=\"auto\">A software-defined radio (SDR) is not a radio in the traditional sense. Instead of fixed analog components with limited range and ability, an SDR is programmable and highly flexible. Referred to as either SDR or USRP (Universal Software Radio Peripheral), it primarily consists of an FPGA or microcontroller, analog-to-digital and digital-to-analog converters, and a radio frequency (RF) transceiver. Combined, they implement traditional components, like the local oscillator for tuning, the mixer to translate or shift frequencies up or down, and modulation\/demodulation for encoding and decoding. Implementing an SDR in programmable circuitry dramatically reduces costs, increases performance, and allows greater flexibility. It is a platform for learning and experimenting with all aspects of radio.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The following article describes how to install GNU Radio in Ubuntu 22.04. GNU Radio is a block-based programming environment that connects blocks to form a flowgraph program. Instead of writing lines of code, you use higher-level blocks, making it easier to construct a program. Also discussed is installing the SDR board universal hardware driver, UHD, and firmware.\u00a0<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">In the last section, we will build and install the UHD Python module and demonstrate using it.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">The Ettus B200 radio features two channels: one full duplex transmit\/receive and a receive only. <a href=\"https:\/\/digilent.com\/shop\/ettus-usrp-b200mini-1x1-70mhz-6ghz-sdr-cognitive-radio\/\">The B200mini<\/a> and <a href=\"https:\/\/digilent.com\/shop\/ettus-usrp-b205mini-i-1x1-70mhz-6ghz-sdr-cognitive-radio\/\">B205<\/a> have two channels, one for receiving signals and the other for transmitting. They have a frequency range of 70 MHz to 6 GHz, a bandwidth of 56 MHz, and USB 3.0 SuperSpeed connectivity. No external power is needed. It features a Spartan 6 FPGA coupled to an Analog Devices 9364 transceiver with built-in 12-bit A\/D and D\/A converters, elevating the need for separate chips. The maximum sample rate is 61.44 MS\/s. The board\u2019s control firmware is held in volatile memory and is loaded upon initial connection. Getting an update is as easy as running the downloader program.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/digilent.com\/blog\/setting-up-gnu-radio-python-with-ettus-sdr-on-ubuntu-22-04\/usrp_b200mini_bd_925x422-1-3\/\" rel=\"attachment wp-att-30567\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/USRP_B200mini_BD_925x422-1.png\" alt=\"\" width=\"925\" height=\"422\" class=\"alignnone wp-image-30567 size-full\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/USRP_B200mini_BD_925x422-1.png 925w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/USRP_B200mini_BD_925x422-1-600x274.png 600w\" sizes=\"auto, (max-width: 925px) 100vw, 925px\" \/><\/a><\/p>\n<p><span data-contrast=\"auto\" xml:lang=\"EN-US\" lang=\"EN-US\" class=\"TextRun SCXW166745109 BCX8\"><span class=\"NormalTextRun SCXW166745109 BCX8\">The<\/span><span class=\"NormalTextRun SCXW166745109 BCX8\"> <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">B200 <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">antenna connection requires a male SMA <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">antenna <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">connector.<\/span><span class=\"NormalTextRun SCXW166745109 BCX8\"> <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">When choosing an antenna, please do not confuse it with the male RP-SMA connector<\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">. They<\/span><span class=\"NormalTextRun SCXW166745109 BCX8\"> are not the same. The male SMA has a visible center pin<\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">. The RP-SMA does not<\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">. <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">A<\/span><span class=\"NormalTextRun SCXW166745109 BCX8\"> right-angle<\/span><span class=\"NormalTextRun SCXW166745109 BCX8\"> <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">SMA adapter <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">can be used to change the <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">antenna <\/span><span class=\"NormalTextRun SCXW166745109 BCX8\">orientation.<\/span><\/span><span class=\"EOP SCXW166745109 BCX8\" data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<div class=\"sc-box sc-box-info\"><p><strong>Sidebar: Dual-Booting Linux on a Windows System<\/strong><\/p>\n<p>If you are not lucky enough to have a Linux computer handy, converting a Windows computer to run both Linux and Windows is easy. If you require a step-by-step description, I found plenty of online information about making a dual-boot Windows\u2013Linux system. The following outlines my procedure to install Linux from a USB flash drive.<\/p>\n<p>1. Configure the computer\u2019s system bios program so that the computer\u2019s boot sequence will attempt to boot from USB before anything else.<\/p>\n<p>2. Use the Windows Disk Management tool to shrink the main disk drive enough to fit a copy of Linux plus extra room for software. 50 GB should do.<\/p>\n<p>3. Download the <a href=\"https:\/\/ubuntu.com\/download\/desktop\">Ubuntu 22.04.3 LTS<\/a> ISO image file. Once this has been done, use a tool like <a href=\"https:\/\/etcher.balena.io\/\">balenaEtcher<\/a> to put the ISO image onto the USB drive. Do not use File Explorer to copy the ISO image to the USB drive.<\/p>\n<p>With the steps above completed, insert the USB flash drive into the USB port, restart it, and wait for installation options to appear on the screen. Select Install Ubuntu to begin the process. Choose the minimum configuration and download third-party drivers. The process will ask you to create an account with a password. When complete, you will be confronted with a boot menu allowing you to choose between Ubuntu or Windows. Ensure that you have the most up-to-date support. Usually, a prompt will appear shortly after booting Linux, but you could also use Software &amp; Updates found in Show Applications. This will ensure the most up-to-date USB support. Otherwise, you could experience USRP communication issues such as a buffer overrun condition.<\/p>\n<\/div>\n<p><span data-contrast=\"auto\">In the following sections we will do the following:<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<ol>\n<li data-leveltext=\"%1.\" data-font=\"DengXian\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:0,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769242&quot;:[65533,0],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;%1.&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Install GNU Radio\u00a0<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"%1.\" data-font=\"DengXian\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:0,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769242&quot;:[65533,0],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;%1.&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Install UHD (USRP Hardware Driver) tools and drivers.<\/span><\/li>\n<li data-leveltext=\"%1.\" data-font=\"DengXian\" data-listid=\"4\" data-list-defn-props=\"{&quot;335552541&quot;:0,&quot;335559685&quot;:720,&quot;335559991&quot;:360,&quot;469769242&quot;:[65533,0],&quot;469777803&quot;:&quot;left&quot;,&quot;469777804&quot;:&quot;%1.&quot;,&quot;469777815&quot;:&quot;hybridMultilevel&quot;}\" data-aria-posinset=\"1\" data-aria-level=\"1\"><span data-contrast=\"auto\">Download the device firmware, which is loaded dynamically when first initialized.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/li>\n<\/ol>\n<ol><\/ol>\n<ol><\/ol>\n<ol><\/ol>\n<p><span data-contrast=\"auto\">Log into Linux and start by launching a (bash) terminal. Enter the commands listed below in bold. The dollar sign ($) is used as a generic command prompt.\u00a0<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Install the GNU Radio software:<\/span><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ sudo apt-get install -y gnuradio\u00a0<\/code><\/pre>\n<\/div>\n<p><span data-contrast=\"auto\">Install Ettus UHD (Universal Hardware Driver) support:<\/span><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ sudo apt-get install -y uhd-host <\/code><\/pre>\n<\/div>\n<p><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><span data-contrast=\"auto\">Download the firmware images for Ettus boards:<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ sudo \/usr\/lib\/uhd\/utils\/uhd_images_downloader.py <\/code><\/pre>\n<\/div>\n<p><span data-contrast=\"auto\">Plug your b200 into a USB 3.0 port and then use the following command to locate and display information about it:<\/span><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ uhd_find_devices\u00a0<\/code><\/pre>\n<\/div>\n<p><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><b><span data-contrast=\"auto\">Sample Output:<\/span><\/b><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<blockquote><p><span data-contrast=\"auto\">[INFO] [UHD] linux; GNU C++ version 11.2.0; Boost_107400; UHD_4.1.0.5-3<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">[INFO] [B200] Loading firmware image: \/usr\/share\/uhd\/images\/usrp_b200_fw.hex&#8230;<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">&#8212; UHD Device 0<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Device Address:<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">serial: XXXXXXXX<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">name: MyB200<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">product: B200<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">type: b200<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p><\/blockquote>\n<p><span data-contrast=\"auto\">You can use your Linux desktop interface to start GNU Radio or enter the following command.<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ gnuradio-companion &amp;\u00a0<\/code><\/pre>\n<\/div>\n<p><span data-contrast=\"auto\">Load the following GNU Radio flowgraph (<\/span><a href=\"https:\/\/digilent-file-share.s3.us-west-2.amazonaws.com\/blog\/FM93.3.zip\"><span data-contrast=\"none\">FM93.3.grc<\/span><\/a><span data-contrast=\"auto\">). It programs the SDR to tune in to FM 93.3. If your area does not have a 93.3 FM station, modify the \u2018freq\u2019 parameter at the bottom of the screen to change the station. It is recommended not to set the radio\u2019s center frequency to match the radio. If the station is at 96.0 MHz, modify the \u2018center_freq\u2019 parameter to 94 MHz. By default, the volume is set low. Move the \u2018volume\u2019 slider (top of the screen) to make it louder.\u00a0<\/span><span data-ccp-props=\"{&quot;335559739&quot;:0}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/digilent.com\/blog\/setting-up-gnu-radio-python-with-ettus-sdr-on-ubuntu-22-04\/gnuradiogui\/\" rel=\"attachment wp-att-30569\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/GnuRadioGUI.png\" alt=\"\" width=\"1198\" height=\"992\" class=\"alignnone wp-image-30569 size-full\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/GnuRadioGUI.png 1198w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/GnuRadioGUI-600x497.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/GnuRadioGUI-1024x848.png 1024w\" sizes=\"auto, (max-width: 1198px) 100vw, 1198px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/digilent.com\/blog\/setting-up-gnu-radio-python-with-ettus-sdr-on-ubuntu-22-04\/gnuradioblockdiagram\/\" rel=\"attachment wp-att-30570\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/GnuRadioBlockDiagram.png\" alt=\"\" width=\"956\" height=\"697\" class=\"alignnone wp-image-30570 size-full\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/GnuRadioBlockDiagram.png 956w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/GnuRadioBlockDiagram-600x437.png 600w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><\/a><\/p>\n<p><span data-contrast=\"auto\" xml:lang=\"EN-US\" lang=\"EN-US\" class=\"TextRun SCXW209991086 BCX8\"><span class=\"NormalTextRun SCXW209991086 BCX8\">Additional<\/span><span class=\"NormalTextRun SCXW209991086 BCX8\"> information about GNU Radio can be found at<\/span><span class=\"NormalTextRun SCXW209991086 BCX8\"> <\/span><\/span><a class=\"Hyperlink SCXW209991086 BCX8\" href=\"https:\/\/wiki.gnuradio.org\/index.php\/Tutorials\" target=\"_blank\" rel=\"noreferrer noopener\"><span data-contrast=\"none\" xml:lang=\"EN-US\" lang=\"EN-US\" class=\"TextRun Underlined SCXW209991086 BCX8\"><span class=\"NormalTextRun SCXW209991086 BCX8\" data-ccp-charstyle=\"Hyperlink\">here<\/span><\/span><\/a><span data-contrast=\"auto\" xml:lang=\"EN-US\" lang=\"EN-US\" class=\"TextRun SCXW209991086 BCX8\"><span class=\"NormalTextRun SCXW209991086 BCX8\">.<\/span><span class=\"NormalTextRun SCXW209991086 BCX8\">\u00a0<\/span><\/span><span class=\"EOP SCXW209991086 BCX8\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Now that GNU Radio is working and we can tune in to a radio station, we can do the same with Python instead. Use the following commands to install the Python module:<\/span><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ sudo apt-get install -y python3-uhd <\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\"><\/div>\n<p>Start Python and enter the commands below to test if Python will detect\u00a0 the b200<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ python3<\/code><\/pre>\n<\/div>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code><span data-contrast=\"auto\" xml:lang=\"EN-US\" lang=\"EN-US\" class=\"TextRun SCXW62975690 BCX8\"><span class=\"NormalTextRun SCXW62975690 BCX8\">import <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW62975690 BCX8\">uhd<\/span><\/span><span class=\"EOP SCXW62975690 BCX8\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\"> <\/span>\r\n<span data-contrast=\"auto\" xml:lang=\"EN-US\" lang=\"EN-US\" class=\"TextRun SCXW200561687 BCX8\"><span class=\"NormalTextRun SpellingErrorV2Themed SCXW200561687 BCX8\">usrp<\/span><span class=\"NormalTextRun SCXW200561687 BCX8\"> = <\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW200561687 BCX8\">uhd.usrp<\/span><span class=\"NormalTextRun SpellingErrorV2Themed SCXW200561687 BCX8\">.MultiUSRP<\/span><span class=\"NormalTextRun SCXW200561687 BCX8\">()<\/span><\/span><\/code><\/pre>\n<\/div>\n<p><span data-contrast=\"auto\" xml:lang=\"EN-US\" lang=\"EN-US\" class=\"TextRun SCXW76211652 BCX8\"><span class=\"NormalTextRun SCXW76211652 BCX8\">The output should <\/span><span class=\"NormalTextRun SCXW76211652 BCX8\">indicate<\/span><span class=\"NormalTextRun SCXW76211652 BCX8\"> <\/span><span class=\"NormalTextRun SCXW76211652 BCX8\">the device <\/span><span class=\"NormalTextRun SCXW76211652 BCX8\">is<\/span><span class=\"NormalTextRun SCXW76211652 BCX8\"> detected <\/span><span class=\"NormalTextRun SCXW76211652 BCX8\">like the following output<\/span><span class=\"NormalTextRun SCXW76211652 BCX8\">.<\/span><\/span><span class=\"EOP SCXW76211652 BCX8\" data-ccp-props=\"{}\">\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/digilent.com\/blog\/setting-up-gnu-radio-python-with-ettus-sdr-on-ubuntu-22-04\/screenshot-from-2024-01-26-15-59-07\/\" rel=\"attachment wp-att-30573\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot-from-2024-01-26-15-59-07.png\" alt=\"\" width=\"742\" height=\"491\" class=\"alignnone size-full wp-image-30573\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot-from-2024-01-26-15-59-07.png 742w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/Screenshot-from-2024-01-26-15-59-07-600x397.png 600w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/a><\/p>\n<p>We can plot the USRP output like the GNU Radio Flowgraph example with the following Python script. Copy the code below into IDLE to plot the FFT response center from the B200 centered at 96 MHz<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import uhd\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\n\r\nusrp = uhd.usrp.MultiUSRP()\r\n\r\nN = 4096\r\ncenter_freq = 96e6 # Radio Center Frequency in Hz\r\nrate = 8e6         # Sample Rate in S\/s or Hz\r\ngain = 30          # dB\r\n\r\nusrp.set_rx_rate(rate, 0)\r\nusrp.set_rx_freq(uhd.types.TuneRequest(center_freq), 0)\r\nusrp.set_rx_antenna('RX2', 0)\r\nusrp.set_rx_gain(gain, 0)\r\n\r\n# Set up the stream and receive buffer\r\nst_args = uhd.usrp.StreamArgs('fc32', 'sc16')\r\nst_args.channels = [0]\r\n\r\nmetadata = uhd.types.RXMetadata()\r\nstreamer = usrp.get_rx_stream(st_args)\r\nrecv_buffer = np.zeros((1, N), dtype=np.complex64)\r\n\r\n# Start Stream\r\nstream_cmd = uhd.types.StreamCMD(uhd.types.StreamMode.start_cont)\r\nstream_cmd.stream_now = True\r\nstreamer.issue_stream_cmd(stream_cmd)\r\n\r\n# Receive Samples\r\nsamples = np.zeros(N, dtype=np.complex64)\r\nstreamer.recv(recv_buffer, metadata)\r\nsamples[0:N] = recv_buffer[0]\r\n\r\n# Stop Stream\r\nstream_cmd = uhd.types.StreamCMD(uhd.types.StreamMode.stop_cont)\r\nstreamer.issue_stream_cmd(stream_cmd)\r\n\r\nfft = np.abs(np.fft.fft(samples))**2 \/ (N*rate)\r\nlog = 10.0*np.log10(fft)\r\nshifted = np.fft.fftshift(log)\r\nf = np.arange(center_freq + rate\/-2.0, center_freq+rate\/2.0, rate\/N)\r\n\r\nplt.plot(f, shifted)\r\nplt.xlabel(\"Frequency [Hz]\")\r\nplt.ylabel(\"Magnitude [dB]\")\r\nplt.grid(True)\r\nplt.show()\r\n<\/code><\/pre>\n<\/div>\n<p><a href=\"https:\/\/digilent.com\/blog\/setting-up-gnu-radio-python-with-ettus-sdr-on-ubuntu-22-04\/matplot_fm93_3\/\" rel=\"attachment wp-att-30576\" style=\"background-color: white;font-size: 1rem\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/Matplot_FM93_3.png\" alt=\"\" width=\"599\" height=\"438\" class=\"alignnone size-full wp-image-30576\" \/><\/a><\/p>\n<p><span>Our guide equipped you to install GNU Radio and Ettus UHD on Linux, providing a springboard for exploring Software Defined Radio (SDR). While tuning an FM radio station is a great starting point, GNU Radio and UHD offer much more. Dive deeper into signal processing, develop custom applications, and unlock the potential of the radio spectrum.\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-30566 jlk' data-task='like' data-post_id='30566' data-nonce='1c819b3974' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-30566 lc'>+3<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-30566 jlk' data-task='unlike' data-post_id='30566' data-nonce='1c819b3974' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-30566 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-30566 status align-left'><\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>A software-defined radio (SDR) is not a radio in the traditional sense. Instead of fixed analog components with limited range and ability, an SDR is programmable and highly flexible. Referred &hellip; <\/p>\n","protected":false},"author":60,"featured_media":30601,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[20,1563,1561],"tags":[4670,4354,4668,4669,4353,4626,4370,4341,4671,4672],"ppma_author":[4461],"class_list":["post-30566","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-products","category-guide","category-applications","tag-bash","tag-ettus","tag-gnu","tag-gnu-radio","tag-linux","tag-python","tag-radio","tag-sdr","tag-ubuntu","tag-usrp"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2024\/03\/2024-Mar-Newsletter-SettingUpGNURadio-1200x628-1.png","authors":[{"term_id":4461,"user_id":60,"is_guest":0,"slug":"jrys","display_name":"John Rys","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/b5f589ceec35aa72d93bdb885888fe28157d060d3a9bd5484c6388d3f10fc51d?s=96&d=mm&r=g","1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":"","9":"","10":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/30566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/60"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=30566"}],"version-history":[{"count":22,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/30566\/revisions"}],"predecessor-version":[{"id":30728,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/30566\/revisions\/30728"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/30601"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=30566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=30566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=30566"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=30566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}