Skip to content

Commit

Permalink
feat: add compatibility with mode-s beast (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
shawaj authored Jul 9, 2024
1 parent 8abd49e commit de9d596
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 7 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

**ADS-B Flight Tracker running on balena with support for FlightAware, Flightradar24, Plane Finder, OpenSky Network, AirNav RadarBox, ADSB Exchange, and Wingbits.**

Contribute to the flight tracking community! Feed your local ADS-B data from an [RTL-SDR](https://www.rtl-sdr.com/) USB dongle and a supported device (see below) running balenaOS to the tracking services [FlightAware](https://flightaware.com/), [Flightradar24](https://www.flightradar24.com/), [Plane Finder](https://planefinder.net/), [OpenSky Network](https://opensky-network.org/), [AirNav RadarBox](https://www.radarbox.com/), [ADSB Exchange](https://adsbexchange.com) and [Wingbits](https://wingbits.com). In return, you will receive complimentary premium accounts (or cryptocurrency tokens) worth several hundred dollars annually!
Contribute to the flight tracking community! Feed your local ADS-B data from an [RTL-SDR](https://www.rtl-sdr.com/) USB dongle (or various other radio types) and a supported device (see below) running balenaOS to the tracking services [FlightAware](https://flightaware.com/), [Flightradar24](https://www.flightradar24.com/), [Plane Finder](https://planefinder.net/), [OpenSky Network](https://opensky-network.org/), [AirNav RadarBox](https://www.radarbox.com/), [ADSB Exchange](https://adsbexchange.com) and [Wingbits](https://wingbits.com). In return, you will receive complimentary premium accounts (or cryptocurrency tokens) worth several hundred dollars annually!

# Stay in the loop

Expand Down Expand Up @@ -37,6 +37,10 @@ Contribute to the flight tracking community! Feed your local ADS-B data from an

Please [let us know](https://github.com/ketilmo/balena-ads-b/discussions/new) if you are successfully running balena-ads-b on a hardware platform not listed here!

# Supported radios

The default setting of this software is to use a RTL-SDR type radio device. However it is also compatible with Mode-S Beast, bladeRF, HackRF, LimeSDR or SoapySDR. You can find more information on how to configure these device types in the [Using different radio device types](#using-different-radio-device-types) section below.

# Credits

The balena-ads-b project was created and maintained by [Ketil Moland Olsen](https://github.com/ketilmo/).
Expand Down Expand Up @@ -375,6 +379,23 @@ You can disable any of the balena-ads-b services by creating a *Device Variable*

**Please note:** Due to how these services are integrated, it's not currently possible to disable the `wifi-connect` and `kiosk` services.

## Using different radio device types

With balena-ads-b you are able to use a variety of SDRs (software defined radios) and other devices such as the FPGA based Mode-S Beast. The default operating mode is to use an RTL-SDR over USB and no additional configuration is needed for this setup.

If you are using a Mode-S Beast, bladeRF, HackRF, LimeSDR or SoapySDR then you will need to configure this for the device to work as intended.

In order to configure the particular device type you are using, you need to create a *Device Variable* named `RADIO_DEVICE_TYPE`. The possible values are below:

- rtlsdr (this is the default and you do not need to configure this variable if you are using an RTL-SDR)
- modesbeast
- bladerf
- hackrf
- limesdr
- soapysdr

For example if you have a Mode-S Beast, you set the `RADIO_DEVICE_TYPE` variable to `modesbeast`. Remember to save the device variable settings after you have updated them. Your device should restart automatically once you configure this and the radio should now work.

## Adaptive gain configuration
The dump1090-fa service can be configured to adapt the tuner gain to changing conditions automatically. You can [read more about how this works](https://github.com/flightaware/dump1090/blob/master/README.adaptive-gain.md#default-settings) at FlightAware's website.

Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ services:
build: ./dump1090-fa
image: dump1090-fa
restart: always
privileged: true
environment:
- LAT=
- LON=
Expand Down Expand Up @@ -225,6 +226,8 @@ services:
restart: always
environment:
- WINGBITS_DEVICE_ID=
- LAT=
- LON=
expose:
- '30154'
# Optional: Uncomment to enable custom mlat server.
Expand Down
14 changes: 13 additions & 1 deletion dump1090-fa/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ENV DUMP1090_ADAPTIVE_MIN_GAIN=""
ENV DUMP1090_ADAPTIVE_MAX_GAIN=""
ENV DUMP1090_SLOW_CPU=""

ARG PERM_INSTALL="tini lighttpd gettext-base libusb-1.0-0 libbladerf2 libhackrf0 liblimesuite22.09-1 librtlsdr0 rtl-sdr libsoapysdr0.8 libncurses6"
ARG PERM_INSTALL="tini lighttpd gettext-base libusb-1.0-0 libbladerf2 libhackrf0 liblimesuite22.09-1 librtlsdr0 rtl-sdr libsoapysdr0.8 libncurses6 libboost-system-dev libboost-program-options-dev libboost-regex-dev"

RUN apt update && \
apt install -y $PERM_INSTALL && \
Expand All @@ -23,6 +23,7 @@ RUN apt update && \
FROM base AS buildstep

ARG DUMP1090_VERSION=v9.0
ARG BEAST_SPLITTER_VERSION=v9.0
ARG TEMP_INSTALL="git build-essential fakeroot cmake debhelper pkg-config libncurses5-dev libbladerf-dev libhackrf-dev liblimesuite-dev libusb-1.0-0-dev libsoapysdr-dev librtlsdr-dev apt-utils apt-transport-https debhelper"

RUN apt update && \
Expand All @@ -45,9 +46,17 @@ RUN git clone https://github.com/flightaware/dump1090 && \
git checkout tags/${DUMP1090_VERSION} && \
dpkg-buildpackage -b --no-sign --build-profiles=custom,rtlsdr,bladerf,hackrf,limesdr,soapysdr

WORKDIR /tmp

RUN git clone https://github.com/flightaware/beast-splitter && \
cd beast-splitter && \
git checkout tags/${BEAST_SPLITTER_VERSION} && \
dpkg-buildpackage -b --no-sign

FROM base AS release

COPY --from=buildstep /tmp/dump1090-fa_*.deb /tmp/
COPY --from=buildstep /tmp/beast-splitter_*.deb /tmp/
COPY start.sh /
COPY add-serial-1090.sh /
COPY showstrongmessages.sh /
Expand All @@ -58,10 +67,13 @@ WORKDIR /tmp
# apt-mark hold librtlsdr0 && \

RUN dpkg -i dump1090-fa_*.deb && \
ln -s /bin/udevadm /sbin/udevadm && \
dpkg -i beast-splitter_*.deb && \
rm -rf /tmp/* && \
mkdir -p /run/dump1090-fa && \
chmod +x /start.sh && \
chmod +x /add-serial-1090.sh && \
chmod +x /showstrongmessages.sh


ENTRYPOINT ["/usr/bin/tini", "--", "/start.sh"]
34 changes: 30 additions & 4 deletions dump1090-fa/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,29 @@ echo " "

# Variables are verified – continue with startup procedure.

radio_device_lower=$(echo "${RADIO_DEVICE_TYPE}" | tr '[:upper:]' '[:lower:]')

if [ "$radio_device_lower" = "modesbeast" ]
then
dump1090configuration="--device-type none --device "none" --net-only --net-bo-port 30105"
elif [ "$radio_device_lower" = "hackrf" ]
then
dump1090configuration="--device-type hackrf --device "$DUMP1090_DEVICE" --net-bo-port 30005,30105"
elif [ "$radio_device_lower" = "bladerf" ]
then
dump1090configuration="--device-type bladerf --device "$DUMP1090_DEVICE" --net-bo-port 30005,30105"
elif [ "$radio_device_lower" = "limesdr" ]
then
dump1090configuration="--device-type limesdr --device "$DUMP1090_DEVICE" --net-bo-port 30005,30105"
elif [ "$radio_device_lower" = "soapysdr" ]
then
dump1090configuration="--device-type soapysdr --device "$DUMP1090_DEVICE" --net-bo-port 30005,30105"
else
dump1090configuration="--device-type rtlsdr --device "$DUMP1090_DEVICE" --net-bo-port 30005,30105"
fi

# Build dump1090 configuration
dump1090configuration="--device-type rtlsdr --device "$DUMP1090_DEVICE" --lat "$LAT" --lon "$LON" --fix --ppm "$DUMP1090_PPM" --max-range "$DUMP1090_MAX_RANGE" --net --net-heartbeat 60 --net-ro-size 1000 --net-ro-interval 0.05 --net-http-port 0 --net-ri-port 0 --net-ro-port 30002,30102 --net-sbs-port 30003 --net-bi-port 30004,30104 --net-bo-port 30005,30105 --raw --json-location-accuracy 2 --write-json /run/dump1090-fa --quiet"
dump1090configuration="${dump1090configuration} --lat "$LAT" --lon "$LON" --fix --ppm "$DUMP1090_PPM" --max-range "$DUMP1090_MAX_RANGE" --net --net-heartbeat 60 --net-ro-size 1000 --net-ro-interval 0.05 --net-http-port 0 --net-ri-port 0 --net-ro-port 30002,30102 --net-sbs-port 30003 --net-bi-port 30004,30104 --raw --json-location-accuracy 2 --write-json /run/dump1090-fa --quiet"
if [[ -z "$DUMP1090_GAIN" ]] && [[ "$DUMP1090_ADAPTIVE_DYNAMIC_RANGE" != "false" ]]; then
echo "Gain is not specified. Will enable Adaptive Dynamic Range."
DUMP1090_ADAPTIVE_DYNAMIC_RANGE="true"
Expand Down Expand Up @@ -75,12 +96,17 @@ if [[ "$DUMP1090_SLOW_CPU" != "" ]]; then
echo "Setting Slow CPU mode to $DUMP1090_SLOW_CPU." && dump1090configuration="${dump1090configuration} --adaptive-duty-cycle $DUMP1090_SLOW_CPU"
fi

# If using Mode-S Beast, launch beast-splitter in background
if [ "$radio_device_lower" = "modesbeast" ]
then
/usr/bin/beast-splitter --serial /dev/ttyUSB0 --listen 30005:R --connect 0.0.0.0:30104:R 2>&1 | stdbuf -o0 sed --unbuffered '/^$/d' | awk -W interactive '{print "[beast-splitter] " $0}' &
fi

# Start dump1090-fa and put it in the background.
/usr/bin/dump1090-fa $dump1090configuration &
/usr/bin/dump1090-fa $dump1090configuration 2>&1 | stdbuf -o0 sed --unbuffered '/^$/d' | awk -W interactive '{print "[dump1090-fa] " $0}' &

# Start lighthttpd and put it in the background.
/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf &
# Start lighttpd and put it in the background.
/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf 2>&1 | stdbuf -o0 sed --unbuffered '/^$/d' | awk -W interactive '{print "[lighttpd] " $0}' &

# Wait for any services to exit.
wait -n
2 changes: 1 addition & 1 deletion planefinder/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ echo " "
# Configure Planefinder according to environment variables.
envsubst < /etc/pfclient-config.json.tpl> /etc/pfclient-config.json

# Start pfclinen and put it in the background.
# Start pfclient and put it in the background.
/usr/bin/pfclient --config_path=/etc/pfclient-config.json --log_path=/dev/console &

# Wait for any services to exit.
Expand Down

0 comments on commit de9d596

Please sign in to comment.