FlightAware Discussions

HOWTO: Airspy mini and Airspy R2: Piaware / dump1090-fa configuration


#1

The guide to do this manually is now in post 2 of this thread. (The manual version right now differs to what the script does as using beast-splitter seems beneficial performance-wise)
(HOWTO: Airspy mini and Airspy R2: Piaware / dump1090-fa configuration)
I’m collecting comments from the author regarding the command line options in my 3rd post in this thread.
(HOWTO: Airspy mini and Airspy R2: Piaware / dump1090-fa configuration)

On popular request i’ve written a script that does all the work, so all you need to do is change the gain if you want :slight_smile:

This script changes the piaware configuration, dump1090-fa configuration and installs a systemd-service to automatically run airspy_adsb.
I have tested the script locally, it should work. But such things sometimes don’t work as intended, keep that in mind.
Piaware and dump1090-fa need to be installed before you run this script otherwise the script can’t change the configuration.
It should work very well on a fresh piaware-sd card image :slight_smile:


Install command:

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/wiedehopf/airspy-conf/master/install.sh)"

“Uninstall”:

Disabling the airspy_adsb service, restoring the dump1090-fa configuration and resetting the piaware configuration to the default:

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/wiedehopf/airspy-conf/master/uninstall.sh)"

Update / download airspy_adsb to /usr/local/bin while preserving options in /etc/default/airspy_adsb

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/wiedehopf/airspy-conf/master/update-binary.sh)"

Other feeders:

While dump1090-fa needs to be installed for this script and configuration to work, you don’t have to install piaware.
It should work fine with all the feeders (fr24, planefinder, …).
Just point them to port 30005 (beast protocol).


Changing airspy_adsb options

If you want to change the airspy options, edit the option file:

sudo nano /etc/default/airspy_adsb

For example you might want to enable the bias tee, just add -b at the end of the options line so it looks like this:

#other options
OPTIONS= -f 1 -x -p -b

There are other lines where you can change the gain or sample rate:

#gain is 0 to 21, each step of gain is equivalent to about 3dB, so reduce in increments of 1 if 21 is too high
GAIN=21

#sample rate can be 12 or 20, 20 is not recommended on the Raspbery Pi, if you chose it please check for lost samples with journalctl -en100 -u airspy_adsb
SAMPLE_RATE=12

Ctrl-O and Enter/Return to save and Ctrl-X to exit

Restart airspy_adsb with

systemctl restart airspy_adsb

Some more options are discussed at the end of the 2nd post of this thread.


Checking for lost packages from Airspy
Building a new receiver, this is going in a prime location - Suggestions for receiver/preamp/filter please
#2

Use either step 1 a) or option 1 b), not both.


1 a) Configuration for users of the piaware sd-card**

In /boot/piaware-config.txt add the following:

receiver-type relay
receiver-host localhost
receiver-port 29999

Or use piaware-config to make the changes when logged in via ssh:

sudo piaware-config receiver-type relay
sudo piaware-config receiver-host localhost
sudo piaware-config receiver-port 29999
sudo systemctl restart piaware dump1090-fa

1 b) Configuration if you installed piaware/dump1090-fa via apt / apt-get

piaware per default expects an open beast port on 30005, so don’t change the piaware configuration.

dump1090-fa configuration in the file /etc/default/dump1090-fa needs to be changed though, open it via a text editor for example like this:

sudo nano /etc/default/dump1090-fa

Either change it to look like the following or just delete everything and paste the following:

RECEIVER_OPTIONS="--net-only"
DECODER_OPTIONS="--max-range 360"
NET_OPTIONS="--net --net-heartbeat 60 --net-ro-size 1000 --net-ro-interval 1 --net-ri-port 0 --net-ro-port 30002 --net-sbs-port 30003 --net-bi-port 30004,30104 --net-bo-port 30005"
JSON_OPTIONS="--json-location-accuracy 1"

Compared to the default configuration file the RECEIVER_OPTIONS are changed to "--net-only".

Ctrl-x to exit, press y (yes) to save.

To apply the changes to the dump1090-fa config you need to restart it:

sudo systemctl restart dump1090-fa

1 c) Other feed clients

If you are using other feed clients set them up as if you had a standard dump1090-fa running.
Use Beast as the protocol and 30005 as port.


2 Download airspy_adsb

cd
mkdir airspy
cd airspy
wget -O airspy.tgz http://airspy.com/downloads/airspy_adsb-linux-arm.tgz
tar xzf airspy.tgz
sudo cp airspy_adsb /usr/local/bin/

3 Automatically starting airspy_adsb per systemd service:

Open /etc/systemd/system/airspy_adsb.service with nano using this command:

sudo nano /etc/systemd/system/airspy_adsb.service

Copy and paste the following:

[Unit]
Description=Airspy ADS-B receiver
Documentation=https://discussions.flightaware.com/t/howto-airspy-mini-piaware-dump1090-fa-configuration/44343/2

[Service]
EnvironmentFile=/etc/default/airspy_adsb
ExecStart=/usr/local/bin/airspy_adsb $NET $OPTIONS $G $GAIN $M $SAMPLE_RATE
Restart=always
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=airspy_adsb
User=root
Group=root
Environment=NODE_ENV=production
Nice=-19

[Install]
WantedBy=multi-user.target

Ctrl-X to exit, press Y (yes) to save.

Open /etc/default/airspy_adsb with nano using this command:

sudo nano /etc/default/airspy_adsb

Paste this and modify it as needed:

#gain is 0 to 21, each step of gain is equivalent to about 3dB, so reduce in increments of 1 if 21 is too high
GAIN=21

#other options
OPTIONS= -f 1 -p

#sample rate can be 12 or 20, 20 may not work depending on the system
SAMPLE_RATE=12

#don't change:
G=-g
M=-m

#network settings
NET= -l 29999:beast -l 47806:asavr  -c localhost:30104:beast

Add -b to enable the bias tee if necessary.
Adjust the gain by changing the number after -g .
You don’t need to change any other options.

Ctrl-x to exit, press y (yes) to save.

After creating and saving those two files the service needs to be enabled:

sudo systemctl daemon-reload
sudo systemctl enable airspy_adsb
sudo reboot

Now airspy_adsb should be starting on boot.


4 Changing airspy_adsb options

If you want to change the airspy options edit the option file with the command

sudo nano /etc/default/airspy_adsb

Ctrl-x to exit, press y (yes) to save.

Restart airspy_adsb with

systemctl restart airspy_adsb


5 Discussion of airspy_adsb options

(the rest of the guide assumes that the networking options -l 30005:beast -c localhost:30104:beast are used, the other options are up to you)
(the following commands assume the program (executable) is located in the folder /usr/local/bin which it should be if you downloaded it as described in step 2)

Sample command line to start airpsy_adsb:
(for example if you don’t use systemd and couldn’t use step 3)

sudo nice -n -19 -- /usr/local/bin/airspy/airspy_adsb -l 29999:beast -c localhost:30104:beast -m 12 -f 1 -p -g 21

Add -b to enable the bias tee if necessary.
Adjust the gain by changing the number after -g.
You don’t need to change any other options.

Refer to the programs help to see what the options mean if you are curious:

airspy_adsb -h

-m 20 can yield better results than -m 12 but is not recommended for the Raspberry Pi as the USB can be too slow to handle the amount of data properly.
(even on the newest Raspberry Pi 3B+ -m20 is not recommended, testing has shown problems with MLAT when the message rate exceeds 1600) (Checking for lost packages from Airspy)

If you have questions or the guide is not working for you please let me know and i will change this post and try to answer your questions.


#3

Good work @wiedehopf. :+1: :+1: :+1:
This updated and clear how-to was needed.


#4

Observation:

  1. At the second option (Configuration if you installed piaware/dump1090-fa via apt / apt-get), the code snippet has at the end bo port 0 instead of 30005. In the following text is correct, but the snippet has to be corrected.
  2. The service route to start airspy is cumbersome. I use the “sudo nano etc/rc.local” to stat it.

#5

Command line option explanations

I’ll collect some explanation on the command line option for airspy_adsb in this post:

-r Reduced IF bandwidth

This option limits the bandwidth of the signal visible to the ADC to about 3.5 MHz instead of the default 9 MHz. This can be useful in some situations when you have some broadband noise right over the 1090 MHz band. But mind you, reducing the bandwidth of a signal also smooths the transitions between 0 and 1 levels in the time domain. This makes the detection harder or even impossible in some cases.

(written by prog the developer of airspy_adsb here: Thoughts on optimizing gain)


-x Enable DX mode

-x is unrelated to oversampling. It simply tells the decoder to trust more frames that are likely to be good.

(written by prog here: Planes but not feeding)


-m <mlat_freq> MLAT frequency in MHz: 12 or 20

This option name is a little misleading, more accurate would be: Sample Rate.
Basically it determines how often the ADC is read. Setting this to 20 will use a lot more USB bandwidth and CPU power for decoding. On a Raspberry Pi using 20 therefore might not work.


-p Enable Bit Packing
In short if -m20 is not working properly you can try adding -p to the options (actually i included it by default when you use my configuration file)

Also, what exactly does bit packing do and is it ever a bad thing?

Bit packing tells the hardware to pack every 2 x 12bit samples into 3 bytes instead of sending every samples as a 16bit integer. This saves 25% of the USB bandwidth, but leaves less headroom in the MCU for synchronizing the USB with the ADC. In general, it helps with some old computers or SBCs.
(Answer by prog HOWTO: Airspy mini and Airspy R2: Piaware / dump1090-fa configuration)


Thoughts on optimizing gain
#6

No, both 1090-fa need to be 30005. Airpsy doesn’t need to output on 30005.
Take a look at this too:
https://airspy.com/quickstart/

FlightAware Integration

The easiest way to integrate Airspy into an existing FlightAware PiAware system is to feed dump1090 through its “MLAT result” port.

mkdir airspy cd airspy wget https://airspy.com/downloads/airspy_adsb-linux-arm.tgz tar xzf airspy_adsb-linux-arm.tgz sudo ./airspy_adsb -c localhost:30104:beast -c sdrsharp.com:47806:avr -p &


#7

I wanted to keep the configuration consistent with the piaware sd-card.
So i chose this configuration.

It is different from yours but it is correct.
And airspy really doesn’t care if it needs to provide the data via one or two ways.
You can either have a daisy chain where the data goes to dump1090 then to piaware.
Or you provide the data to dump1090 via 30104 as a push client and provide piaware the data via listening on 30005.

The push client only method does not work with the piaware sd-card image and i wanted to have a single airspy configuration for my HOWTO :slight_smile:

@prog

You might want to add to this information that it won’t work with the piaware sd-card image.
Feel free to copy my HOWTO to your web page after testing/verifying it :slight_smile:


#8

Well… I guess is more than one way to skin a cat.
Personally I wanted to keep consistency with what manufacturer of airspy recommends on their site for FA compatibility (link above), to eliminate confusions. In my dump1090-fa add-on, I think the default was for bo 30005, not 0. But I can’t guarantee now and I don’t feel like reinstalling it.

Also, the push method worked if the piaware config file was set on “relay”. Obj presented that clearly:

relayconfig "OUTPUT_OPTIONS=\"--listen 30005:R --connect localhost:30104:R\""
::fa_config_generator::generate_file "/etc/default/beast-splitter"

#9

The relay config only means beast splitter will be pushing any data it gets into dump1090-fa via 30104 while also offering them on 30005.

beast-splitter INPUT is configured like this:

lappend relayconfig "INPUT_OPTIONS=\"--net [$config get receiver-host]:[$config get receiver-port] $force\""

So it connects to the IP receiver-host on the port receiver-port. (Even if you would enter localhost:30104 here this would not work as dump1090-fa only accepts but does not provide data on that port)

dump1090 is configured for net-only and bo-port of 0:

lappend receiverOpts "--net-only" "--net-bo-port 0" "--fix"

Data makes it way to dump1090-fa but not to beast-splitter or piaware.


#10

Very good job :slight_smile:
Linked in the Quick Start guide.


#11

Yep, that’s how Obj did it on his SD card install - to use beast splitter instead of dump1090-fa built-in.
Personally I have left the default config for the dump1090-fa as installed - that is with “bo 30005”. That takes the data from bi and mirrors it to bo port.
Like I said, that’ show the airspy people choose to show it too. No big deal, as long as is understood.


#12

Haha, the airspy people linked this thread on their “Quick Start” page, instead of what they had there previosly! Good job!
https://airspy.com/quickstart/

Scroll down to " FlightAware Integration".


#13

I guess you didn’t get the memo, prog who posted above you is literally THE airspy guy :wink:

Anyway i thought about also including the rc local method for startup but actually in regards to logging errors to syslog and also restarting/stopping the service, the systemd service is quite nice.

And i don’t think the setup is much harder.


#14

I didn’t get the memo :smiley:


#15

To me that does not make too much sense. If you type systemctl status airspy_adsb you will get a message like airspy_adsb.service - airspy_adsb, the description of the service as the name of the service. I suggest you provide a more meaningful text similar to the one in my file. I.e. the description for piaware is FlightAware ADS-B uploader.


#16

Impressed how quickly the reactions are in this forum. Actually, we could even add

Documentation=https://discussions.flightaware.com/t/howto-airspy-mini-piaware-dump1090-fa-configuration/44343

in the [Unit] section. :sunglasses:

And may I suggest a rename of the thread? It’s not very Airspy mini specific, virtually all of it also applies to the Airspy R2. I’d just leave the mini. It may change the documentation link however. Note most people find this thread through search engines.


#17

¯_(ツ)_/¯

The number displaying new posts in the website title is sure useful.

Anyway the thread is linked on the manufacturers website now so … that’s where people might check.


#18

Could this be included in the debian package airspy? Then the howto would crunch down to making some decisions in the /etc/default/airspy_adsb-file.


#19

Didn’t know airspy had a debian package.
(The binary is just dowloaded and extracted)

Anyway it’s not that complicated and the howto is rather detailed :slight_smile:
So i don’t see a upside of including it to be honest.
If it had a debian package it could of course just install a service itself and leave it to the user to enable it.


#20

The package is there but I found out only after downloading manually.

$ apt-cache showpkg airspy

All the common packages (piaware, gpsd, ntp, …) have their corresponding service file and default configuration file included so why not this one. I am sure you agree that googling for additional files in a forum, copying them in a new file is not the most straightforward way of installing a program. Yes the user should have the choice whether to enable the service during startup. Just as i.e. GPSD.