The Navigatrix has been updated. The new website can be found at navigatrix.net.




Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: rtl-sdr

Joined: 18 Jul 2013, 12:24
Posts: 20
I was recently successful in installing rtl-sdr on my Linux Mint laptop. I was not able to get it to work in Navigatrix.

I was able to use the product below to monitor VHF 16 using the laptop.

http://www.fasttech.com/products/1254300

Using these how-tos: http://blogs.bu.edu/mhirsch/2012/07/get ... in-ubuntu/

http://de8msh.blogspot.com/search/label/RTL-SDR

http://kmkeen.com/rtl-demod-guide/index.html

I failed a few times but finally got it to install on Linux Mint. I'm not sure I can replicate it, the software is not user friendly.

The command that receives VHF 16 is as follows:

sudo rtl_fm -W -f 156.75M -l 36 -g 49.6 -s 200000 -r 48000 | aplay -r 48k -f S16_LE

You will have to adjust -f (frequency). Nominally the frequency for VHF16 is 156.8M, however I calibrated my setup by trial and error and found the best reception 0.05M lower than the nominal frequency.

The -l is the squelch level, which will change based on background noise that day.

-g is gain, which should be set at the highest result returned from rtl_test.

So far I have tested using my own VHF handheld in tx mode. I need to make an antenna. A vertical dipole with legs of 18" should work. My plan is to solder two 18" wires to the board and to use a usb male to female extension cord to put the board up in the air. Another option is to use the supplied coax and cut the coating back 18" and pull the shielding one way and the inner wire the other. Or solder a wire to the shielding, if it is foil, which I suspect.

If this is reliable, it would be a good way to monitor 16. If I am running OpenCPN anyway, might as well use the laptop to monitor 16 too. rtl-sdr should also be able to scan frequencies, for example 9 - 13 - 16 - 22. It should also pick up weather VHF stations.

Here are my notes from trying to install on Navigatrix:

# Installing rtl_sdr to receive VHF 16

sudo apt-get update

# http://blogs.bu.edu/mhirsch/2012/07/get ... in-ubuntu/
# de8msh.blogspot.com/2012/09/rtl-sdr-toolbox-on-linux-based-os.html
# note:error in de8msh webpage: build-essential has no s at the end

# I did this but it is for the full gnuradio install, might have been a mistake
sudo apt-get install build-essential cmake git-core libboost-all-dev libusb-1.0-0-dev python-scitools portaudio19-dev -y

# mhirsch's install:
sudo apt-get install libusb-1.0-0-dev
sudo apt-get install git
sudo apt-get install libusb-1.0-0-dev git cmake

# make a directory to hold source files and move to it

cd ~
mkdir rtl-sdr
cd rtl-sdr

#get the rtl-sdr software
git clone git://git.osmocom.org/rtl-sdr.git

#note: this created a second rtl-sdr directory in the ~/rtl-sdr directory. I moved the files to the ~/rtl-sdr directory

# make a build directory and move to it
mkdir build
cd build

#you should now be in ~/rtl-sdr/build with all the rtl_sdr git files in ~/rtl-sdr

# install the rtl-sdr software
sudo cmake ../
sudo make
sudo make install

# make rtl files executable

chmod a+x /usr/local/bin/rtl*

#getting lib errors so see if this fixes it:
chmod a+x /usr/local/lib/librtlsdr.so.0.5git

The error that I see on terminal is:
rtl_test: error while loading shared libraries: librtlsdr.so.0: cannot open shared object file: No such file or directory

I am wondering if anyone has suggestions as to how to get this to work.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
Try running ldconfig
Quote:
ldconfig creates the necessary links and cache to the most recent
shared libraries found in the directories specified on the command
line, in the file /etc/ld.so.conf, and in the trusted directories
(/lib and /usr/lib). The cache is used by the run-time linker, ld.so
or ld-linux.so. ldconfig checks the header and filenames of the
libraries it encounters when determining which versions should have
their links updated.

ldconfig will attempt to deduce the type of ELF libs (i.e., libc5 or
libc6/glibc) based on what C libs, if any, the library was linked
against.

Some existing libs do not contain enough information to allow the
deduction of their type. Therefore, the /etc/ld.so.conf file format
allows the specification of an expected type. This is used only for
those ELF libs which we can not work out. The format is
"dirname=TYPE", where TYPE can be libc4, libc5, or libc6. (This
syntax also works on the command line.) Spaces are not allowed.
Also see the -p option. ldconfig should normally be run by the
superuser as it may require write permission on some root owned
directories and files.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 18 Jul 2013, 12:24
Posts: 20
before I saw the above post, I tried installing gnuradio using the build-gnuradio script:

mkdir ~/sdr
cd ~/sdr

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

after an overnight build, I rebooted and ran rtl_test, getting:
Library error 0, exiting...

$sudo ldconfig -v
$rtl_test
Library error 0, exiting...

Now trying $sudo apt-get install gnuradio


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 18 Jul 2013, 12:24
Posts: 20
rebooted
$rtl_test
Library error 0, exiting...

I do have GRC (Gnu Radio Companion) in the menu under Programming.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
When you ran sudo ldconfig -v did you see a bunch of data which included:
Quote:
/usr/local/lib:
libtiffxx.so.5 -> libtiffxx.so.5.2.0
libtiff.so.5 -> libtiff.so.5.2.0
librtlsdr.so.0 -> librtlsdr.so.0.5git
because I did...and then saw this:
Quote:
moe@example:~$ /usr/local/bin/rtl_test
No supported devices found.
moe@example:~$ rtl_test
No supported devices found.
moe@example:~$
...because I don't have the device.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
Ok, I'm at a loss here....
Attachment:
gnuradio.png
gnuradio.png [ 107.1 KiB | Viewed 21907 times ]


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 18 Jul 2013, 12:24
Posts: 20
Yes, I saw a list of lib files pointing to other lib files.

It looks like you have rtl-sdr running, except you need to plug in one of the usb devices. I get a lib error before that point.

http://www.fasttech.com/products/1254300

This is the device that is working for me on Linux Mint to receive VHF 16.

I have not yet solved the mysteries of Gnu Radio Companion, I intend to try to learn when I have time.

The rtl-sdr program is supposed to be much more lightweight on system resources than gnuradio. I did not really want the full gnuradio install but am trying to get something working.

Apparently there is a gnuradio app gr-ais that will receive ais signals, and it has successfully been used together with OpenCPN to display AIS. I have not gotten to that point in the experiment yet.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
skyl4rk wrote:
It looks like you have rtl-sdr running, except you need to plug in one of the usb devices. I get a lib error before that point.
Yeah, that's one way of looking at it...another way to look at it is that following the instructions I could successfully build and launch the applications on Navigatrix without getting errors.

Spending 12 bucks and waiting 2 weeks will not change that.

Run a simple test. Don't plug in your thingy. Launch the application.

Do you get a library error or "No supported devices found"?


AIS frequencies:
Channel 87 – 161.975 MHz
Channel 88 – 162.025 MHz

and then pipe it to a device/app that OpenCPN can pick up and use.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 18 Jul 2013, 12:24
Posts: 20
Good point...

$rtl_test
No supported devices found.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
So when you do plug it in and run the application does it give a library error?
(paste the output rather than interpret)


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
I was just looking at http://sdr.osmocom.org/trac/wiki/rtl-sdr

It might be a simple thing as the executable needs an argument...such as rtl_test -t or rtl_test -s 3.2e6


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
...that being said, I don't see the Marine VHF frequency range between 156.0 and 162.025 MHz in the dongles specs.
Quote:
DVBT: 48.25~863.25 MHz
FM radio: 87.5~108 MHz
DAB radio: L-Band-1452960~1490624 KHZ, VHF-174928~239200 KHZ
unless the DVB-T range counts. I don't know anything about it as radio is among the black arts; which I avoid; as it steals the souls of men.

I'm curious if this hardware can deal with marine vhf.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 18 Jul 2013, 12:24
Posts: 20
Ha ha, and I thought unix-linux was a deal with the devil.

The range of the Rafael Micro R820T is 24 - 1766 MHz.

I have a usb extension cord on order and will solder some antenna wires on the usb chip soon. Then I will see if I can pick up real VHF traffic. So far it picks up my transmission from a handheld VHF, albeit only a few meters away from the dongle. This is using the original antenna and my Linux Mint laptop.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 18 Jul 2013, 12:24
Posts: 20
Some clues as to how to get gr-ais and OpenCPN going...

http://www.reddit.com/r/RTLSDR/comments ... d_opencpn/


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
I don't know how ais_rxworks, or what -dosmocom -g35 -r250e3 signify; but you could edit /usr/local/bin/opencpnais
Code:
sudo medit /usr/local/bin/opencpnais
to something like this:
Code:
#!/bin/sh
cd /
if ( ! pidof opencpn ); then
## Sound card -don't need-
#  alsactl store -f ~/.config/alsa_std
#  alsactl restore -f ~/.config/alsa_ais
#
## Script to link the non static /dev/ttyUSB[N] ports
## to static /dev/com[N]. configuration will be saved
## to a configuration file which is unique for each
## computer -don't need-
#  comports
#
  mkfifo /tmp/aisfifo
  socat -L /tmp/ais - PTY,link=/tmp/aisfifo,raw & pidof air_rx || ais_rx -dosmocom -g35 -r250e3 > /tmp/aisfifo 2>/dev/null
#
## AIS Sound card demodulator -don't need-
#  pidof gnuais || sudo gnuais -c /etc/gnuais.conf -f  >/dev/null 2>&1
#
## Make sure OCPN language matches system language -don't need-
#  sed -i "s/^Locale=.*$/Locale=${LANGUAGE%%:*}/" ~/.opencpn/opencpn.conf
  /usr/bin/opencpn $@ >/dev/null 2>&1
  #/usr/bin/opencpn --verbose
## Cleans up possible loose ends
#  sudo killall gnuais
  sudo killall ais_rx
  kill -9 $(cat /tmp/ais)
  rm /tmp/aisfifo
  rm /tmp/ais
## Didn't do -don't need-
#  alsactl store -f ~/.config/alsa_ais
#  alsactl restore -f ~/.config/alsa_std
fi
...deleting any line you wish that begin with #, except the first.

My guess is you'll want to run it from a script. This way it should mean only one thing to mess with-once. Although I've not found a good way to deal with stray socat processes.

If you try it...try it first from the terminal (opencpnais) to see if it dies. 2>/dev/null in line 15 will hide any error from ais_rx so you could leave that out in a test.

If it works, you can just click your OpenCPN icons to launch the whole thing.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 18 Jul 2013, 12:24
Posts: 20
Thanks, I have an antenna made up, and my usb extension cord came in, so now all I need is a good block of time to experiment and try to get it to work.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
The solution to dealing with a stray socat process was found in another Navigatrix script (/usr/local/bin/gippy).
Code:
kill -9 $(cat /tmp/ais)
I've edited the code above.

Now the only thing left is to make it work.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 11 Jun 2013, 10:17
Posts: 1
socat -L /tmp/ais - PTY,link=/tmp/aisfifo,raw & pidof air_rx || ais_rx -dosmocom -g35 -r250e3 > /tmp/aisfifo 2>/dev/null

error!!!!! select source with ais_rx -s, not -d !!!

try with socat -L /tmp/ais - PTY,link=/tmp/aisfifo,raw & pidof air_rx || ais_rx -sosmocom -g35 -r250e3 > /tmp/aisfifo 2>/dev/null


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 04 Nov 2010, 20:51
Posts: 1062
There you have it. A typo repeated over and over finally gets corrected.

Thanks.


Top
   
 
 Post subject: Re: rtl-sdr

Joined: 06 Jun 2014, 03:26
Posts: 6
the rtl_sdr plugin for opencpn automatically runs everything. You can use either gnuradio, or rtl_fm and aisdecoder (much less cpu usage and easier to compile and get working) Instructions are in the readme for the plugin.

https://github.com/seandepagnier/rtlsdr_pi


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 25 posts ]  Go to page 1, 2  Next


Search for:

Credits © 2010 - 2024