ADS-B Receiver Project Setup Scripts

May be the file “/home/pi/adsb-feeder/bash/feeders/adsbexchange.sh” needs review/revision (see two red parts, looks dual assignment)??

pi@raspberrypi:~ $ cat /home/pi/adsb-feeder/bash/feeders/adsbexchange.sh
#!/bin/bash

#####################################################################################

ADS-B FEEDER

#####################################################################################

This script is not meant to be executed directly.

Instead execute install.sh to begin the installation process.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

Copyright (c) 2015 Joseph A. Prochazka

Permission is hereby granted, free of charge, to any person obtaining a copy

of this software and associated documentation files (the “Software”), to deal

in the Software without restriction, including without limitation the rights

to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

copies of the Software, and to permit persons to whom the Software is

furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all

copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

SOFTWARE.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

VARIABLES

BUILDDIR=$PWD
ADSBEXCHANGEDIR=“$BUILDDIR/adsbexchange”

source …/bash/functions.sh

INFORMATIVE MESSAAGE ABOUT THIS SOFTWARE

clear

echo -e “\033[31m”
echo “-----------------------------------------------------”
echo " Now ready to set up ADS-B Exchange feed."
echo “-----------------------------------------------------”
echo -e “\033[33mADSBexchange.com is a co-op of ADS-B/Mode S/MLAT feeders from around the world.”
echo “PiAware is required to be installed in order to feed this site. If PiAware is not”
echo “currently installed this script will execute the PiAware installation script after”
echo “which this script will continue with the ADS-B Exchange feed setup.”
echo “”
echo “Ways To Join The Exchange - ADS-B Exchange
echo “GitHub - flightaware/piaware: Client-side package and programs for forwarding ADS-B data to FlightAware
echo -e “\033[37m”
read -p “Press enter to continue…” CONTINUE

CHECK FOR PREREQUISITE PACKAGES

echo -e “\033[33m”
echo “Installing packages needed to build and fulfill dependencies…”
echo -e “\033[37m”
CheckPackage netcat

CONFIGURE PIAWARE TO FEED ADS-B EXCHANGE IF PIAWARE IS INSTALLED

echo -e “\e[33m”
printf “Configuring PiAware if it is installed…”
if [ $(dpkg-query -W -f=‘${Status}’ piaware 2>/dev/null | grep -c “ok installed”) != 0 ]; then
echo -e “\033[33m”
[color=#FF0000]echo “Adding the ADS-B Exchange feed to PiAware’s configuration…”
ORIGINALFORMAT=sudo piaware-config -show | grep mlatResultsFormat | sed 's/mlatResultsFormat //g'
MLATRESULTS=sed 's/{}]//g' <<< $ORIGINALFORMAT
CLEANFORMAT=sed 's/ beast,connect,feed.adsbexchange.com:30005//g' <<< $MLATRESULTS
sudo piaware-config -mlatResultsFormat “${CLEANFORMAT} beast,connect,feed.adsbexchange.com:30005

echo "Restarting PiAware so new configuration takes effect..."
echo -e "\033[37m"
sudo piaware-config -restart
echo ""

fi

CONFIGURE SCRIPT TO EXECUTE NETCAT TO FEED ADS-B EXCHANGE

echo -e “\033[33mSetting permissions on adsbexchange-maint.sh…”
echo -e “\033[37m”
sudo chmod +x $ADSBEXCHANGEDIR/adsbexchange-maint.sh

[color=#FF0000]echo -e “\033[33mAdding startup line to rc.local…”
echo -e “\033[37m”
lnum=($(sed -n ‘/exit 0/=’ /etc/rc.local))
((lnum>0)) && sudo sed -i "${lnum[$((${#lnum[@]}-1))]}i ${ADSBEXCHANGEDIR}/adsbexchange-maint.sh &
" /etc/rc.local

START NETCAT ADS-B EXCHANGE FEED

echo -e “\033[33mExecuting adsbexchange-maint.sh…”
echo -e “\033[37m”
sudo $ADSBEXCHANGEDIR/adsbexchange-maint.sh &

echo -e “\033[33mConfiguration of the ADS-B Exchange feed is now complete.”
echo “Please look over the output generated to be sure no errors were encountered.”
echo -e “\033[37m”
read -p “Press enter to continue…” CONTINUE
pi@raspberrypi:~ $

[/quote]

The file “adsbexchange-maint.sh” for reference:

pi@raspberrypi:~ $ cat adsb-feeder/build/adsbexchange/adsbexchange-maint.sh
#! /bin/sh
while true
do
sleep 30
/bin/nc 127.0.0.1 30005 | /bin/nc feed.adsbexchange.com 30005
done
pi@raspberrypi:~ $

File /etc/rc.local for reference. Please see two lines above last line (exit 0):

pi@raspberrypi:~ $ cat /etc/rc.local
#!/bin/sh -e

rc.local

This script is executed at the end of each multiuser runlevel.

Make sure that the script will “exit 0” on success or any other

value on error.

In order to enable or disable this script just change the execution

bits.

By default this script does nothing.

Print the IP address

_IP=$(hostname -I) || true
if “$_IP” ]; then
printf "My IP address is %s
" “$_IP”
fi

/home/pi/adsb-feeder/build/dump978/dump978-maint.sh &

/home/pi/adsb-feeder/build/adsbexchange/adsbexchange-maint.sh &

exit 0
pi@raspberrypi:~ $

This is fixed.
It is a simple fix for a mistake on my part and it might be easier to just fix it manually.
Open /var/www/html/data/settings.xml in your favorite editor.
Look check if the wording “blog.php” exists in the file. If it does change it to “blog”.
Open /var/www/html/admin/index.php in your favorite editor.
Search the file for two occurrences of “blog.php” and change them to “blog”.

@sjacket99
dump978 output is logged to the file /var/log/dump978.log which is rotated weekly just like dump1090.
Also yes dump978 is started automatically when the device is booted.

Was the string “beast,connect,feed.adsbexchange.com:30005” added to your PiAware configuration?
After installing dump1090 and selecting to feed ADS-B Exchange the command “sudo piaware-config -show” should have the following for -mlatResultsFormat:
-mlatResultFormat {beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005}
If this is not the case let me know what you got.

The first section adds the ADS-B Exchange to the -mlatResultsFormat setting. The other adds the start up command for ADS-B Exchange to the file /etc/rc.local.

Yes initially it did show as you mentioned, then I chaged it. This is what happened:



#checked status
pi@raspberrypi:~ $ sudo piaware-config -show
contents of piaware config file '/root/.piaware':
mlatResultFormat {beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005}
password xxxxxxxx
user xxxxxxxx

#removed adsbexchange part by following command & restarted piaware.

pi@raspberrypi:~ $ sudo piaware-config -mlatResultsFormat "beast,connect,localhost:30104" 
pi@raspberrypi:~ $ sudo service piaware restart

#checked to make sure adsbexchange part is removed.

pi@raspberrypi:~ $ sudo piaware-config -show
contents of piaware config file '/root/.piaware':
mlatResultsFormat beast,connect,localhost:30104
password xxxxxxxx
user xxxxxxxx

pi@raspberrypi:~ $ sudo reboot


Checked /tmp/piaware.out, found Err 110 for adsbexchange is no more there.
Checked feed.adsbexchange.com/VirtualRadar/desktop.html, and found planes from Receiver CYYZ-1 are now showing.
.

@jprochazka,

Where do I change the heywhatsthat parameter and distance ring settings? (without re-running the install script)
I would like different distance rings.

I searched for the heywhatsthat parameter but only found it for the dump978 webpage.
I want to change to a different setting.

Jon

I would recommend downloading a new Json file from heywhatsthat.com using wget to replace the existing Json files. There are two places where the position from heywhatsthat.com are placed using wget when installing. The commands below can be used to replace both.

Replace PANARAMA_ID with the panorama ID displayed on heywhatsthat.com.
Replace ALTITUDE_ONE and ALTITUDE_TWO with the altitude in meters you want the rings to extend to.

First one is for dump1090-mutability:


sudo wget -O /usr/share/dump1090-mutability/html/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=PANARAMA_ID&refraction=0.25&alts=ALTITUDE_ONE,ALTITUDE_TWO" 

Second one is for dump978:


sudo wget -O /var/www/html/dump978/upintheair.json "http://www.heywhatsthat.com/api/upintheair.json?id=PANARAMA_ID&refraction=0.25&alts=ALTITUDE_ONE,ALTITUDE_TWO

@abcd567



#checked status
pi@raspberrypi:~ $ sudo piaware-config -show
contents of piaware config file '/root/.piaware':
mlatResultFormat {beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005}
password xxxxxxxx
user xxxxxxxx

Your mlatResultFormat setting looked proper with the ADS-B Exchange addition in the lines you posted.

Just an FYI: The maintenance script does not send MLAT positions this is why PiAware is configured to send MLAT data to feed.adsbexchange.com. Basically what you did was tell PiAware not to send MLAT data to ADS-B Exchange by removing “beast,connect,feed.adsbexchange.com:30005” from your mlatResultFormat setting.

This is the mlatResultsFormat setting on my live feeder and have not seen any of the errors mentioned. (ext_basestation,listen,30106 is there so VRS can get MLAT data from it)
mlatResultsFormat {beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005 ext_basestation,listen,30106}

If Dan has a custom port set up for you and you receive the error when changing the mlatResultsFormat to said port you might want to contact him and make sure it is still open on his end.

Thanks for the info.

Sorry, I realise that I wasn’t clear. I wanted to update both the heywhatsthat rings and the fixed distance rings.
Heywhatsthat is covered.

What about the distance rings?

J

@jprochazka

I have now only “beast,connect,localhost:30104” for my mlatResultFormat

How to add “beast,connect,feed.adsbexchange.com:30005” to my mlatResultFormat? When I tried to add it, “beast,connect,localhost:30104” disappeared.

There are two files you need to edit for the distance rings.

/usr/share/dump1090-mutability/html/config.js
/var/www/html/dump978/config.js

Look for the following and change the array to the distances you want.


// In nautical miles or km (depending settings value 'Metric')
SiteCirclesDistances = new Array(100,150,200);


sudo piaware-config -mlatResultFormat "beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005"

Did not work



pi@raspberrypi:~ $ sudo piaware-config -mlatResultFormat "beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005"
piaware-config : piaware-config -help|-user|-password|-start|-stop|-restart|-status|-show|-autoUpdate 1/0|-manualUpdate 1/0|-mlat 1/0|-mlatResults 1/0|-mlatResultsFormat formatlist
 -user value          specify the user name of a valid FlightAware account <>
 -password            interactively specify the password of the FlightAware account
 -autoUpdate value    1 = allow FlightAware to automatically update software on my Pi, 0 = no <>
 -manualUpdate value  1 = allow me to trigger manual updates through FlightAware, 0 = no <>
 -mlat value          1 = allow multilateration data to be provided, 0 = no <>
 -mlatResults value   1 = send multilateration results to localhost:30004, 0 = no <>
 -mlatResultsFormat value format(s) to generate mlat results in, 'default' to reset to the default format <>
 -start               attempt to start the ADS-B client
 -stop                attempt to stop the ADS-B client
 -restart             attempt to restart the ADS-B client
 -status              get the status of the ADS-B client
 -show                show config file
 --                   Forcibly stop option processing
 -help                Print this message
 -?                   Print this message

pi@raspberrypi:~ $ sudo piaware-config -show         
contents of piaware config file '/root/.piaware':
mlatResultsFormat beast,connect,localhost:30104
password xxxxxxxx
user xxxxxxxxx
pi@raspberrypi:~ $

I know I’m definitely in the learning mode, but this is not working for me.

Update! Tried one more time today 1/31 and everything seems to be working! Thanks.

I can say that Dump978 map and all is working.

Keep up the good work. :smiley:

Missing an ‘s’. Try


sudo piaware-config -mlatResultsFormat "beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005"

Wow, it worked, thanks! This dumb computer does not understand a typo. I feel we need to add spell check :smiley:



pi@raspberrypi:~ $ sudo piaware-config -show         
contents of piaware config file '/root/.piaware':
mlatResultsFormat beast,connect,localhost:30104
password xxxxxxxx
user xxxxxxxx
pi@raspberrypi:~ $ sudo piaware-config -mlatResultsFormat "beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005"

pi@raspberrypi:~ $ sudo piaware-config -show         
contents of piaware config file '/root/.piaware':
mlatResultsFormat {beast,connect,localhost:30104 beast,connect,feed.adsbexchange.com:30005}
password xxxxxxxx
user xxxxxxxx
pi@raspberrypi:~ $


Checked piaware log



pi@raspberrypi:~ $ cat /tmp/piaware.out
..........
..........
01/29/2016 22:34:44 piaware has successfully sent several msgs to FlightAware!
01/29/2016 22:34:44 multilateration support enabled (use piaware-config to disable)
01/29/2016 22:34:44 multilateration data requested, enabling mlat client
01/29/2016 22:34:44 Starting multilateration client: /usr/lib/piaware/helpers/fa-mlat-client --input-connect localhost:30005 --results beast,connect,localhost:30104 --results beast,connect,feed.adsbexchange.com:30005 --udp-transport 70.42.6.198:9321:115093776
01/29/2016 22:34:44 mlat(12995): fa-mlat-client 0.2.4 starting up
01/29/2016 22:34:44 mlat(12995): Using UDP transport to 70.42.6.198:9321
01/29/2016 22:34:44 mlat(12995): Input connected to localhost:30005
01/29/2016 22:34:45 mlat(12995): Beast-format results connection with localhost:30104: connection established
01/29/2016 22:34:45 mlat(12995): Beast-format results connection with feed.adsbexchange.com:30005: connection established
01/29/2016 22:35:13 147 msgs recv'd from dump1090-mutabi; 147 msgs sent to FlightAware
pi@raspberrypi:~ $


Thanks jprochazka
Both changes work.
:slight_smile:

I don’t know if I missed something or not. But I installed the new graph set up on 2 Pi’s and I am missing graph or have a empty space on both. Is this right or did something go wrong? Thanks.

That is correct. The empty space is due to a new graph that was added recently (Messages/AC/Sec). Maybe someone will come up with another new graph to fill the currently empty space.

Ok. Thanks.

I was able to connect to my both RPi’s from Virtual Radar Server on my Windows desktop.
After latest install on RPi-2, it is refusing to connect to VRS “No connection could be made to target machine as it is actively refusing connection”.
VRS settings on both RPI-1 & RPi-2 are Port 30003, Format “AVR or Beast Raw Feed”.

Any ideas?

Confirmed on mine as well (Actively refusing connections).

Thinking out loud, it is probably due to the dump1090 setting of 127.0.0.1.

Confirmed. Remove 127.0.0.1 and leave blank.


sudo dpkg-reconfigure dump1090-mutability

@usafpride
Thanks for the tip. It worked. Now VRS is able to connect to RPi-2