Установка gnuradio на windows

Windows Installation

Too long, won’t read: Use the RadioConda installer, as linked from our InstallingGR landing page.

Binary Installers

There are a few different unofficial GNU Radio binary installers that are maintained by the community:

1) Radioconda installer. This binary installer tends to be the most up-to-date, but you should check the list of packages to see if it includes what you need. It utilizes the conda package/environment manager and provides easy access to thousands of Python and other packages that are not strictly related to GNU Radio. This also lets you stay up-to-date without having to re-install. Since this provides the same conda-forge packages available without the installer, the conda install guide might be useful for additional instructions, including how to build additional OOT modules from source.
After installing Radioconda you will get a «GNU Radio Companion» added to your start menu. Run this to start GNU Radio Companion, the graphical GNU Radio design tool.

2) (only outdated versions as of 2023-09) Geof Nieboer’s installer hosted at gcndevelopment.com (recently unreachable in 2022-07, but reachable currently 2022-10-23). This is a binary installer for 64-bit Windows 7/8/10 that includes all dependencies for Windows, a custom python distro, commonly used SDR drivers, and several OOT blocks.

3) (only outdated versions as of 2023-09) Pothos SDR development environment installer. This binary installer includes GNU Radio, Pothos, CubicSDK, and other tools. It has historically been updated about once or twice per year.

Current Windows Status

Installing core GNU Radio and USRP on Windows is becoming more routine. Many OoT modules may still require compiling locally. Please report any success or failures. Patches and enhancements are especially welcome!

Windows Porting Issues

Considerable effort has been put into making the GNU Radio code portable among various operating systems, but there are several reasons why it cannot be «simply» compiled and run under Windows:

  • The build and install procedures are based on Linux scripts and tools
  • Several third-party libraries are used, each with its own, often system-dependent, installation procedure
  • Most GNU Radio applications must interface to hardware (e.g., a sound card or USRP) which require system-dependent drivers and installation procedures
  • Because GNU Radio is written as an extension to Python, there are potential problems on Windows if different runtime libraries are used for GNU Radio and Python

The following sections show how these issues can be addressed.

Installation Options

GNU Radio is designed to be flexible. It has a number of modules, capabilities, and options that can be enabled or disabled to suit the needs of the user, and the user can add custom blocks or modules to the system.

To support this flexibility, it comes with a set of files and scripts to be used with GNU software build tools (sh, make, autoconf, automake, etc.). These tools use Linux-like commands and filenames that are not normally available on Windows systems.

Fortunately, we are not the first to face this problem, and several solutions exist. These are presented in order of increasing difficulty:

Building on Windows with Native Tools

Ettus Application note [1] describes how to build from source. Similar is a post at [2] for OOT modules.

Powershell scripts are now available at https://www.github.com/gnieboer/gnuradio_windows_build_scripts that fully automate the build process for GNURadio 3.7.9.2+. A few build dependencies are required (MSVC 2015, Git, Doxygen, CMake, Perl, Wix) but all are free. The script has two options:

  1. Build all dependencies from source (including python itself)
  2. Download a prebuilt custom dependency package and then build only GNURadio and a few OOT modules on top.

The binary installers described above are built with these scripts. They ensure that all dependencies are built with the same toolchain against the same runtime libraries, and handle the patches and configuration «tweaks» needed to build them on Windows.
If option 1 is desired, note that to build scipy, the non-free Intel Fortran compiler is required, gfortran cannot build objects that can link with MSVC C objects. If you do not have said compiler, the scripts will download pre-compiled wheels instead.

More information on the build process is available on the GitHub repo readme, and also at http://www.gcndevelopment.com/gnuradio.

GNURadio 3.6 has also been compiled on Windows using native tools as well (see http://voltronics.blogspot.com/2013/01/gnu-radio-windows-build-guide.html and https://lists.gnu.org/archive/html/discuss-gnuradio/2013-08/msg00284.html)

More helpful tips on dependency version information have been reported:
https://lists.gnu.org/archive/html/discuss-gnuradio/2013-12/msg00497.html

MinGW/MSYS

MinGW (http://www.mingw.org/) provides GNU compilers and Window-specific header files for compiling native Windows applications.
MSYS (http://www.mingw.org/msys.shtml) is a companion set of Linux-like commands, shell, and build tools.
MinGW does not include a Linux programming interface; programs should be smaller and faster than with Cygwin (in theory), but will require more Windows-specific code.
MSYS is intended primarily as a build environment, making it more compact than Cygwin.

Because there is no Linux API emulation, GNU Radio built with MinGW should be used with standard Windows versions of Python and the third-party libraries.
MinGW does not provide as much support as Cygwin for installing third-party libraries, but in many cases precompiled binaries are available.

For detailed installation instructions using MinGW and MSYS see Installing GNU Radio with MinGW.

MinGW-w64/MSYS2

MinGW-w64 (https://www.mingw-w64.org/) is an advancement of the original mingw.org project. It was created to support the GCC compiler on Windows systems.
MSYS2 (https://www.msys2.org/) is a software distribution and building platform for Windows. It provides command line terminal, bash, and Linux tools like sed and awk all based on a modified version of Cygwin. To provide easy installation, MSYS2 provides a package management system called Pacman. To install GNU Radio with MSYS2 open up a mintty command line terminal and run either:

pacman -S mingw-w64-x86_64-gnuradio

or:

pacman -S mingw-w64-ucrt-x86_64-gnuradio

For more detailed instructions on using GNU Radio with MinGW-w64 and MSYS2 see Using GNU Radio with MinGW-w64 and MSYS2

Cygwin

Cygwin (http://www.cygwin.com/) is a Linux-like environment for Windows.
It provides the Linux-like shell, file naming, and build tools we need and also makes it easy to install many of the third-party libraries required by GNU Radio. It also provides a Linux programming interface (API); this is not required by GNU Radio, but it lets us use the better-tested Linux versions of some functions.

Because the Linux API uses its own C runtime library, it is best to use Cygwin versions of Python and the third-party libraries when building GNU Radio with Cygwin.

For detailed installation instructions using Cygwin see Installing GNU Radio with Cygwin.

Chocolatey

To quote from the [|https://chocolatey.org/ Chocolatey homepage]: Chocolatey NuGet is a Machine Package Manager, somewhat like apt-get, but built with Windows in mind..

There are packages for gnuradio (and its dependencies) available in a separate repository (currently the best known source is: https://github.com/ariovistus/chocolatey-packages)

To install, open an Administrative command line session and run:

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

Now you need to install a source which has the recipes for gnuradio and dependents. The easiest method is to clone the chocolatey-packages from the github repository listed above (https://github.com/ariovistus/chocolatey-packages), then add the local source from within an Administrative command line session:

choco source add -name gnuradio -source C:\<path-to>\chocolatey-packages

Create the numpy package:

cd <path-to>\chocolatey-package\numpy
cpack

Create the gnuradio package:

cd <path-to>\chocolatey-package\gnuradio
cpack

Now install the gnuradio package:

choco install gnuradio

Follow the command prompts.

WSL | Ubuntu

Enable WSL from windows features.

Install Ubuntu 20.04 (or newer) from Microsoft Store.

Using the Ubuntu terminal, install gnuradio as you would on linux [3]. If you want to develop GNU Radio’s core you will need to build GNU Radio from source.

WSL 1/2 (before WSLg)

Install additional package «libgtk-3-dev»

 sudo apt install libgtk-3-dev
 

WSL 1 and 2 (before WSLg) do not have an X server for displaying graphical applications. Install an X server, either VcXsrv [4] or Xming [5] as WSL does not come with an X server. VcXsrv is recommended as it is open source and self-contained instead of being tied to Cygwin, whereas Xming «asks for donations» to the developer as a dubious «sale» for non-existent support.

Launch VcXsrv, making sure to select «Disable access control» option in the Extra settings so that any application can export to X11.

Edit bashrc to set up the display by adding the following lines at the bottom of the file.

WSL1:

 # X11 forwarding for Windows
 export DISPLAY=:0.0
 export LIBGL_ALWAYS_INDIRECT=1

WSL2:

 # X11 forwarding for Windows
 export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2>/dev/null):0
 export LIBGL_ALWAYS_INDIRECT=1

Restart the Ubuntu terminal and run

 gnuradio-companion

WSLg

Currently in early testing stages, the WSLg update contains a Wayland graphics server and X interface layer allowing graphical applications to run without extra setup.

From the Ubuntu terminal run

 gnuradio-companion

Using an Azure VM

Another way to generate a GNU Radio environment if you’re using Windows, is to create an Azure Virtual Machine running Ubuntu Server 18.04 LTS.

If you already have an existing Azure account you can follow the instructions here[6] to create an Ubuntu VM using the Azure portal. Otherwise, you can sign up for an account here[7]. Azure provides free accounts for students[8] with a limited set of credits.

Once your VM is created you should be able to SSH into it, to install a desktop environment. Full instructions can be found here, but in summary:
Install xfce

 sudo apt-get update 
 sudo apt-get -y install xfce4

Install xrdp as a remote desktop server

 sudo apt-get -y install xrdp 
 sudo systemctl enable xrdp

Configure xrdp to use xfce

 echo xfce4-session >~/.xsession

Restart the xrdp service

 sudo service xrdp restart

You will need to create a local password for your Linux VM (on top of your existing SSH key), and open port 3389[9] on the VM.

Finally you can use a remote desktop client, such as Remote Desktop Connection to connect to your VM and follow the instructions for GNU Radio on Ubuntu found here[10].

Время на прочтение10 мин

Количество просмотров52K

Привет, Хабр.

В третьей части было рассказано, как получить доступ к SDR-приемнику посредством языка Python. Сейчас мы познакомимся с программой GNU Radio — системой, позволяющей создать достаточно сложную конфигурацию радиоустройства, не написав ни единой строчки кода.

Для примера рассмотрим задачу параллельного приема нескольких FM-станций на один приемник. В качестве приемника будем использовать все тот же RTL SDR V3.

Продолжение под катом.

Установка

Для начала работы GNU Radio необходимо установить, дистрибутив для Windows можно скачать здесь. Система эта кроссплатформенная, версии есть также под Linux и под OSX (вроде бы GNU Radio успешно запускали и на Raspberry Pi, но 100% гарантии дать не могу).

По сути, GNU Radio это целый фреймворк для цифровой обработки сигналов, в котором программа «собирается» из отдельных модулей. Есть большое количество уже готовых блоков, при желании также можно создавать свои собственные. Сами модули написаны на С++, а для взаимодействия блоков друг с другом используется Python. Желающие могут посмотреть на API более подробно, но на практике это, скорее всего, не пригодится — все действия можно делать визуально в программе GNU Radio Companion.

Система ориентирована на обработку потоков данных, так что каждый блок обычно имеет вход и выход. Далее, соединяя блоки в редакторе, мы получаем готовую систему. Сам интерфейс GNU Radio довольно простой, сложность состоит в понимании того, что делает тот или иной блок. Как говорилось ранее, низкоуровневая работа с SDR имеет высокий порог входа и требует некоторого знания в DSP и математике. Но мы рассмотрим простую задачу, для которой никаких специальных знаний не потребуется. Итак, приступим.

Начало работы

Запускаем GNU Radio Companion, создаем новый проект, тип проекта выбираем WX GUI, добавляем на экран и соединяем два блока, как показано на скриншоте.

Мы видим два типа блоков — Source (источник) и Sink (выход, «слив»). RTL-SDR — это наш приемник, FFT GUI — это виртуальный спектроанализатор.

Переменную Sample Rate устанавливаем в 2048000, это частота дискретизации нашего приемника. Частоту RTL-SDR оставляем по умолчанию равной 100МГц.

Запускаем проект — все работает, мы видим спектр FM-станций. Первая программа для GNU Radio готова!

Если мы посмотрим лог, то увидим такие строки.

Generating: ‘D:\\MyProjects\\GNURadio\\top_block.py’
Executing: C:\Python27\python.exe -u D:\MyProjects\GNURadio\top_block.py

Да, мы можем посмотреть файл top_block.py, который сгенерил нам GNU Radio Companion. Истинные джедаи могут писать непосредственно в Python, но требуемый код, как мы видим, довольно большой. Мы же создали его за 1 минуту.

top_blocks.py

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Wed May 22 22:05:14 2019
##################################################

if __name__ == '__main__':
    import ctypes
    import sys
    if sys.platform.startswith('linux'):
        try:
            x11 = ctypes.cdll.LoadLibrary('libX11.so')
            x11.XInitThreads()
        except:
            print "Warning: failed to XInitThreads()"

from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import wxgui
from gnuradio.eng_option import eng_option
from gnuradio.fft import window
from gnuradio.filter import firdes
from gnuradio.wxgui import fftsink2
from grc_gnuradio import wxgui as grc_wxgui
from optparse import OptionParser
import osmosdr
import time
import wx


class top_block(grc_wxgui.top_block_gui):

    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2048000

        ##################################################
        # Blocks
        ##################################################
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
        	self.GetWin(),
        	baseband_freq=0,
        	y_per_div=10,
        	y_divs=10,
        	ref_level=0,
        	ref_scale=2.0,
        	sample_rate=samp_rate,
        	fft_size=1024,
        	fft_rate=15,
        	average=False,
        	avg_alpha=None,
        	title='FFT Plot',
        	peak_hold=False,
        )
        self.Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(100e6, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(10, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)


        ##################################################
        # Connections
        ##################################################
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))

    def get_samp_rate(self):
        return self.samp_rate

    def set_samp_rate(self, samp_rate):
        self.samp_rate = samp_rate
        self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
        self.rtlsdr_source_0.set_sample_rate(self.samp_rate)


def main(top_block_cls=top_block, options=None):

    tb = top_block_cls()
    tb.Start(True)
    tb.Wait()


if __name__ == '__main__':
    main()

Впрочем, если убрать громоздкую инициализацию, то мы увидим, что ключевых строк кода не так уж много.

from gnuradio import gr
from gnuradio.wxgui import fftsink2
import osmosdr

class top_block(grc_wxgui.top_block_gui):

    def __init__(self):
        grc_wxgui.top_block_gui.__init__(self, title="Top Block")
        self.samp_rate = samp_rate = 2048000
        self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(...)
        self.Add(self.wxgui_fftsink2_0.win)
        self.rtlsdr_source_0 = osmosdr.source(args="numchan=" + str(1) + " " + '' )
        self.connect((self.rtlsdr_source_0, 0), (self.wxgui_fftsink2_0, 0))

def main(top_block_cls=top_block, options=None):
    tb = top_block_cls()
    tb.Start(True)
    tb.Wait()

Так что в принципе, это можно написать вручную. Но мышью оно все-таки быстрее. Хотя возможность поменять код иногда может пригодиться, если захочется добавить какую-то нестандартную логику.

Принимаем FM-радио

Теперь попробуем принять одну из станций. Как было видно из скриншотов, центральная частота приемника 100МГц и ширина полосы пропускания около 2МГц. На спектре мы видим две станции, на 100.1МГц и 100.7МГц соответственно.

Первым шагом необходимо перенести спектр станции в центр, сейчас он отстоит вправо на 100КГц. Для этого вспоминаем школьную формулу умножения косинусов — в результате будет две частоты, сумма и разность — нужная станция сдвинется в центр, что нам и нужно (а лишнее мы потом отфильтруем).

Создаем две переменные для хранения частоты freq_center=100000000 и freq_1=100100000, также добавляем генератор сигналов с частотой freq_center — freq_1.

Т.к. система построена на базе Python, то в полях ввода параметров мы можем использовать выражения, что достаточно удобно.

Схема в итоге должна выглядеть так:

Теперь необходимо добавить сразу несколько блоков — уменьшить тактовую частоту входного сигнала (она равна 2048КГц), отфильтровать сигнал, подать его на FM-декодер, затем еще раз уменьшить тактовую частоту до 48КГц.

Результат показан на картинке:

Считаем внимательно. Мы делим тактовую частоту 2048КГц в 4 раза блоком Rational Resampler (получаем 512КГц), затем после Low Pass фильтра стоит WBFM-декодер с децимацией 10 (получаем 51.2КГц). В принципе, этот сигнал уже можно подать на звуковую карту, но высота тона будет чуть отличаться. Еще раз меняем тактовую частоту в 48/51, в результате будет тактовая частота 48.2КГц, разницей уже можно пренебречь.

Второй важный момент — тип входов. С приемника поступает комплексный IQ-сигнал (входы-выходы синего цвета), с FM-декодера выходит вещественный сигнал — входы и выходы желтого цвета. Если перепутать, ничего не заработает. Подробнее уже было на Хабре, нам достаточно понять общий принцип.

В общем, запускаем, убеждаемся что все работает. Можно запустить программу и слушать радио. Мы пойдем дальше — у нас же все-таки Software Defined радио — добавим одновременный прием второй станции.

Многоканальный прием

Второй приемник добавляется любимым программистским методом — Ctrl+C/Ctrl+V. Добавляем переменную freq_2, копируем блоки и соединяем их точно также.

Результат вполне сюрреалистичный — две FM-станции можно слушать одновременно. Тем же самым методом (Ctrl+V) можно добавить и третью станцию.

Запись

Слушать две станции оригинально, но на практике мало полезно. Сделаем что-то более нужное, например добавим запись звука в отдельные файлы. Это может быть достаточно удобно — с одного физического приемника можно параллельно записывать несколько каналов.

Добавим к каждому выходу компонент File Sink, как показано на скриншоте.

Windows-версия почему-то требует абсолютные пути файлов, иначе запись не работает. Запускаем, убеждаемся что все нормально. Размер сохраняемых файлов довольно большой, т.к. по умолчанию записывается формат float. Запись в формате int оставлю читателям в качестве домашнего задания.

Получившиеся файлы можно открыть в Cool Edit и убедиться, что звук записался нормально.

Разумеется, число записываемых каналов можно увеличить, оно ограничено только полосой пропускания приемника и мощностью компьютера. Кроме File Sink можно использовать и UDP Sink, так что программу можно использовать для трансляции по сети.

Запуск из командной строки

И последнее. Если использовать программу автономно, например для многоканальной записи, то UI в принципе и не нужен. В верхнем левом блоке Options меняем параметр Run Options на No UI. Запускаем программу еще раз, убеждаемся что все работает. Теперь сохраняем сгенерированный файл top_block.py — мы можем просто запускать его из командной строки, например из bat-файла или из консоли.

Если кому интересно, сгенерированный файл сохранен под спойлером.

recorder.py

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
##################################################
# GNU Radio Python Flow Graph
# Title: Top Block
# Generated: Fri May 24 21:47:03 2019
##################################################

from gnuradio import analog
from gnuradio import audio
from gnuradio import blocks
from gnuradio import eng_notation
from gnuradio import filter
from gnuradio import gr
from gnuradio.eng_option import eng_option
from gnuradio.filter import firdes
from optparse import OptionParser
import osmosdr
import time


class top_block(gr.top_block):

    def __init__(self):
        gr.top_block.__init__(self, "Top Block")

        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 2048000
        self.freq_center = freq_center = 100000000
        self.freq_2 = freq_2 = 100700000
        self.freq_1 = freq_1 = 100100000

        ##################################################
        # Blocks
        ##################################################
        self.rtlsdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
        self.rtlsdr_source_0.set_sample_rate(samp_rate)
        self.rtlsdr_source_0.set_center_freq(freq_center, 0)
        self.rtlsdr_source_0.set_freq_corr(0, 0)
        self.rtlsdr_source_0.set_dc_offset_mode(0, 0)
        self.rtlsdr_source_0.set_iq_balance_mode(0, 0)
        self.rtlsdr_source_0.set_gain_mode(False, 0)
        self.rtlsdr_source_0.set_gain(10, 0)
        self.rtlsdr_source_0.set_if_gain(20, 0)
        self.rtlsdr_source_0.set_bb_gain(20, 0)
        self.rtlsdr_source_0.set_antenna('', 0)
        self.rtlsdr_source_0.set_bandwidth(0, 0)

        self.rational_resampler_xxx_1_0 = filter.rational_resampler_fff(
                interpolation=48,
                decimation=51,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_1 = filter.rational_resampler_fff(
                interpolation=48,
                decimation=51,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None,
        )
        self.rational_resampler_xxx_0 = filter.rational_resampler_ccc(
                interpolation=1,
                decimation=4,
                taps=None,
                fractional_bw=None,
        )
        self.low_pass_filter_0_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate/4, 100000, 500000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0 = filter.fir_filter_ccf(1, firdes.low_pass(
        	1, samp_rate/4, 100000, 500000, firdes.WIN_HAMMING, 6.76))
        self.blocks_multiply_xx_0_0 = blocks.multiply_vcc(1)
        self.blocks_multiply_xx_0 = blocks.multiply_vcc(1)
        self.blocks_file_sink_0_0 = blocks.file_sink(gr.sizeof_float*1, 'D:\\Temp\\1\\audio2.snd', False)
        self.blocks_file_sink_0_0.set_unbuffered(False)
        self.blocks_file_sink_0 = blocks.file_sink(gr.sizeof_float*1, 'D:\\Temp\\1\\audio1.snd', False)
        self.blocks_file_sink_0.set_unbuffered(False)
        self.audio_sink_0 = audio.sink(48000, '', True)
        self.analog_wfm_rcv_0_0 = analog.wfm_rcv(
        	quad_rate=samp_rate/4,
        	audio_decimation=10,
        )
        self.analog_wfm_rcv_0 = analog.wfm_rcv(
        	quad_rate=samp_rate/4,
        	audio_decimation=10,
        )
        self.analog_sig_source_x_0_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq_center - freq_2, 1, 0)
        self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, freq_center - freq_1, 1, 0)

        ##################################################
        # Connections
        ##################################################
        self.connect((self.analog_sig_source_x_0, 0), (self.blocks_multiply_xx_0, 1))
        self.connect((self.analog_sig_source_x_0_0, 0), (self.blocks_multiply_xx_0_0, 1))
        self.connect((self.analog_wfm_rcv_0, 0), (self.rational_resampler_xxx_1, 0))
        self.connect((self.analog_wfm_rcv_0_0, 0), (self.rational_resampler_xxx_1_0, 0))
        self.connect((self.blocks_multiply_xx_0, 0), (self.rational_resampler_xxx_0, 0))
        self.connect((self.blocks_multiply_xx_0_0, 0), (self.rational_resampler_xxx_0_0, 0))
        self.connect((self.low_pass_filter_0, 0), (self.analog_wfm_rcv_0, 0))
        self.connect((self.low_pass_filter_0_0, 0), (self.analog_wfm_rcv_0_0, 0))
        self.connect((self.rational_resampler_xxx_0, 0), (self.low_pass_filter_0, 0))
        self.connect((self.rational_resampler_xxx_0_0, 0), (self.low_pass_filter_0_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.audio_sink_0, 0))
        self.connect((self.rational_resampler_xxx_1, 0), (self.blocks_file_sink_0, 0))
        self.connect((self.rational_resampler_xxx_1_0, 0), (self.audio_sink_0, 1))
        self.connect((self.rational_resampler_xxx_1_0, 0), (self.blocks_file_sink_0_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_multiply_xx_0, 0))
        self.connect((self.rtlsdr_source_0, 0), (self.blocks_multiply_xx_0_0, 0))

    def get_samp_rate(self):
        return self.samp_rate

    def set_samp_rate(self, samp_rate):
        self.samp_rate = samp_rate
        self.rtlsdr_source_0.set_sample_rate(self.samp_rate)
        self.low_pass_filter_0_0.set_taps(firdes.low_pass(1, self.samp_rate/4, 100000, 500000, firdes.WIN_HAMMING, 6.76))
        self.low_pass_filter_0.set_taps(firdes.low_pass(1, self.samp_rate/4, 100000, 500000, firdes.WIN_HAMMING, 6.76))
        self.analog_sig_source_x_0_0.set_sampling_freq(self.samp_rate)
        self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate)

    def get_freq_center(self):
        return self.freq_center

    def set_freq_center(self, freq_center):
        self.freq_center = freq_center
        self.rtlsdr_source_0.set_center_freq(self.freq_center, 0)
        self.analog_sig_source_x_0_0.set_frequency(self.freq_center - self.freq_2)
        self.analog_sig_source_x_0.set_frequency(self.freq_center - self.freq_1)

    def get_freq_2(self):
        return self.freq_2

    def set_freq_2(self, freq_2):
        self.freq_2 = freq_2
        self.analog_sig_source_x_0_0.set_frequency(self.freq_center - self.freq_2)

    def get_freq_1(self):
        return self.freq_1

    def set_freq_1(self, freq_1):
        self.freq_1 = freq_1
        self.analog_sig_source_x_0.set_frequency(self.freq_center - self.freq_1)


def main(top_block_cls=top_block, options=None):

    tb = top_block_cls()
    tb.start()
    try:
        raw_input('Press Enter to quit: ')
    except EOFError:
        pass
    tb.stop()
    tb.wait()


if __name__ == '__main__':
    main()

Удобно и то, что система является кросс-платформенной, и получившаяся программа может работать на Linux, Windows и OSX.

Заключение

Можно сказать, что GNU Radio достаточно сложная система, не в плане рисования блоков конечно, а в плане понимания того, как все это работает. Но какие-то несложные вещи сделать вполне посильно и интересно. GNU Radio также удобно использовать как «виртуальную лабораторию» для обучения — к любой части схемы можно подключить виртуальный осциллограф или спектроанализатор и посмотреть, как выглядит сигнал.

Если не будет каких-то отдельных пожеланий, тему SDR-приема наверно можно закрыть — все основные моменты уже рассмотрены, да и количество просмотров от первой к третьей части падает почти по экспоненте (хотя еще можно написать про передачу, но оно требует более дорогого «железа» для тестов чем RTL SDR). Надеюсь все же, что некоторое понимание того как это работает, у читателей осталось. Ну и всем удачных экспериментов.

TLDR: To install GNU Radio on Windows, just install RadioConda and the drivers for your SDR. Create a shortcut, double-click, and you’re running GNU Radio Companion! For hardware support, simply install the drivers for your platform.

The longer version of this post will provide a step-by-step process for using RadioConda to install GNU Radio on your Windows PC as well as building a quick flowgraph to test the installation. I’ll also show you how to enable support for the following hardware:

  • HackRF
  • PlutoSDR

In addition, I’ll introduce Python virtual environments in general, Conda more specifically, and Radioconda more specifically than that.

What are Virtual Environments?

These are configurations for your computer that include a specific version of Python as well as a number of applications, packages, and dependencies. What’s great is that none of this is installed on your machine itself! You can enter the virtual environment, execute applications, and then exit the virtual environment. Upon exiting, your operating system will return to the state it was in prior to entering the virtual environment.

What is Conda?

Conda is a powerful management tool for virtual environments. You can use it to create any number of Conda environments, and use very simple commands to install hundreds of packages.

What is Mamba?

Mamba is essentially an optimized, higher-performing version of Conda (stuff installs faster).

What is RadioConda?

Finally, we’ve arrived at the tool we’re going to use! RadioConda is based on Conda, but its default configuration includes a ton of SDR-specific packages, such as GNU Radio, RF apps, SDR hardware support, and many key out-of-tree modules. Installing it on your Windows, Linux, or Mac machine will give you an enormous amount of SDR software. And like any other Conda environment, you can enter and exit it at will, leaving your core operating system unaffected.

RadioConda Installation Process for Windows

Navigate to the RadioConda GitHub Page:

Download the Windows installer. If using Edge, you may be temporarily prevented from completing the download. If you click on the downloads button on the upper right, you may see this warning:

Click on the three dots to select “Keep”

And then confirm by selecting “Keep anyway”

Your download should then show as complete

Double-click the installer

Agree to the license

Choose the scope of the installation (“Just Me” is good for most users, unless you want multiple users to have access the software on your machine)

Select a location for the installed files (or just click “Install” to accept the default)

The install will take a few minutes. Click “Next” when it completes

Then click “Finish”

You can now access GNU Radio Companion from your start bar by typing “gnu”

It’s a good idea to click “Pin to taskbar” if you want easy access

Installing HackRF Support

Go back to the RadioConda GitHub Page and find the hardware support section

Clicking the “HackRF (setup)” link leads you down the page to the following:

Clicking the “Install the WinUSB driver with Zadig” link moves you further down the page to this:

Clicking the “Zadig” link takes you to this site, which hosts a general purpose USB driver for windows devices

Scrolling down a bit, you’ll find a download link for the most recent version of the driver. Note that the advertising on this site is… extensive… and that there are may be several other links appearing to be downloads. The “Zadig 2.9” link below is the one you want (although the version may have changed by the time you read this post)

Double-click the installer, and allow it to check for updates online

Then click “Install WCID Driver”

Installing PlutoSDR Support

Go back to the RadioConda GitHub Page and find the hardware support section

Click the “libiio (setup)” link, which leads you down the page to this

Click the link to download, then run the installer, accepting the license agreement

Confirm (or modify) the install location

Then confirm to begin installing

This brings you to an installer wizard, at which you click “Next”

Confirm install from Analog Devices

And Finish

Testing the Installation – HackRF

Bring up GNU Radio by typing GNU into the start bar or clicking the shortcut you’ve made

On the first attempt, I’ve seen a glitch where only a blank window appears. In that case, close the blank window and try again. You should then see the GNU Radio Companion interface.

Create a flowgraph as follows:

  1. change existing samp_rate variable to “10e6”
  2. add a Soapy HackRF Source with
    • RF Options -> Bandwidth: samp_rate
    • RF Options -> Center Freq (Hz): 98e6
  3. add a QT GUI Frequency Sink with
    • General -> Center Frequency (Hz): 98e6
  4. Connect the source output to the sink input
  5. Save the flowgraph

Attach your HackRF to the PC via USB. After executing the flowgraph using the Play button in the toolbar, you should a live frequency plot several FM broadcast signals. The specific frequencies you observe will be different depending on the FM broadcasts in your area.

Testing the Installation – PlutoSDR

Bring up GNU Radio by typing GNU into the start bar or clicking the shortcut you’ve made

On the first attempt, I’ve seen a glitch where only a blank window appears. In that case, close the blank window and try again. You should then see the GNU Radio Companion interface.

Create a flowgraph as follows:

  1. change existing samp_rate variable to “10e6”
  2. add a Soapy PLUTO Source with
    • RF Options -> Bandwidth: samp_rate
    • RF Options -> Center Freq (Hz): 98e6
  3. add a QT GUI Frequency Sink with
    • General -> Center Frequency (Hz): 98e6
  4. Connect the source output to the sink input
  5. Save the flowgraph

Attach your PlutoSDR to the PC via USB. After executing the flowgraph using the Play button in the toolbar, you should a live frequency plot several FM broadcast signals. The specific frequencies you observe will be different depending on the FM broadcasts in your area.

GNURadio can be installed on Windows, OS X and Linux Operating Systems. Linux is by far the easiest and is well supported. Installation on Windows is becoming more routine and installers are now available from Ettus Research. OS X installation is possible through MacPorts. All installations now include the GNURadio Companion (GRC). In addition, these installations also include drivers and firmware for the Ettus USRP line of radios, audio drivers and other software defined radios such as the BladeRF and RTL2832.

Linux Installation

Installation on the Linux platform is fairly straightforward. There are three methods to install GNURadio on Linux. The first method is to install via the distribution’s package manager. Most popular distributions have GNURadio in their repositories. This allows for a fairly painless method to install GNURadio. However, be careful with this method as not all repos are updated with the latest version of GNURadio. Ubuntu, Fedora, and SUSE all have packages for GNURadio.

There are two methods for installing from source. The first method uses a script provided by Marcus Leech. The second method uses PyBOMBS to install. Keep in mind that you are installing and compiling from the source code. This may result in long build times depending on your computer.

The first method is to use the install script that has been provided by Marcus Leech. This will install GNURadio, drivers and GNURadio Companion directly from the source code. It will also install any other software needed such as Python and other supporting software. This script will work on both Fedora and Ubuntu. This method was used to build GNURadio for use in the experiments performed at ISU.

To use this method download the build-gnuradio script from the website. Then simply execute this script. The script will check to make sure you have any dependencies installed and if not it will download them for you. Once that is complete it will also download the UHD drivers and GNURadio from their GitHub repos. Please note you will need SU privileges for this script. If you want, you may use the command below to both download and execute the install script

$ wget http://www.sbrac.org/files/build-gnuradio && chmod a+x ./build-gnuradio && ./build-gnuradio

The second method uses PyBOMBS. This is now the preferred method and is the method that the developers of GNURadio are moving too. You can find information about installing GNURadio using PyBOMBS at this link.

To install via PyBOMBS simply execute these commands.

git clone git://github.com/pybombs/pybombs
cd pybombs
./pybombs install gnuradio

Once the install is done, execute this command

./pybombs env

Finally you will want to source that file, to do that execute this command, replace the $prefix with the path to the folder you installed GNURadio

source $prefix/setup_env.sh

Once that is done, GNURadio and GNURadio companion should be up and running. To run GRC, execute this command

gnuradio-companion

If you want, the PyBOMBS install now includes a handy app for installation of additional GRC blocks and additional drivers. Use this command to launch this application

./app_store.py

Please be aware that at this time this application is still experimental. It does not for example warn if you are about to replace your most recent GNURadio install with an older version to make it compatible with that add-on. So use this application with care.
The link and additional information on installation through this method can be found here. GNURadio Wiki

Mac OS X Installation

Running GNURadio on OS X will require two things. First, you will need XCode installed and you will also need X11/XQuartz to display the GUI interface. It is recommended that you use XQuartz instead of X11.

The easiest method to install GNURadio is to use Macports. Macports gives OS X users a method to install programs very much like using apt-get or yum. If you do not have Macports installed on your machine, you will need to install it. Once installed, installation is fairly straightforward and you can install GNURadio using the command below in a OS X terminal.

sudo port install gnuradio

This should install the most recent copy of GNURadio and GRC. If you already have Macports, make sure you run an update first on Macports. You can do that via the following command.

sudo macports selfupdate

This will make sure both your copy of Macports and it’s repository are updated.

Once installed you can run GNURadio Companion by typing in the following into a terminal window in OS X. Please note it does not install or add an icon to either your desktop or application folder.

gnuradio-companion

Please see either the GNURadio page or the Macports page if you have problems with these installs.

Window Installation

Windows installation is not officially supported by GNURadio. However Ettus Research has made pre-compiled binaries available for Windows. It should be noted that while these seem to work on 32-bit operating systems, there are known issues with 64-bit operating systems. This is mostly due to a number of dependancies for GNURadio that are not 64-bit, at least not yet. Ettus has instructions for installing both their binaries and the UHD software package that provides the needed drivers to talk to their hardware (like the N200).

It should be noted that Ettus Research only officially supports their UHD software. There is no official support for the windows binaries.

It also possible to build and run GNURadio from Cygwin. Click here for the website describing how to install GNURadio using Cygwin

Update March 21: 

At the moment on my Windows  10 PC there are GNU Radio 3.7.11 and 3.8.2 installed side by side without issues.

Both can be found following the link below:

http://www.gcndevelopment.com/gnuradio/downloads.htm

I tried some of the precompiled installers but not all worked. I got lucky with 3.7.11 and 3.8.2 :

Version 3.7.11 comes with osmosdr  plugin preinstalled.  Gr-osmosdr can be used to access AIRSPY and other SDR devices.  In addition to that 3.7.11 is compatible with Myriad RF’s GR-limesdr plugin so you can control Lime SDR as well.

Version  3.8.2 comes with soapy and Osmosdr as well.

The direct link to GNU Radio 64 bit  3.7.11 is here :

http://www.gcndevelopment.com/gnuradio/downloads/installers/v1.2.0/gnuradio_3.7.11_win64.msi

The direct link to GNU Radio 64 but 3.8.2 is here:

http://www.gcndevelopment.com/gnuradio/downloads/installers/v3.8.2.1/gnuradio_3.8.2.0_win64.msi

###############################################

In the past I worked with 3.6.4.1 on WinXP, Win7 32 bits and had compiled the instructions below:

Older instruction how to install GNU RADIO 3.6.4.1 on Windows 7 (32 bit)

Most probably, these will work for Windows XP and 8 (32 bit) as well.

I wanted to install GNU Radio 3.6.4.1 on Windows 7 and found some excellent instructions here (click) . User Bhaskar11 uploaded them and below I have just recompiled the instructions based on my experience. Following these instructions GNU Radio worked on my Win7 machine.

Note: I could not get QT GUI blocks working , but this is not a problem for my needs, since WX GUI blocks work fine including FFT, Waterfall, Scope etc.

I have gathered all necessary packages required to install GNU Radio 3.6.4.1  in one place and created a zip folder “stuff_gnuradio” and uploaded it to Dropbox. You just need to download it from there , unzip it to C:\stuff_gnuradio and follow the instructions.

Download “stuff_gnuradio” folder (177MB)

INSTRUCTIONS how to install GNU-RADIO 3.6.4.1 on Windows 7 (32 bit).

Most probably, these will work for Windows XP and 8 (32 bit) as well.

GNU Radio will be installed to C:\gnuradio and the UHD USRP driver to C:\UHD.

Follow the …21 steps below 🙂

1.

Read carefully the provided html file:

“[Discuss-gnuradio] Successful installation of GNURadio 3.6.4.1 on Window”

All the instructions below come from this link 

All credits go to user Bhaskar11 !

I have just recompiled his instructions based on my experience on Win7 and created a zip folder with all the necessary files in one place.

2.

Ensure your Internet connection is up and running

3.

If not already done, download all the necessary files (stuff_gnuradio.zip) from Dropbox and unzip this folder to C:\stuff_gnuradio

4.

Ensure that you have administrative privileges

5.

Go to the stuff_gnuradio folder, double click “vcredist_x86” and install C++ 2010 redistributable package, only  if required.

If it says a copy is already installed and offers to repair it, accept to repair.

If it says a later version is already installed, then accept to close.

6.

Double click “python-2.7.3”, select install for all users and keep the default settings.

7.

Double click “lxml-3.0.2.win32-py2.7” and keep the default settings.

8.

Double click “numpy-1.7.1-win32-superpack-python2.7” and keep the default settings.

9.

Double click “PyQt-Py2.7-x86-gpl-4.9.6-1” and keep the default settings.

10.

Double click “PyQwt-5.2.1-py2.7-x32-pyqt4.9.6-numpy1.7.1” and keep the default settings

11.

At this point you need to install pip.

Open a command terminal (cmd) and change directory to the “stuff_gnuradio” folder:

cd C:\stuff_gnuradio

Then type:

python get-pip.py

If this does not work, you need to add python to your system path.

To do so, add the following paths to your “Path” in the “System variables” :

C:\Python27\;C:\Python27\Scripts;

Close the command terminal you opened before and open a new one.

Type again :

cd C:\stuff_gnuradio

Then type

python get-pip.py

Now the installation of pip should start.

12.

Install the Cheetah whl file by typing

pip install Cheetah-2.4.4-cp27-none-win32.whl

By the way , pip must be recognized as a command . If not,you need to add  C:\Python27\Scripts to your “Path” in the “System variables” as mentioned above.

13.

Install the PyOpenGL whl file by typing:

pip install PyOpenGL-3.1.1b1-cp27-none-win32.whl

14.

Double click “pygtk-all-in-one-2.24.2.win32-py2.7” and keep the default settings.

15.

Double click “wxPython-2.8.12.1.win32-py2.7” and keep the default settings.

On Windows 7 and 8 you may get:

Runtime error R6034 “An application has made an attempt to load the C runtime library incorrectly.

Please contact the application’s support team for more information.”

Ignore the message and continue.

16.

Double click “wxPython-common-2.8.12.1.win32-py2.7”

On Windows 7 and 8 you may get:

Runtime error R6034 “An application has made an attempt to load the C runtime library incorrectly.

Please contact the application’s support team for more information.”

Ignore the message and continue.

17.

If you have a USRP install the drivers now by double-clicking

“uhd_003.005.004-release_Win32”

This is not the latest UHD driver.

I tried the latest but could not get connected to my USRP1.

Select the option to “Add gnuradio to the system path for all users”.

Change installation directory to C:\UHD.

All other settings  default.

Double check that your system path includes C:\UHD\bin; If not,add it.

When you plug in the USRP1 for the first time, point it to this directory:

erllc_uhd_winusb_driver found in the stuff_gnuradio folder.

18.

Double click “gnuradio_3.6.4.1_Win32”

Select the option to “Add gnuradio to the system path for all users”.

Change installation directory to C:\gnuradio.

On Windows 8 you may receive “Warning! PATH too long installer unable to modify PATH!” which seems to be a NSIS

installer problem when it finds the total path to be longer than 1024.

If you receive this message then you must manually add the installation bin directory to the system path.

Double check that your system path includes C:\gnuradio\bin; If not,add it.

19.

Manually add the PYTHONPATH environment variable.

Create a new environmental variable “PYTHONPATH”

Since we have installed gnuradio to C:\gnuradio , its value should be:

C:\gnuradio\lib\site-packages;

20.

Check that the GRC_BLOCKS_PATH environment variable has been set to by GNURadio installer.

Normally this should happen automatically.

If it has not been set, then first create a system variable GRC_BLOCKS_PATH and then set its value manually:

C:\gnuradio\share\gnuradio\grc\blocks;

21.

You are done! Close all open command windows, open a new one and type

gnuradio-companion.py

This will open GNU Radio!

Open TEST_GRC.grc file , hit F5( Generate) ,then hit F6(Execute) .

You can also use the provided “gnuradio.bat” file and create a shortcut to easily launch GNU Radio.

Enjoy !

Michael Margaras – SV1CAL

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Не удается восстановить загрузку windows 7
  • Как вернуть нормальный рабочий стол windows 10
  • Windows installer error 1605
  • Как бесплатно скачивать приложения с windows store
  • Звуковые драйвера для windows 10 pro 64 bit