AIS Receiver - SARCNET

School Amateur Radio Club Network
School Amateur Radio Club Network
School Amateur Radio Club Network
School Amateur Radio Club Network
Title
Go to content
AIS Receiver
Amateur Radio Magazine Article
Our original article describing the inspiration and operation of the AIS receiver is here. We also presented this project at GippsTech in 2016 here.
AIS Receiver Mk1 (RPi1) Pictorial Schematic
AIS Receiver Mk1 (RPi1) Layout
AIS Antenna
AIS Receiver Mk2 (RPi0) Layout
Parts List
Your AIS receiver will require the following items:
  • 162MHz AIS vertical antenna. See above for the simplest design or here for other ideas.
  • Antenna mast. High enough to mount the antenna within line of sight of ships.
  • Coaxial cable (50 Ohm, e.g. RG-58) from the antenna to the AIS receiver, with an SMA connector
  • AIS Filtered RF Preamplifer - 162MHz (Only needed for poor reception areas). See: www.uputronics.com.
  • Weatherproof, non-metallic (for Wi-Fi access), enclosure for mounting the hardware
  • Raspberry Pi (RPi) single board computer. Any version: 0,1,2,3,4, model B or B+. See: www.raspberrypi.org.
  • USB Hub Hat with micro USB joiner (Only required for RPi0). See: www.waveshare.com.
  • USB Wi-Fi dongle to suit your home Wi-Fi router (Not required if your RPi already has Wi-Fi)
  • USB RTL-SDR dongle (TCXO 1ppm or better). See: www.rtl-sdr.com.
  • USB extension cable, 10cm (Not required for RPi0 with Hub Hat)
  • USB DC/DC converter (12V to 5V, 2A with USB micro connector) and a DC Adapter (12V, 1A) - For outside AIS Receiver mounting; or
  • USB plug pack (5V 2A) with USB micro connector - For inside AIS Receiver mounting
  • DC Cable, twin core as required to connect the DC Adapter (inside) to the DC/DC converter (outside)
  • 8GB SDHC card (RPi1) or 8GB Micro SDHC card (RPi0,2,3,4)
  • Raspbian Buster with our latest AIS Receiver software image (Version 2.00 - Released 11 May 2020). See below.
Note: Components and cables should be readily available locally or search for their name on eBay.
Create your SDHC Card Image
To simplify the installation process, we have prepared a complete, working image of the Raspbian Buster operating system together with the open-source rtl_ais and aisdispatcher software already installed and enabled as services. The image file is compressed, but will still require a large download and sufficient free space on your PC to unzip it: At least 10GB in total.

Request a link to our AIS receiver software image here and follow the software installation instructions below.

To install our AIS receiver software image do the following on a PC:
  1. Download the zip file (650MB) using the link provided
  2. Unzip the zip file to an img file (8GB)
  3. Download Win32DiskImager (12MB) using the link provided
  4. Install Win32DiskImager
  5. Insert an 8GB SDHC or 8GB Micro SDHC card into the PC (Note: A USB SD card adapter may be necessary)
  6. Start Win32DiskImager
  7. Select the image file and the SDHC card above. Select Write.
  8. Eject the SDHC card from the PC when finished
  9. You can then delete the zip and img files from your PC if desired
Configure your Raspberry Pi
Your Raspberry Pi will have to be configured for the first time using a hard-wired keyboard and monitor. You need to enter your own login password, your WiFi router access credentials and your localization information as follows:

  1. Power off the Raspberry Pi
  2. Insert the SDHC card into the Raspberry Pi
  3. For a RPi1 connect a powered USB hub
  4. Connect a USB Wi-Fi Dongle (only for RPis without a Wi-Fi adapter)
  5. Connect a USB keyboard
  6. Connect an HDMI monitor - You may need an HDMI to micro HDMI adapter
  7. Do not connect USB RTL-SDR dongle just yet
  8. Power up the Raspberry Pi using a USB Plug Pack or USB DC/DC Converter connected to a 12V DC Adapter
  9. Log in:
    1. Type: pi
    2. Type: raspberry
  10. Type: sudo raspi-config. Select and configure the following options for your installation:
    1. Change your User Password (Very, Very Important!)
    2. Network Options
      1. Enter your Wi-Fi SSID and Passphrase for your Wi-Fi Router
    3. Localization Options
      1. Locale
      2. Timezone
      3. Keyboard Layout
      4. Wi-Fi Country
  11. When connected to the Internet, upgrade the operating system:
    1. Type: sudo apt-get update
    2. Type: sudo apt-get upgrade -y
  12. To discover the IP Address of your RPi so you can log-in later:
    1. Type: hostname -I
  13. Shutdown your RPi:
    1. Type: sudo shutdown now
  14. Power down your RPi
  15. Connect the USB RTL-SDR dongle
  16. Connect your 162MHz antenna to the USB RTL-SDR dongle
  17. Power up the RPi
Calibrate your AIS Receiver
The operating frequency of the USB RTL-SDR Dongle's internal Temperature Controlled Crystal Oscillator (TCXO) may not be precisely on frequency, depending on its quality and other factors. However, you can use the RPi clock to calibrate the RTL-AIS service to account for any frequency offset. Note: The frequency offset is measured in Parts Per Million (PPM). Note: For 1PPM RTL-SDRs this step is hardly necessary as the frequency would only be off by +/- 162Hz.

Do the following on the Raspberry Pi:
  1. Login:
    1. Type: pi
    2. Type: Your password
  2. Stop the RTL AIS service and run the RTL test
    1. Type: sudo systemctl stop rtl_ais.service
    2. Type: rtl_test -p60
    3. Wait until the cumulative error value (in PPM) remains more-or-less the same for three consecutive minutes
    4. Note the last cumulative error value (in PPM). As shown below it is -3 PPM in this case.

pi@AIS:~ $ rtl_test -p60
Found 1 device(s):
 0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Detached kernel driver
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
Reporting PPM error measurement every 60 seconds...
Press ^C after a few minutes.
Reading samples in async mode...
Allocating 15 zero-copy buffers
lost at least 64 bytes
real sample rate: 2048000 current PPM: 0 cumulative PPM: 0
real sample rate: 2047993 current PPM: -3 cumulative PPM: -1
real sample rate: 2047989 current PPM: -5 cumulative PPM: -3
real sample rate: 2047994 current PPM: -3 cumulative PPM: -3
real sample rate: 2047995 current PPM: -2 cumulative PPM: -3

3. Update the RTL AIS service with the required correction value in PPM (+3 in this case), which is the opposite of the error value in PPM (-3 in this case) determined above.
a. Type: sudo nano /etc/systemd/system/rtl_ais.service
b. Change: ExecStart=/usr/local/bin/rtl_ais -p 0 to ExecStart=/usr/local/bin/rtl_ais -p 3
c. Type: Ctrl-O to save the changes and Ctrl-X to exit the editor
4. Reload and restart the RTL AIS service with the new changes
5. Type: sudo systemctl daemon-reload
6. Type: sudo systemctl restart rtl_ais
Register your AIS Receiver
By default, the AIS receiver software will upload your AIS station data only to the Pocket Mariner, Ship Finder and Vessel Finder AIS servers as an anonymous user. To upload to the AIS Hub and Marine Traffic AIS servers you will have to register with them to get a unique Upload IP Address and Port Number for your AIS station. These AIS servers also provide statistics for your AIS station. You can also register with the Vessel Finder AIS server if you want statistics for your AIS station too. Some AIS servers provide significant benefits to registered AIS station operators like free premium membership for the use of their AIS data and AIS station upload statistics, area coverage, online availability and email alerts. Since AIS servers don't all share your data, please upload to as many as possible. It will make the world a safer place for vessels! Here are the links to some AIS service providers including their IP Address and Port Numbers for anonymous upload:

To add new AIS Server Upload IP Addresses and Port Numbers to the defaults for the AIS Dispatcher service:
  1. Stop and edit the AIS Dispatcher service
    1. Type: sudo systemctl stop aisdispatcher
    2. Type: sudo nano /etc/systemd/system/aisdispatcher.service
  2. Add each new Upload IP Address and Port Number (Format: AAA.BBB.CCC.DDD:PPPP) to the end of the line below, each separated by a comma and with NO spaces.
  3. ExecStart=/usr/local/bin/aisdispatcher -u -g -h 127.0.0.1 -p 10110 -H 54.225.113.225:5322,109.200.19.151:4001,195.201.71.220:5964
  4. Type: Ctrl-O to save the changes and Ctrl-X to exit the editor
  5. Reload and restart the changed AIS Dispatcher service:
    1. Type: sudo systemctl daemon-reload
    2. Type: sudo systemctl restart aisdispatcher
Monitor your AIS Receiver
You can securely log into your AIS receiver over your Wi-Fi network to check its operation from another Wi-Fi enabled PC.
  1. Use your AIS Receiver's IP address discovered earlier (or check your Wi-Fi router's DHCP leases to find it).
  2. Open a terminal window
    1. Type: ssh pi@<Your AIS Receiver's IP Address>
    2. Type: <Your password>
  3. Display the AIS data being received in real-time as raw NMEA sentences
    1. Type: journalctl -u aisdispatcher.service -f
pi@AIS:~ $ journalctl -u aisdispatcher.service -f
-- Logs begin at Fri 2020-05-15 19:39:48 AEST. --
May 16 01:26:05 AIS aisdispatcher[438]: !AIVDM,1,1,,B,18JslT0014bGF;5bEibtLqqh0D1A,0*3D
May 16 01:27:12 AIS aisdispatcher[438]: !AIVDM,1,1,,B,4@4k1EQvAGgK;:Etkmb:JM7P00S:,0*10
May 16 01:27:45 AIS aisdispatcher[438]: !AIVDM,1,1,,B,18JslT0014bGEFkbEnwtCIm:00ST,0*75
May 16 01:28:03 AIS aisdispatcher[438]: !AIVDM,1,1,,B,17OetM5P18:GEFwbEp4<=?v80D0U,0*57
May 16 01:28:32 AIS aisdispatcher[438]: !AIVDM,1,1,,B,4@4k1EQvAGgLO:Etkmb:JM7P0L1:,0*7D
May 16 01:28:34 AIS aisdispatcher[438]: !AIVDM,1,1,,B,3815F:Uwh0bGHugbG4U:FWW40r7b,0*48
May 16 01:29:12 AIS aisdispatcher[438]: !AIVDM,1,1,,B,4@4k1EQvAGgM;:Etkmb:JM7P0H7=,0*0D
May 16 01:29:24 AIS aisdispatcher[438]: !AIVDM,1,1,,B,17OetM5P0w:GDcWbEt>LEwvj08><,0*1A
May 16 01:29:44 AIS aisdispatcher[438]: !AIVDM,1,1,,B,17P4895P15:GD;obEwB<8gwJ0@JB,0*7E
May 16 01:30:03 AIS aisdispatcher[438]: !AIVDM,1,1,,B,17OetM5P11:GDG7bEv6<E?v80<0U,0*1A
b. Type: Ctrl-C to exit

However, to verify that your data is being uploaded to an AIS server you have to log into it and check your upload statistics - if provided.
Install your AIS Receiver
Reconfigure the AIS receiver for stand-alone operation, install it in the enclosure and mount it as follows:
  1. Disconnect the USB keyboard, HDMI monitor and USB hub, if used
  2. Assembe the RPi, USB RTL-SDR dongle and 12V to 5V 2A micro USB DC/DC converter in the enclosure
  3. Connect the 162MHz antenna via the 50 Ohm coaxial cable and an SMA connector to the USB RTL-SDR
  4. Optionally connect an inline 162MHz AIS Filtered Preamp to amplify the AIS signals and filter out local radio frequency interfrence.   
  5. Connect the 12V DC Adapter via 12V DC Cable to the 12V to 5V 2A micro USB DC/DC converter.
  6. Mount the enclosure as close to the 162MHz Antenna as possible to reduce coaxial line losses if required. However, inside installations with short lengths of coaxial cable may also be acceptable.
Operate your AIS Receiver
Operating an AIS Receiver station is easy. Just switch it on, let it connect to the Internet and it will receive and upload AIS traffic to the AIS Servers, 24/7.
  1. Make a backup copy of the RPi SD Card using Win32diskimager.
  2. Check the operation of the AIS Receiver on a regular basis by monitoring it (as above).
  3. Check your AIS Servers. Some provide useful AIS Receiver station statistics and on-line maps.
Check the Performance of your AIS Receiver
The AIS receiver will work well on any version of Raspberry Pi with WiFi access - either using the built-in WiFi transceiver or an add-on USB WiFi dongle. Expect the rtl_ais application to run at the following CPU throughput levels:
  • 90% CPU on a RPi1
  • 66% CPU on an RPi0
  • 23% CPU on and RPi2
More information
For more information and credit for the open-source code used in this project please see:
  • A simple AIS tuner and generic dual-frequency FM demodulator by D. Giardini: rtl-ais
  • An AIS data forwarding utility by AISHub: aisdispatcher
Project Status (Updated: 3 February 2023)
Total number of reported builders: 489

Please update your status by e-mailing us. You can send us pictures and reports of your progress.

Notes and Errata:

One builder reported an issue with the Raspberry Pi 4 (we have not tested it). Apparently it would not boot. The solution was to download the latest official Buster build to another mini SDHC card and then to copy all the latest files from its /boot directory (except cmdline.txt) to the /boot directory our mini SDHC card. However, we have not verified this.
AIS Yagi Antenna
In most cases the AIS receiving station is located inland, or at least on the coast. In these situations, omnidirectional coverage is not needed. Where 90-120 degree beamwidth is adequate, a small Yagi antenna can provide additional gain over a simple omnidirectional antenna.

We have recently developed a simple, low-cost method of Yagi antenna construction for schools: It does not require a drill press or any special tools. This method uses aluminium flat bar elements, which are easy to cut, drill, bend and connect to. The folded-dipole driven element can be formed by rolling it around a 25mm dowel. The boom is made using light-weight aluminium angle. Everything is assembled using M5 x 12mm stainless-steel hex bolts, with shakeproof washers (on either side of the boom for good electrical connection and rigidity) and nylock nuts. These bolts can be fastened, using spanners, to a high torque - to prevent the elements turning. A 25x25x25mm piece of PVC angle is use as an insulator for the feed point. It can be glued to the boom. A quarter-wavelength balun is attached to the boom using cable ties. Coaxial cable connection to the driven-element is made using two, 3mm holes at feed point and 3mm ring-lugs. The coax shield is connected to the boom via a 5mm ring-lug at the feed point. All connections are kept very short.


Feed Point Construction

This 3-Element AIS Yagi Antenna for 162MHz was designed using the VK5DJ Yagi Calculator and constructed using 12x3mm aluminium flat bar elements on a light-weight 1m length of 25x25x3mm aluminium angle boom.

VK5DJ's YAGI CALCULATOR RESULTS
Yagi design frequency =162.00 MHz
Wavelength =1851 mm
Parasitic elements contacting a square section metal boom 25 mm across.
Folded dipole mounted same as directors and reflector
Director/reflector strip =12 mm by 3 mm
Radiator strip =12 mm by 3 mm
REFLECTOR Length 912.6mm. Boom position 30 mm
RADIATOR Folded Dipole 25 mm ID. Length 899.9 mm. Boom position 400.1 mm.
DIRECTORS Dir 1. Length 824.3 mm. Boom position 538.9 mm. Gain 4.8 dBd. Gain 6.9 dBi.
A quarter-wavelength 4:1 balun uses 0.66 velocity factor RG-58C and is 611 mm long.


Balun Construction

AIS 162MHz 3-Element Yagi Antenna with Coaxial Balun

Vertical Mounting on 8.5m Aluminium Mast
Status Reported by Builders
The following is a list of some of the builders who have completed the rotator and sent us their comments or pictures:

Richard Charmers - "Hi all, Just a line to let you know that I have got my AIS receiving station up and running. I used your antenna design, fastened onto the (no longer used) chimney stack. There's a Pi 3A connected to a Nooelec NESDR SMArt v4 SDR located in the attic. I also installed AISHUB's Ais Dispatcher program onto the Pi, which gives me a web page to monitor from any machine on my network. We're located on the southern shore of Broadford Bay, Isle of Skye and are pulling in messages from up the Inner Sound, over to Kyleakin, Raasay and possibly as far as Kishorn. Many thanks, I wish there had been such fun things when I was at school!!! Keep up the good work."



Back to content