Howto Run ADS-B Receiver + AIS Receiver on Same RPi

Running ADS-B Receiver + AIS Receiver on Same RPi

  • ADS-B : Aircraft Tracking at 1090MHz (using DVB-T Dongle)
  • AIS: Ship and Vessel Tracking at 162MHz (using DVB-T Dongle)

I am running following on RPi model 4 (1 GB ram):

  • RaspberryPi OS Lite Bullseye
  • AIS-catcher (receiver+decoder+feeder software) - CLICK HERE
  • AIS Dispatcher for local map at ip-of-pi:8181 - CLICK HERE
  • dump1090-fa
  • piaware
  • fr24feed
  • rbfeeder
  • pfclient
  • adsbexchange
  • opensky
  • modesmixer2
  • graphs1090

I had to serialize dongles by following commands:

sudo apt install rtl-sdr

sudo systemctl stop piaware dump1090-fa aiscatcher  

## SERIALIZED ONE DONGLE AT A TIME
## REMOVED ALL OTHER DONGLES WHEN GIVING FOLLOWING COMMAND

rtl_eeprom -s [desired_serial_number]

to prevent conflict. Used serial numbers as follows:

00001090 for dump1090
00000162 for AIS-catcher

Also set serial number 00001090 in file /etc/default/dump1090-fa by following command:

sudo sed -i 's/^RECEIVER_SERIAL=.*/RECEIVER_SERIAL=00001090/' /etc/default/dump1090-fa  

 

Port 8080 Conflict:
To clear conflict between Skyaware map and AIS Dispatcher map, I changed port number from 8080 to 8181 in following file of AIS Dispatcher:

/home/ais/etc/aiscontrol.cfg

 

PPM CORRECTION

AIS-catcher tunes in on a frequency of 162 MHz. However, due to deviations in the internal oscillator of RTL-SDR devices, the actual frequency can be slightly off which will result in no or poor reception of AIS signals. It is therefore important to provide the program with the necessary correction in parts-per-million (ppm) to offset this deviation where needed. For optimal reception ensure you determine the necessary correction, and provide as input via the -p switch on the command line.

I am using a $10 Generic DVB-T (Black) WITHOUT TCXO. The PPM is much higher than it is for costlier dongles which have TCXO correction.

Here is how I determined the value of PPM to be used in file aisctacher.cfg :
(1) Installed test software
sudo apt install rtl-sdr

(2) Determined the device index of the dongle for AIS-catcher by following command
rtl_test -t

(3) In my case the device index was 1.
I used following command to determine ppm
rtl_test -d 1 -p60

(4) Waited until the cumulative error value (in PPM) remains more-or-less the same for three consecutive minutes. Note the last cumulative error value (in PPM) and use it in config of AIS-catcher. I am using 34 (-p 34) in my config. Your value may be different

 

image

 

CLICK ON SCREENSHOT TO SEE LARGER SIZE

 

NOTE:
If you are using a cheap DVB-T dongle that suffers from thermal drift (i.e. the required PPM correction drifts when the dongle is getting warmer), you could consider to use the option -go AFC_WIDE on or switch to a FM decoding model which is less sensitive for frequency offsets (-m 0). The frequency correction applied by the default decoding model can be made visible with the switch -M D so you can inspect.

AIS-CATCHER CONFIGURATION

Location of Config file

 /usr/share/aiscatcher/aiscatcher.conf  

Default contents of config file (To be modified by user after installation)

 -d 00000162
 -v 10
 -M DT
 -gr TUNER 38.6 RTLAGC off
 -s 2304k
 -p 3
 -o 4
 -u 127.0.0.1 10110

 

AFTER INSTALLATION IS COMPLETED, PLEASE DO FOLLOWING:

  1. The Map Software installed on RPi (AIS Dispatcher OR OpenCPN) should
    be configured to use UDP Port 10110, IP 127.0.0.1 OR 0.0.0.0

  2. As per advice at AIS-catcher Github site, first systematically identify
    the optimal settings starting with -s 1536K -gr tuner auto rtlagc on -a 192K
    before editing the file /usr/share/aiscatcher/aiscatcher.conf

  3. Open file aiscatcher.conf by following command:
    sudo nano /usr/share/aiscatcher/aiscatcher.conf

  4. In above file:
    (a) Change 00000162 in “-d 00000162” to actual Serial Number of AIS dongle
    (b) Change 3 in “-p 3” to the actual ppm correction figure of AIS dongle
    (c) Change 38.6 in “-gr TUNER 38.6 RTLAGC off” to desired Gain for AIS dongle
    (d) For each Site you want to feed AIS data, add a line immediately below the
    last line, in following format:
    -u [URL or IP of Site] [Port Number of Site]
    NOTE: Do NOT leave any blank spaces between lines
    (e) Save (Ctrl+o) and Close (Ctrl+x) file aiscatcher.conf

    5. REBOOT RPi
    REBOOT RPi

MONITORING EFFECT OF CHANGING PPM AND GAIN SETTING:

Use Following Command to output Message Rate (msg/s):
:
sudo journalctl -u aiscatcher -n 150 | grep -o 'received.*'

 

AIS ANTENNA I USED IS A VERTICAL DIPOLE MADE OF COAX

162 MHz AIS Dipole

 

 

 

 

 

4 Likes

Great set of instructions here. Thanks! I’m running this, although feeding a few less ADSB sites, on a Pi 3. Also, I started with the adsbexchange image so there was nothing on port 8080 when I added AIS Dispatcher. I built a little 1/4 wave radial ground plane antenna. At 162MHz, it’s easier than 1090MHz antennas to build your own.

I should mention that you may find a kernel module has already claimed the SDR. You need to remove that module and blacklist the SDR so it won’t reload.

1 Like

I have first built a 1/2 wavelength Dipole (1/4 + 1/4 wavelength = 46cm + 46 cm), taped to window glass.

Now I have built a free-standing !/4 wavelength Monopole (46 cm) with horizontal ground plane, which I could move to different locations in my apartment to find optimum location.

Also, I have installed AIS-catcher and AIS-Dispatcher on Thin Client HP520, which already had Debian11 amd64, dump1090-fa and piaware (both built from source code right on Thin Client).

 

 

 

 

 

 

sudo journalctl -u aiscatcher -n 300 | grep -o 'received.*'

 

2 Likes

You’re doing well if you can see stuff coming out of the Welland canal into Lake Erie. I get blocked by the escarpment at around Thorold.

@Jranderson777

I live in a multi-storied apartment building. Height of my apatment (several floors above ground floor) helps my reception.

$10 Generic DVB-T Black, with ppm correction -p 35 in file aiscatcher.conf :

sudo journalctl -u aiscatcher -n 20 | awk -F',' '{print $4}'  

 

 

sudo journalctl -u aiscatcher -n 500 | grep -o 'received.*'  

 

 

 

 

Great improvement. What has changed?

Nothing changed at my setup.

Most likely weather conditions.

Another possibility is reopening of ferry terminal at Toronto Billy Bishop Airport after Saturday’s suspicious package bomb terror was cleared by police.

 

Another wierd thing. After reaching unusualy good reception of 45+ ships last evening, from 00 UTC (20 hrs local time), it started decreasing gradually, and has now reached a low of 23 ships tracked.

Seems weather plays a strong role. Yesterday weather was bad, cold and humid, so good reception. Today weather is good, (warmer and sunny with low humadity), so the reception is poor.

 

 

 

Are you still using your ‘low end’ RTL SDR?
I find the freq on mine drifts significantly when it starts receiving signals.
My guess is your receiver has drifted too far off freq and re-trimming it will improve your stats.

Yes, I am still using $10 generic black dvbt.

I have checked it just now. Its drift is max 4.9 ppm from the set value of 35 ppm (-p 35).

The weekly performance graph shows a regular pattern of variation of reception.

Anyway, I will change the cheap generic dvbt by orange prostick and leave it running for few days to see if that makes a diffefence.

 

Weekly Stats

Daily Stats

Just Now

looks pretty tight, but try bumping your offset up by 3ppm and see if it makes a difference.

Just before making any changes in ppm setting:

Few minutes after making changes in ppm setting ( bumped from 35 to 39) and restarting

 

EDIT: Two and half hours after ppm setting was increase from -p 35 to -p 39. Red arrow in graph shows the time when ppm setting was adjusted.

 

 

 

 

 

 

 

I have now added following line in file aiscatcher.conf :

-go AFC_WIDE on

I will let it run for few dsys and observe.

 

Commands to view specific parts of AIS-catcher log:

Command:
sudo journalctl -u aiscatcher -n 200 | grep -o 'received.*'

Output:
received: 12 msgs, total: 59754 msgs, rate: 1.19834 msg/s

 

Command:
sudo journalctl -u aiscatcher -n 200 | grep -o 'rate.*'

Output:
rate: 1.29752 msg/s

 

Command:
sudo journalctl -u aiscatcher -n 30 | awk -F',' '{print $4}'

Output:
"ppm":4.340278

In above command’s last part, i.e. in {print $4}, substitute $4 by values listed in first column of the table below to get the output shown in second column of the table.

 

$n Output Example
$1 Oct 25 12:09:56 debian11 aiscatcher[3304]: {“rxtime”:“20221025160956”
Oct 25 12:46:20 debian11 aiscatcher[3304]: [AIS engine v0.38 ] received: 11 msgs
$2 “channel”:“A”
total: 58298 msgs
$3 “signalpower”:-47.659782
$4 “ppm”:1.736111
$5 “type”:1
$6 “mmsi”:316023269
$7 “status”:0
$8 “status_text”:“Under way using engine”
$9 “epfd”:7
“speed”:8.100000
“turn”:0
$10 “accuracy”:true
“shipname”:“M.V. RIVER GAMBLER”
“speed”:12.800000
$11 “lon”:-79.396454
“accuracy”:true
$12 “lat”:43.635452
$13 “course”:52.500000}
$14 “course”:256.600006
$15 “heading”:257}
$16 “to_port”:21
$17 “to_starboard”:3

 
 

Notice that quite a large proportion of your reception is from class B vessels such as yachts, pleasure vessels and other small craft. These will be much less likely to be out in poor weather, and also because they aren’t commercial craft, will probably be more active at weekends and holidays.

Ship traffic can be a lot more variable than aviation - the density is nothing like as high, and ships have different considerations than aircraft. A bulk carrier might take a week to load or unload, a container ship might take a day, and cruise ships and ferries can turn around in only a few hours. Depending on what traffic is in your vicinity you will probably see peaks and troughs as different services coincide.

3 Likes

After adding following line in file aiscatcher.conf, the stats are stable and moderate.

-go AFC_WIDE on

Red arrow on graph points to the time when above line was added in file aiscatcher.conf, and after that aiscatcher was restarted.

 

 

 

In RTL-SDR Blog V3 dongle, the Bias-T should be switched on before decoder software starts. This problem occures in dump1090-fa and dump1090-mutability also. The solution was easy as the Bias-T startup software rtl_biast was a separate package, so in Service file following line was added:

[Service]
ExecStartPre=/home/pi/rtl_biast/build/src/rtl_biast -b 1

 

In case of AIS-catcher, the bias-t turn on off software is integral part of the AIS-cacher binary, so the ExecStartPre method cannot be used directly, unless a stand-alone rtl-biast package is built and installed, and Service file modified, like is done for dump1090-fa and dump1090-mutability.
Following method overcomes this issue of AIS-catcher biast.

(1) Building stand-alone rtl_biast
(2) Modifying aiscatcher’s Service file to add ExecStartPre=
(3) Delete BIASTEE on from aiscatcher.cfg file to avoid conflict

STEP (1): Install dependencies

$ sudo apt update
$ sudo apt install git cmake build-essential libusb-1.0-0-dev

STEP (2): Clone Source Code of Biast and Build It

## Enter AIS-catcher folder
cd /usr/share/aiscatcher  

## Clone source-code of biast from Github and make executeable
$ sudo git clone https://github.com/rtlsdrblog/rtl_biast  
$ cd rtl_biast 
$ sudo mkdir build 
$ cd build 
$ sudo cmake .. -DDETACH_KERNEL_DRIVER=ON 
$ sudo make 

STEP (3): Check:

$ ls /usr/share/aiscatcher/rtl_biast/build/src 

CMakeFiles               librtlsdr.a     librtlsdr.so.0.5git
cmake_install.cmake      librtlsdr.so    Makefile
libconvenience_static.a  librtlsdr.so.0  rtl_biast

STEP (4): Modify aiscatcher’s Service file

$ sudo nano /lib/systemd/system/aiscatcher.service 

## Add following line ABOVE the line starting with ExecStart=
ExecStartPre=/usr/share/aiscatcher/rtl_biast/build/src/rtl_biast -b 1 -d 0  

NOTE: If you are using more than one dongle, run command rtl_test -t to determine device index of AIS Dongle (0, 1, 2,…). If the AIS dongle has index 1, then in above command change d 0 to d 1

 

BEFORE Adding New Line

 

AFTER Adding New Line

STEP (5): Delete “BIAST on” from AIS-Catcher config

STEP (6):

REBOOT PI

 

1 Like

@abcd567 any idea how to fix this, ADSB is working fine, but AIS Catcher refuses to find the dongle even though I have seralized it

See this post: