How-to Feed Plane Plotter Site directly from Raspberry Pi


#1

This method is applicable to:

  • Piaware SD Card image
  • Raspbian image with dump1090-fa and Piaware package install
  • Raspbian image with dump1090-mutability and Piaware package install

CREDITS:
David & Cecilia Taylor
http://www.satsignal.eu/raspberry-pi/dump1090.html
.

Last update: July 14, 2018

STEP-BY-STEP METHOD

(1) Install packages necessary to build and necessary to fulfil dependencies.

sudo apt-get update
sudo apt-get install git
sudo apt-get install librtlsdr-dev

sudo apt-get install cmake
sudo apt-get install libusb-1.0-0-dev 
sudo apt-get install pkg-config

(2) Build the Planeplotter uploader ppup1090 from source code of dump1090 (Malcolm Robb)

2.1 - Clone/download the dump1090 source code from Github.

cd ~
git clone git://github.com/MalcolmRobb/dump1090.git

2.2 - The downloaded directory’s name is dump1090. To make it clear that this is not dump1090 mut or fa, but is PlanePlotter Uploader, change it’s name to ppup

sudo mv dump1090 ppup

2.3 - Enter folder ppup

cd ppup

2.4 - Obtain Planeplotter Configuration/user key
Go to http://www.coaa.co.uk/rpi-request.htm and enter your details, and your co-ordinates. You will then be e-mailed your own personal copy of a file called coaa.h.

2.5 - Add Planeplotter Configuration/user key

In directory ppup, you will find dummy file coaa.h. Replace it with the coaa.h you have received by email. Use any one of following 2 options.

Option-1:
Use FileZilla or WinSCP or similar program to copy file coaa.h from your Desktop/Laptop to RPi in folder ppup.

The file coaa.h cannot be directly copied to folder ppup due to permissions problem. To overcome this problem, copy it to folder /home/pi which has permission for copying files using SCP or FTP.

Once you have a copy of file coaa.h in folder home/pi, SSH to Pi, and issue following command to copy it to folder ppup:

cd ~/
sudo cp coaa.h  ppup/ 

Option-2:
Open file coaa.h received by email using MS Word or Wordpad
It’s content will be like this:

//coaa.h configuration file for ab cd 2018-07-11 05:58:29
#define USER_REGNO xxxxxxx
#define USER_AUTHCODE xxxxxxxxxx
#define USER_LATITUDE xx.xxx
#define USER_LONGITUDE xx.xxx

open file coaa.h in RPi’s folder ppup for editing

cd ~/ppup
sudo nano coaa.h

following will be displayed

// coaa.h configuration file for Plane Plotter Uploader
//
// You MUST apply via the COAA website for your own personal version of this fi$
// Do not disclose the contents of this file to anyone thereafter as it uniquely
// identifies you to the PlanePlotter system
//

Press (Ctrl+k) to delete all these lines and make this file empty.
Copy-Paste all lines from the file coaa.h which you received by email) in the file coaa.h in RPi.
After pasting, it will become like this

//coaa.h configuration file for ab cd 2018-07-11 05:58:29
#define USER_REGNO xxxxxx
#define USER_AUTHCODE xxxxxxxxx
#define USER_LATITUDE xx.xxx
#define USER_LONGITUDE xx.xxx

Save (Ctrl+o) and close (Ctrl+x)

2.6 - Compile the ppup1090 (plane plotter uploader) from source code

NOTE: Only the “ppup1090” component of cloned source code needs to be compiled for uploading to Planeplotter. You don’t have to compile dump1090 itself, as dump1090 is already available in Piaware SD Card image (dump1090-fa), or you have already installed dump1090-fa / dump1090-mutability yourself.

cd ~/ppup
make -f makeppup1090

2.7 - TEST

cd ~/ppup
./ppup1090

(3) Make ppup1090 to auto-start at boot

3.1 - Create a blank file ppup-maint.sh

cd ppup
sudo touch ppup-maint.sh
sudo chmod +x ppup-maint.sh
sudo nano ppup-maint.sh

3.2 - Copy-paste this code
Then Save (Ctrl+o) and Close (Ctrl+x)

#! /bin/sh
while true
  do
    sleep 30
    /home/pi/ppup/./ppup1090  > /tmp/ppup.log 2>&1
  done

NOTE:
The log file /tmp/ppup.log grows in size very fast. You can stop loggig by using following code instead of above code

! /bin/sh
while true
  do
    sleep 30
    /home/pi/ppup/./ppup1090 
  done

3.3 - Open file rc.local to edit

sudo nano /etc/rc.local

In the file opened, copy-paste following line just above last line (i.e. above exit 0)
Then Save (Ctrl+o) and Close (Ctrl+x)

/home/pi/ppup/ppup-maint.sh &

(4) CHECKS

4.1 - Check log

cat /tmp/ppup.log

.

.

4.2 - Check ppup1090 is running

top

.

ppup
.


#2

Got to Step 3.4 and had a gas pain:

pi@piaware:~/dump1090$ make -f makeppup1090
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c ppup1090.c
Package librtlsdr was not found in the pkg-config search path.
Perhaps you should add the directory containing `librtlsdr.pc’
to the PKG_CONFIG_PATH environment variable
No package ‘librtlsdr’ found
In file included from ppup1090.h:35:0,
from ppup1090.c:31:
dump1090.h:60:25: fatal error: rtl-sdr.h: No such file or directory
#include “rtl-sdr.h”
^
compilation terminated.
makeppup1090:21: recipe for target ‘ppup1090.o’ failed
make: *** [ppup1090.o] Error 1
pi@piaware:~/dump1090$


#3

This happens when in step (2) the rtl-sdr is not build properly.

Did you get any error messages during step (2)? What is output of following command?

cd ~/rtl-sdr/build
sudo ldconfig

#4

pi@piaware:~/rtl-sdr/build$ sudo ldconfig
pi@piaware:~/rtl-sdr/build$

:frowning:

Blank…

EDIT:

Reran Step 2. Closer now…

New error:
pi@piaware:~/dump1090$ make -f makeppup1090
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c ppup1090.c
Assembler messages:
Fatal error: can’t create ppup1090.o: Permission denied
makeppup1090:21: recipe for target ‘ppup1090.o’ failed
make: *** [ppup1090.o] Error 1


#5

.
That is exactly what you should get if the rtl-sdr is built properly.

The problem came becaue after last command
of step-2 (see below), you did not reboot.

cd ~ 
sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/ 

.
It is my mistake. I forgot the reboot command at the end of step-2. I have now added it.


#6

Same…do I need to redo steps after 2 and before 3.4? coaa.h file is ok - checked it.

pi@piaware:~ cd ~/dump1090 pi@piaware:~/dump1090 make -f makeppup1090
gcc -O2 -g -Wall -W pkg-config --cflags librtlsdr -c ppup1090.c
Assembler messages:
Fatal error: can’t create ppup1090.o: Permission denied
makeppup1090:21: recipe for target ‘ppup1090.o’ failed
make: *** [ppup1090.o] Error 1


#7

Try with sudo

cd ~/dump1090
sudo make -f makeppup1090

#8

My bad…I changed permissions to dump1090 when trying to get pi access to FTP. Seems to be working:


ppup1090 RPi Uploader for COAA Planeplotter Ver : 1.10.3010.14

MLAT: 0, DF11: 0/0, DF17: 0/0, IP 0.0.0.0:0 ICAO 000000
SMU : 0, DF11: 0/0, DF17: 0/0, IP 0.0.0.0:0
HTTP: 0, DF11: 0/0, DF17: 0/0, IP 0.0.0.0:0
Next upload in 23 sec.
Last upload 74 aircraft; 41 with position, 33 without position.
Total uploads 74 aircraft.
HTTP/1.1 200 OK
Date: Wed, 11 Jul 2018 22:26:32 GMT
Server: Apache
Connection: close
Content-Length: 0
Content-Type: text/html; charset=UTF-8


#9

The best way to copy coaa.h from your desktop/laptop to Pi is to first copy it to home directory /home/pi or ~/. The home directory already has necessay permission for FTP or SCP.

Once the file coaa.h is copied to home folder, you can copy it to dump1090 folder by following command without need to change permissions of folder dump1090

cd ~/
sudp cp coaa.h ~/dump1090/

EDIT:
Included above detail in Step 3.3, Option-1


#10

Got it, thnx.

Last thing is that I don’t see it running via TOP. I built the auto start but that seemed to not work. Re-checking.

EDIT: Ran it manually and it looks like it’s running now. Have to debug why it didn’t autostart on reboot.

image

image


#11

hi abcd567

had the following issues at step 2

root@traSD32:~# cd /home/pi/rtl-sdr/build
root@traSD32:/home/pi/rtl-sdr/build# cd ~

root@traSD32:~# sudo cp ./rtl-sdr/rtl-sdr.rules /home/pi

cp: cannot stat ‘./rtl-sdr/rtl-sdr.rules’: No such file or directory```

tested it by trying to copy back to /home/pi and it worked
as I was in the root dir, I felt the dot was not needed.

root@traSD32:~# sudo cp /home/pi/rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
root@traSD32:~#

so proceeded normally after that and it works. thanks

root@traSD32:/home/pi# cd dump1090

root@traSD32:/home/pi/dump1090# make -f makeppup1090

gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr`  -c ppup1090.c
gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr`  -c anet.c
gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr`  -c interactive.c
gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr`  -c mode_ac.c
gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr`  -c mode_s.c
gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr`  -c net_io.c
gcc -g -o ppup1090 ppup1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o coaa1090.obj `pkg-config --libs librtlsdr` -lpthread -lm

root@traSD32:/home/pi/dump1090# ls
anet.c        dump1090.dsw                   makedump1090  mode_s.o    ppup1090.sh  tools
anet.h        dump1090.h                     Makefile      net_io.c    pthreads     view1090.c
anet.o        dump1090.rc                    makeppup1090  net_io.o    public_html  view1090.dsp
coaa1090.obj  dump1090.sh                    makeview1090  ppup1090    README.md    view1090.h
coaa.h        dump1090-win.1.10.3010.14.zip  mode_ac.c     ppup1090.c  rtlsdr       winstubs.h
dump1090.c    interactive.c                  mode_ac.o     ppup1090.h  testfiles
dump1090.dsp  interactive.o                  mode_s.c      ppup1090.o  TODO


root@traSD32:/home/pi/dump1090# ./ppup1090


-----------------------------------------------------------------------------
|    ppup1090 RPi Uploader for COAA Planeplotter         Ver : 1.10.3010.14 |
-----------------------------------------------------------------------------
MLAT: 0, DF11: 0/0, DF17: 0/0, IP 0.0.0.0:0 ICAO 000000
SMU : 0, DF11: 0/0, DF17: 0/0, IP 0.0.0.0:0
HTTP: 0, DF11: 0/0, DF17: 0/0, IP 0.0.0.0:0
Next upload in 31 sec.
Last upload 8 aircraft;  5 with position, 3 without position.
Total uploads 8 aircraft.
HTTP/1.1 200 OK
Date: Wed, 11 Jul 2018 23:12:32 GMT
Server: Apache
Connection: close
Content-Length: 0
Content-Type: text/html; charset=UTF-8


^Z
[1]+  Stopped                 ./ppup1090
root@traSD32:/home/pi/dump1090# killall ppup1090
root@traSD32:/home/pi/dump1090#

then I tried same in /adsb-receiver/build/dump1090-mutability/dump1090 and it failed.


#12

The ppup1090 source code and make files are included in dump1090 (Malcol Robb) version only.

The source code for ppup1090 is NOT included in source code of dump1090-mutability and dump1090-fa.


#13

correct, but I copied these from the rtl-sdr dir and this is what I got

root@traSD32:/home/pi/adsb-receiver/build/dump1090-mutability/dump1090# make -f makeppup1090
gcc -O2 -g -Wall -W `pkg-config --cflags librtlsdr`  -c ppup1090.c
ppup1090.c: In function ‘ppup1090InitConfig’:
ppup1090.c:54:10: error: ‘struct <anonymous>’ has no member named ‘bEnableDFLogging’
     Modes.bEnableDFLogging        = 1;
          ^
ppup1090.c:56:10: error: ‘struct <anonymous>’ has no member named ‘net_input_beast_port’
     Modes.net_input_beast_port    = MODES_NET_OUTPUT_BEAST_PORT;
          ^
ppup1090.c:56:37: error: ‘MODES_NET_OUTPUT_BEAST_PORT’ undeclared (first use in this function)
     Modes.net_input_beast_port    = MODES_NET_OUTPUT_BEAST_PORT;
                                     ^
ppup1090.c:56:37: note: each undeclared identifier is reported only once for each function it appears in
ppup1090.c:57:10: error: ‘struct <anonymous>’ has no member named ‘interactive_delete_ttl’
     Modes.interactive_delete_ttl  = MODES_INTERACTIVE_DELETE_TTL;
          ^
ppup1090.c:57:37: error: ‘MODES_INTERACTIVE_DELETE_TTL’ undeclared (first use in this function)
     Modes.interactive_delete_ttl  = MODES_INTERACTIVE_DELETE_TTL;
                                     ^
ppup1090.c:59:37: error: ‘MODES_USER_LATITUDE_DFLT’ undeclared (first use in this function)
     Modes.fUserLat                = MODES_USER_LATITUDE_DFLT;
                                     ^
ppup1090.c:60:37: error: ‘MODES_USER_LONGITUDE_DFLT’ undeclared (first use in this function)
     Modes.fUserLon                = MODES_USER_LONGITUDE_DFLT;
                                     ^
ppup1090.c: In function ‘ppup1090Init’:
ppup1090.c:75:30: error: ‘struct <anonymous>’ has no member named ‘pDF_mutex’
     pthread_mutex_init(&Modes.pDF_mutex,NULL);
                              ^
ppup1090.c:80:24: error: ‘struct <anonymous>’ has no member named ‘icao_cache’
     if ( NULL == (Modes.icao_cache = (uint32_t *) malloc(sizeof(uint32_t) * MODES_ICAO_CACHE_LEN * 2)))
                        ^
ppup1090.c:80:77: error: ‘MODES_ICAO_CACHE_LEN’ undeclared (first use in this function)
     if ( NULL == (Modes.icao_cache = (uint32_t *) malloc(sizeof(uint32_t) * MODES_ICAO_CACHE_LEN * 2)))
                                                                             ^
ppup1090.c:87:17: error: ‘struct <anonymous>’ has no member named ‘icao_cache’
     memset(Modes.icao_cache, 0,   sizeof(uint32_t) * MODES_ICAO_CACHE_LEN * 2);
                 ^
ppup1090.c:109:5: warning: implicit declaration of function ‘modesInitErrorInfo’ [-Wimplicit-function-declaration]
     modesInitErrorInfo();
     ^
ppup1090.c:113:25: error: ‘MODES_USER_LATITUDE_DFLT’ undeclared (first use in this function)
     coaa1090.fUserLat = MODES_USER_LATITUDE_DFLT;
                         ^
ppup1090.c:114:25: error: ‘MODES_USER_LONGITUDE_DFLT’ undeclared (first use in this function)
     coaa1090.fUserLon = MODES_USER_LONGITUDE_DFLT;
                         ^
ppup1090.c: In function ‘main’:
ppup1090.c:192:18: error: ‘struct <anonymous>’ has no member named ‘net_input_beast_port’
             Modes.net_input_beast_port = atoi(argv[++j]);
                  ^
ppup1090.c:218:83: error: ‘struct <anonymous>’ has no member named ‘net_input_beast_port’
     if ((fd = anetTcpConnect(Modes.aneterr, ppup1090.net_input_beast_ipaddr, Modes.net_input_beast_port)) == ANET_ERR) {
                                                                                   ^
ppup1090.c:219:95: error: ‘struct <anonymous>’ has no member named ‘net_input_beast_port’
         fprintf(stderr, "Failed to connect to %s:%d\n", ppup1090.net_input_beast_ipaddr, Modes.net_input_beast_port);
                                                                                               ^
ppup1090.c:238:10: error: ‘struct <anonymous>’ has no member named ‘bis’
     Modes.bis  = fd;
          ^
ppup1090.c:243:9: warning: implicit declaration of function ‘modesReadFromClient’ [-Wimplicit-function-declaration]
         modesReadFromClient(c,"",decodeBinMessage);
         ^
ppup1090.c:243:34: error: ‘decodeBinMessage’ undeclared (first use in this function)
         modesReadFromClient(c,"",decodeBinMessage);
                                  ^
ppup1090.c:244:9: warning: implicit declaration of function ‘interactiveRemoveStaleAircrafts’ [-Wimplicit-function-declaration]
         interactiveRemoveStaleAircrafts();
         ^
makeppup1090:21: recipe for target 'ppup1090.o' failed
make: *** [ppup1090.o] Error 1

I even recompiled dump1090 to include the coaa.h but…no joy…


#14

So the easiest way is to keep dum1090-mutability (or fa) and dump1090 malcolm robb separate from each other, using MR version for ppup1090 only.


#15

@vannossc
@evangelyul

  1. Keep an eye on size of log file /tmp/ppup.log.
    It grows very rapidly: new data EVERY SECOND :frowning:

    Edit: Since I have located ppup.log in /tmp folder, it gets deleted at reboot, then the script ppup1090-maint.sh recreates a blank file, and starts stuffing it with data. The log file again fattens after a while.

  2. I will now check possibility to simplify steps (1) and (2). Instead of bulding rtl-sdr from source code, I will install pre-built package by following command. This will simllify steps (1) and (2).

sudo apt-get install rtl-sdr

#16

correct. in PP Windoze ver, there is an option to turn-off logging.
when i run ./ppup1090 --help there is no option regarding log.

root@traSD32:/home/pi/dump1090# ./ppup1090 --help
-----------------------------------------------------------------------------
|    ppup1090 RPi Uploader for COAA Planeplotter         Ver : 1.10.3010.14 |
-----------------------------------------------------------------------------
--net-bo-ipaddr <IPv4>   TCP Beast output listen IPv4 (default: 127.0.0.1)
--net-bo-port <port>     TCP Beast output listen port (default: 30005)
--net-pp-ipaddr <IPv4>   Plane Plotter LAN IPv4 Address (default: 0.0.0.0)
--quiet                  Disable output to stdout. Use for daemon applications
--help                   Show this help

#17

In automated start-up script ppup1090-maint.sh, the logging is done by this part of command:
> /tmp/ppup.log 2>&1

Removing above part from command will stop logging.
The file ppup1090-maint.sh will become like this:

#! /bin/sh
while true
  do
    sleep 30
    /home/pi/dump1090/./ppup1090 
  done

#18

@vannossc
@evangelyul

Please see updated Post #1

Last update: July 14, 2018

  1. The Step “clone/download the rtl-sdr source code from Github and build it” is deleted.
    This step, although recommended in David Taylor’s web site, is not required for above noted installs.

  2. After download, the cloned folder dump1090 is renamed to ppup to make it easily identifiable as planeplotter folder.

  3. Some other minor enhancements.