Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
75 views5 pages

GNU Radio for Engineering Students

This document discusses GNU Radio, an open-source toolkit for building software-defined radios. It describes how GNU Radio allows radio hardware problems to be solved through software by processing digital signals with user-defined code. The document also provides an overview of the typical architecture of a GNU Radio system, including the USRP hardware and how C++ and Python are used together. Specifically, it explains that C++ is used for signal processing blocks while Python glues the blocks together through a graphical user interface.

Uploaded by

taloul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views5 pages

GNU Radio for Engineering Students

This document discusses GNU Radio, an open-source toolkit for building software-defined radios. It describes how GNU Radio allows radio hardware problems to be solved through software by processing digital signals with user-defined code. The document also provides an overview of the typical architecture of a GNU Radio system, including the USRP hardware and how C++ and Python are used together. Specifically, it explains that C++ is used for signal processing blocks while Python glues the blocks together through a graphical user interface.

Uploaded by

taloul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

1

GNU Radio
Ke-Yu, Chen (8818-0493), Zhi-Feng Chen (1218-1197)
Dept. of Electrical Computer Engineering
University of Florida
Gainesville, Florida

ABSTRACT radio and TV provide a one-way channel, are tightly regulated


GNU radio is a free/open-source software toolkit for and the content is controlled by a handful of organizations. Cell
building software radios, in which software defines the phones are a great convenience, but the features your phone
transmitted waveforms and demodulates the received supports are determined by the operator's interests, not yours.
waveforms. Software radio is the technique of getting code A centralized system limits the rate of innovation. Instead of
as close to the antenna as possible. It turns radio hardware cell phones being second-class citizens, usable only if
problems into software problems. GNU Radio provides infrastructure is in place and limited to the capabilities
functions to support implementing spectrum analyzer, an determined worthwhile by the operator, we could build smarter
oscilloscope, concurrent multichannel receiver and an devices. These user-owned devices would generate the network.
ever-growing collection of modulators and demodulators. They'd create a mesh among themselves, negotiate for backhaul
In this academic semester, we will build the environment of and be free to evolve new solutions, features and applications.
GNU radio, be familiar with it, and learn how to use the
existing libraries to transmit a jpeg file with Differential II. DESCRIPTION
Binary Phase Shift Keying (DBPSK)/ Differential
Quadrature Phase Shift Keying (DQPSK) modulation A. Basic Architecture in GNU Radio
between two end systems by TCP connection. The future Figure 1 shows a typical block diagram for a software radio.
objective of this project is to build the video/audio To understand the software part of the radio, we first need to
transmission over wireless network, including error understand a bit about the associated hardware.
correction (CRC) and QoS (Quality of Service) by using
GNU Radio.
Sender
Key words—, GNUradio, Python, , DBPSK/DQPSK, TCP
socket User-defined RF
Code USB FPGA DAC Front end

I. INTRODUCTION
The fundamental characteristic of software radio is that PC USRP (mother board)
software defines the transmitted waveforms, and software
demodulates the received waveforms. This is in contrast to
most radios in which the processing is done with either analog
circuitry or analog circuitry combined with digital chips. GNU Receiver
Radio is a free software toolkit for building software radios.
Software radio is a revolution in radio design due to its User-defined RF
Code USB FPGA ADC Front end
ability to create radios that change on the fly, creating new
choices for users. At the baseline, software radios can do pretty
much anything a traditional radio can do. The exciting part is
the flexibility that software provides you. Instead of a bunch of Figure 1. Architecture of GNU Radio

fixed function gadgets, in the next few years we'll see a move to
universal communication devices. Imagine a device that can The USRP (Universal Software Radio Peripheral)[1], as
morph into a cell phone and get you connectivity using GPRS, described in figure 2, consists of a small motherboard
802.11 Wi-Fi, 802.16 WiMax, a satellite hookup or the containing up to four 12-bit 64M sample/sec ADCs, four 14-bit,
emerging standard of the day. You could determine your 128M sample/sec DACs, a million gate-field programmable
location using GPS, GLONASS or both. gate array (FPGA) and a programmable USB 2.0 controller.
Perhaps most exciting of all is the potential to build Each fully populated USRP motherboard supports four
decentralized communication systems. If you look at today's daughterboards, two for receive and two for transmit. RF front
systems, the vast majority is infrastructure-based. Broadcast ends are implemented on the daughterboards. A variety of
2

daughterboards is available to handle different frequency bands. output range centered at 5.75 MHz. The center frequency of the
For amateur radio use, low-power daughterboards are available output range is called the intermediate frequency, or IF.
that receive and transmit in the 440 MHz band and the 1.24 In the simplest-thing-that-possibly-could-work category, the
GHz band. A receive-only daughterboard based on a cable RF front end may be eliminated altogether. One GNU Radio
modem tuner is available that covers the range from 50 MHz to experimenter has listened to AM and shortwave broadcasts by
800 MHz. Daughterboards are designed to be easy to prototype connecting a 100-foot piece of wire directly to his 20M
by hand in order to facilitate experimentation. sample/sec ADC.
Examining the receive path in the figure, we see an antenna, B. Software development environment
a mysterious RF front end, an analog-to-digital converter (ADC) We choose Fedora Core 5 as our testing platform. RedHat
and a bunch of code. The analog-to-digital converter is the decided stopping to develop the personal edition of Linux after
bridge between the physical world of continuous analog signals RedHat 9 and transfer all the techniques of RedHat to the new
and the world of discrete digital samples manipulated by project, called “Fedora Core”. RedHat put some experimental
software. packages used in enterprise edition into Fedora Core to test its
stability. That is why Fedora Core still has some critical
problems even though it has been developed into the 5th edition.
We had spent much time to solve them.
Since Fedora still has so many “experimental packages”
inside, why do we still choose this platform? The answer is
very simple – sufficient and strong software support. Because
many experienced RedHat users keep using Fedora Core, when
any new problem occurs, it is more likely to find corresponding
solutions on the website. There are also some useful forums to
issue our problems. Designer or engineers can get quick
responses usually in one day. These considerations are why we
picked this platform.
C. Co-work of C++ and Python
There are two program languages used in GNU Radio, C++
and Python which play different roles in the whole system. All
Figure 2. USRP (Universal Software Radio Peripheral) the signal processing and performance-critical blocks are
written in C++ and Python is used to create a network or graph
ADCs have two primary characteristics, sampling rate and and glue these blocks together. So in this particular scenario,
dynamic range. Sampling rate is the number of times per Python is a higher level language. Many useful and frequently
second that the ADC measures the analog signal. Dynamic used blocks have been provided by the GNU Radio project, so
range refers to the difference between the smallest and largest in many cases we don't need to touch C++, just using Python to
signal that can be distinguished; it's a function of the number of finish your task. However, to do more sophisticated work, you
bits in the ADC's digital output and the design of the converter. have to use C++ to create your own block. In our demo
For example, an 8-bit converter at most can represent 256 (28) program, because Python lacks of type conversion functions,
signal levels, while a 16-bit converter represents up to 65,536 we write a C++ block which is in charge of type converting
levels. Generally speaking, device physics and cost impose between character and unsigned short.
trade-offs between the sample rate and dynamic range. There are two methods to using C++ modules in Python. The
Assuming we're dealing with low pass signals - signals first one is to build the C++ into an executable file, and use
where the bandwidth of interest goes from 0 to fMAX, the Python built-in function os.system() to call this executable file,
Nyquist criterion states that our sampling frequency needs to be just like sending a command into the shell.
at least 2 * fMAX. But if our ADC runs at 20 MHz, how can we The second way is to use SWIG, the powerful tool in Python
listen to broadcast FM radio at 92.1 MHz? The answer is the RF to ‘glue’ the C++ blocks to Python. SWIG generates the
front end. The receive RF front end translates a range of wrapper for C++ modules and generate the corresponding
frequencies appearing at its input to a lower range at its output. Python code (*.py) and library (*.so) so that we can include
For example, we could imagine an RF front end that translated these classes and functions in Python. The details of what
the signals occurring in the 90 - 100 MHz range down to the 0 - SWIG does and how to import C++ modules into Python is
10 MHz range.
described in [5].
Mostly, we can treat the RF front end as a black box with a
single control, the center of the input range that's to be III. EVALUATION AND DEMO
translated. As a concrete example, a cable modem tuner module In the previous section, we know that GNU Radio with
that we've employed successfully has the following USRP has the ability to communicate with each other. Our
characteristics. It translates a 6 MHz chunk of the spectrum
objective is to transmit a JPEG file by using the modules in
centered between about 50 MHz and 800 MHz down to an
GNU Radio. Because lacking of the real hardware (USRP), we
3

have to try to substitute it with other component. To modulate the source file, we need to produce a binary
The modified architecture is shown in figure 3. We first read stream and feed it into the modulation module. So, we first read
a BMP file from hard disk, send it into a JPEG encoder the jpeg file, which is just produced above, as a byte stream and
implemented by C++ to get a compressed image file. After save it into a vector variable. There is a trick here, in the
encoding, the transmitter read the JPEG file and starts the DBPSK modulation block, it assume that signal starts from
modulation. On the completion of modulation, the transmitter zero phase. However, the first bit in the JPEG file does not
puts the bit stream into socket and sends it to the receiver. necessary zero. So, we need to add one bit “0” ahead the JPEG
file. To simplify the memory allocation, we add a byte
“0x00”here.
Sender
DBPSK / Modulation module
JPEG DQPSK
Hard Disk Modulation Socket Source Bits to Gray Differentia Real to Output
Encoder input Bytes code l encoder complex
encoder

Demodulation module

Receiver Input Differentia Output


Complex Gray code Bytes to
l Decoder to real decoder bits
DBPSK /
Hard Disk Socket
DQPSK
Demodulation
Figure 4 modulation and demodulation modules
Figure 3. Architecture of our demo program

b) Bits to Bytes converter


We add modulation and demodulation respectively in the
Now we will begin to process the data stream into DBPSK
transmitter and receiver in order to implement a practical
I/Q signals. In DBPSK modulation, each bit represents one
wireless communication system, which use DBPSK/DQPSK as symbol to be modulated. So, we will process data stream bit by
the modulation method. However, this setup needs the bit. Since in computer it is easier to use byte operation than bit
hardware support of Universal Software Radio Peripheral operation, we use one byte to represent each bit. While
(USRP). In our demo, we will use TCP/IP socket to simulate mapping each bit into one byte is quite straightforward, we
the wireless transmission, which will be discussed in detail in need to take care of the selection of Big-Endian or
the next section. So, without multiple the sinusoid carrier Little-Endian, and the selection should keep same in both the
signals in our modulation, the final output is a baseband modulation and demodulation side. In our program, we choose
representation of the modulated signal, that is, the in-phase and the Big-Endian, that is, the most significant bit first.
quadrate (I/Q) signals. Receiver plays the role, the server, to
c) Gray code encoder
listen the incoming bit stream and put the incoming bit stream
into the next block ’demodulation’ to restore the input data to In modern digital communications, gray codes play an
the original JPEG file. All the works described above are done important role in error correction. Different from natural binary
by software in PC, and we use socket to substitute USRP. We code, in gray code the signal's constellation diagram is arranged
will describe the details in each block in the following so that the bit patterns conveyed by adjacent constellation
paragraphs. points differ by only one bit. By combining this with forward
error correction (FEC) capable of correcting single-bit errors, it
1) JPEG Encoder is possible for a receiver to correct any transmission errors that
JPEG Encoder reads a BMP file and compresses it into a cause a constellation point to deviate into the area of an
JPEG file. The component is implemented in C++ and is called adjacent point. This makes the transmission system less
by the main program, written in Python. These two languages susceptible to noise comparing with natural binary code.
have different functions and there are two methods to In DQPSK, we may choose to use gray code or not, again,
coordinate these two languages. We will discuss it latter. the option should be the same in both the modulation and
demodulation side. In the GNUradio, there is also a function
2) DBPSK/DQPSK Modulation and demodulation block in processing gray code for DBPSK, but actually, the
The modulation and demodulation flow graph is show as below map between natural binary code and gray code is the same.
in figure 4
d) Differential encoder
Modulation module
Instead of using the bit patterns to set the phase of the wave
a) Get source input from JPEG file known as Phase Shift Keying (PSK), we can use it to denote the
4

phase changes of the wave by Differential Phase Shift Keying When differential encoding is used in this manner, the
(DPSK). Since the DPSK demodulator then determines the scheme is known as differential phase-shift keying (DPSK). If
changes in the phase of the received signal rather than the phase demodulator still use reference signal to first demodulate each
itself, DPSK can be significantly simpler to implement than symbol, and then do the reverse of differential decoder, it is still
ordinary PSK. a PSK demodulation with only baseband data being differential
Analysis shows that differential encoding approximately coded.
doubles the error rate compared to ordinary M-PSK. However
Limit in our modulation and demodulation modules:
this may be overcome by only a small increase in SNR.
Furthermore, this analysis is based on a system in which the As mentioned in the beginning of this section, in our demo
only corruption is additive white Gaussian noise. In the final output of modulation module is a baseband
communication system, the physical channel between the representation of the modulated signal. In the real wireless
transmitter and receiver will, in general, introduce an unknown communication, we may need to fill out the high frequency
phase-shift to the PSK signal. In these cases the differential components in the I/Q complex signal by a root raised cosine
schemes can yield a better error-rate than the ordinary schemes filter and then multiple it with a sinusoid carrier signal to get
relying on precise phase information[2]. Intermediate Frequency (IF). In reverse, we also need to add
some processes in the demodulation module, such as: automatic
e) Map the symbol into constellation point (Real number to
gain control, root raised cosine filter, symbol clock recovery.
Complex number)
3) Socket
Till now, each symbol is still represented by one byte (As
As mentioned above, in our demo we simulate the wireless
mentioned above, in fact, only one bit of the byte is used in
channel by using TCP/IP connection, which is done by python
DBPSK, and only two bits is used in DQPSK). In DBPSK,
socket call. Python provide access to the Berkeley Software
there are only two points in the constellation diagram, so each
Distribution (BSD) socket interface. Python socket interface is
point, i.e. each symbol, denote one bit baseband information.
a straightforward transliteration of the Unix system call and
For the digital modulation, signal processing is based on
library interface[3]. For Internet connection, two kinds of most
complex number operation, and therefore, each symbol will use
important socket types are SOCKET_STREAM and
one complex number to represent and computation. In
SOCKET_DGRAM, which respectively represent the standard
GNUradio, each complex number occupies 8 bytes, i.e. 64 bits
Transmission Control Protocol (TCP) and User data Protocol
and denotes one bit of baseband information. So, at the end of
(UDP) in transportation layer. TCP provides a logical
the modulation, we will see the output file become 64 times
full-duplex connection between two application layer processes
bigger than the original JPEG file.
across the Internet with connection-oriented, reliable,
The same, if using DQPSK, one symbol denote two bits
in-sequence service and flow control and congestion control,
baseband information, and for complex number computation,
while UDP is a connectionless, unreliable protocol that
each complex number, i.e. 64 bits, represent one symbol. So,
provides only two additional services beyond IP:
the output file is 32 times bigger than the original JPEG file.
de-multiplexing and error checking on data[4].
Demodulation module In our demo, we choose the TCP connection based on two
concerns: First, TCP connection is reliable and do not need
In our demodulation module, there are main 4 function
extra application layer software to ensure the file being
blocks: Differential Decoder, Constellation mapping (Complex
correctly received as in UDP. Second, we may want to extend
number to Real number), Gray code decoder, Bytes to bits
the demo to support data stream transmission, such as
converter. Other than Differential decoder, each function block
video/audio stream, in the future, which requires a
performs the reverse procedure of their respective opposite
connection-orient service.
function block in the modulation module.
We implement the modulation together with TCP client in
The reason why the position of Differential Decoder in
transmission side, and demodulation with TCP server in
demodulation module is not exactly the reverse position of
receiver side, and send the modulated JPEG file from client to
Differential encoder in the modulation is because the difference
server. First, we should assign a socket for TCP server with a
of DPSK from PSK. In PSK, demodulator need a complex
fixed port number, and then TCP server will keep listening on
carrier-recovery schemes to provide an accurate phase estimate
the appointed port for any connection. Second, TCP client
and determine the symbols by mapping signals directly from
setup a connection with TCP server by latter’s IP address and
constellation point. While in DPSK, as mentioned above,
appointed port. After the connection is established, server will
demodulator only determines the changes in the phase of the
keep listening on any data stream coming from client. As soon
received signal rather than the phase itself. So, without a
as server receives the whole modulated JPEG file, it will save
reference signal to compare the phase of the received signal, we
the file for demodulation use next.
cannot determine the symbols by directly mapping from
constellation points. But in an easier way in QPSK, we can
IV. RELATED AND FUTURE WORK
determine each symbol phase by knowing the phase change and
the initial phase, which we set as “0” at the beginning. Then we The GNUradio project is still under developing, so source
map the symbol from constellation point (complex number) to code release is updated at times. In our study, we find there are
real number. some bugs in the released software. For example, in the
5

DBPSK demodulation module, the clock recovery block does [11] http://www.woodpecker.org.cn:9081/doc/abyteofpython_
not work well. If we choose to add this function in the cn/chinese
demodulation, after performing clock recovery, it will lose [12] http://wiki.wxpython.org/index.cgi/Getting_Started
some data which represent the first 11 symbols in modulation.
This definitely is not acceptable in transmitting a JPEG file,
since any bit error in it will cause the JPEG decoder can decode
it correctly. So, in our next work, we may go in detail to find the
solution for this issue. Otherwise, it will cause
DBPSK/DQPSK wrongly demodulate the received signal.
In our present demo, since we use the TCP socket to transmit
the JPEG file, so we do not worry about any packets loss and bit
error in the transmission channel since the TCP connection is a
reliable connection. However, if we use USRP hardware with a
practical wireless channel to transmit the JPEG file, things are
quite different. We need to check whether received bit stream is
correctly demodulated, and even if receiver’s demodulation
module functions well, we still have to check whether some
signals lost or interfered, which are caused by noisy wireless
channel. So, we may need to implement Forward error
correction (FEC) or Automatic Repeat-reQuest (ARQ), and in
error detection, CRC may be used.
At current stage, GNUradio also provide the functions
support for implementing Frequency Shift Keying (FSK),
Frequency Modulation (FM), Spectrum display (FFT sink) and
Oscilloscope (Scope sink). Implementing these functions in our
demo will give us more convenience to deploy future research
project and stimulate us to develop more functions based on
GNUradio environment.

V. SUMMARY AND CONCLUSIONS

In our paper, we first introduce the concept of


software-defined radio and the capacity of GNUradio.
Afterward, we describe the related hardware support and
development environment respectively. Then, we explain in
detail about what we have implemented based on our demo,
and discuss the limits in this demo. At last we present some
possible improvements and probable future work. Through this
project, we build up a systematical knowledge and experience
for developing GNUradio and it is very helpful for us to deploy
a research-oriented project next.

REFERENCES
[1] http://www.comsec.com/wiki?UniversalSoftwareRadioPe
ripheral
[2] http://en.wikipedia.org/wiki/DPSK
[3] http://www.python.org/doc/current/lib/module-socket.htm
l
[4] Communication Networks, Alberto Leon-Garcia, Indra
Widjaja, McGraw-Hill 2003
[5] http://www.geocities.com/foetsch/python/extending_pyth
on.htm
[6] http://www.nd.edu/~jnl/sdr/docs/tutorials/
[7] http://staff.washington.edu/~jon/gnuradio.html
[8] http://lists.gnu.org/archive/html/discuss-gnuradio/
[9] http://jsp.dfes.tpc.edu.tw/py-book.jsp
[10] http://www.freebsd.org.hk/html/python/tut_tw/tut.html

You might also like