Tuesday 16 July 2013

Complex and Analytical Signals

Open GNU Radio Companion using this command

$ gnuradio-companion

An untitled GRC window should open.


1. Double click on the options block. Type project title and Author Name. Set General options to WX GUI. Click OK.

2. On the right side of the window by expanding the wave generator category click on signal source. Place signal source.

3. Click on Misc->Throttle and place in the flow graph also place scope sink connect the blocks. The data type must be float.

4. Press F5 to generate and F6 to execute the flow graph you will see simple cosine wave with frequency 1Khz.






5. Now change the data type of all the three blocks to complex and then press F5 and F6 to generate and execute flow graph. You will see two wave that are 90' out of phase from each other.





The leading (ch1) wave is the In-phase component of the
complex signal and the lagging (ch 2) wave is the quadrature component. When a signal source is set to Complex, it will output both the I and Q components



FFT Sink and Low Pass Filter

Open GNU Radio Companion using this command

$ gnuradio-companion

An untitled GRC window should open.


1. Double click on the options block. Type project title and Author Name. Set General options to WX GUI. Click OK.

2. Double click on variable and change the sample rate to 10Khz.

3. On the right side of the window by expanding the wave generator category click on signal source. Place two signal sources. Double click on the signal source and set frequency 1KHz and 2KHz.

4. Place Multiply Block and connect the signal sources to the multiply block and place FFT Sink and Scope Sink.

5. Place throttle block to control the flow between the multiply block and the sinks block.

6. Press F5 to generate the flow graph and F6 to execute the flow graph. You will see two peaks one at 1Khz and other at 3Khz.





 
Now we want to low pass the signal to get only 1KHz signal at the output.

7. On the right hand side of the window click on Filters-> Low pass filter. Double click on Low pass filter block and set the cut off frequency and transition bandwidth. Set cut off freq to be 1.2Khz and transition bandwidth to be 200.

8.  Fir filter type be Float-Float. Now place FFT sink and scope sink at the output of the filter.

9. Press F5 to generate and F6 to execute the Flow graph.


Time and Frequency Domain analysis of a Signal

Open GNU Radio Companion using this command

$ gnuradio-companion

An untitled GRC window should open.


1. Double click on the options block. Type project title and Author Name. Set General options to QT GUI. Click OK.

2. On the right side of the window by expanding the wave generator category click on signal source.

3. Now similarly place QT GUI Sink. Connect source and sink to connect. By Pressing F5 generate flow graph warning will be display and ask for throttle block to control the flow. Place throttle block between the source and sink.

4. Now press F5 to generate the Flow graph and F6 to execute the flow graph. A window will appear showing the Frequency of the signal. There will be tabs of Frequency Display , Waterfall Display , Time Domain Display and Constellation Display.

5. Now by using QT GUI Range change the frequency of the signal at runtime. For this on the right side of the window click on GUI Widgets ->QT-> QT GUI Range.

6. Double click on the QT GUI Range block and copy the ID of the block. Now double click on the Signal source and paste in the frequency box.

7. Now execute the flow graph by pressing F5 and execute the flow graph by clicking F6 now you can change the frequency runtime. By changing the frequency analyze the signal in all four blocks.

Wednesday 3 July 2013

Transmit and Recieve Tone Using Sound Card

You need to connect a stereo wire to connect mic and speaker.
$ 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_transmit_receive) 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 cosine wave at 1000 Hz and amplitude of 0.01.
  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 Audio list double click on Audio 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.
  5. 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.
  6. Search for Gui Scope and Place two WX Gui Scope Sink and connect one to Audio Source and other to Signal Source.
  7. 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.
  8. 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_both.grc and save
  9. 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".



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