The files and instructions to get a rtklib RTK base station running on a Raspberry Pi
- Raspberry Pi Model b (I've used a Pi3)
- 8GB Micro SD card (I've used a Sandisk MAX ENDURANCE card)
- U-blox GPS module that supports RXM-RAWX output (I've used a Neo-M8T)
- 4g USB dongle (Huawei Unlocked E3372h)
Seeing as the Pi will most likely operate as a headless server, I've opted to setup everything from the get-go via SSH.
- A knowledge of the Linux (Raspberry Pi OS is based on Debian) command line interface (CLI)
- An SSH client PuTTY is a good one for Windows
- Download Raspberyy Pi OS Lite from the Raspberry Pi website
- Write the image to the SD card
- Enable the SSH server by adding an empty file called
ssh
(no extension) to the/boot
(small) partition on the SD card - Insert the SD card, connect the Pi to your router/switch and power the Pi up
- Connect to the Pi - the name of the computer will be
raspberrypi
with a username ofpi
and password ofraspberry
Configure the following using sudo rasbpi-config
- Under System Options, connect to your Wireless LAN, change the password and change the Hostname to something other than
raspberrypi
. - Under Performance Options, reduce the GPU Memory to the minimum (16MB) as it'll be headless.
- Under Localisation Options, set your Timezone and Keyboard.
- If you plan on adding a display to the GPIO header, eable SPI and I2C under Interface Options.
- Finish and reboot
If you don't want to use the user pi
, then you should add yourself to all the groups that the pi
user is a member of:
sudo usermod -a -G adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi <username>
The GPSD server for Debian Buster is quite an old version which doesn't fully support u-blox. So the Backports needs to be added to the package sources:
echo "deb http://deb.debian.org/debian buster-backports main" | tee --append /etc/apt/sources.list
sudo apt-get update
If apt-get update
returns an error saying "The following signatures couldn't be verified...", then you need to install each of the keys referenced:
Err:2 http://deb.debian.org/debian buster-backports InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 04EE7237B7D453EC NO_PUBKEY 648ACFD622F3D138
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
Update all packages, and then install all the required packages:
sudo apt-get dist-upgrade
sudo apt-get install dnsutils lsof screen vim tree telnet tcpdump git gfortran gpsd/buster-backports
Install Node.js 14
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install nodejs
DEVICES="tcp://localhost:4000 tcp://localhost:4001"
GPSD_OPTIONS=""
USBAUTO="false"
## Clone repositories
The [RTKLIB fork by rtklibexplorer](https://github.com/rtklibexplorer/RTKLIB) is optimised for *"single and dual frequency low cost GPS receivers, especially u-blox receivers"*, but has not Debian package, so will need to be cloned. This repro should also be cloned.
``` bash
mkdir -p ~/src
cd ~/src
git clone https://github.com/rtklibexplorer/RTKLIB
git clone https://github.com/oobayly/pi-rtk
As of 21 April 2021 there's a bug in RTKLIB where the rtkrcv
doesn't start if run with a telnet interface. This PR fixes the issue, so a patch needs to be applied.
cd ~/src/RTKLIB
patch -p0 < ~/src/pi-rtk/patches/rtklib-patch-38.diff
cd ~/src/RTKLIB/app/consapp/
make
sudo make install
The pi-rtk package install itself into /opt/pi-rtk
, and will do the following:
- Install systemd service files
pi-rtk-multiplex
- Allows multiple applications to read from a single GNSS serial portpi-rtk-base
- Operates the system as an RTK base station that can provide data to an NTRIP Casterpi-rtk-rover
- Operates the system as an RTK roverpi-rtk-http
- A HTTP server that allows a user to view the status of the station
- Install configuration files int
/etc/pi-rtk
- Install cronjobs for the ubx/RINEX
pi-rtk-multiplex
service
The Nodejs HTTP server needs to be built before installation
cd ~/src/pi-rtk/
npm --prefix pi-rtk-http install
npm --prefix pi-rtk-http run build
sudo ./install.sh