| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Buried in cloud files? We can help with Spring cleaning!

    Whether you use Dropbox, Drive, G-Suite, OneDrive, Gmail, Slack, Notion, or all of the above, Dokkio will organize your files for you. Try Dokkio (from the makers of PBworks) for free today.

  • Dokkio (from the makers of PBworks) was #2 on Product Hunt! Check out what people are saying by clicking here.

View
 

Using a Raspberry Pi with The Mode-S Beast

Page history last edited by Richard Jones 1 year, 1 month ago Saved with comment

This is a quick series of steps needed to set up a Raspberry Pi 2 (or greater) to interface with a Mode-S Beast receiver. This arrangement allows the RPi to operate as an autonomous Ground Station (GS) that will upload periodic position data to the PlanePlotter servers, as well as serve raw time stamped data to other PlanePlotter stations for MLAT position fixes. 

 

The Mode-S beast provides fully decoded binary output on a virtual serial port operating over a USB connection. The Beast receiver normally feeds its data to PlanePlotter via a direct USB connection on the same PC on which PlanePlotter is running. To PlanePlotter, it appears that the connection to the Beast is made through a very high-speed (3000000 baud!) serial port connection using hardware handshaking via a (virtual) RS-232 RTS signalling line to reduce data overflows.

 

However, PlanePlotter also has the ability to receive data from the Beast directly from a TCP port. This capability was originally included in PlanePlotter to support the optional (and expensive) Lantronix Xport "smart" Ethernet connector/adapter that was soldered onto the Beast PCB. It could take the serial data from the Beast's FPGA chip and convert it to a TCP stream that could be routed over a LAN to the PC running PlanePlotter. Adding the Lantronix option was not often done, as it required a non-standard enclosure and external power supply.

 

Adding a Raspberry Pi v2 (or greater) to the Beast accomplishes the same thing as adding the Lantronix jack option, with the added advantage of providing autonomous uploads/MLAT service as well as a nice web interface with statistics, coverage area mapping, aircraft lists and a variety of maps. It also allows the Pi to simultaneously feed data to PlanePlotter. It is a very "green" solution, as the PC hosting PlanePlotter no longer needs to be running 24/7.

 

A slight disadvantage is the inability of the Pi to provide Beamfinder or auto-MLAT fixes. However, these functions can still be provided when PlanePlotter is running, so the disadvantage is minimal.

 

A Raspberry Pi version 2 (or greater) is required for proper operation. Experimentation has shown that the older Raspbberry Pi Model B/B+ lacks the needed CPU power to handle higher Mode-S message rates while simultaneously feeding the PlanePlotter servers, the local PlanePlotter program, and the web interface. The Pi v2 provides a very comfortable margin of performance to service all of these functions.

 

The software installed using the following procedure has been shown to fit comfortably on a 8 Gbyte microSD card (latest Stretch Raspbian OS). It is important to provide a 5 volt power supply with a minimum 2 amp capacity to properly feed the Raspberry Pi 2 or greater. An old cell phone charge is simply NOT adequate to the task. Signs of an insufficient power supply are a flashing or unilluminated red LED on the Pi.

 

Basic steps:

 

- Install Raspbian and dump1090 per the instructions found on David Taylor's excellent guide here: http://www.satsignal.eu/raspberry-pi/dump1090.html The only steps that should be omitted are compiling dump1090 and view1090. It is necessary to compile the rtl-sdr drivers for the R820T-based TV tuner dongle, even though the driver is not being used. ppup1090 checks for its presence, Only the "ppup1090" component of dump1090 needs to be compiled for this application. This is described farther down the page in the section "Uploading to the Plane Plotter server directly from the Raspberry Pi". You must request a customized coaa.h file from COAA and compile it into the code, using the instructions on David's page.

 

- Enable the root password ("sudo passwd root"), if desired, and log in as "root" to make configuration easier and to avoid having to type "sudo" in front of each command requiring privileged access.

 

- After installing the Raspbian operating system, but before compiling or configuring anything, be sure to expand the file system to fill the space on your microSD card with the "raspi-config" command from an SSH session. Do NOT turn on the Raspbian GUI! Use the command line interface only.

 

- Set the correct location and time zone for your installation with the "raspi-config" configuration menu.

 

- Set a fixed IP address on the Pi. On the newest Raspbian (Stretch at the last edit), the method has changed. Edit the /etc/dhcpcd.conf, appending the following lines to the end of the file, then reboot and connect to the new fixed IP address with putty. Adjust values in the example to suit your own network and DNS servers:

 

     interface eth0

     static ip_address=192.168.1.204/24

     static routers=192.168.1.1

     static domain_name_servers=8.8.8.8 8.8.4.4

     static domain_search =

 

- Obtain the latest pre-compiled version of the "modesmixer2" program from this thread at the radarspotting.com web site: http://radarspotting.com/forum/index.php/topic,2978.0.html

 

- Using Filezilla or a similar FTP program, upload the binary executable "modesmixer2" to the Pi. I put mine into the /home/pi/dump1090 directory. This directory is created when following David's instructions for compiling ppup1090.

 

- As the modesmixer2 program lacks the ability to set Mode-S Beast options over the serial port, the internal DIP switch settings must be set correctly, as follows:

 

    SW1 - OFF
    SW2 - OFF
    SW3 - ON   << Enables Beast Binary format, rather than AVR, Firmware >= v1.30. MUST BE ON!!!
    SW4 - OFF
    SW5 - ON   << This one enables MLAT timestamps - REQUIRED TO BE ON!!!!!
    SW6 - OFF
    SW7 - OFF
    SW8 - ON
    SW9 - ON
    SW10 - OFF << Disable Mode A/C for reduced load on the Pi. Untested if enabled. May work.

 

It is possible to turn Mode-A/C messaging on from the Pi command line while modes2mixer is running, or from the /etc/init.d startup script with:

 

sudo echo -e '\x1a\x31\x4a' > /dev/ttyUSB0 

 

...or turn Mode-A/C off:

 

sudo echo -e '\x1a\x31\x6a' > /dev/ttyUSB0

 

Other DIP switch settings could be modified under script control by coding the correct escape sequences per the Mode-S Beast wiki:

 

http://wiki.modesbeast.com/Mode-S_Beast:Data_Input_Formats

 

Note that the developers got the "Esc" character wrong by coding it as 0x1a rather than the correct 0x1b. As long as 0x1a is used, all works fine.

 

- Connect the USB cable from the Mode-S Beast to one of the 4 USB ports on the Pi. It doesn't matter which one. However, the same port should be used once the Beast is plugged in so that the serial port enumeration remains the same. Plugging in the cable should cause the FTDI driver to load and the virtual serial port /dev/ttyUSB0 to be created. This is the port on which the Pi will receive data from the Beast.

 

- Change port forwarding for UDP port 9742 on your router to forward incoming unsolicited UDP packets on the port to the fixed IP address of the Raspberry Pi, rather than the IP address of the PC running PlanePlotter. This allows the Pi to handle all MLAT requests. If set up as below, PlanePlotter will function normally in all respects.

 

- modesmixer2 must be started before ppup1090 with this command:  /home/pi/dump1090/modesmixer2 --inSerial /dev/ttyUSB0:3000000:hardware --outServer beast:30005 --web 8080 --location yy.yyyy:xx.xxxx

 

- In the above line, you are instructing modesmixer2 to translate the incoming data on virtual serial port /dev/ttyusb0 to TCP output on the IP address of the of the Pi. port 3005. You are telling modesmixer2 to use its internal web server on its IP address, port 8080 (adjust as desired). You also should provide the same latitude/longitude values as found in the coaa.h file you used to compile ppup1090. This allows modesmixer2 to determine the location of an aircraft from a single DF17 position message rather than two. It also enables the modesmixer2 to dynamically create a very accurate coverage plot of your installation on the web page.

 

- Next, start ppup1090 to begin sharing data from the Pi to the PlanePlotter servers and other MU stations:  /home/pi/dump1090/ppup1090 --quiet --net-pp-ipaddr 192.168.1.130

 

- The IP address in the above command needs to be the fixed IP address of the PC running PlanePlotter. This allows PlanePlotter to continue to pass all networking tests, although the Pi is actually handling autonomous requests for MLAT data.

 

- Set up PlanePlotter to use the new TCP port on the Pi rather than the old serial port, as follows...

 

- In "Options/I/O settings", select "Beast receiver TCP" as the receiver type. Keep "Allow Auto Mlats" and "Raw data for Mlats" checked.

 

- In "Options/Mode-S receiver/Beast receiver/Setup TCP client", enter the fixed IP address of the Pi and port 30005: xxx.xxx.x.xxx:30005

 

- Enable both upload and download sharing in PlanePlotter to continue to share Beamfinder and auto-MLAT fixes with the PlanePlotter servers. This also sends duplicate normal positions from the Pi and Planeplotter, but this should cause no issues. Alternatively, you may disable sharing uploads at the cost of sharing Beamfinder and auto-MLAT fixes determined by PlanePlotter.

 

- Using the authorization code in your coaa.h file, substitute in the following URL to check that port forwarding is correctly set up to point to the Pi: http://www.coaa.co.uk/rpiusers.php?authcode=xxxxxxxxx

 

- Run the networking tests in PlanePlotter. All should still pass.

 

- Let PlanePlotter support know about the change so they may run additional checks and apply any adjustments that might be required on the server side for your new configuration.

 

- The web server of modesmixer2 may be accessed from your browser by entering the IP address and web port of the Pi, i.e. http://192.168.1.204:8080

 

- Starting both modesmixer2 and ppup1090 automatically at boot time can be accomplished by editing the script for starting dump1090 and ppup1090 on David's page, substituting modesmixer2 and its arguments for dump1090.  Installation instructions for the script should be the same. 

 

Here is my startup script. It resides in /etc/init.d:

 

#!/bin/bash

### BEGIN INIT INFO

#

# Provides:             modesmixer2 and ppup1090

# Required-Start:       $remote_fs

# Required-Stop:        $remote_fs

# Default-Start:        2 3 4 5

# Default-Stop:         0 1 6

# Short-Description:    modesmixer2 and ppup1090 initscript

 

#

### END INIT INFO

## Fill in name of program here.

PROG="modesmixer2"

PROG_PATH="/home/pi/dump1090"

PROG_ARGS="--inSerial /dev/ttyUSB0:3000000:hardware --outServer beast:30005 --web 8080 --location 41.911269:-88.357252"

PIDFILE="/var/run/$PROG.pid"

 

PROG2="ppup1090"

#REPLACE IP ADDRESS IN THE NEXT LINE WITH THE (STATIC) IP ADDRESS OF THE PC RUNNING PLANEPLOTTER

PROG2_ARGS="--quiet --net-pp-ipaddr 192.168.1.130"

PIDFILE2="/var/run/$PROG2.pid" 

 

DELAY=5

 

start() {

      if [ -e $PIDFILE ]; then

          ## Program is running, exit with error.

          echo "Error! $PROG is currently running!" 1>&2

          exit 1

      else

          ## Change from /dev/null to something like /var/log/$PROG if you want to save output.

          cd $PROG_PATH

          ./$PROG $PROG_ARGS 2>&1 >/dev/null &

          echo "$PROG started, waiting $DELAY seconds..."

          touch $PIDFILE

          sleep $DELAY

          echo "Attempting to start $PROG2..."

          ./$PROG2 $PROG2_ARGS 2>&1 >/dev/null &

          echo "$PROG2 started"

          touch $PIDFILE2

          sleep $DELAY

 

          # Mode-S Beast DIP switch override settings - set by uncommenting selection as per PlanePlotter recommendations

 

          #To enable AVR output format, DIP switch 3 off

          #sudo echo -e '\x1a\x31\x63' > /dev/ttyUSB0

          #To enable Binary output format dip switch 3 on

          sudo echo -e '\x1a\x31\x43' > /dev/ttyUSB0

 

          #To disable DF-11/17 only filter, DIP switch 4 off

          sudo echo -e '\x1a\x31\x64' > /dev/ttyUSB0

          #To enable DF-11/17 only filter, DIP switch 4 on

          #sudo echo -e '\x1a\x31\x44' > /dev/ttyUSB0

 

          #To disable MLAT timestamp, DIP switch 5 off

          #sudo echo -e '\x1a\x31\x65' > /dev/ttyUSB0

          #To enable MLAT timestamp, DIP switch 5 on

          sudo echo -e '\x1a\x31\x45' > /dev/ttyUSB0

 

          #To disable CRC check, DIP switch 6 on

          #sudo echo -e '\x1a\x31\x46' > /dev/ttyUSB0

          #To enable CRC check, DIP switch 6 off

          sudo echo -e '\x1a\x31\x66' > /dev/ttyUSB0

 

          #To disable DF-0/4/5 filter, DIP switch 7 off

          sudo echo -e '\x1a\x31\x67' > /dev/ttyUSB0

          #To enable DF-0/4/5 filter, DIP switch 7 on

          #sudo echo -e '\x1a\x31\x47' > /dev/ttyUSB0

 

          #To disable RTS handshake, DIP switch 8 off

          #sudo echo -e '\x1a\x31\x68' > /dev/ttyUSB0

          #To enable RTS handshake, DIP switch 8 on

          sudo echo -e '\x1a\x31\x48' > /dev/ttyUSB0

 

          #To disable 1 bit forward error correction, DIP switch 8 on

          sudo echo -e '\x1a\x31\x49' > /dev/ttyUSB0

          #To enable 1 bit forward error correction, DIP switch 8 off

          #sudo echo -e '\x1a\x31\x69' > /dev/ttyUSB0

 

          #To disable Mode A/C dip switch 10 off

          sudo echo -e '\x1a\x31\x6a' > /dev/ttyUSB0

          #To enable Mode A/C dip switch 10 on

          #sudo echo -e '\x1a\x31\x4a' > /dev/ttyUSB0

 

      fi

}

 

stop() {

      if [ -e $PIDFILE ]; then

          ## Program is running, so stop it

         echo "$PROG is running"

         killall $PROG2

         killall $PROG

         rm -f $PIDFILE2

         rm -f $PIDFILE

         echo "$PROG stopped"

      else

          ## Program is not running, exit with error.

          echo "Error! $PROG not started!" 1>&2

          exit 1

      fi

}

 

## Check to see if we are running as root first.

## Found at http://www.cyberciti.biz/tips/shell-root-user-check-script.html

if [ "$(id -u)" != "0" ]; then

      echo "This script must be run as root" 1>&2

      exit 1

fi

 

case "$1" in

      start)

          start

          exit 0

      ;;

      stop)

          stop

          exit 0

      ;;

      reload|restart|force-reload)

          stop

          start

          exit 0

      ;;

      **)

          echo "Usage: $0 {start|stop|reload}" 1>&2

          exit 1

      ;;

esac

 

#

 

Nick Norman has a Beast receiver and is uploading to Planeplotter from a Raspberry Pi 4. This is how he achieved it:

 

"I've got beast-splitter & ppup1090 running on a RPI-4 all automagically starting on boot

 

This is/was the process:

 

 

To use beast splitter <https://github.com/flightaware/beast-splitter>

 

Make a file called beast-splitter.service in /lib/systemd/system/ (or /etc/systemd/system) with the following content

 

<code>

# Mode S Beast data forwarding service for systemd

# install in /etc/systemd/system

 

[Unit]

Description=Mode S Beast data forwarder

Documentation=https://github.com/flightaware/beast-splitter

Wants=network.target

After=network.target

 

[Service]

User=beast

Group=beast

RuntimeDirectory=beast-splitter

RuntimeDirectoryMode=0755

ExecStart=/usr/share/beast-splitter/start-beast-splitter --status-file %t/beast-splitter/status.json

SyslogIdentifier=beast-splitter

Type=simple

Restart=on-failure

RestartSec=30

SuccessExitStatus=64

 

[Install]

WantedBy=default.target

</code>

 

Then execute:

 

sudo systemctl enable beast-splitter.service

 

and

 

sudo systemctl start beast-splitter.service

 

To start ppup1090

 

make a file called ppup1090.service in /lib/systemd/system/

 

<code>

# planeplotter uploader service for systemd

# create in /lib/systemd/system/

# then install in /etc/systemd/system/default.target.wants/

# by command: sudo systemctl enable ppup1090.service

 

[Unit]

Description=PlanePlotter Raspberry Pi uploader

Wants=network-online.target

After=beast-splitter.service network-online.target time-sync.target

PartOf=beast-splitter.service

 

[Service]

User=ppup1090

RuntimeDirectory=ppup1090

ExecStart=/home/pi/ppup1090/ppup1090 --quiet --modeac --net-pp-ipaddr 10.52.52.30

ExecReload=/bin/kill -HUP $MAINPID

Type=simple

Restart=on-failure

RestartSec=30

# exit code 4 means login failed

# exit code 6 means startup failed

RestartPreventExitStatus=4 6

 

[Install]

WantedBy=default.target

 

</code>

 

 

In fact either of the service files can be put into /etc/systemd/system/ and it still seems to work, I have beast-splitter in /lib/systemd/system & the ppup1090 one in /etc/systemd/system/

 

The output of the status command to systemctl should look similar to the following:

 

 

<quote>

pi@raspberrypi:~/beast-splitter $ systemctl status beast-splitter.service

* beast-splitter.service - Mode S Beast data forwarder

    Loaded: loaded (/lib/systemd/system/beast-splitter.service; enabled; vendor preset: enabled)

    Active: active (running) since Wed 2021-04-28 16:17:05 GMT; 2 weeks 3 days ago

      Docs: https://github.com/flightaware/beast-splitter

  Main PID: 485 (beast-splitter)

     Tasks: 1 (limit: 1771)

    CGroup: /system.slice/beast-splitter.service

            `-485 /usr/bin/beast-splitter --serial /dev/beast --listen 30005:BCdfgIJk --status-file /run/beast-splitter/status.json

 

May 15 20:21:32 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdfgIJk

May 15 20:21:32 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdfgIJk

May 15 20:21:32 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdfgIJk

May 15 20:21:32 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdfgIJk

May 15 20:21:32 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdEfgIJk

May 15 20:21:32 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdEfgIJk

May 15 20:21:33 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdEfgIJk

May 15 20:21:33 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdEfgHIJk

May 15 20:21:33 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdEfgHIJk

May 15 20:21:33 raspberrypi beast-splitter[485]: 10.52.52.30:55647:

settings changed to BCdEfgHIJk

 

</quote>

 

 

<quote>

pi@raspberrypi:~/beast-splitter $ systemctl status ppup1090.service

* ppup1090.service - PlanePlotter Raspberry Pi uploader

    Loaded: loaded (/etc/systemd/system/ppup1090.service; enabled; vendor preset: enabled)

    Active: active (running) since Wed 2021-04-28 16:48:09 GMT; 2 weeks 3 days ago

  Main PID: 1372 (ppup1090)

     Tasks: 3 (limit: 1771)

    CGroup: /system.slice/ppup1090.service

            `-1372 /home/pi/ppup1090/ppup1090 --quiet --modeac

--net-pp-ipaddr 10.52.52.30

 

</quote>

 

If you want to run dump1090 then proceed as for beast-splitter but put the relevant command, switches etc. in the service file and all should work.  I am sure I found the instructions somewhere but can't currently remember.

 

Ah!

 

The dump1090-fa page has the following:

 

<code>

sudo cp -r ~/build-dump-fa/dump1090/dump1090  /usr/bin/dump1090-fa

 

sudo cp ~/build-dump-fa/dump1090/debian/dump1090-fa.default/etc/default/dump1090-fa

 

sudo cp ~/build-dump-fa/dump1090/debian/dump1090-fa.service/lib/systemd/system/dump1090-fa.service

 

sudo systemctl enable dump1090-fa.service

 

sudo adduser --system dump1090

 

sudo wget -O  /etc/udev/rules.d/rtl-sdr.rules"https://raw.githubusercontent.com/osmocom/rtl-sdr/master/rtl-sdr.rules"

 

sudo reboot

 

</code>

 

and on github

<https://github.com/flightaware/dump1090/blob/master/debian/dump1090-fa.service>

there is a .service file that looks like:

 

 

<code>

 

# dump1090-fa service for systemd

 

[Unit]

Description=dump1090 ADS-B receiver (FlightAware customization)

Documentation=https://flightaware.com/adsb/piaware/

Wants=network.target

After=network.target

 

[Service]

User=dump1090

RuntimeDirectory=dump1090-fa

RuntimeDirectoryMode=0755

ExecStart=/usr/share/dump1090-fa/start-dump1090-fa --write-json%t/dump1090-fa --quiet

SyslogIdentifier=dump1090-fa

Type=simple

Restart=on-failure

RestartSec=30

RestartPreventExitStatus=64

Nice=-5

 

[Install]

WantedBy=default.target

 

</code>

 

</quote>

 

 

 

Comments (0)

You don't have permission to comment on this page.