Instalando AIS en una Raspberri Pi

En una entrada anterior se ha descrito el sistema AIS (Automatic Identification System) de localización de embarcaciones, ahora vamos a proceder a instalar y configurar un receptor AIS en una Raspberry pi con un SDR USB de la misma forma que hemos hecho previamente con

La instalación compartirá con las instalaciones anteriores

  • Raspberry Pi
  • SDR USB
  • Antena (aunque no sea especifica para esta frcuencia de VHF  161,975 MHz - Channel 87B y  162,025 MHz - Channel 88B)
El filtro pasabanda de 403 MHz es especifico para radiosondas y por eso no se usará y un filtro de banda suprimida de 88-108 MHz se estudiará usarlo o no pues puede ser conveniente en entornos urbanos con muchas emisoras de radiodifusión de FM.



De las opciones posibles hemos elegido el software ais-catcher (Se descarta Rtl-ais) por las siguientes razones:
  • Es un software mas moderno
  • Es open source
  • Es Compatible con RTL-SDR. 
  • Puede decodificar los dos canales AIS (161,975 MHz y 162,025 MHz) al mismo tiempo con un solo pincho SDR USB, y consume pocos recursos CPU/memoria.
  • Las señales de los barcos que recibe se convierten a protocolo  NMEA que pueden enviarse a sitios web como 
Sin embargo, dado las restricciones del sistema que comparte Pi-Star para DMRradiosonde_auto_rx para radiosondasdirewolf  para APRS en VHF se termina instalando rtl-ais por los menores requerimientos que presenta

Lo primero de todo ábrase una sesión con su IA de confianza para estos temas, en mi caso uso actualmente Gemini que le ayudará en el proceso 


AIS-CATCHER

Hay dos modulos:
  • El básico que recibe las tramas AIS, las convierte en NEMEA y las envia a un servidor como Marine Traffic
  • El modulo de visualización en local (Este por el momento no se monta para ahorrar consumo)

Instalación

Hay que conectarse a la Raspberry Pi (en nuestro caso concreto a Pi-Star, si usa una raspberry pi limpia lo tendra todo mas sencillo) y ejecutar:

Dar permisos
  • rpi-rw
Heramientas de compilación
  • sudo apt-get update
  • sudo apt-get install -y git make gcc g++ librtlsdr-dev libusb-1.0-0-dev libssl-dev
  • sudo apt-get install -y cmake
Descargar software y compilarlo
  • cd /home/pi-star
  • git clone https://github.com/jvde-github/AIS-catcher.git
  • cd AIS-catcher
  • mkdir build
  • cd build
  • cmake ..
  • sed -i 's/$/ -latomic/' CMakeFiles/AIS-catcher.dir/link.txt
  • make  -j2
[100%] Built target AIS-catcher
  • sudo make install
[100%] Built target AIS-catcher 
Install the project...
-- Install configuration: "Release"   
-- Installing: /usr/local/bin/AIS-catcher 

Comprobación de la instalación correcta
  • AIS-catcher -L
AIS-catcher (build Apr 17 2026) v0.66-0-g35d6a6da                               
(C) Copyright 2021-2026 jvde-github and other contributors                      
This is free software; see the source for copying conditions. There is NO       
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     
SDR support: RTLSDR RTLTCP SPYSERVER                                            
Other support: SYSLOG SSL ZLIB RTLSDR-BIASTEE RTLSDR-TUNERBW 
 
Prueba de funcionamiento
  • AIS-catcher -v
ERROR
AIS-catcher (build Apr 19 2026) v0.00-1-unknown                                 
(C) Copyright 2021-2026 jvde-github and other contributors                      
This is free software; see the source for copying conditions. There is NO       
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     
usb_claim_interface error -6                                                    
RTLSDR: cannot open device. 

COREECTO
AIS-catcher (build Apr 17 2026) v0.66-0-g35d6a6da           
(C) Copyright 2021-2026 jvde-github and other contributors    
This is free software; see the source for copying conditions. There is NO  
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
Found Rafael Micro R820T tuner 
Allocating 15 zero-copy buffers 
Device    : RTL2838UHIDIR        
Settings  : rate 1536K format CU8 tuner AUTO rtlagc ON biastee OFF buffer_count 24     
Model #0-0 -> (Src: 1, Grp: 1): [AIS engine v0.66] channel AB ps_ema ON afc_wide
 ON droop ON fp_ds OFF dsk OFF   
 [AIS engine v0.66 #0-0]  received: 0 msgs, total: 0 msgs, rate: 0 msg/s  


Prueba de recepción
  • AIS-catcher -v -gr TUNER 45  (SE SALE CON CTRL-C)
AIS-catcher (build Apr 17 2026) v0.66-0-g35d6a6da  
(C) Copyright 2021-2026 jvde-github and other contributors  
This is free software; see the source for copying conditions. There is NO 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Found Rafael Micro R820T tuner   
Allocating 15 zero-copy buffers 
Device    : RTL2838UHIDIR     
Settings  : rate 1536K format CU8 tuner 45.000000 rtlagc ON biastee OFF buffer_count 24  
Model #0-0 -> (Src: 1, Grp: 1): [AIS engine v0.66] channel AB ps_ema ON afc_wide ON droop ON fp_ds OFF dsk OFF  
[AIS engine v0.66 #0-0]received: 0 msgs, total: 0 msgs, rate: 0 msg/s 
!AIVDM,1,1,,B,13iSav3000Ov`dBFTEGd;A;P06AH,0*1C ( MSG: 1, REPEAT: 0, MMSI: 253291000, signalpower: -2.19454, ppm: 0.289352, timestamp: 20260417182248)
!AIVDM,1,1,,B,33EieTPP@nwvS8VFTE38E5UP00uh,0*1E ( MSG: 3, REPEAT: 0, MMSI: 224161170, signalpower: -16.9694, ppm: 2.31481, timestamp: 20260417182249)
!AIVDM,1,1,,A,B3P=t>P007w`lS5aBHil7wpUCP06,0*14 ( MSG: 18, REPEAT: 0, MMSI: 235109434, signalpower: -18.3949, ppm: 0.289352, timestamp: 20260417182249)  
!AIVDM,1,1,,B,H7WK6EDTCBD8:1JDp1knmn10744t,0*58 ( MSG: 24, REPEAT: 0, MMSI: 511100501, signalpower: -10.5473, ppm: -5.20833, timestamp: 20260417182250)  
!AIVDM,1,1,,B,342O`iQ000wvewVFRtIT9AST2DOJ,0*03 ( MSG: 3, REPEAT: 0, MMSI: 271050950, signalpower: -5.51227, ppm: -0.868056, timestamp: 20260417182251)  
!AIVDM,1,1,,B,13GQDPPP04wvRbfFTi1=0OwT26AH,0*50 ( MSG: 1, REPEAT: 0, MMSI: 225989762, signalpower: -16.6187, ppm: -2.31481, timestamp: 20260417182251)
[AIS engine v0.66 #0-0]  received: 6 msgs, total: 220 msgs, rate: 1.99423 msg/s                        
Configurar el servicio

Ahora lo configuramos como servicio para que arranque de forma automatica con la Raspberry Pi y sea facil su parada y rearranque

La forma rapida de instalarlo es 

sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/jvde-github/AIS-catcher/main/scripts/aiscatcher-install) -p"

Si da problemas por ser una raspberry pi con cosas se puede hacer por pasos

# 1. Instalar dependencias necesarias (sin usar backports)

sudo apt update
sudo apt install -y build-essential librtlsdr-dev libusb-1.0-0-dev pkg-config

# 2. Descargar el código fuente

cd /tmp
git clone https://github.com/jvde-github/AIS-catcher.git
cd AIS-catcher

# 3. Compilar

make

o si da problemas (Pi-star)

make CC=g++ CXX=g++

o mejor

make CC=g++ CXX=g++ CFLAGS="-O3"

# 4. Instalar el binario en una ruta accesible

sudo cp AIS-catcher /usr/local/bin/

sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/jvde-github/AIS-catcher-control/main/install_ais_catcher_control.sh)"



rtl-ais

Este software es mas sencillo y antiguo pero completamente funcional, si bien no tiene un servidor web para acceder en lcoal a los datos

Instalación
  • cd /tmp
  • wget https://github.com/dgiardini/rtl-ais/archive/refs/heads/master.zip
  • unzip master.zip
  • cd rtl-ais-master
  • ls
  • make
  • sudo cp rtl_ais /usr/local/bin/
Prueba
  • /usr/local/bin/rtl_ais -n -h 127.0.0.1 -P xxxxx -p 0
  • nohup /usr/local/bin/rtl_ais -n -h 127.0.0.1 -P xxxxx -p 0 > /dev/null 2>&1 &
  • sudo killall rtl_ais
  • nohup /usr/local/bin/rtl_ais -n -h 185.77.96.227 -P xxxxx -p 0 > /var/log/rtl_ais.log 2>&1 &
  • sudo netstat -tupn | grep rtl_ais
  • /usr/local/bin/rtl_ais -n -h 185.77.96.227 -P [TU_PUERTO MARINE TRAFFIC] -p 0
Abrir puertos

sudo iptables -A OUTPUT -p udp --dport [TU_PUERTO MARINE TRAFFIC] -j ACCEPT
sudo iptables -A INPUT -p udp --sport [TU_PUERTO MARINE TRAFFIC] -j ACCEPT
sudo iptables -L OUTPUT -n -v
rtl-ais-master$ /usr/local/bin/rtl_ais -n -h 185.77.96.227 -P [TU_PUERTO MARINE TRAFFIC] -p 0        

Edge tuning disabled.                                                           
DC filter enabled.                                                              
RTL AGC disabled.                                                               
Internal AIS decoder enabled.                                                   
Buffer size: 163.84 mS                                                          
Downsample factor: 64                                                           
Low pass: 25000 Hz                                                              
Output: 48000 Hz                                                                
Found 1 device(s):                                                              
  0:  Realtek, RTL2838UHIDIR, SN: 00000001              
Using device 0: Generic RTL2832U OEM                                            
Found Rafael Micro R820T tuner                                                  
Log NMEA sentences to console ON                                                
AIS data will be sent to 185.77.96.227 port 10632                               
Tuner gain set to automatic.                                                    
Tuned to 162000000 Hz.                                                          
Sampling at 1600000 S/s.                                                        
Allocating 12 zero-copy buffers                                                 
!AIVDM,1,1,,A,B3dwfH03wk?8mP=18D3Q29OQjlvr,0*4A                                 
!AIVDM,1,1,,A,13ElTP5Oh2wvS0rFTJJrnVJf0D2g,0*6C                                 
!AIVDM,1,1,,A,14hMQL0000OvPrHFU2r`BA@p00ST,0*4F                                 
!AIVDM,1,1,,B,13ElTP5000wvS0rFTJIq>6I20<2g,0*55                                 
            

rpi-rw   
sudo nano /etc/systemd/system/rtl-ais.service
                     
[Unit]
[Unit]
Description=RTL-AIS Service                                                     
After=network-online.target                                                     
Wants=network-online.target                                                     
[Service]
#MarineTraffic
#ExecStart=/usr/local/bin/rtl_ais -n -h 5.9.207.224 -P xxx -p 0
#VesselFinder
ExecStart=/usr/local/bin/rtl_ais -n -h 195.201.71.220 -P xxxx -p 0
Restart=always                                                                  
RestartSec=10                                                                   
User=root                                                                       
[Install]
WantedBy=multi-user.target  

Parar otros servicios que requieran los mismos recursos
  • sudo systemctl stop autorx.service
  • sudo systemctl daemon-reload
  • sudo systemctl enable rtl-ais.service 
  • sudo systemctl start rtl-ais.service 
  • sudo systemctl status rtl-ais.service --no-pager -l               
rtl-ais.service - RTL-AIS Service
     Loaded: loaded (;;file://pi-star/etc/systemd/system/rtl-ais.service/etc/sys
temd/system/rtl-ais.service;;; enabled; vendor preset: enabled)                 
     Active: active (running) since Sun 2026-04-19 17:39:45 CEST; 1min 48s ago
    Process: 2206 ExecStartPre=/bin/sleep 30 (code=exited, status=0/SUCCESS)    
   Main PID: 2251 (rtl_ais)                                                     
      Tasks: 4 (limit: 1716)                                                    
        CPU: 1min 17.247s                                                       
     CGroup: /system.slice/rtl-ais.service                                      
             └─2251 /usr/local/bin/rtl_ais -n -h 185.77.96.227 -P 10632 -p 0    
                                                                                
Apr 19 17:41:00 pi-star rtl_ais[2251]: !AIVDM,1,1,,B,14hMQL0000OvPr@FU2q8BACn0<2
C,0*78                                                                          
Apr 19 17:41:01 pi-star rtl_ais[2251]: !AIVDM,1,1,,A,33a`db5000OvS7PFT0HVMCP40mD
r,0*14                                                               

sudo journalctl -u rtl-ais.service | grep '!AIVDM' | wc -l

sudo ss -tunap | grep rtl_ais
udp   UNCONN 0      0            0.0.0.0:38101      0.0.0.0:*     users:(("rtl_a
is",pid=2251,fd=8))                      

 nc -zv 185.77.96.227 10632
185.77.96.227: inverse host lookup failed: Unknown host 
  • journalctl -u rtl-ais.service -f
Verificar que existe el servicio
  • ls -l /home/pi-star/rtl-ais/rtl-ais

Referencias

Advertencia importante

Las modificaciones, configuraciones y procedimientos descritos en este sitio pueden implicar riesgos técnicos, legales o de seguridad. El autor no se responsabiliza del mal funcionamiento de los equipos, daños permanentes, pérdida de garantía ni de posibles infracciones legales derivadas del uso de esta información.
El lector asume plena responsabilidad por cualquier acción que decida realizar basándose en el contenido de este blog.

© 2026 EA5JTT. Queda prohibida la reproducción total o parcial sin autorización expresa del autor.

No hay comentarios:

Publicar un comentario

MeshCore: los presets de la discordia

En la peninsula ibérica conviven varias configuraciones  para redes Meshcore. U nas  vienen ya son el firmware  predefinidas (Presets) en un...