For some time now I have been in great need of small and cheap AIS receivers that could be used for guiding various tracking equipment during Copenhagen Suborbitals missions. AIS stands for Automatic Identification System and is used by maritime vessels for reporting various status, including position, heading and speed.
At the physical layer AIS uses 9600 bps GMSK on 161.975 and 162.025 MHz. There are already various free software packages that provide the demodulator and decoder functionality, including gr-ais and gnuais. For the present experiment, I have decided that a configuration using an rtl-sdr dongle and a Beaglebone Black running gnuais would be ideal. I didn’t know much about gnuais before these experiments except that it seemed to be a small and efficient software package.
As it turns out, gnuais does not contain any demodulator but relies on an external demodulator. This is probably for historical reasons, i.e. this way you can connect the discriminator output of an FM receiver to the audio input on your PC running gnuais. However, in my setup I use a software defined radio and so must provide the demodulator functionality before sending the samples to gnuais.
The diagram below shows an overview of the receiver setup that I have used for my tests.
I use a 1/2 wavelength marine whip followed by a good band pass filter (164 ±10 MHz). VHF is really full of all sorts of crap, so using a tuned antenna and a band pass filter is really necessary if you want to receive anything else than FM radio on your rtl-sdr dongle. Remember that adding a cheap pre-amp will hardly solve any interference issues, since the pre-amp does not know the difference between what you want to receive and what you don’t. Fortunately, AIS signals are relatively strong and even under poor receiver conditions you should be able to pick up something if you are located near marine traffic.
Following the band pass filter is the rtl-sdr dongle. I have used one of my newer dongles with an R820T tuner.
For SDR receiver I have used a simple GNU Radio flowgraph with two parallel receivers receiving +/- 25 kHz from the center 162 MHz.
Download the .grc file here: https://gist.github.com/csete/6524653 (please, do us all a favour and select “raw” before doing “Save As” in your browser).
The quadrature demodulator takes a gain parameter expressing the samples per symbol ratio. Different texts give different definitions and I am not even going to try to define it here. The exact value is not critical as long as the output from the demodulator is not saturated.
After the demodulator we resample to 48 ksps and convert from float to 16 bit signed integers. By examining the gnuais source code I found that it uses the same sample format regardless of whether is uses audio or file input. This format is S16_LE at 48 ksps.
The demodulated and converted output from the two channels are interleaved to create a single stream of the form ABABAB… and sent to a named unix pipe. At the other end of the pipe, we start gnuais using the -l parameter.
It is a good idea to create and edit the gnuais configuration file as suggested by the application. This is also where you configure gnuais to decode both AIS channels using stereo audio.
Gnuais also has another interesting feature. It can forward the NMEA sentences to aprs.fi, see the gnuais.conf-example file and http://aprs.fi/page/ais_feeding. It can also store the decoded AIS data in a database in case you have other applications or web services that can use it.
My next step with this setup is to take the python script generated from the GRC file and try to make it run on a Beaglebone Black using GNU Radio for armhf from the Gqrx PPA.