• No se han encontrado resultados

3. Desarrollo de la propuesta

3.5 Descripción de los videos

GNU Radio is an advanced Linux based graphical programming tool for digital signal processing (DSP). It can interface with the RTL-SDR and perform real time decoding.

This guide is intended to teach the basics of GNU Radio by helping you to create your first GNU Radio RTL-SDR program. If are not running a Linux distribution with GNU Radio preinstalled and you have not yet installed in, please see the GNU Radio installation guide section earlier in the book.

GNU RADIO PROGRAM: FFT DISPLAY

The first program we’ll make is a simple FFT RF spectrum display using GNU Radio. 1. First open GNU-Radio Companion by typing the following into a terminal.

gnuradio-companion

2. On the right side of the GNURadio Companion you’ll see a list of GNU Radio blocks that can be added. Locate the Sources menu and expand it. Click and drag the ‘RTL-SDR Source’ into the main GNU Radio window. 3. Next double click the Variable box with the ID: samp_rate. Change the samp_rate (sampling rate) to 2 MHz by typing in a value of 2e6.

Math Tip: The number 2e6 is equivalent to 2 x 106 or 2M or 2000000.

4. Next double click on the RTL-SDR source block that you’ve just added. Change the Ch0: Frequency (Hz) value to the frequency of a local broadcast FM station. For example here it is set to 88.6 MHz by using the value 88.6e6. Also set the Gain Mode to Automatic. Finally, set the PPM offset under Ch0: Freq. Corr. (ppm) to your dongles PPM offset value if desired.

5. Next in the block selection window pane go to Instrumentation -> WX -> WX GUI FFT Sink and drag this into the main Window. Place this block to the right of the RTL-SDR Source block. 6. Connect the two blocks together by first clicking on the blue out node of the RTL-SDR Source and then clicking on the blue in node of the WX GUI FFT Sink block.

7. Now click on the Generate Flowgraph button . First you will be prompted to save. Call this project FFTSink.grc. Then click the execute flowgraph button . (Note please be aware that in the very latest version of GNU Radio these icons have changed.)

GNU RADIO PROGRAM: WBFM RECEIVER

Now we will extend the FFT display we just made to also play Wide Band FM (WBFM) audio. First a GNU Radio tip: To easily find blocks go to View->Find Blocks . A search bar will appear on the top right side which will make finding blocks much easier.

1. Open the FFTSink.grc file project that you created in the previous tutorial then go to file save as and save the project as a new file called FFTsink+audio.grc. 2. Add in a ‘Rational Resampler’ Block and connect it to the RTL-SDR Source. Double click it and set the parameters as follows.

Interpolation = 1 Decimation = 4

3. Add in a ‘Low Pass Filter’ block and connect it to the Rational Resampler. Set the parameters as follows. Cutoff Freq = 400e3

Transition Width = 50e3

4. Add in a ‘WBFM Receive’ Block. Connect it to the Low Pass Filter. Set the parameters as follows. Quadrature Rate = 500e6

Audio Decimation = 10

5. Add in a second ‘Rational Resampler’ block. Connect it to the WBFM Receiver. Set the parameters as follows. Type = Float->Float (Real Taps)

Interpolation = 48 Decimation = 50

6. Add an ‘Audio Sink’ block. Connect it to the Rational Resampler. Set the parameters as follows. Sample Rate = 48e3

7. Press the Execute Button. You should now hear audio playing.

EXPLANATION OF WBFM FLOW GRAPH

The first thing that happens in the flow graph is that the signal from the RTL-SDR is decimated by four times. Decimation is a way to get higher resolution data (higher effective number of quantization bits) out of an ADC. Essentially, by decimating by four, we reduce our 2 MSPS sample rate to 0.5 MSPS, but gain about one extra bit on our ADC. We need to be careful of the amount we decimate by, as decimating by a wrong value could cause neighboring signals to overlap onto the signal of interest. For a tutorial on decimation see http://www.atmel.com/images/doc8003.pdf .

After decimation we use a low pass filter to select only the WBFM signal that we are interested in, which is at the center frequency. This is needed as nearby WBFM frequencies are received in the same bandwidth, but we want to listen to only one. The bandwidth of a typical WBFM radio station is about 200 kHz. After decimating by four, the bandwidth of our WBFM signal is multiplied by four to 800 kHz. The lowpass filter cutoff frequency is measured for only one side of the bandwidth, so here we set it to 400 kHz. The lowpass filter transition width defines how ‘sharp’ our filter is. The smaller the transition width, the more square the low pass filter becomes. However, the smaller the transition width, the greater the number of calculations required and thus the greater CPU time required. On a Intel i5 CPU a transition width of 100e3 GNU Radio uses approximately 33% CPU, a transition width of 10e3 uses 45% CPU and a transition width of 1e6 tries to use over 100% of the CPU.

Next comes the WBFM Receiver block which handles the WBFM to audio decoding. We set the Quadrature Rate at 500e6 because 0.5 Msps is our sample rate after decimation. We also set the audio decimation as 10, as this will bring the 0.5 Msps decimated signal down to a 50 kHz output audio signal. This can then easily be converted to the 48 kHz sample rate that our soundcard needs. Decimation could also be done in the next rational resampler block, but the resampling performed in the WBFM block is of higher quality.

As the soundcard needs 48 kHz audio we need to convert our 50 kHz audio signal down to 48 kHz. We do this by first taking the signal down to 1000 Hz by decimating by 50. Then by interpolating by 48 we get a final sample rate of 48 x 1000 = 48 kHz. This is exactly the amount our sound card needs.

To learn more we recommend connecting FFT sinks to the output of the first rational resampler and to the output of the low pass filter to see how they affect the signal as shown in the graphs below. The top graph is the low pass filtered signal, the middle graph is the decimated signal and the bottom graph is the raw signal.

GNU RADIO PROGRAM: COMPILING A WBFM-RDS RECEIVER

For this tutorial we will show you how to download, build and run a ready made GNU Radio program. We will download the GR-RDS program which allows you to not only listen to WFM broadcast radio, but to also decode the RDS signals inside of them. To get started follow the instructions below.

Clone the gr-rds program from Github using the following command.

git clone git://git.github.com/bastibl/gr-rds

Now build gr-rds with the following.

cd gr-rds mkdir build cd build cmake .. make sudo make install sudo ldconfig

Now you can run gr-rds by running gnuradio-companion rds_rx.grc in GNU Radio or by running the python file as shown below.

cd .. cd apps python rds_rx.py

REFERENCES AND ADDITIONAL LINKS: More GNU Radio Tutorials: http://files.ettus.com/tutorials/

GNU Radio Video Tutorial Series: https://www.youtube.com/playlist?list=PL618122BD66C8B3C4

Documento similar