Showing posts with label gnuradio. Show all posts
Showing posts with label gnuradio. Show all posts

Monday, May 21, 2018

How to Create a Linear Transponder using a RTL Dongle and HackRF with Gnu Radio.

How to Create a Linear Transponder using a RTL Dongle and HackRF with Gnu Radio.

I wanted to test the concept of a linear Transponder and how difficult would it be to build it with conventional components.
Hardware Configuration
Hardware required to build the Transponder.
  1. SDR IQ demodulator with rtl dongle (RF In)
  2. SDR IQ DSP processing system. Gnu Radio (DSP processing)
  3. SDR IQ Modulator. HackRF (RF Out)
  4. Background management system. (OBC) for additional telemetry.
Software required for Transponder.
  1. SDR IQ demodulator. rtl dongle (RF In)
  2. SDR IQ DSP processing system. Gnu Radio (DSP processing)
  3. SDR IQ Modulator. HackRF (RF Out)
  4. Background management system. (OBC)

Video of working Transponder.



Gnu Radio.


Transponder Block Diagram

RTL SDR Block.

RTL-SDR Source

Low Pass Filter Block.

 
Low Pass Filter Block

AGC Block.

AGC Block

Power Squelch.

Power Squelch

Osmocom Sink. (HackRF)

Osmocom Sink (HackRF)

FFT. (Spectrum View of input)

FFT Spectrum View

REF: Power point Slides at AMSAT SA

Ref:Source code is available on Github Version 4

Thursday, February 22, 2018

Setting up my hackrf on ubuntu 17.10

Setting up my hackrf on ubuntu 17.10



sudo apt-get install gcc-arm-none-eabi

sudo apt install cmake
sudo apt install hackrf

if the hackrf command above did not work then follow the following steps


git clone https://github.com/mossmann/libopencm3.git
cd libopencm3/
ls
cd ../hackrf/
ls
git submodule init
git submodule update
cd firmware/libopencm3/
make
sudo synaptic
xhost +
sudo synaptic
make
sudo apt-get install gcc-arm-none-eabi
cd hackrf/firmware/hackrf_usb/build
mkdir build
cd build
cmake ..

hackrf_spiflash -w hackrf_usb.bin

Update firmware
hackrf_spiflash -w hackrf_one_usb.bin
hackrf_info

hackrf_cpldjtag -x hackrf_cpld_default.xsvf
hackrf_info

Saturday, November 26, 2016

Creating a 2m Fm Repeater with a Raspberry Pi (B) and a RTL dongle.

Creating a 2m Fm Repeater with a Raspberry Pi (B) and a RTL dongle. (Don't use this application without the RF filter)

RTL dongles is available from Giga Technology and the filter will be available soon.



For the purpose of this configuration I expect your Raspberry pi to be connected to the internet.
How will this repeater work.
This configuration was done with the latest Raspbian Os for Raspberry Pi downloaded from here https://www.raspberrypi.org/downloads/
I used my original Raspberry Pi B+ and also repeated  this on a Banana Pi
 as I need a hard drive to compile gnuradio for later SDR use.

I will be using a rtl dongle to receive my input signal on 70cm frequency configurable on the amateur 2m or 70cm band. The receiver signal will then be demodulated and re transmitted with a DSP Library simulating a FM Signal using a GPIO pin on the Raspberry as an transmitter.

Get your Raspberry Pi on the latest patch/update.

sudo apt-get update
sudo apt-get upgrade
Go and get some Coffee as it might take long time to update ..zzz...... ;-) 

Install the SDR command line application to access rtl  USB dongle.
This rtl library allow you to demodulate the fm / ssb input

sudo apt-get install rtl-sdr-0.5.3-3 mplayer octave gnuplot gnuplot-x11


Download the Fm transmitter software from github using the following command

Install the rpitx python library using the following command. 

rpitx is the main software to transmit. It allows to transmit from:
  • IQ files *.iq (can be generated by external software like GNU Radio).
  • Frequency/Time files *.ft (generally used to easily implement digital modes)
Installation of rpitx

git clone https://github.com/F5OEO/rpitx git clone https://github.com/F5OEO/rpitx
cd rpitx # make sure to have access to the internet to download packages # or download and install them manually (libsndfile1-dev and imagemagick) 
./install.sh

Ok lets create some IQ files that will be used  to test the transmitter.

SSB Transmiiter
./pissb sampleaudio.wav ssbIQ.wav


A sample script testssb.sh is included.


FM modulation

pifm converts an audio file (Wav, 48KHz, 1 channel, pcm_s16le codec) to Narrow band FM (12.5khz excursion) and outputs it to a .ft file. Assuming your audio file is in your current working directory ./pifm sampleaudio.wav fm.ft

Connect a antenna to pin 4  long wire 40cm or longer depending on 1/4 lent of wavelength.
Pin Connection Diagram. Use coaxial cable to make connection
Here is a link with the filter details for the 2m Band


You could then transmit it on 100MHZ (please set a correct frequency to be legal) 
sudo ./rpitx -m RF -i fm.ft -f 100000 -l -c1


A sample script : testfm.sh is included.  add -c1 for pin 4 transmission in file

VFO
A VFO mode is provided to allows precise frequency resolution. For example to set a carrier on 100MHz (please set a correct frequency to be legal)sudo ./rpitx -m VFO -f 100000 -c1

Ok we got the Transmitter working Now lets get the rtl dongle working.
Follow my steps here http://zr6aic.blogspot.co.za/2013/02/setting-up-my-raspberry-pi-as-sdr-server.html

When you are complete with installation of rtl_sdr and have tested it wit rtl_test -t we can now check what audio devices the raspberry have.

sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Now we need to install some audio utility programs to pyp and convert audio signals
sudo apt-get install sox libsox-fmt-all
ok lets test to see if we can receive 2m band transmission.

Tune the the rtl dongle for a frequency of 145.500Mhz and transmit a test signal.

sudo rtl_fm -f 145500000 -M fm 

Transmit a mp3 file recording
sox -t mp3 zr6aic_CQ_mono.mp3 -t wav -r 48000 -c 1 - | sudo ./pifm - 145.5 -c1

Installing ffmpeg


# build and install x264
git clone --depth 1 git://git.videolan.org/x264 cd x264 
./configure --host=arm-unknown-linux-gnueabi --enable-static --disable-opencl 
make -j 4
sudo make install

 # build and make ffmpeg
git clone --depth=1 git://source.ffmpeg.org/ffmpeg.git cd ffmpeg
./configure --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree
make -j4
sudo make install


Install the following utility classes to help with the audio manipulation
sudo apt-get install libav-tools sox oggfwd libsndfile1-dev
sudo apt-get install fftw3 libfftw3-dev

Install csdr
git clone https://github.com/simonyiszk/csdr.git 
cd csdr 
git fetch 
git checkout dev 
make && sudo make install

Testing transmitter with Audio file (pin4 = -c1)
(while true; do cat speech48000.raw; done) | csdr convert_i16_f | csdr gain_ff 700 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 145000 -c1

Putting the rpitx transmitter in TCP port listening mode (replace ip with Raspberry pi ip)
Sending audio from remote computer. (using mike from Linux computer)
arecord -fS16_LE -r48000 -c1 - | nc 192.168.10.128 8011

Testing RTL_fm (replace ip with your Raspberry ip)
sudo rtl_fm -M wbfm -f 98000000 | play -t raw -r 24k -es -b 16 -c 1 -V1 -
sudo rtl_fm -M wbfm -f 98000000 |nc  192.168.10.128 8011 -


Send rtl_dongle to transmitter (replace with your raspnerry ip)
sudo rtl_sdr -s 250000 -f 144300000 -p 0 - | nc -vv 192.168.10.128 8011
sudo rtl_sdr -s 4800 -f 144300000 -p 0 - | nc -vv 192.168.10.128 8011
 

Working RX with rtl dongle
sudo nc -l 8011 | csdr convert_i16_f | csdr gain_ff 8000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 145300 -c1

Working TX with pin 4

sudo rtl_fm -s48000 -g 49.6 -l 0 -M fm -f 434400000 |nc  192.168.10.128 8011 -

here is repeater without sqaulse


How to make the Repeater to auto start when the Raspberry start boot up.

Create a file and edit it
sudo vi /etc/init.d/Repeater

Add the following in the file and save it

#! /bin/sh

# /home/pi/sh/run_repeater.sh

### BEGIN INIT INFO

# Provides:          SDR repater start script
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to start a program at boot
# Description:       A simple script from www.stuffaboutcode.com which will start / stop a program a boot / shutdown.
### END INIT INFO

# If you want a command to always run, put it here


# Carry out specific functions when asked to by the system

case "$1" in
  start)
    echo "Starting SDR_repeater"
    # run application you want to start
    /home/pi/sh/run_repeater.sh
    ;;
  stop)
    echo "Stopping SDR_Repeater"
    # kill application you want to stop
    killall rtl_fm
    killall rpitx
    ;;
  *)
    echo "Usage: /etc/init.d/Repeater {start|stop}"
    exit 1
    ;;

esac

Make the file executable

sudo chmod 755 /etc/init.d/Repeater


Create a file in the /home/pi/sh/run_repeater.sh

Vi /home/pi/sh/run_repeater.sh

Add the Repeater script define above in this file so that it can auto start on boot time.


sudo rtl_fm -p 38 -s48000 -g 0 -l 3 -M fm -f 434400000 |csdr convert_i16_f | csdr gain_ff 12000 | csdr convert_f_samplerf 20330 | sudo rpitx -i- -m RF -f 145293 -c1&


Test the start and stop script.


Start the Repeater

sudo /etc/init.d/Repeater start

Stop The Repeater

sudo /etc/init.d/Repeater stop

Here is a video of the Test of the repeater ( I have changed the wires with a coaxial cable)


Video testing Fm demod and re mod cross band


What else can I do

Creating APRS transmitter
Setting up APRX rpitx with Raspberry Pi

aprs --callsign <callsign> --output - "<message>" | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo rpitx -m RF -i - -f 144800 -c1

Repeater configured in a single line 
sudo rtl_fm -p 38 -s48000 -g 0 -l 0 -M fm -f 434400000 |csdr convert_i16_f | csdr gain_ff 12000 | csdr convert_f_samplerf 20330 | sudo rpitx -i- -m RF -f 145293 -c1


Specifications (measured with New Low pass filter board )

Here is some results of Power measurements at 145Mhz. (@50ohm) 

  • Voltage  1.3V
  • Power 32.7 mW  (15.1dBm)

Total power consumption on power supply when repeater is running

Measured  5.44 V  and  540mA  = Total watts   2.937Watts

Monday, October 27, 2014

How to install Gqrx SDR software on Linux using your RTL dongle or Softrock receivers.

How to install the Gqrx SDR software on Linux using your RTL dongle or Softrock receivers. (Ubuntu)

RTL _dongle

The RTL Dongles is available from http://www.giga.co.za/ocart/index.php?route=product/category&path=59_63
Gqrx SDR software

Update the repository files and update your Linux to the latest versions.
sudo apt-get update
sudo apt-get upgrade

Now install the libraries ... get coffee
Now install the libraries for GQRX SDR on you Linux (Ubuntu)

sudo apt-get install cmake python-cheetah doxygen libboost-all-dev python-sphinx libfftw3-dev python-numpy libqwt-dev libgsl0-dev python-wxgtk2.6 qtcreator libpulse-dev swig libcppunit-dev libusb++-dev libusb-dev libusb-1.0-0-dev maybe some more coffee ;-)

For Ubuntu 16.04 I had to add the following libraries
sudo apt-get install qtdeclarative5-dev libqt5svg5*

Build and Install GNU Radio libraries


Create a directory where you will install the SDR software in your favorite install directory.
mkdir gqrx
goto directory you created.
cd gqrx
get the gnuradio source code
git clone http://git.gnuradio.org/git/gnuradio.git
git clone https://github.com/gnuradio/gnuradio.git
if you are using the old git before 1.6 then use this command
git clone git://gnuradio.org/gnuradio

it looks like for Ubuntu 16.04 you need to use the following git clone

git clone --recursive http://git.gnuradio.org/git/gnuradio.git
You should see
Cloning into 'gnuradio'...
got to the newly created directory gnuradio when the cloning is done
cd gnuradio
make a build directory
mkdir build
goto the build directory
cd build
Compile gnuradio
cmake ../
if you get an error -- WARNING: Found a known bad version of Boost (v104601). Disabling.
Then run cmake -DENABLE_BAD_BOOST=True ../
This can take a couple of hours depending on the speed of you Linux server.
make
Now install the newly compiled binaries into the required directories
sudo make install
Now load the the gnu drivers
sudo ldconfig

Build and Install RTL-SDR drivers
go to your favorite install directory
cd ../../../
get the latest source code from osmocom.org
git clone git://git.osmocom.org/rtl-sdr.git
go to the newly created directory
cd rtl-sdr/
Now compile the rtl drivers
create the build directory
mkdir build
go to the build directory
cd build
compile the code
cmake ../
make
now install the compiled binaries
sudo make install
load the drivers
sudo ldconfig

now copy the content of the file rtl-sdr.rules and append it to the /etc/udev/rules.d/70-persistent-cd.rules file

use your favorite editor

vi rtl-sdr.rules  and copy the content.

then open the file /etc/udev/rules.d/70-persistent-cd.rules

sudo vi /etc/udev/rules.d/70-persistent-cd.rules and append the previous files content at the end
in ubuntu 16.04 the file name was /etc/udev/rules.d/rtl-sdr.rules

This is how my file looked like

# This file maintains persistent names for CD/DVD reader and writer devices.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-cd-aliases-generator.rules
# file; however you are also free to add your own entries provided you
# add the ENV{GENERATED}=1 flag to your own rules as well.
# hp_DVD_RW_AD-7581S (pci-0000:00:1f.2-scsi-0:0:0:0)
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0", SYMLINK+="cdrom", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0", SYMLINK+="cdrw", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0", SYMLINK+="dvd", ENV{GENERATED}="1"
SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_PATH}=="pci-0000:00:1f.2-scsi-0:0:0:0", SYMLINK+="dvdrw", ENV{GENERATED}="1"
#************************* below is what was appended ****************
# original RTL2832U vid/pid (hama nano, for example)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2832", MODE:="0666"
# ezcap EzTV668 (E4000)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666"
# Terratec Cinergy T Stick Black (rev 1) (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00a9", MODE:="0666"
# Terratec NOXON rev 1 (FC0013)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b3", MODE:="0666"SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b4", MODE:="0666"SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b7", MODE:="0666"SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00c6", MODE:="0666"
# Terratec Cinergy T Stick RC (Rev.3) (E4000)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d3", MODE:="0666"
# Terratec T Stick PLUS (E4000)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d7", MODE:="0666"
# Terratec NOXON rev 2 (E4000)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00e0", MODE:="0666"
# PixelView PV-DT235U(RN) (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1554", ATTRS{idProduct}=="5020", MODE:="0666"
# Astrometa DVB-T/DVB-T2 (R828D)SUBSYSTEMS=="usb", ATTRS{idVendor}=="15f4", ATTRS{idProduct}=="0131", MODE:="0666"
# Compro Videomate U620F (E4000)SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0620", MODE:="0666"
# Compro Videomate U650F (E4000)SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0650", MODE:="0666"# Compro Videomate U650F (E4000)SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0650", MODE:="0666"
# Compro Videomate U680F (E4000)SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0680", MODE:="0666"
# Sweex DVB-T USB (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="a803", MODE:="0666"
# GTek T803 (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="b803", MODE:="0666"
# Lifeview LV5TDeluxe (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="c803", MODE:="0666"
# MyGica TD312 (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d286", MODE:="0666"
# PROlectrix DV107669 (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d803", MODE:="0666"
# Zaapa ZT-MINDVBZP (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d398", MODE:="0666"
# Twintech UT-40 (FC0013)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a4", MODE:="0666"
# ASUS U3100MINI_PLUS_V2 (FC0013)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a8", MODE:="0666"
# Dexatek DK DVB-T Dongle (Logilink VG0002A) (FC2580)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1101", MODE:="0666"
# Dexatek DK DVB-T Dongle (MSI DigiVox mini II V3.0)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1102", MODE:="0666"# Dexatek DK 5217 DVB-T Dongle (FC2580)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1103", MODE:="0666"
# MSI DigiVox Micro HD (FC2580)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1104", MODE:="0666"
# DigitalNow Quad DVB-T PCI-E card (4x FC0012?)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0413", ATTRS{idProduct}=="6680", MODE:="0666"
# Leadtek WinFast DTV Dongle mini D (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0413", ATTRS{idProduct}=="6f0f", MODE:="0666"
# Genius TVGo DVB-T03 USB dongle (Ver. B)SUBSYSTEMS=="usb", ATTRS{idVendor}=="0458", ATTRS{idProduct}=="707f", MODE:="0666"
# GIGABYTE GT-U7300 (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d393", MODE:="0666"
# DIKOM USB-DVBT HDSUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d394", MODE:="0666"
# Peak 102569AGPK (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d395", MODE:="0666"
# SVEON STV20 DVB-T USB & FM (FC0012)SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d39d", MODE:="0666"
# SVEON STV21 DVB-T USB & FMSUBSYSTEMS=="usb", ATTRS{idVendor}=="2b80", ATTRS{idProduct}=="d3b0", MODE:="0666"


Building and Install gr_osmoSDR

cd ../../
git clone git://git.osmocom.org/gr-osmosdr
cd gr-osmosdr/
mkdir build
cd build/
cmake ../ -Wno-dev
make
sudo make install
sudo ldconfig



Building and Install Gqrx with command line.

git clone https://github.com/csete/gqrx.git gqrx.git
cd gqrx.git
mkdir build
cd build
cmake ..

make
sudo make install
If you want to build the code using the Qt development environment then follow the steps below

cd ../../
git clone https://github.com/csete/gqrx.git
cd gqrx
qtcreator ./gqrx.pro

A new window will open (the QT compiler).
When it opens click the build menu then the build all option.

QT Compiler

you should see The process "/usr/bin/make" exited normally.

Plug in your RTL dongle.
Now run gqrx.
gqrx

Select Yes
GQRX Should now be open. On the first run you will be prompted for a device listing.

Select your SDR (in my case RTL dongle)

 In the device drop down menu select "ezcap USB 2.0 DVB-T/DAB/FM Dongle", then continue to the main GQRX window.

Select File->Start DSP. You should now be receiving something.
Tune to a local radio station between 88-108Mhz FM.
select Wide FM Stero as the Mode Type.



Now connect a proper external antenna to your RTL dongle or Softrock HF/VHF kit.
Hope you have lost of fun ;-)

Here is a video of GQRX using the 100Khz to 17Ghz RTL dongle in direct conversion mode.


How to configure your direct conversion dongle.

Here is the screen-shot of the configuration on Linux for Gqrx
  1. Device Select other
  2. Device String rtl=0,direct_sample=2 (possibly 0/1/2) (This number could differ depending on which pin was wired via balin)
 
 
Device String rtl=0,direct_sample=2
Here is a picture of the 100KHX to 1.7Ghz rtl dongle
100Khz to 1.7Ghz RTL direct conversion dongle
They are available at http://www.giga.co.za/ocart/index.php?route=product/product&path=59&product_id=178

Friday, February 1, 2013

Setting up my Raspberry Pi as a SDR Server with RTL-2832U USB dongle

Setting up my Raspberry Pi as a SDR Server with RTL-2832U USB dongle. (Android details also)

Raspberry Pi

RTL-2832U


Here is my hardware configuration.

1)Raspberry PI + PSU.
2) External power USB hub. ( Preferably don't connect RTL Dongle directly into Raspberry Pi)
3) RTL-2832U USB Dongle.

Software configeration

First update you Raspberry Pi wheezy Linux to the latest version.

sudo apt-get update

Now install the required utils to compile the RTL-2832U USB dongle driver

sudo apt-get install git 
sudo apt-get install cmake
sudo apt-get install libusb-1.0-0.dev
sudo apt-get install build-essential

Now install the RTL-2832U USB dongle driver src and compile

git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

if it was successful you should see no return on the previous command.

I have been told that the Raspberry crash if you don't reboot before inserting the dongle.

With the new Dongles and updated raspberry OS you mite get an error like this.
Found 1 device(s):
  0:  Generic RTL2832U OEM
Using device 0: Generic RTL2832U OEM
Kernel driver is active, or device is claimed by second instance of librtlsdr.
In the first case, please either detach or blacklist the kernel module
(dvb_usb_rtl28xxu), or enable automatic detaching at compile time.
usb_claim_interface error -6
Failed to open rtlsdr device #0.


If you did get this error then edit add the following blacklist text to solve the problem.

Edit the following file /etc/modprobe.d/raspi-blacklist.conf

use your favourite editor like nano or vi 

sudo vi /etc/modprobe.d/raspi-blacklist.conf

add the following lines in the file.

blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830


Save and exist.

You need to reboot. so just run sudo shutdown -r 0

Install the RTL-2832U USB dongle on external powered USB HUB

sudo ldconfig

Run this command sudo rtl_test -t to test the compiled driver
I had to reboot and run the command sudo ldconfig again before the test worked.
If U are using a RTL2832+R820T dongle U will get this error below when running the rtl_test -t command
**************************************
Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle

Found Rafael Micro R820T tuner

Supported gain values (there was a string of values)

No E4000 tuner found, aborting

Just ignore it the normal rtl_tcp command will work.

**************************************
pi@raspberrypi ~ $ sudo rtl_test -t

Found 1 device(s):

  0:  ezcap USB 2.0 DVB-T/DAB/FM dongle



Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle

Found Elonics E4000 tuner

Supported gain values (14): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0 21.5 24.0 29.0 34.0 42.0

Benchmarking E4000 PLL...

[E4K] PLL not locked for 51000000 Hz!

[E4K] PLL not locked for 2201000000 Hz!

[E4K] PLL not locked for 1101000000 Hz!

[E4K] PLL not locked for 1242000000 Hz!

E4K range: 52 to 2200 MHz

E4K L-band gap: 1101 to 1242 MHz



To run the rtl server type rtl_tcp -a and you ip address of your Pi.



 sudo rtl_tcp -a 192.168.10.135Found 1 device(s).
Found Elonics E4000 tuner
Using ezcap USB 2.0 DVB-T/DAB/FM dongle
Tuned to 100000000 Hz.
listening...
Use the device argument 'rtl_tcp=192.168.10.135:1234' in OsmoSDR (gr-osmosdr) source
to receive samples in GRC and control rtl_tcp parameters (frequency, gain, ...).


Wala the Raspberry SDR Server is running. 
listening to Audio on the local speaker jack

sudo rtl_fm -f 144800000 -s 44100 -g 9 -l 10 - | aplay -t raw -r 44100 -c 1 -f S16_LE

I had to set the volume in the mixer to hear something.

to get your soundcard playback details run the command  
sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7

You will have to configer your .asoundrc file (you can read about it in my websdr sound card section)
just use default as alsa device it should work

here is a example of .asoundrc config file content

pcm.!default {

        type hw

        card 0

}

ctl.!default {

        type hw

        card 0

}

pcm.usb {

        type plug

        slave {

                pcm "hw:1,0"

        }

}

ctl.usb {

        type plug

        slave {

                ctl "hw;1,0"

        }

}

Here is how you set your audio level


sudo alsamixer

alsamixer





Some Debugging

if you get this error below you tried to start the server when its already running.



sudo rtl_tcp -a 192.168.10.135

Found 1 device(s).

usb_claim_interface error -6

Failed to open rtlsdr device #0.

There is already running rtl server just kill the server and will now start.

Now to set-up a client to connect to server. 

Setting up SDR client on Linux / Raspberry. (multimode.py) or on Windows.


Linux client

1) install subversion
2) install python
3) install gnuradio and compile
3) compile mutimode.py
4) test and run

Run the following commands to install and configure multimode.py

apt-get install subversion

Install python
sudo apt-get install python


Check out the python multimode.py scipt

Setup the python path


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


cd /home/pi/Download/multimode/trunk (where ever you have checkout your mutimode code with subversion


run sudo make install


mkdir -p /root/bin
cp multimode.py multimode_helper.py /root/bin
Please make sure your PYTHONPATH includes /root/bin
And also that PATH includes /root/bin
this will allow multimode to work correctly

Check your python path with the following command.

echo $PYTHONPATH
/usr/local/lib/python2.7/dist-packages:/home/anton/bin

it seems to not include the /root/bin


So add it 


export PYTHONPATH=/usr/local/lib/python2.7/dist-packages:/home/anton/bin:/root/bin


Run mutimode.py

sudo ./multimode.py

Traceback (most recent call last):

  File "./multimode.py", line 9, in <module>
    from gnuradio import audio
ImportError: No module named gnuradio

need to install gnuradio

install gnuradio 

This process will take several ours  12 + on slow CPU(Raspberry or inter < 1.2Ghz ) so go and get some coffee or a bear and switch the TV on ......


Make shore you have sudo privileged be fore you go ahead.
You will be ask if you have sudo privileged in the script say Y.

wget http://www.sbrac.org/files/build-gnuradio && chmod a+x ./build-gnuradio && ./build-gnuradio

Proceed?Y Starting all functions at: Sun Feb 3 11:37:06 SAST 2013 SUDO privileges are required Do you have SUDO privileges?Y

.....................



......................


[sudo] password for anton: 
Done building and installing Gnu Radio
GRC freedesktop icons install ...Done
Done function gnuradio_build at: Sun Feb 3 19:26:13 SAST 2013
Starting function rtl_build at: Sun Feb 3 19:26:13 SAST 2013
Building rtl-sdr...Done building/installing rtl-sdr/gr-osmosdr
Done function rtl_build at: Sun Feb 3 19:29:47 SAST 2013
Starting function extras at: Sun Feb 3 19:29:47 SAST 2013
Doing GIT checkout for extra module gr-baz
Building extra module gr-baz
Doing GIT checkout for extra module grextras
Couldnt build module grextras directory not there
Done function extras at: Sun Feb 3 19:36:47 SAST 2013
Starting function mod_groups at: Sun Feb 3 19:36:47 SAST 2013
********************************************************************************
This script has just modified /etc/group to place your userid '('$USER')' into group 'usrp'
In order for this change to take effect, you will need to log-out and log back
in again.  You will not be able to access your USRP1 device until you do this.

If you wish to allow others on your system to use the USRP1 device, you will need to use:


  sudo usermod -a -G usrp userid

  
For each userid you wish to allow access to the usrp

********************************************************************************


Further 

Done function mod_groups at: Sun Feb 3 19:36:49 SAST 2013
Starting function mod_udev at: Sun Feb 3 19:36:49 SAST 2013
Done function mod_udev at: Sun Feb 3 19:36:53 SAST 2013
Starting function mod_sysctl at: Sun Feb 3 19:36:53 SAST 2013
Applying updates to /etc/sysctl.conf
Group 'usrp' now has real-time scheduling privileges
You will need to log-out and back in again for this to
take effect
Done function mod_sysctl at: Sun Feb 3 19:36:53 SAST 2013
Starting function pythonpath at: Sun Feb 3 19:36:53 SAST 2013


************************************************************

You should probably set your PYTHONPATH to:

     /usr/local/lib/python2.7/dist-packages


Using:


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


in your .bashrc or equivalent file prior to attempting to run

any Gnu Radio applications or Gnu Radio Companion.
*************************************************************
Done function pythonpath at: Sun Feb 3 19:36:53 SAST 2013
Done all functions at: Sun Feb 3 19:36:53 SAST 2013
All Done

sudo gnuradio-companion

















My Raspberry ran out of space need bigger SD card (but the process is the same on Ubuntu)

I will update this aria when I get my new SD card.

Now we are reddy to run the mutimode.py


cd to your directory where multimode.py 

something lie this cd /home/anton/Downloads/multimode/multimode/trunk
run sudo ./multimode.py

Woila ...

















It seems that the Raspberry CPU is to slow to run the mutimode.py

Setting up a Windows Client to connect  to rtl server.

Download SDR# from http://sdrsharp.com/  http://sdrsharp.com/downloads/sdr-stable.zip

Unzip sdr-stable.zip


run SDR#



Run SDRSharp

Configure the SDR# to connect to rtl_tcp

Select RTL-SDR/TCP
Select IP , Port, And I had to decrees sample rate to 1000000 (I think my WIFI is to slow)
This is the IP and Port of your Raspberry Pi (default port is 1234)


Add IP, Port and possibly change your Sample rate to 1000000


















Here is a video of the SDR# connected to Raspberry Pi





Android client connecting to rdl_tcp server (Worked on my Galaxy S2 and Galaxy tab 7')

Screenshots is from Galaxy S2
What you need to install from Google Play
1) SDR Touch from Google play
2) [RTL2832U driver] from Google play
3) And you need to pay for the License app +_ R90 [SDR Touch Key]. (
If you see Demo on left bottom corner the key did not work run it first.
( I had to sometimes stop and start the app to get it working)

I also have plug in the RTL-2832U dongle directly to the phone with a adapter cable and it also works vine via a external powered USB HUB ( I got the adapter cable from local China mole for about R70-00)


Galaxy S2 USB Host Adapter












Samsung Galaxy S2


















Run the [Touce Key] app and close it.


Then run [SDR Touch] and you should see the screen below.




Select the menu button = on bottom of phone and you should see a menu like this.
Enter your RTL_TCP server details as configure above.

















Then click on [Spectrum] button and you can then scroll the freq by dragging the spectrum left or write.
You could also pres the[ set Mhz] button and enter the frequency in the menu see screenshot below.
Just one problem (selecting the modulator option is a trick)
[AM LSB USB NBFM .....]
There is a small gap between the [set Mhz] button and the [help] button and you should carefully click the gap to change the mode. I am shore the developer will fix this soon


























Debug info:
If you get popups saying you need root just ignore them.
I had to sometimes restart the app.