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
Updated in 2025
Our original project was distributed as a complete Raspberry Pi image, mainly because there were many fiddly settings and bug fixes required just to get it all working. That meant that there were issues with porting it to the latest Raspberry Pi hardware and operating systems. For this updated version we decided to use the Raspberry Pi Imager to load the latest Raspberry Pi OS. Then we created our own AIS messenger application to distribute AIS messages to numerous AIS servers. The system can now be installed on all network-enabled RPi platforms, using a simple script.
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
The AIS receiver may require the following items, depending on the version and model of Raspberry Pi:
  • 162 MHz AIS vertical antenna. See below 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 - 162 MHz (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 or 5 model B or B+. See: www.raspberrypi.com.
  • 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 AC-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 AC-DC Adapter (inside) to the DC/DC converter (outside)
  • 8GB or larger SDHC card (RPi1) or Micro SDHC card (RPi0, 2, 3, 4, 5)
  • Note: Components and cables should be readily available locally or search for their name on eBay.
Create the SDHC Card Image
We highly recommend installing the AIS Receiver software on a Raspberry Pi used only for this purpose, as there may be unforeseen interactions with existing application. Download the latest Raspberry Pi OS for your model of Raspberry Pi and write it to an SDHC card using the RPi Imager as follows:

  1. Insert the SDHC card into your PC (via a USB adapter if necessary)
  2. Download and install the Raspberry Pi Imager on your PC from here.
  3. Start the Raspberry Pi Imager
  4. Select the Raspberry Pi device that you will be using for the AIS Receiver
  5. For RPi 0, 1 or 2: Select the Raspberry Pi OS Other | Raspberry Pi OS Lite (32 Bit) with no Desktop Environment
  6. For RPi 3, 4 or 5: Select the Raspberry Pi OS Other | Raspberry Pi OS Lite (64 Bit) with no Desktop Environment
  7. Select the SDHC Card storage device
  8. Press Next
  9. Select Edit OS Customisation Settings - It is much easier to configure these settings on the PC.
  10. Select General
    1. Set hostname: ais
    2. Set username: pi
    3. Set password - Very important to use a strong password!
    4. Set Configure Wireless LAN:
      1. Set SSID
      2. Set Password
      3. Set Country
    5. Set locale settings
      1. Set Time zone
      2. Set Keyboard layout
  11. Select Services
    1. Select Enable SSH
  12. Press Save
  13. Press Yes to use the OS Customisation Settings
  14. Press Yes to continue and write the RPi OS to the SDHC card
  15. Remove the SDHC card from the PC when advised
Start the Raspberry Pi
Insert the SDHC card into the Raspberry Pi and temporarily connect all required devices as follows:

  1. Power off the Raspberry Pi
  2. Insert the SDHC card into the Raspberry Pi
  3. Connect an HDMI monitor - You may need an HDMI to micro HDMI adapter
  4. Connect a powered USB hub (only for RPi1)
  5. Connect a USB Wi-Fi Dongle (only for RPis without a Wi-Fi adapter)
  6. Connect a USB keyboard
  7. Connect a USB mouse
  8. Connect a USB RTL-SDR dongle
  9. Connect a 162 MHz antenna to the USB RTL-SDR dongle
  10. Power up the Raspberry Pi using a USB Plug Pack or USB 12/5V DC/DC Converter connected to a 12V DC Adapter
  11. Log in as pi using your password
Install the AIS Receiver Software
Request a link to our AIS receiver installer script here and follow the software installation instructions therein.
Calibrate the 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). For 1ppm RTL-SDRs this step is hardly necessary as the frequency should 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 -T -p 0 to ExecStart=/usr/local/bin/rtl-ais -T -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

Finally, in operation, monitor the AIS Receiver output (as shown below) for a gross imbalance in the number of messages received on channel A as opposed to channel B. If many more A messages are received than B messages, increase the PPM. If many more B messages are received then A messages, decrease the PPM. Do this until there is a general balance of A and B messages.  
Register the AIS Receiver
By default, the AIS receiver software will upload the received AIS station data, anonymously, to only one server (Vessel Finder). We recommend that the station be registered with other servers. AIS data can be uploaded to Pocket Mariner, Ship Finder and Vessel Finder AIS servers as an anonymous user. To upload station-specific data to AIS Hub, Vessel Finder, Marine Traffic and AIS Friends servers, register with them to get a unique Upload IP Address and Port Number for the AIS station. 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. If you only upload anonymously, your data will be mixed with data from stations all over the world. 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:
Configure the AIS Receiver Software
Configure the AIS Receiver to upload to the AIS Servers above as follows:

  1. Login to the Raspberry Pi:
    1. Type: pi
    2. Type: Your password
  2. Type: sudo nano /etc/systemd/system/ais-messenger.service
  3. Use the cursor keys to add a comma-separated list of AIS Server IP addresses and Port numbers after the default AIS Server (Vessel Finder) shown in bold below
  4. Do not include any spaces
  5. The format is: IPaddress:PortNumber,IPaddress:PortNumber etc
  6. Press <Ctrl-O> <Enter> to Save the file
  7. Press <Ctrl-X> to exit.
  8. Type: sudo systemctl daemon-reload
  9. Type: sudo systemctl restart ais-messenger.service
  10. Check that the new AIS Servers are receiving your uploaded data. Typically, log in to their web site,  search for the station and check the upload statistics - if provided.

[Unit]
Description=AIS Messenger
After=network.target

[Service]
ExecStart=/home/pi/env/ais_messenger.py -v 195.201.71.220:5964
WorkingDirectory=/home/pi/env
Restart=always
RestartSec=60
KillMode=mixed
User=pi

[Install]
WantedBy=multi-user.target
Monitor the AIS Receiver
You can monitor the operation of the AIS receiver on a PC using SSH over the Wi-Fi network as follows:

  1. Use PuTTY or other SSH terminal emulator to log into the Raspberry Pi
    1. Type: pi
    2. Type: Your password
  2. Type: sudo journalctl -f -u ais_messenger.service
  3. You should see a list of time-stamped, raw, AIS messages scrolling up the screen, like this:

Mar 13 19:26:12 ais ais_messenger.py[2094]: !AIVDM,1,1,,B,E>lt;Ih9Qh2Pab00000000000005;bj3m2@=800000N010,0*6D
Mar 13 19:26:20 ais ais_messenger.py[2094]: !AIVDM,1,1,,B,E>lt<902QQnpP000000000000005;2QOm2aB@00000N010,0*5E
Mar 13 19:26:21 ais ais_messenger.py[2094]: !AIVDM,1,1,,A,404k1R1vTn`JEbGDG1bEAQ70051`,0*7F
Mar 13 19:26:29 ais ais_messenger.py[2094]: !AIVDM,1,1,,B,17PM=>0v2r:GHC1b;FiW45Vp0<1:,0*7D
Mar 13 19:26:38 ais ais_messenger.py[2094]: !AIVDM,1,1,,B,E>lsp9:2W:90W1Rh12PQWW00000E;:=4m2jth10888N000,0*29
Mar 13 19:26:40 ais ais_messenger.py[2094]: !AIVDM,1,1,,A,E>lt<9P2QQnqP00000000000000E;50Fm2oB000000N010,0*5D
Mar 13 19:26:41 ais ais_messenger.py[2094]: !AIVDM,1,1,,A,E>lt<8hb1Hp0000000000000000E;M2Hm2L7P00000N010,0*30
Install the AIS Receiver Hardware
Install the AIS Receiver hardware inside the enclosure and mount it as follows:

  1. Disconnect the USB keyboard, USB mouse, USB Hub and HDMI monitor
  2. Assemble the RPi, USB RTL-SDR dongle and 12V to 5V 2A micro USB DC/DC converter in the enclosure
  3. Connect the 162 MHz antenna via the 50 Ohm coaxial cable and an SMA connector to the USB RTL-SDR
  4. Optionally connect an inline 162 MHz AIS Filtered Preamp to amplify the AIS signals and filter out local radio frequency interference.   
  5. Connect the 12V DC Adapter via 12V DC Cable from inside the building to the 12V to 5V 2A micro USB DC/DC converter.
  6. Mount the enclosure as close to the 162 MHz Antenna as possible to reduce coaxial line losses if required. However, inside installations with short lengths of coaxial cable may also be acceptable.
  7. The AIS Receiver must be able to connect to the Wi-Fi router access point
Operate the 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 shown above).
  3. Check your AIS Servers. Some provide useful AIS Receiver station statistics and on-line maps.
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
Project Status (Updated: 12 March 2025)
Total number of reported builders: 698. Please update your status by e-mailing us. You can send us pictures and reports of your progress.
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."


John VK4AJC -  I have recently completed a build of your AIS Receiver project and I’m very pleased with the performance. It is currently uploading data to a number of AIS services from my location on the top end of the Sunshine Coast in QLD. Build details are: Antenna - 5/8th wave vertical stainless steel whip.  Preamp - Uputronics 162MHz AIS filtered preamp. Receiver - RTL-SDR software defined radio. Processor - Raspberry Pi 3 Model B. AIS Receiver Software - SARCNet v2.00 I am located 4km inland from the coast, so, to improve coverage I will most likely build the 3-element Yagi in the near future. A photo of the build is attached. Thank you for documenting this project. Regards, John VK4AJC



Back to content