Dual Source GPS/DCF77 NTP-Server with AIS and ADS-B receivers: Unterschied zwischen den Versionen

Aus DL8RDS Wiki
Wechseln zu: Navigation, Suche
(Image and packages)
(Ensure that you have a NTPd what can handle PPS and DFC-77)
Zeile 141: Zeile 141:
  
 
The package, once again has to be modified and rebuilt:
 
The package, once again has to be modified and rebuilt:
 +
 +
* Get the build dependencies and the source code of the package:
 +
cd ~
 +
apt-get -y build-dep ntp
 +
apt-get -y source ntp
 +
* The source code was stored in my home directory. In the moment and for me it is the version '''ntp-4.2.6.p5+dfsg'''. Note that it could be different for you.
 +
cd ntp-4.2.6.p5+dfsg/debian/
 +
* Edit the '''rules''' file and add the missing support for PPS/ATOM. Search for '''configure''' and append a line at the end of the statement. Don't forget the '''\''' at the end of the previous line.
 +
./configure CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' \
 +
                --prefix=/usr \
 +
                --enable-all-clocks --enable-parse-clocks --enable-SHM \
 +
                --disable-debugging --sysconfdir=/var/lib/ntp \
 +
                --with-sntp=no \
 +
                --with-lineeditlibs=edit \
 +
                --without-ntpsnmpd \
 +
                --disable-local-libopts \
 +
                --enable-ntp-signd \
 +
                --disable-dependency-tracking \
 +
                --with-openssl-libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
 +
                --enable-ATOM
 +
                --enable-JUPITER \
 +
                --enable-ONCORE \
 +
                --enable-LOCAL-CLOCK \
 +
                --enable-RAWDCF \
 +
                --enable-HOPF6021 \
 +
                --enable-TRIMTSIP \
 +
                --enable-NMEA
 +
 +
: Note that I am enabling some more GPS technologies because I have some Navman Jupiters hhere, and I would like to use them in the future...
 +
 +
* Now add the '''changelog''' file so that it reflects the change:
 +
ntp (1:4.2.6.p5+dfsg-7+deb8u1) jessie-security; urgency=medium
 +
: into:
 +
ntp (1:4.2.6.p5+dfsg-8+deb8u1) jessie-security; urgency=medium
 +
* Now 'cd' into the package directory and build the package.
 +
cd ..
 +
sudo dpkg-buildpackage -b
 +
: It will take a while now. In my case three deb files were created:
 +
-rw-r--r-- 1 root root  351566 Dec  2 00:37 ntp_4.2.6.p5+dfsg-8+deb8u2_armhf.deb
 +
-rw-r--r-- 1 root root  69132 Dec  2 00:37 ntpdate_4.2.6.p5+dfsg-8+deb8u2_armhf.deb
 +
-rw-r--r-- 1 root root 1031588 Dec  2 00:36 ntp-doc_4.2.6.p5+dfsg-8+deb8u2_all.deb
 +
* Now install them:
 +
dpkg -i ntp_4.2.6.p5+dfsg-8+deb8u2_armhf.deb
 +
dpkg -i ntpdate_4.2.6.p5+dfsg-8+deb8u2_armhf.deb
 +
dpkg -i ntp-doc_4.2.6.p5+dfsg-8+deb8u2_all.deb
 +
* Now restart the ntp server with the command '''service ntp restart''' and after ~ 1 minute it should give you this output using '''ntpq -p''':
  
 
== Results ==
 
== Results ==

Version vom 10. Dezember 2016, 23:14 Uhr

1 Scope

This project is a continuation of my stream of experiments with the NTP protocol and GPS-disciplined clock models. I need to reference the past projects before we go into details:

These past projects raised the question, how precise a DCF-77 clock would be. And this project here also needs to be seen in the context of an April 1st joke of Rainer DF2NU, who proposed that DCF-77 can be switched off now because the GPS system is there and it is much more precise. So I started to collect ideas to investigate how less precise a DCF-77 disciplined clock model would be compared to the GPS Pulse Per Second. The reason for the reduced precision is because the 77,5 kHz signals are reflected randomly in the ionosphere and the exact reflection point cannot be predicted, resulting in a varying signal runtime.

In addition to the clock question I was thinking of setting up a pair of receivers for the AIS frames broadcasted around Regensburg by the shipd on the danube and I wanted to receove ADS-B frames. Even though slowly navigating ships allow for some frame processing delay, and in case the delay is a couple of seconds, one would still consider such an application a real time application. A jet plane however travels quite distance in a couple of seconds, so a positioning application would need to add some timestamping logic in order to allow for a realistic position information, particularly if received by multiple receivers.

For this reason it makes perfect sense to add a precise clock to a position frame receiver setup.

2 List of components

~ 560 Euro

The prices are partly a bit over the market, roundet up, so that there are no surprises.

3 Configuration

3.1 Image and Packages

The Raspberry installation is based on a Minibian 2016-03-12 image: https://minibianpi.wordpress.com/

I found that sometimes it is hard to install it into a running state with improper readers / adapters. But if you have a good adapter, it should work properly with any SD card.

The minibian standard image does not have a "pi" user like Raspian, but the login succeeds with "root" and "raspberry". Of yourse, this information is just for those who want to replicate my project. Be sure that I have chosen another password, and please do the same :-)

If you choose to attach a serial console to your Raspberry, you must make sure that the agetty stops attaching to your /dev/ttyAMA0 device. You can do that with the following commands:

systemctl stop serial-getty@ttyAMA0.service
systemctl disable serial-getty@ttyAMA0.service
systemctl mask serial-getty@ttyAMA0.service

Then reboot and check if it has succeeded using lsof. I think it does not come with the Minibian distro, so it is one of the tools you need to install:

lsof | grep ttyAMA0

3.2 Hardware Connectivity and Kernel

I configured the kernel like this:

cat /boot/config.txt
gpu_mem=16
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=pps-gpio,gpiopin=18
init_uart_baud=9600
enable_uart=0

Accordingly the kernel modules configuration file /etc/modules looks like this:

snd-bcm2835
i2c-bcm2708
i2c-dev

Since we have a FTDI to connect the GPS and another FTDI that is used in the GUDE DFC-77 clock, we need to keep them apart and ensure that they will always and forever in the future use the correct device name:

Check who is who:

root@multirx:/etc/udev/rules.d# lsusb | grep 403
Bus 001 Device 006: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 001 Device 005: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 004: ID 0403:e88a Future Technology Devices International, Ltd Expert mouseCLOCK USB II

Then create this file:

vi /etc/udev/rules.d/70-persistent-dev.rules
KERNEL=="ttyUSB*", ATTRS{idProduct}=="e88a", SYMLINK+="refclock-0"
KERNEL=="ttyUSB*", ATTRS{idProduct}=="6001", SYMLINK+="gps0"

These statements will give me the following devices:

/dev/refclock-0
/dev/gps0

The names are important because they need to correspond to the expectations of the accoring NTP modules.

3.3 Packages

I found that it makes sense to install the following tools:

apt-get update
apt-get install i2c-tools      # I2C-Toolkit for commandline
apt-get install python-smbus   # Python library for I2C
apt-get install libi2c-dev     # library for C
apt-get install git            # need this later...
apt-get install lsof           # determine who is using the serial port
apt-get install apache2        # for all the later web stuff
apt-get install lsusb          # see who is connected via USB


3.4 Fundamental system config

  • Configure the timezone using the command dpkg-reconfigure tzdata

3.5 NTP

3.5.1 Check that PPS works

The /dev/pps0 should be created upon boot if the Kernel-PPS module is loaded.

root@multirx:~# ppstest /dev/pps0
trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1462395271.608254834, sequence: 4022 - clear  0.000000000, sequence: 0
source 0 - assert 1462395272.608254999, sequence: 4023 - clear  0.000000000, sequence: 0
source 0 - assert 1462395273.608254163, sequence: 4024 - clear  0.000000000, sequence: 0
source 0 - assert 1462395274.608255327, sequence: 4025 - clear  0.000000000, sequence: 0
source 0 - assert 1462395275.608373487, sequence: 4026 - clear  0.000000000, sequence: 0
^C
root@multirx:~# 


3.5.2 Ensure that you have a NTPd what can handle PPS and DFC-77

Since I decided against using /dev/ttyAMA0 for the NMEA interface for NTP, I was rather free in terms of the serial device. Yet, I connected the PPS pin to GPIO 18.

The package, once again has to be modified and rebuilt:

  • Get the build dependencies and the source code of the package:
cd ~
apt-get -y build-dep ntp
apt-get -y source ntp
  • The source code was stored in my home directory. In the moment and for me it is the version ntp-4.2.6.p5+dfsg. Note that it could be different for you.
cd ntp-4.2.6.p5+dfsg/debian/
  • Edit the rules file and add the missing support for PPS/ATOM. Search for configure and append a line at the end of the statement. Don't forget the \ at the end of the previous line.
./configure CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' \
               --prefix=/usr \
               --enable-all-clocks --enable-parse-clocks --enable-SHM \
               --disable-debugging --sysconfdir=/var/lib/ntp \
               --with-sntp=no \
               --with-lineeditlibs=edit \
               --without-ntpsnmpd \
               --disable-local-libopts \
               --enable-ntp-signd \
               --disable-dependency-tracking \
               --with-openssl-libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
               --enable-ATOM
               --enable-JUPITER \
               --enable-ONCORE \
               --enable-LOCAL-CLOCK \
               --enable-RAWDCF \
               --enable-HOPF6021 \
               --enable-TRIMTSIP \
               --enable-NMEA
Note that I am enabling some more GPS technologies because I have some Navman Jupiters hhere, and I would like to use them in the future...
  • Now add the changelog file so that it reflects the change:
ntp (1:4.2.6.p5+dfsg-7+deb8u1) jessie-security; urgency=medium
into:
ntp (1:4.2.6.p5+dfsg-8+deb8u1) jessie-security; urgency=medium
  • Now 'cd' into the package directory and build the package.
cd ..
sudo dpkg-buildpackage -b
It will take a while now. In my case three deb files were created:
-rw-r--r-- 1 root root  351566 Dec  2 00:37 ntp_4.2.6.p5+dfsg-8+deb8u2_armhf.deb
-rw-r--r-- 1 root root   69132 Dec  2 00:37 ntpdate_4.2.6.p5+dfsg-8+deb8u2_armhf.deb
-rw-r--r-- 1 root root 1031588 Dec  2 00:36 ntp-doc_4.2.6.p5+dfsg-8+deb8u2_all.deb
  • Now install them:
dpkg -i ntp_4.2.6.p5+dfsg-8+deb8u2_armhf.deb
dpkg -i ntpdate_4.2.6.p5+dfsg-8+deb8u2_armhf.deb
dpkg -i ntp-doc_4.2.6.p5+dfsg-8+deb8u2_all.deb
  • Now restart the ntp server with the command service ntp restart and after ~ 1 minute it should give you this output using ntpq -p:

4 Results

5 Integration

6 Images

2016-12-10-MultiRX-1.jpg 2016-12-10-MultiRX-6.jpg

2016-12-10-MultiRX-3.jpg 2016-12-10-MultiRX-2.jpg

2016-12-10-MultiRX-4.jpg 2016-12-10-MultiRX-5.jpg

2016-12-10-MultiRX-7.jpg 400px