RTL-SDR AIS Ship Tracking: Difference between revisions

From wikiluntti
 
(31 intermediate revisions by the same user not shown)
Line 22: Line 22:
Frequencies 161.975 MHz and 162.025 MHz, thus by adjusting the frequency to 162.000MHz we can listen to both frequencies. Marine VHF is narrow band (NFM) Ch16 is on 156.8MHz.
Frequencies 161.975 MHz and 162.025 MHz, thus by adjusting the frequency to 162.000MHz we can listen to both frequencies. Marine VHF is narrow band (NFM) Ch16 is on 156.8MHz.


* [https://en.wikipedia.org/wiki/Narrowband AM]: Amplitude Modulation
* [https://en.wikipedia.org/wiki/Frequency_modulation FM]: Frequency Modulation
* [https://en.wikipedia.org/wiki/Narrowband NFM]: Narrow Frequency Modulation, 16kHz bandwidth which comes from +/-5kHz frequency deviation.
* WFM: Wide Frequency Modulation
* [https://en.wikipedia.org/wiki/Sideband SSB]: Single Side Band. See https://ccrane.com/ssb-frequency-lists/
* [https://en.wikipedia.org/wiki/Sideband LSB]: Lower Side Band
* [https://en.wikipedia.org/wiki/Sideband USB]: Upper Side Band
* [https://en.wikipedia.org/wiki/Continuous_wave CW]: Continuous Wave (Morse Code)


[[File:AIS SDRSharp peruskuva.png|thumb|The basic of SDRsharp. Bands is unclear, but this clearly shows two peaks at correct frequencies.]]
SDRSharp, SDR#
SDRSharp, SDR#
* https://www.rtl-sdr.com/sdrsharp-users-guide/
* https://www.rtl-sdr.com/sdrsharp-users-guide/
Line 28: Line 38:


SDR#, brief tutorial:
SDR#, brief tutorial:


* set your audio piping method in the Audio output drop down box
* set your audio piping method in the Audio output drop down box
Line 54: Line 67:


=== SDRangel ===
=== SDRangel ===
[[File:AIS SDRAngel peruskuva.png|thumb|Get the correct device, and soon the program will work;)]]
<gallery>
AIS SDRAngel AISpreset0.png|Radio properties of the Default AIS settings [See Configuration Presets, a star]. L SR is 1,000,000 S/s, RFBW is 2,5000 kHZ, Gain is 42.1
AIS SDRAngel AISpreset1.png|Frequencies and signals.
AIS SDRAngel AISpreset2.png|The Data
AIS SDRAngel AISpreset3.png|The Data
AIS SDRAngel AISpreset4.png|Also the map
</gallery>


* Wiki https://github.com/f4exb/sdrangel/wiki
* Wiki https://github.com/f4exb/sdrangel/wiki
Line 191: Line 214:




Driven element is a dipole element [or actually a half-dipole], thus the length should be <math>\ell = \tfrac12 \lambda = \tfrac12 \frac{c}{f}= \frac12 \frac{299792458}{160 \times 10^6} = \tfrac12 \times 1.85 = 0.925 </math> (m). A slightly different number for speed of light (speed of radio waves in the antenna; <math>v \approx 0.97 c</math>) makes the <math>\ell</math> to be <math>\ell = 0.8975</math> m. Furthermore, the driven element is called ''folded dipole'' as it has an additional parallel wire connecting its two ends. Thus two nearly identical radiating currents are generated. See [https://en.wikipedia.org/wiki/Loop_antenna loop antenna].
Driven element is a dipole element [or actually a half-dipole], thus the length should be <math>\ell = \tfrac12 \lambda = \tfrac12 \frac{c}{f}= \frac12 \frac{299792458}{160 \times 10^6} = \tfrac12 \times 1.85 = 0.925 </math> (m). A slightly different number for speed of light (speed of radio waves in the antenna; <math>v \approx 0.97 c</math>) makes the <math>\ell</math> to be <math>\ell = 0.8975</math> m. The driven element has an additional parallel wire connecting its two ends, and is called a ''folded dipole''. Thus two nearly identical radiating currents are generated. See [https://en.wikipedia.org/wiki/Loop_antenna loop antenna]. Folded dipole consists of a ''split dipole'' and an unbroken ''impedance transformer'', and those two elements are connected together at both ends. The gap should be fixed to keep the wires at a constant separation distance. Spacing is the distance between the two parts of the driven element.  


[[File:Antenna DE positioning.png|thumb|Positioning of the driven element.]]
[[File:Antenna DE positioning.png|thumb|Positioning of the driven element.]]
There are three (3) common mounting types of driven elements: below, top or middle (see the image). Actually the mounting point do not matter.  
There are three (3) common '''mounting''' types of driven elements: below, top or middle (see the image). Actually the mounting point do not matter. A good method to connect the wires to the driven element is to flatten the ends and attach the wire with a small nut and bolt, or use soldering iron. 
 
Feeding. Normally the feeding impedance is 300 Ω. Impedance matching (if 75 Ω coaxial cable)
 
https://www.k7mem.com/Ant_Yagi_VHF_Feed.html#Mounting


https://www.k7mem.com/Ant_Folded_Dipole.html#Page_Top


https://www.k7mem.com/Ant_Yagi_VHF_Feed.html
https://www.k7mem.com/Ant_Yagi_VHF_Feed.html


Material: Common 1/4" copper tubing is often a good choice, or aluminum tubing
Material: Common 1/4" copper tubing is often a good choice, or aluminum tubing, or #14 AWG electrical wire (diameter 1.6 mm and area 2.08 mm2).
 




Line 212: Line 241:
Refs:
Refs:
* https://www.rtl-sdr.com/rtl-sdr-tutorial-cheap-ais-ship-tracking/
* https://www.rtl-sdr.com/rtl-sdr-tutorial-cheap-ais-ship-tracking/
* https://www.waves.utoronto.ca/prof/svhum/ece422/notes/13-folded.pdf


=== Programming ===
=== Programming ===
Line 217: Line 247:
== Raspberry Pi AIS ==
== Raspberry Pi AIS ==


I will use an old Raspberry Pi 2B model for this.
# Allow SSH: GUI: Preferences -> Raspberry Pi Configuration -> Interfaces -> SSH.
# Start to CLI, no graphical user interface: Preferences -> Raspberry Pi Configuration -> System -> Boot To CLI.
# User name: ''mol'', server name: ''raspi''
# Find the IP address using a Windows and Zenmap: <code>nmap -p 22 192.168.8.0/24</code> or check the topology.
#* OLD: Find the IP address using a Windows: <code>Wireshark</code> and use the following display filter <code>eth.addr[0:3] == B8:27:EB</code>. ?????
# Use WinSCP and PuTTY. I know how to use them.
After pluged in,
# <code>lsusb</code> shows <code>0bda:2838 Realtek Cemiconductor Corp. RTL2939 DVB-T</code>.
# Install [https://osmocom.org/projects/rtl-sdr/news osmocom] drivers. See https://ranous.wordpress.com/wp-content/uploads/2018/02/rtl-sdr4linux_quickstartv2-18.pdf
# Remove the old kernel modules, see the above pdf
# <code>rtl_test -t</code> gives data!
# Install software
[https://github.com/jvde-github/AIS-catcher AIS Catcher] and https://aiscatcher.org/?lat=59.4537&lon=24.8201&zoom=11.89
* see https://ianrenton.com/hardware/planesailing/ais-receiver/ for a brief tutorial, and how to install it via binaries.
* <code>/usr/local/bin/AIS-catcher</code>. Some parameters:
** [-d:x - select device based on index (default: 0)]
** [-gr RTLSDRs: TUNER [auto/0.0-50.0] RTLAGC [on/off] BIASTEE [on/off] ]
** [-a xxx - set tuner bandwidth in Hz (default: off)]
** [-N [optional: port][optional settings] - start http server at port, see README for details]
* To share your raw feed with other AIS-catcher users (and see their data in your webviewer - see below) use -X. Additionally, for sending the messages via UDP to ports 10110 and 10111, we can use the following command:
<code>AIS-catcher -v 10 -X -u 127.0.0.1 10110 -u 127.0.0.1 10111</code>
* The AIS NMEA lines on screen can be suppressed with the option <code>-q</code>.
* For RTL-SDR devices performance can be sensitive to the device settings. In general, a good starting point is the following:
<code>AIS-catcher -gr RTLAGC on TUNER auto -a 192K</code>
* to create a webviewer that you can access from your local network, use the following command:
<code>AIS-catcher -N 8100</code>
[https://www.gqrx.dk/ Gqrx] needs Qt (so, perhaps X. Not using that).
* Already in the repository with a name <code>gqrx-sdr</code>.
[https://cubicsdr.com/ CubicSDR]
https://ranous.wordpress.com/wp-content/uploads/2018/02/rtl-sdr4linux_quickstartv2-18.pdf
Aim: To listen the data and to send it to a MySQL database for further usage. Also, take some photos.
Aim: To listen the data and to send it to a MySQL database for further usage. Also, take some photos.



Latest revision as of 17:38, 7 July 2024

Introduction

  • AIS: Automatic Identification System.
  • RTL
  • SDR: Software Defined Radio
  • Also: ADS-B (Automatic Dependent Surveillance-Broadcast) for aircraft surveillance. 1090 MHz

Need a radio dongle, antenna. Use Arduino and RPi.

RTL-SDR V3

My dongle seems to be original, according to https://www.rtl-sdr.com/rtl-sdr-blog-v-3-dongles-user-guide/

V3 Datasheet is at https://www.rtl-sdr.com/wp-content/uploads/2018/02/RTL-SDR-Blog-V3-Datasheet.pdf

  • Install the custom drivers in order to make the V4 work
    • RTL-SDR Blog driver fork from https://github.com/rtlsdrblog/rtl-sdr-blog.
    • Release.zip file from the Releases page. For SDR# extract the rtlsdr.dll file from the x86 folder to the SDR#. For most other x64 programs, use the rtlsdr.dll file in the x64 folder.

Software

Frequencies 161.975 MHz and 162.025 MHz, thus by adjusting the frequency to 162.000MHz we can listen to both frequencies. Marine VHF is narrow band (NFM) Ch16 is on 156.8MHz.

  • AM: Amplitude Modulation
  • FM: Frequency Modulation
  • NFM: Narrow Frequency Modulation, 16kHz bandwidth which comes from +/-5kHz frequency deviation.
  • WFM: Wide Frequency Modulation
  • SSB: Single Side Band. See https://ccrane.com/ssb-frequency-lists/
  • LSB: Lower Side Band
  • USB: Upper Side Band
  • CW: Continuous Wave (Morse Code)


The basic of SDRsharp. Bands is unclear, but this clearly shows two peaks at correct frequencies.

SDRSharp, SDR#

SDR#, brief tutorial:




AISCatcher

https://www.youtube.com/watch?v=8wRIYuFXOqE

  • In built-web server:
    AIS-catcher -v 10 127.0.0.1 -M DT -N 8100
  • Use external data from https://airspy.com/directory/:
    AIS-catcher -v 10 127.0.0.1 -M DT -N 8100 y 37.136.93.253 5000


AirSpy


OpenCPN is a plotter.

AISmon

SDRangel

Get the correct device, and soon the program will work;)

AIS Data received

  • Date. Eg: Tue Jun 18 2024
  • Time. Eg: 12:07:49
  • MMSI: Maritime Mobile Service Identity. Eg: 230011000
  • Country. Eg:
  • Type. Eg: Static data report // Standard Class B equipment position report // Ship static and voyage related data // Position report (Scheduled) // Position report (Interrogated) // Data link management message // Base station report //
  • Id. Eg:
  • Data. Eg: Type: Vessel - Sailing Vendor ID: SRTH%GM Callsign: OH8682 // Type: Vessel - Pleasure craft Vendor ID: AMC@ANM Callsign: OH6573 // Name: MAIJU // Lat: 91° Lon: 181° Speed: 102.3 knts Course: 360° Status: Moored // Lat: 59.5295° Lon: 24.7398° Speed: 24.2 knts Course: 339.7° Status: Under way using engine // Lat: 59.5168° Lon: 24.8398° Tue Jun 18 09:37:29 2024 GMT // IMO: N/A Callsign: ES2735 Name: AHTO-28 Type: Pilot vessel Destination: MUUGA //
  • NMEA 0183(?) (National Marine Electronics Association). See https://pypi.org/project/pyais/ Eg: !AIVDM,1,1,,,13KIo6P000QiV=:R2p;u2Db@2H59,0*4b // !AIVDM,1,1,,,13KtJ`04PaQiHGJR0w6j2GWT0D2I,0*08
// !AIVDM,1,1,,,347eHF50P0QiIBRR0qsWLFgN2000,0*2e
// !AIVDM,2,1,1,,54cac6429V2GQ1=2221LTi<tr20QDl8E:22222169p;975SV091AE33888888,0*73

!AIVDM,2,2,1,,8888888880,2*5c

  • Hex. Eg: 14420221e2025bcd4854cc4800003594d40520000000000000000000003d0baf92485a497914515604ef2df8624814c00000000000 // 0441fbd883e0000871275fa2059611b9ffac008364
  • Slot. Eg:

NMEA

NMEA 0183(?) (National Marine Electronics Association). See https://pypi.org/project/pyais/ or https://gpsd.gitlab.io/gpsd/AIVDM.html


  • Comma-separated fields, eg !AIVDM,1,1,,B,15MwkT1P37G?fl0EJbR0OwT0@MS,0*4E
    • !AIVDM: the sentence is an AIS message in the "VDM" (VDO Message) format.
    • 1,1: the total number of sentences in the message and the current sentence number, respectively.
    • Blank
    • B: the communication channel. In this case, the channel is "B".
    • 15MwkT1P37G?fl0EJbR0OwT0@MS: the message in Six-bit ASCII.
    • 0*4E: a checksum.
  • Eg, Position Report" message: position, course, and speed.
Eg: !AIVDM,1,1,,,13KIo6P000QiV=:R2p;u2Db@2H59,0*4b // !AIVDM,1,1,,,13KtJ`04PaQiHGJR0w6j2GWT0D2I,0*08
// !AIVDM,1,1,,,347eHF50P0QiIBRR0qsWLFgN2000,0*2e
// !AIVDM,2,1,1,,54cac6429V2GQ1=2221LTi<tr20QDl8E:22222169p;975SV091AE33888888,0*73

!AIVDM,2,2,1,,8888888880,2*5c

Theory -- AIS decoding

https://www.rtl-sdr.com/rtl-sdr-tutorial-cheap-ais-ship-tracking/


Radio Dongle

https://www.rtl-sdr.com/buy-rtl-sdr-dvb-t-dongles/

https://www.ebay.com/str/rtlsdrblog

https://www.ebay.com/itm/283144516411?mkcid=1&mkrid=711-53200-19255-0&siteid=0&campid=5338814417&customid=&toolid=20012&mkevt=1

Antenna

The frequency of AIS signal is 161.975 MHz and 162.025 MHz, and have the max range of about 70 km. Is is a line of sight signal. I wish to have 180 degrees view.


I decided to make two different Yagi antennas both working at 162.0 MHz. Both antennas have the reflecting and driven (dipole) elements, and two (2) or three (3) directional elements. The dimensions (given by k7mem, using non-metallic boom, boom diameter 20mm and element diameters 2.5 mm) are following:

Antenna dimensions with cumulative spacing
Gain Hor beam width Refl pos DE pos D1 pos D2 pos D3 pos
2 Element
Lengths
4.007 dBd Nan deg 0 370.11
907.55 901.08
3 Element
Lengths
5.382 dBd 75.9 deg 0 370.11 508.91
907.55 901.08 840.99
4 Elements
Lengths
6.756 dBd 59 deg 0 370.11 508.91 842.01
907.55 901.08 840.99 835.12
5 Elements
Lengths
8.003 dBd 52.0 deg 0 370.11 508.91 842.01 1239.88
907.55 901.08 840.99 835.12 827.89


Driven element is a dipole element [or actually a half-dipole], thus the length should be (m). A slightly different number for speed of light (speed of radio waves in the antenna; ) makes the to be m. The driven element has an additional parallel wire connecting its two ends, and is called a folded dipole. Thus two nearly identical radiating currents are generated. See loop antenna. Folded dipole consists of a split dipole and an unbroken impedance transformer, and those two elements are connected together at both ends. The gap should be fixed to keep the wires at a constant separation distance. Spacing is the distance between the two parts of the driven element.

Positioning of the driven element.

There are three (3) common mounting types of driven elements: below, top or middle (see the image). Actually the mounting point do not matter. A good method to connect the wires to the driven element is to flatten the ends and attach the wire with a small nut and bolt, or use soldering iron.

Feeding. Normally the feeding impedance is 300 Ω. Impedance matching (if 75 Ω coaxial cable)

https://www.k7mem.com/Ant_Yagi_VHF_Feed.html#Mounting

https://www.k7mem.com/Ant_Folded_Dipole.html#Page_Top

https://www.k7mem.com/Ant_Yagi_VHF_Feed.html

Material: Common 1/4" copper tubing is often a good choice, or aluminum tubing, or #14 AWG electrical wire (diameter 1.6 mm and area 2.08 mm2).



Other antenna types I considered:

  • Quarter wave / dipole. One vertical 1/4 wave element connected to the center of the coax cable and 4 (or more) more grounding elements pointing towards the the ground at 45 deg. A quarter wave antenna calculator: https://jeroen.steeman.org/Antenna/Quarter-Wave-Antenna-Calculator
  • Coax collinear antenna. Very high omnidirectional gain. Multiple short coax cables where the outer conductor is connected to the inner conductor in an alternating fashion.
  • Slim Jim.

https://arundaleais.github.io/docs/ais/aerial.html

Refs:

Programming

Raspberry Pi AIS

I will use an old Raspberry Pi 2B model for this.

  1. Allow SSH: GUI: Preferences -> Raspberry Pi Configuration -> Interfaces -> SSH.
  2. Start to CLI, no graphical user interface: Preferences -> Raspberry Pi Configuration -> System -> Boot To CLI.
  3. User name: mol, server name: raspi
  4. Find the IP address using a Windows and Zenmap: nmap -p 22 192.168.8.0/24 or check the topology.
    • OLD: Find the IP address using a Windows: Wireshark and use the following display filter eth.addr[0:3] == B8:27:EB. ?????
  5. Use WinSCP and PuTTY. I know how to use them.

After pluged in,

  1. lsusb shows 0bda:2838 Realtek Cemiconductor Corp. RTL2939 DVB-T.
  2. Install osmocom drivers. See https://ranous.wordpress.com/wp-content/uploads/2018/02/rtl-sdr4linux_quickstartv2-18.pdf
  3. Remove the old kernel modules, see the above pdf
  4. rtl_test -t gives data!
  5. Install software

AIS Catcher and https://aiscatcher.org/?lat=59.4537&lon=24.8201&zoom=11.89

  • see https://ianrenton.com/hardware/planesailing/ais-receiver/ for a brief tutorial, and how to install it via binaries.
  • /usr/local/bin/AIS-catcher. Some parameters:
    • [-d:x - select device based on index (default: 0)]
    • [-gr RTLSDRs: TUNER [auto/0.0-50.0] RTLAGC [on/off] BIASTEE [on/off] ]
    • [-a xxx - set tuner bandwidth in Hz (default: off)]
    • [-N [optional: port][optional settings] - start http server at port, see README for details]
  • To share your raw feed with other AIS-catcher users (and see their data in your webviewer - see below) use -X. Additionally, for sending the messages via UDP to ports 10110 and 10111, we can use the following command:

AIS-catcher -v 10 -X -u 127.0.0.1 10110 -u 127.0.0.1 10111

  • The AIS NMEA lines on screen can be suppressed with the option -q.
  • For RTL-SDR devices performance can be sensitive to the device settings. In general, a good starting point is the following:

AIS-catcher -gr RTLAGC on TUNER auto -a 192K

  • to create a webviewer that you can access from your local network, use the following command:

AIS-catcher -N 8100


Gqrx needs Qt (so, perhaps X. Not using that).

  • Already in the repository with a name gqrx-sdr.

CubicSDR

https://ranous.wordpress.com/wp-content/uploads/2018/02/rtl-sdr4linux_quickstartv2-18.pdf Aim: To listen the data and to send it to a MySQL database for further usage. Also, take some photos.

References