Wednesday, 26 June 2013

Mono_tone in GNURadio Companion

GNURadio Companion is a GUI that allows you to build GNURdio flow graphs. You can open grc ( GNURadio Companion ) by this command

$ gnuradio-companion or grc

grc window will appear. On Right side you will find list of block available which you can use to create flow graphs. Left side is the working area.

  1. Double Click on options block to set general parameters for the flow graph. Type in Project title (my_mono_tone) and author (in my case Osama). Leave other parameters unchanged and click ok.
  2. Open the Sources category and double click on Signal Source. It will appear in the main window. To change the properties double click on it. Adjust settings to match with the picture at the end. The signal source is sine wave at 650 Hz and amplitude of 0.4.
  3. Expand the Audio list and double click on Audio Sink. It will appear in the main window. To change the properties double click on it. Adjust settings to match with the picture at the end.
  4. In order to connect these two blocks. click on the "out" port of Signal Source and then once on the "in" port of the Audio Sink.
  5. An active minus sign will appear if there is any error in your flow graph. If there is no error minus sign will be inactive.
  6. Click on the Generate the flow graph. A box will come up in which you can name the file. Name of this file is my_mono.grc and save
  7. Click the "Execute the flow graph" icon. You will hear a sound from your speaker. You can stop at any time by clicking "Kill the flow graph".


Dial Tone Example

The simplest example is the dial_tone example in which you will be listening a dial tone from the sound card.

 
$ cd /usr/share/gnuradio/examples/audio
$ ./dial_tone.py
 
The Block diagram of Dial tone is as follow


To view the code behind dial_tone block
 
$ cd /usr/share/gnuradio/examples/audio
$ gedit dial_tone.py
 
It will open code for the dial_tone. You can understand the basic flow by viewing the commented code.

The Basic objective of this block is:
 
  • Setting up sinewaves at 350 and 440Hz
  • Create singal generating blocks
  • Defining destination
  • Connecting source and destinations

How to Install GNURadio on Ubuntu 12.04

I have followed GNU Radio Installation for Ubuntu Linux 12.04 and summarize here the procedure.

  •     Installation from Ettus Research
  •     Installing manually from source

 

Installation from Ettus Research

Install the required dependencies as mentioned at Install-Dependencies
Download UHD
Install this package using Ubuntu Software Center
Download GnuRadio
install these packages using Ubuntu Software Center
After installation set the PYTHONPATH and LD_LIBRARY_PATH environment variables
Default installation uses following paths /usr/bin and /usr/lib/python2.7/dist-packages
Export the paths as

$ export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/bin


Installing manually from source

Install the required dependencies as mentioned at Install-Dependencies
Download and install UHD software from source by these command for Ubuntu:

$ git clone git://github.com/EttusResearch/uhd.git
$ cd uhd/host/
$ mkdir build
$ cd build/
$ cmake ../
$ sudo apt-get install cmake
$ cd uhd/host/
$ mkdir build
$ cd build/
$ cmake ../
$ cmake -DENABLE_E100=ON ../
$ cmake -DENABLE_E100=ON -DENABLE_B100=ON../
$ make
$ sudo make install
$ cd
$ sudo gedit .bashrc

Set library path in the text file

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:usr/local/lib

and save the file

$ sudo ldconfig


Download and install GNURadio software from source by this command for Ubuntu:

$ git clone http://gnuradio.org/git/gnuradio.git
$ cd gnuradio/
$ mkdir build
$ cd build/
$ cmake ../
$ make
$ make test
$ sudo make install
$ sudo ldconfig
$ cd
$ cd /usr/local/lib/python2.7/dist-packages
$ ls
$ pwd
$ cd
$ sudo gedit .bashrc

Set library path in the text file

export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages

and save the file

$ sudo ldconfig
$ sudo apt-get install gnuradio-companion
$ gnuradio-companion
$ cd /usr/local/bin/
$ ls
$ cd