An Introduction to Gnu Radio
Kuntal Ray
Outline
Introduction
Software Radio What is GNU Radio?
GNU Radio Architecture
Hardware Architecture Software Architecture
Programming the GNU Radio
GNU Radio "Hello World" GNU Radio Companion
References
Outline
Introduction
Software Radio
Software Radio
An implementation technology A technique for moving digital signal processing into software Software Radio definition
Replacing Rigid Hardware... with flexible software based solutions
A software (defined) radio is a radio that includes a transmitter in which the operating parameters of the transmitter, including the frequency range, modulation type or maximum radiated or conducted output power can be altered by making a change in software without making any hardware changes.
Defining Software Radio using Tiers
Tier 0: The Hardware Radio
The radio is implemented using hardware components only and cannot be modified except through physical intervention
Tier 1: Software Controlled Radio(SCR)
Multiple hardware transceivers are required to support several protocols. Software controls are used to choose which transceiver to activate. An example will be a dual-mode mobile phone implementing GSM and code division multiple access (CDMA).
Defining Software Radio using Tiers
Tier 2: Software Defined Radio
It employs software to control various modulation techniques, wideband and narrowband operation, security. Example : GNU Radio and USRP2.
Tier 3: Ideal Software Radio
It includes all the features of Tier 2, but eliminates the analog amplification or heterodyne mixing prior to digital-to-analog conversion. Analog conversions taking place at the antenna.
Outline
Introduction
What is GNU Radio?
GNU Radio
An open source software toolkit
Supports, Linux, Mac OS and Windows Creating signal processing applications Defining waveforms in software Processing waveforms in software
A hardware platform USRP, Universal software radio peripheral, low cost HW platform for preprocessing
ADC &DAC FPGA Ethernet Interface to Host PC
A framework for building software radio transceivers
GNU Radio
Using the GNU radio is cross disciplinary
Requiring know-how in the fields of
Computer programming Communications systems Digital signal processing Analog as well as digital hardware
Hardware is also open source Schematics are available
Outline
GNU Radio Architecture
Hardware Architecture
GNU Radio Block Schematic
GNU Radio block schematic in more detail
Features of USRP2
100 MS/s 14-bit dual (IQ) ADCs
~80 MHz instantaneous RF bandwidth
400 MS/s 16-bit dual (IQ) DACs Gigabit Ethernet interface
3-6x improvement over US Allows for 25 MHz of RF BW each way @16bits Wide enough for WiFi!
Features of USRP2
Bigger FPGA w/Multipliers (Spartan 3) 1 MB high-speed on-board SRAM High speed serial expansion interface Configured by flash
Can operate without host computer
Outline
GNU Radio Architecture
Software Architecture
A 3 Tier Architecture
Python scripting language used for creating "signal flow graphs" C++ used for creating signal processing blocks
An already existing library of signaling blocks OFDM functionality is currently being added tested and will be added to the library.
Python Application development, creating flow graphs
C++ Signal processing modules
Scheduler Controlling flow graphs
The scheduler is using Pythons built-in module threading, to control the starting, stopping or waiting operations of the signal flow graph.
Software development on GNU Radio
The application of Python
It is a high Level scripting language Select sources , sinks & signal processing blocks Set parameters for the various blocks Using Python for creating flow graphs Connects the Signal processing blocks
Signal processing blocks in C++
Built as shared libraries dynamically loaded using python import feature SWIG "Simplified Wrapper and Interface Generator" used for glue code allowing python import. Components needed in writing a C++ block
.h & .cc file for class declaration .i file defining how SWIG generate glue code binding the C++ class into Python
Outline
Programming the GNU Radio
GNU Radio "Hello World"
Sine generator (350Hz)
GNU Radio Hello World application
#!/usr/bin/env python
from gnuradio import gr from gnuradio import audio def build_graph (): sampling_freq = 48000 ampl = 0.1
fg = gr.flow_graph () src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl) dst = audio.sink (sampling_freq) fg.connect ((src0, 0), (dst, 0)) fg.connect ((src1, 0), (dst, 1))
Sine generator (350Hz)
return fg if __name__ == __main__: fg = build_graph () fg.start () raw_input (Press Enter to quit: ) fg.stop ()
Audio Sink Sine generator (450Hz)
Hello world step-by-step
#!/usr/bin/env python `
Makes the python code executable by executing $ chmod +x filename.py"
Sine generator (350Hz) Audio Sink Sine generator (450Hz)
Hello world step-by-step
#!/usr/bin/env python
from gnuradio import gr from gnuradio import audio
`
Importing Necessary Modules, modules from GNU library
Sine generator (350Hz) Audio Sink Sine generator (450Hz)
Hello world step-by-step
#!/usr/bin/env python
from gnuradio import gr from gnuradio import audio def build_graph (): sampling_freq = 48000 ampl = 0.1
`
Setting up fo signal flow graph Sampling Freq and Amplitude on Sound Card
Sine generator (350Hz) Audio Sink Sine generator (450Hz)
Hello world step-by-step
#!/usr/bin/env python
from gnuradio import gr from gnuradio import audio def build_graph (): sampling_freq = 48000 ampl = 0.1
Setting up sine waves at 350 and 440 Hz
fg = gr.flow_graph () src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl)
Sine generator (350Hz) Audio Sink Sine generator (450Hz)
Hello world step-by-step
#!/usr/bin/env python
from gnuradio import gr from gnuradio import audio def build_graph (): sampling_freq = 48000 ampl = 0.1
defining destination to be soundcard
fg = gr.flow_graph () src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl) dst = audio.sink (sampling_freq) `
Sine generator (350Hz) Audio Sink Sine generator (450Hz)
Hello world step-by-step
#!/usr/bin/env python
from gnuradio import gr from gnuradio import audio def build_graph (): sampling_freq = 48000 ampl = 0.1
connecting source and destinations
fg = gr.flow_graph () src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl) dst = audio.sink (sampling_freq) fg.connect ((src0, 0), (dst, 0)) fg.connect ((src1, 0), (dst, 1))
Sine generator (350Hz)
`
Audio Sink Sine generator (450Hz)
Hello world step-by-step
#!/usr/bin/env python
from gnuradio import gr from gnuradio import audio def build_graph (): sampling_freq = 48000 ampl = 0.1
returning created flow graph
fg = gr.flow_graph () src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl) dst = audio.sink (sampling_freq) fg.connect ((src0, 0), (dst, 0)) fg.connect ((src1, 0), (dst, 1))
Sine generator (350Hz)
return fg
Audio Sink Sine generator (450Hz)
Hello world step-by-step
#!/usr/bin/env python
from gnuradio import gr from gnuradio import audio def build_graph (): sampling_freq = 48000 ampl = 0.1
Create code to execute the flowgraph
fg = gr.flow_graph () src0 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 350, ampl) src1 = gr.sig_source_f (sampling_freq, gr.GR_SIN_WAVE, 440, ampl) dst = audio.sink (sampling_freq) fg.connect ((src0, 0), (dst, 0)) fg.connect ((src1, 0), (dst, 1))
Sine generator (350Hz)
return fg
if __name__ == __main__: fg = build_graph () fg.start () raw_input (Press Enter to quit: ) fg.stop ()
Audio Sink Sine generator (450Hz)
Outline
GNU Radio Companion
GNU Radio Companion(GRC)
GRC is bundled with the GNU radio source. Graphical user Interface of GNU Radio Drag and drop feature. Flow can be created merely by connecting the block by mouse click GRC can generate source code as per the block connections.
Outline
References
References
GNU Radio website
http://www.gnu.org/software/gnuradio/
GNU Radio tutorials
http://www.nd.edu/ jnl/sdr/
How to Write a Signal Processing Block
http://www.gnu.org/software/gnuradio/doc/how to-write-a-block.html
Exploring GNU Radio
http://www.gnu.org/software/gnuradio/doc/expl oring-gnuradio.html
THANK YOU
ANY QUESTIONS??