Sunday 2 June 2013

Using your SDR Pi. Fun stuff.

Tune In with your Pi.

Grab yourself a powered set of computer speakers. One of those amplified ones with the Bass Reflex box and two speakers.

If you're ready to have a bit of fun with your Raspberry Pi and SDR receiver connect the speakers 3.5mm stereo plug into your Raspberry Pi audio out socket. Power up your Raspberry Pi with your USB SDR plugged in and log in when the command line prompt appears. You might want to make sure your SDR stick has the cool little antenna plugged in that came with it.
RasPi + DVB + Speaker plug = FM Stereo

You could also do this remotely using PuTTY on your Windows PC or just use 'SSH' on your Linux computer.

The RTL_SDR software we installed in our Raspberry Pi has a pre-made 'FM' mode that we can call from the command line. If you are now logged in just enter the following:

rtl_fm -f XXX -W -s 200000 -r 48000 - | aplay -r 48k -f S16_LE

NOTE: Replace the XXX with the frequency you want to listen to in Hertz. For our purposes you can enter the frequency for 100MHz as 100.0e6 as per the screen grab below. Its there just after the '-f'.


 Our Raspberry Pi is now an FM Radio Tuner that we can set to pretty much any frequency from 50MHz up to 2200MHz (with a gap around 1100MHz).

While we are building the rest of our Radio Astronomy Station we now have a neat way to play with our Raspberry Pi and SDR receiver. If you want to have a look through the command line options for the FM Receiver try entering:

rtl_fm --help

This results in the following output.

pi@raspberrypi ~ $ rtl_fm --help
rtl_fm, a simple narrow band FM demodulator for RTL2832 based DVB-T receivers

Use:    rtl_fm -f freq [-options] [filename]
    -f frequency_to_tune_to [Hz]
     (use multiple -f for scanning, requires squelch)
     (ranges supported, -f 118M:137M:25k)
    [-s sample_rate (default: 24k)]
    [-d device_index (default: 0)]
    [-g tuner_gain (default: automatic)]
    [-l squelch_level (default: 0/off)]
    [-o oversampling (default: 1, 4 recommended)]
    [-p ppm_error (default: 0)]
    [-E sets lower edge tuning (default: center)]
    [-N enables NBFM mode (default: on)]
    [-W enables WBFM mode (default: off)]
     (-N -s 170k -o 4 -A fast -r 32k -l 0 -D)
    filename (a '-' dumps samples to stdout)
     (omitting the filename also uses stdout)

Experimental options:
    [-r output_rate (default: same as -s)]
    [-t squelch_delay (default: 20)]
     (+values will mute/scan, -values will exit)
    [-M enables AM mode (default: off)]
    [-L enables LSB mode (default: off)]
    [-U enables USB mode (default: off)]
    [-R enables raw mode (default: off, 2x16 bit output)]
    [-F enables high quality FIR (default: off/square)]
    [-D enables de-emphasis (default: off)]
    [-C enables DC blocking of output (default: off)]
    [-A std/fast/lut choose atan math (default: std)]

Produces signed 16 bit ints, use Sox or aplay to hear them.
    rtl_fm ... - | play -t raw -r 24k -e signed-integer -b 16 -c 1 -V1 -
                 | aplay -r 24k -f S16_LE -t raw -c 1
      -s 22.5k - | multimon -t raw /dev/stdin


Cheers!
Robert.

No comments:

Post a Comment