Skip to content

built-in aisdecoder #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 151 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
8ff1ba2
rtl_ais.c
dgiardini Jun 4, 2015
15d7867
Merge pull request #1 from dgiardini/patch-1
dgiardini Jun 10, 2015
d2c44ed
compile aisdecoder files too
dgiardini Jul 3, 2015
cf11901
use built-in aisdecoder
dgiardini Jul 3, 2015
6da04e9
ais decoder for rtl_ais
dgiardini Jul 3, 2015
54775f8
ais decoder for rtl_ais
dgiardini Jul 3, 2015
20ceb52
Create sounddecoder.c
dgiardini Jul 3, 2015
a7ad26c
Create sounddecoder.h
dgiardini Jul 3, 2015
bfd260a
receiver.c
dgiardini Jul 3, 2015
ea908bc
receiver.h
dgiardini Jul 3, 2015
c35a312
protodec.c
dgiardini Jul 3, 2015
7695357
protodec.h
dgiardini Jul 3, 2015
c368c83
Create callbacks.h
dgiardini Jul 3, 2015
65b9676
hmalloc.h
dgiardini Jul 3, 2015
ce5b37e
hmalloc.c
dgiardini Jul 3, 2015
453b488
filter.h
dgiardini Jul 3, 2015
c420fb5
filter.c
dgiardini Jul 3, 2015
49a5aa6
filter-i386.h
dgiardini Jul 3, 2015
0014a83
build script
dgiardini Jul 3, 2015
d256988
rtl_ais built-in ais decoder.
dgiardini Jul 3, 2015
f517bd7
rtl_ais built-in aisdecoder
dgiardini Jul 3, 2015
f0e9d48
Update rtl_ais.c
dgiardini Jul 4, 2015
43c8e9c
fclose() NULL file fixed
dgiardini Jul 6, 2015
8151c67
Clean tree
nunojpg Jul 11, 2015
c6cf5e7
Remove libusb.h include
nunojpg Jul 12, 2015
2948205
Build with a Makefile
nunojpg Jul 12, 2015
877af1d
Merge pull request #2 from nunojpg/master
dgiardini Jul 13, 2015
d1084f6
add minimal support for MSys
dgiardini Jul 13, 2015
5060803
README file added
dgiardini Jul 13, 2015
cf29a36
Fixed some typos
dgiardini Jul 14, 2015
741578c
Update README
dgiardini Jul 14, 2015
5dd3f74
typo fixed
dgiardini Jul 14, 2015
8d4c4a0
small fix for OSX compilation
Jul 22, 2015
b805be0
Merge pull request #3 from Odyno/osx_makefile
dgiardini Jul 22, 2015
5a03d35
Create TODO
dgiardini Jul 27, 2015
8c2b9d3
Add files via upload
klapligehesten May 10, 2016
ebb5002
Add files via upload
klapligehesten May 10, 2016
59f5577
Create Makefile
klapligehesten May 10, 2016
c0a521c
Add files via upload
klapligehesten May 10, 2016
95e3011
Create README
klapligehesten May 10, 2016
c4afe3f
Update README
klapligehesten May 10, 2016
deba4a2
Update README
klapligehesten May 10, 2016
e8d2f37
Merge pull request #4 from klapligehesten/klapligehesten-patch-1
dgiardini May 10, 2016
8e4cd04
Update tcp_listener.c
dgiardini May 10, 2016
2a0a740
Correct getopt param
dgiardini May 10, 2016
bfd2e69
Add tcplistener to makefile
dgiardini May 10, 2016
3e982c3
Update README
dgiardini May 10, 2016
5409644
Update README
dgiardini May 10, 2016
828dfcb
removed libtcp_listener.a linking is static.
klapligehesten May 12, 2016
b200d7a
Fix CLOSE_WAIT in special caces
klapligehesten May 12, 2016
e1387ea
Merge pull request #8 from klapligehesten/patch-8
dgiardini May 14, 2016
06ce522
Revert "Fix CLOSE_WAIT in special caces"
dgiardini May 14, 2016
1dd95d2
Merge pull request #7 from klapligehesten/patch-5
dgiardini May 14, 2016
51237ad
Merge pull request #9 from dgiardini/revert-8-patch-8
dgiardini May 14, 2016
65f8d41
Fix CLOSE_WAIT in special caces
dgiardini May 14, 2016
b873b74
Bugs fixed for Windows
dgiardini May 14, 2016
95410e7
Clean Windows rtl_ais.exe too
dgiardini May 14, 2016
a54ab00
initial support for using rtl_ais as a library
seandepagnier Jun 2, 2016
356854e
Merge branch 'master' of github.com:seandepagnier/rtl-sdr-misc
seandepagnier Jun 2, 2016
a208b5f
Merge pull request #10 from seandepagnier/master
dgiardini Jun 2, 2016
28e6a29
Add again missing arguments "T" and "t"
dgiardini Jun 2, 2016
ce6bcce
Fix: Dongle_freq and dongle_rate are local
dgiardini Jun 2, 2016
6c98544
Use internal aisdecoder by default
dgiardini Jul 2, 2016
5aba6c6
Initialize config->seconds_for_decoder_stats=0
dgiardini Aug 17, 2016
b2dbee5
Avoid duplicatd messages to console
dgiardini Aug 18, 2016
c8a2579
Avid duplicated messages to console
dgiardini Aug 18, 2016
dcbdb7f
Change pthread_join() for pthread detach(); or can't be stopped using…
dgiardini Aug 18, 2016
8d21c8d
init dc_avg=0; now starts receiving messages inmediatly. More init mi…
dgiardini Aug 18, 2016
671ac02
Some missing strings re-added.
dgiardini Aug 18, 2016
e262cb5
spurious character supressed
dgiardini Aug 30, 2016
0726fd3
Fix missing includes
rhaamo Mar 27, 2017
0b456b5
Merge pull request #11 from rhaamo/fix_includes
dgiardini Mar 27, 2017
a2a8e78
fixed shifting of filter history in fifth_order()
v15n Apr 27, 2017
b93f9f3
Merge pull request #12 from v15n/fix-decimation-filter
dgiardini Apr 29, 2017
252f33b
Missing colon for "t" parameter added
dgiardini Jul 26, 2018
efd05ad
Add command line option to output packet timing information
BertoldVdb Feb 16, 2019
eb62441
Fix extended NMEA for packets that require more than one sentence
BertoldVdb Feb 20, 2019
72ad264
Merge pull request #13 from BertoldVdb/timing
dgiardini Feb 21, 2019
6884447
Move variable declaration for C compliance
dgiardini Feb 21, 2019
c838eac
switch -I added
dgiardini Feb 21, 2019
3c15243
Add missing include for musl
neheb Jul 4, 2019
974c874
Merge pull request #14 from neheb/patch-2
dgiardini Jul 5, 2019
1b6ac5b
treewide: Remove bzero and usleep
neheb Oct 3, 2019
c3d45e5
Merge pull request #16 from neheb/b
dgiardini Oct 3, 2019
5e25eab
Check for nanosleep() availability
dgiardini Oct 3, 2019
a3338e8
Fix compliation "error multiple definition of `__mac_g'". Credits to …
dgiardini Oct 3, 2019
6a5fc2c
fix buffer overflow
sayzard Dec 30, 2019
ef9c245
Merge pull request #17 from sayzard/fix_buffer_overflow
dgiardini Dec 31, 2019
b8e4efd
Add gitignore
FredericGuilbault Feb 19, 2020
3038aeb
Merge pull request #18 from FredericGuilbault/master
dgiardini Feb 19, 2020
b935cac
Get rid of warnings
dgiardini Feb 19, 2020
4861507
Avoid compiling warnings
dgiardini Feb 19, 2020
36aef50
Avoid compiling warnings
dgiardini Feb 19, 2020
7644b9a
Avoid compiling warnings
dgiardini Feb 19, 2020
bd68526
Add make install for linux
FredericGuilbault Feb 19, 2020
0e85f4e
Merge pull request #19 from FredericGuilbault/master
dgiardini Feb 20, 2020
6d9ee64
Update README format and include hardware information
ikatz-drizly Mar 2, 2020
527e7d3
Merge remote-tracking branch 'dgiardini/master'
FredericGuilbault Aug 8, 2020
29a51d9
Add Debian package builder and related procedure.
FredericGuilbault Aug 8, 2020
f39a989
Fix control file
FredericGuilbault Aug 8, 2020
bcf17b7
Fix errors in debian packaging documentation.
FredericGuilbault Aug 8, 2020
9c37b6f
Merge pull request #22 from FredericGuilbault/master
dgiardini Aug 10, 2020
fa093d5
Merge branch 'master' into FredericGuilbault/master
FredericGuilbault Aug 31, 2020
1beaeea
Add licence file
FredericGuilbault Aug 31, 2020
00c2fc7
Fix make install, DESTDIR is for the target not source location.
FredericGuilbault Sep 1, 2020
d093381
Rework debian packaging to support source packages
FredericGuilbault Sep 1, 2020
6638cbd
Merge pull request #27 from FredericGuilbault/debian
dgiardini Sep 1, 2020
5f63ad8
Merge pull request #26 from FredericGuilbault/makefile
dgiardini Sep 1, 2020
457a093
Merge pull request #21 from ianfixes/2020-03-02_readme
dgiardini Sep 1, 2020
8b6a283
Merge pull request #24 from FredericGuilbault/licence
dgiardini Sep 1, 2020
5a5abc6
Update LICENCE
dgiardini Sep 1, 2020
1975fdd
small modifications to make the debian package compliant with standards
FredericGuilbault Oct 3, 2020
a28765a
Force ubuntu release as a workaround to librtlsdr0 version bug
FredericGuilbault Oct 5, 2020
6de4563
fix bad category
FredericGuilbault Oct 5, 2020
26b13c9
Add missing dep
FredericGuilbault Oct 5, 2020
1280114
Build different package for respective arch.
FredericGuilbault Oct 13, 2020
d77aaf4
Add missing runtime dependency
FredericGuilbault Oct 13, 2020
29a7a85
Change build OS
FredericGuilbault Nov 9, 2020
6211704
Add ref to licence file location (requested by debuild linter )
FredericGuilbault Nov 9, 2020
1ef4dc3
Merge pull request #31 from FredericGuilbault/debian
dgiardini Nov 11, 2020
0535890
Added first cut of Dockerfile for building rtl-ais
bklofas May 19, 2021
a60426d
Removed reference to hardcoded git repository. Now copying in the git…
bklofas May 19, 2021
0800467
Cleaned up dockerfile, removing unused packages after build. Image re…
bklofas May 20, 2021
c99eae0
Updated readme file with example Docker commands and container build …
bklofas Jun 2, 2021
f3b6d47
Cleaned up the README file, adding some more documentation
bklofas Jun 7, 2021
ab6d8e5
Merge pull request #38 from bklofas/dockerfile
dgiardini Jun 7, 2021
23e3400
Added first cut of the github actions file for building the container…
bklofas Jun 10, 2021
4c5004c
One too much indentation for the workflow_dispatch
bklofas Jun 11, 2021
50cdccb
Workflow dispatch enabling?
bklofas Jun 11, 2021
0dccad4
Will brackets work?
bklofas Jun 11, 2021
f5ee0bc
Merge branch 'github_actions_build_container'
bklofas Jun 11, 2021
ef0517e
Updated the README file with some multi-arch clarifications
bklofas Jun 15, 2021
e61e350
Updated README with clarification for multi-arch docker packages
bklofas Jun 15, 2021
642cc66
Merge branch 'Dockerfile' with cleaned up documentation
bklofas Jun 17, 2021
09ca36c
Add exotic librtlsdr path for some RPI distros
dgiardini Jul 3, 2021
738ccca
Merge branch 'dgiardini:master' into master
bklofas Sep 6, 2021
605c29c
Support for broadcast addresses
dgiardini May 18, 2023
35f2011
Try to detect if pkg-config fails, default to -l librtlsdr
dgiardini May 24, 2023
88d062f
Extra paths for the linker
dgiardini May 24, 2023
3bcc835
Keep all warinings on
dgiardini Jun 4, 2023
5293369
Add paths for Homebrew on Apple Silicon to the Makefile
nohal Jan 12, 2024
9ab00f9
Merge pull request #45 from nohal/macos
dgiardini Jan 16, 2024
d1ab768
fix building error
jtaveau Jul 17, 2024
9be4dfb
Merge pull request #47 from jtaveau/master
dgiardini Jul 17, 2024
631bb9e
Updated github actions for building new container
bklofas Mar 7, 2025
777f8e1
Merge pull request #2 from dgiardini/master
bklofas Mar 7, 2025
66eca38
Updated debian strech -> bookworm
bklofas Mar 7, 2025
5f63c41
Updated Dockerfile with build/run containers
bklofas Mar 7, 2025
60a6992
Changed directory for rtl_ais so previous arguments work
bklofas Mar 7, 2025
d06ac95
Merge pull request #3 from bklofas/upstream_changes
bklofas Mar 7, 2025
6717b76
Merge pull request #51 from bklofas/master
dgiardini Mar 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Docker Builds

on: [workflow_dispatch]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/[email protected]
with:
image: tonistiigi/binfmt:qemu-v8.1.5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
id: cache-docker
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.RTLAIS_GITHUB_TOKEN }}

- name: Build and push to ghcr
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v6,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=AIS recevier using RTL-SDR dongle
tags: |
ghcr.io/bklofas/rtl-ais:latest

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.o
rtl_ais
debianPackage/usr
debianPackage/*.deb
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -------------------
# The build container
# -------------------
FROM debian:bookworm-slim AS build

WORKDIR /usr/src/app

COPY . /usr/src/app

# Upgrade bookworm and install dependencies
RUN apt-get -y update && apt -y upgrade && apt-get -y install --no-install-recommends \
rtl-sdr \
librtlsdr-dev \
libusb-1.0-0-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*

# Build rtl_ais
RUN make && \
make install


# -------------------------
# The application container
# -------------------------
FROM debian:bookworm-slim

LABEL org.opencontainers.image.title="rtl-ais"
LABEL org.opencontainers.image.description="AIS decoding using RTL-SDR dongle"
LABEL org.opencontainers.image.authors="Bryan Klofas KF6ZEO bklofas@gmail"
LABEL org.opencontainers.image.source="https://github.com/bklofas/rtl-ais"

# Upgrade bookworm and install dependencies
RUN apt-get -y update && apt -y upgrade && apt-get -y install --no-install-recommends \
tini \
rtl-sdr \
librtlsdr-dev \
libusb-1.0-0-dev &&\
rm -rf /var/lib/apt/lists/*

COPY --from=build /usr/src/app /

# Use tini as init.
ENTRYPOINT ["/usr/bin/tini", "--"]

CMD ["/rtl_ais", "-n"]

18 changes: 18 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (C) 2012 by Kyle Keen <[email protected]>
* rtl-ais uses code from AISDecoder Copyright (C) 2013 Astra Paging Ltd / AISHub ([email protected])
* AISDecoder uses parts of GNUAIS project (http://gnuais.sourceforge.net/)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
80 changes: 80 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
CFLAGS?=-O2 -g -Wall
CFLAGS+= -I./aisdecoder -I ./aisdecoder/lib -I./tcp_listener
LD_EXTRA_PATHS= -L /usr/lib/arm-linux-gnueabihf -L /usr/lib/i386-linux-gnu -L /usr/lib/x86_64-linux-gnu
LDFLAGS+=-lpthread -lm $(LD_EXTRA_PATHS)
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
#Conditional for Linux
CFLAGS+= $(shell pkg-config --cflags librtlsdr)
LD_LIBRTLSDR=$(shell pkg-config --libs librtlsdr)
#Ugly hack. Check if the output of pkg-config is long enough to be valid
LD_LIBRTLSDR_LENGTH := $(shell echo "$(LD_LIBRTLSDR)" | wc -c)
ifeq ($(shell test $(LD_LIBRTLSDR_LENGTH) -gt 13; echo $$?),0)
#The pkg-config output seem to be ok, let's use it
LDFLAGS+=$(shell pkg-config --libs librtlsdr)
else
#The pkg-config output seem to be too short, use the default lib name and default paths
LDFLAGS+=-lrtlsdr
endif

else
#
#ADD THE CORRECT PATH FOR LIBUSB AND RTLSDR
#TODO:
# CMAKE will be much better or create a conditional pkg-config


# RTLSDR
RTLSDR_INCLUDE=/tmp/rtl-sdr/include
RTLSDR_LIB=/tmp/rtl-sdr/build/src

# LIBUSB
LIBUSB_INCLUDE=/tmp/libusb/include/libusb-1.0
LIBUSB_LIB=/tmp/libusb/lib

ifeq ($(UNAME),Darwin)
#Conditional for OSX
CFLAGS+= -I/usr/local/include/ -I/opt/homebrew/include -I$(LIBUSB_INCLUDE) -I$(RTLSDR_INCLUDE)
LDFLAGS+= -L/usr/local/lib -L/opt/homebrew/lib -L$(LIBUSB_LIB) -L$(RTLSDR_LIB) -lrtlsdr -lusb-1.0
else
#Conditional for Windows
CFLAGS+=-I $(LIBUSB_INCLUDE) -I $(RTLSDR_INCLUDE)
LDFLAGS+=-L$(LIBUSB_INCLUDE) -L$(RTLSDR_LIB) -L/usr/lib -lusb-1.0 -lrtlsdr -lWs2_32
endif


endif

CC?=gcc
SOURCES= \
main.c rtl_ais.c convenience.c \
./aisdecoder/aisdecoder.c \
./aisdecoder/sounddecoder.c \
./aisdecoder/lib/receiver.c \
./aisdecoder/lib/protodec.c \
./aisdecoder/lib/hmalloc.c \
./aisdecoder/lib/filter.c \
./tcp_listener/tcp_listener.c

OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=rtl_ais

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) -o $@ $(LDFLAGS)

.c.o:
$(CC) -c $< -o $@ $(CFLAGS)

clean:
rm -f $(OBJECTS) $(EXECUTABLE) $(EXECUTABLE).exe

install:
install -d -m 755 $(PREFIX)/bin
install -m 755 $(EXECUTABLE) "$(PREFIX)/bin/"


162 changes: 162 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
`rtl-ais`, a simple AIS tuner and generic dual-frequency FM demodulator
-----------------------------------------------------------------------

rtl-ais provides the `rtl_ais` command, which decodes AIS data from Software Defined Radio (SDR) and outputs `AIVDM` / `AIVDO` sentences.

| OS support | |
|------------|---|
| Linux | ✅ |
| Windows | ✅ |
| OSX | ✅ |


Command Line
------------
```
Use: rtl_ais [options] [outputfile]
[-l left_frequency (default: 161.975M)]
[-r right_frequency (default: 162.025M)]
left freq < right freq
frequencies must be within 1.2MHz
[-s sample_rate (default: 24k)]
maximum value, might be down to 12k
[-o output_rate (default: 48k)]
must be equal or greater than twice -s value
[-E toggle edge tuning (default: off)]
[-D toggle DC filter (default: on)]
[-d device_index (default: 0)]
[-g tuner_gain (default: automatic)]
[-p ppm_error (default: 0)]
[-R enable RTL chip AGC (default: off)]
[-A turn off built-in AIS decoder (default: on)]
use this option to output samples to file or stdout.
Built-in AIS decoder options:
[-h host (default: 127.0.0.1)]
[-P port (default: 10110)]
[-T use TCP communication as tcp listener ( -h is ignored)]
[-t time to keep ais messages in sec, using tcp listener (default: 15)]
[-n log NMEA sentences to console (stderr) (default off)]
[-L log sound levels to console (stderr) (default off)]
[-I add sample index to NMEA mesages (default off)]
[-S seconds_for_decoder_stats (default 0=off)]
When the built-in AIS decoder is disabled the samples are sent to
to [outputfile] (a '-' dumps samples to stdout)
omitting the filename also uses stdout
Output is stereo 2x16 bit signed ints
Examples:
Receive AIS traffic,sent UDP NMEA sentences to 127.0.0.1 port 10110
and log the senteces to console:
rtl_ais -n
Tune two fm stations and play one on each channel:
rtl_ais -l233.15M -r233.20M -A | play -r48k -traw -es -b16 -c2 -V1 -
```


Compiling
---------
Make sure you have the following dependencies:
- librtlsdr
- libusb
- libpthread

```console
$ # Get the source code:
$ git clone https://github.com/dgiardini/rtl-ais
$ # Change to the source dir
$ cd rtl-ais
$ make
$ # Test running the command
$ ./rtl_ais
```

For compiling a MS Windows executable you will need a working MSYS/MinGW environment.
Edit the `Makefile`, and modify these lines:

```Makefile
#### point this to your correct path ###
RTLSDR_PATH="/c/tmp/rtl-sdr/"
RTLSDR_LIB=$(RTLSDR_PATH)/build/src/
########################################
```


Installing
----------
* On Linux, `sudo make install`
* On Windows, put the `librtlsdr.dll` and `libusb-1.0.dll` files in the same directory
with `rtl_ais.exe`. You'll need the `zadig` driver installed too.


Running
-------

rtl-ais uses software defined radio (SDR). The specific
hardware we use for this is a DVB-T dongle. A good starting point is:
https://www.rtl-sdr.com/about-rtl-sdr

You'll need also an antenna, and be located near (some miles) the
passing vessels.

You'll also need to do some procedure to get the tunning error for the
specfic dongle you have (aka ppm error), and pass that number as parameter
of rtl-ais.


Docker Container
----------------
Now you can run rtl-ais in a docker container. No dependencies to install. Total container size is 55 to 75 MB, depending on the host architecture. Get/install docker [here](https://docs.docker.com/get-docker/).

Two options for obtaining the container: Either download and run a pre-built container, or build the container locally.

1. Just to test things out: `docker run -it --rm --device=/dev/bus/usb ghcr.io/bklofas/rtl-ais:latest`
* This downloads a pre-built container from the Github container registry.
* Architectures supported are i386, amd64, arm32v6, arm32v7, and arm64. Tested on amd64, arm32v7, and arm64. arm packages run on all RaspberryPi flavors. Your client will automatically download the appropriate architecture.
* This image will run by default `./rtl_ais -n`, showing the received packets on STDOUT. Uses all other default values.
* You can add other ./rtl-sdr options, see below.
* Make sure at least one RTL-SDR dongle is connected.
* Startup messages and decoded packets will display in the terminal.
* Ctrl-C to kill.
* Using the `--rm` flag will delete the container when you kill it. Otherwise, it will stay around until you prune.

1. For a more permanent setup, run the container in the background and add any options you want: `docker run -d --name rtl-ais --restart=unless-stopped --log-driver=local --network=host --device=/dev/bus/usb ghcr.io/bklofas/rtl-ais:latest ./rtl_ais -n -d 00000002 -h 127.0.0.1 -P 10110`
* -d: Start this container in daemon/background mode.
* --name: Name this anything you want.
* --restart=unless-stopped: Automatically restart the container if something happens (reboot, USB problem), unless you have manually stopped the container.
* --log-driver=local: By default, docker uses the json log driver which may fill up your harddrive, depending on how busy your station is. `local` log driver defaults to 100MB of saved logs, and automatically rotates them.
* --network=host: Allows the container to talk to the internet, if you are sending the packets to an online service.
* --device=: Allows the container to talk to the USB bus to access the RTL-SDR dongle.
* ./rtl_ais: Same command-line options as non-containerized.
* View the startup messages and decoded packets with `docker logs --follow rtl-ais`
* Stop the container with `docker stop rtl-ais`

Building the container:

* Clone the repository with `git clone https://github.com/dgiardini/rtl-ais.git` , then from the folder `docker build -t rtl-ais .`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to change the github url?

* Or, build the container without cloning the repository: `docker build https://github.com/dgiardini/rtl-ais.git`

Other tips and tricks:

* If you have the `-n` flag, view the decoded AIS packets in real-time with `docker logs --follow rtl-ais`
* If you are only sending packets to one internet service (such as marinetraffic.com), you can use the `-h` and `-P` options that they provide.
* You are encouraged to send your decoded packets to multiple online services. Check out AIS packet multiplexer [kplex](http://www.stripydog.com/kplex/), pre-built containers are available [here](https://ghcr.io/bklofas/kplex).


Testing
-------

TODO: something like
https://github.com/freerange/ais-on-sdr/wiki/Testing-AISDecoder#with-an-audio-file


Known Issues
------------
* The `[-p ppm error]` parameter is essential for rtl_ais to work.
* The ppm error is the frequency deviation in parts per million from the desired tuning
frequency, and the real tuned frequency due to the crystal oscillator deviation. This
figure is different for each device, it's very important to know this value and pass this parameter to rtl_ais.
* Some instructions for get the ppm error are here:
http://www.rtl-sdr.com/how-to-calibrate-rtl-sdr-using-kalibrate-rtl-on-linux
* and here (using SDR#):
http://www.atouk.com/SDRSharpQuickStart.html#adjusting
* and here (using HDSDR ad AIS traffic)
http://www.cruisersforum.com/forums/f134/new-rtlsdr-plugin-102929-11.html#post1844966
6 changes: 6 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
----
TODO
----
- Auto calibration mode
- Compile as library
- Add audio gain control
12 changes: 0 additions & 12 deletions ais/build.sh

This file was deleted.

Loading