RTKBase

An easy to use and easy to install web frontend with bash scripts and services for a simple headless gnss base station.

FrontEnd:

|status|settings|logs|

Frontend's features are:

Base example:

status

Other images are available in the ./images folder.

Ready to flash release:

If you use a Raspberry Pi, thanks to jancelin, you can download a ready to flash iso file here.

Easy installation:

Manual installation:

The install.sh script can be use without the --all option to split the installation process into several differents steps:

   $ ./install.sh --help
   ################################
   RTKBASE INSTALLATION HELP
   ################################
   Bash script to install a simple gnss base station with a web frontend.

   * Before install, connect your gnss receiver to raspberry pi/orange pi/.... with usb or uart.
   * Running install script with sudo

         sudo ./install.sh

   Options:
        --all
                         Install all dependencies, Rtklib, last release of Rtkbase, gpsd, chrony, services,
                         crontab jobs, detect your GNSS receiver and configure it.

        --dependencies
                         Install all dependencies like git build-essential python3-pip ...

        --rtklib
                         Clone RTKlib 2.4.3 from github and compile it.
                         https://github.com/tomojitakasu/RTKLIB/tree/rtklib_2.4.3

        --rtkbase-release
                         Get last release of RTKBASE:
                         https://github.com/Stefal/rtkbase/releases

        --rtkbase-repo
                         Clone RTKBASE from github:
                         https://github.com/Stefal/rtkbase/tree/web_gui

        --unit-files
                         Deploy services.

        --gpsd-chrony
                         Install gpsd and chrony to set date and time
                         from the gnss receiver.

        --detect-usb-gnss
                         Detect your GNSS receiver.

        --configure-gnss
                         Configure your GNSS receiver.

        --start-services
                         Start services (rtkbase_web, str2str_tcp, gpsd, chrony)

So, if you really want it, let's go for a manual installation with some explanations:

  1. Install dependencies with sudo ./install.sh --dependencies, or do it manually with:

    $ sudo apt update
    $ sudo apt install -y  git build-essential python3-pip python3-dev python3-setuptools python3-wheel libsystemd-dev bc dos2unix socat
  2. Install RTKLIB with sudo ./install.sh --rtklib, or:

    • clone RTKlib

      $ cd ~
      $ git clone -b rtklib_2.4.3 https://github.com/tomojitakasu/RTKLIB/rtklib_2.4.3
    • compile and install str2str:

      Optionnaly, you can edit the CTARGET line in makefile in RTKLIB/app/str2str/gcc

      $ cd RTKLIB/app/str2str/gcc
      $ nano makefile

      For an Orange Pi Zero SBC, i use:

      CTARGET = -mcpu=cortex-a7 -mfpu=neon-vfpv4 -funsafe-math-optimizations

      Then you can compile and install str2str:

      $ make
      $ sudo make install
    • Compile/install rtkrcv and convbin the same way as str2str.

  3. Get latest rtkbase release sudo ./install.sh --rtkbase-release, or:

    $ wget https://github.com/stefal/rtkbase/releases/latest/download/rtkbase.tar.gz -O rtkbase.tar.gz
    $ tar -xvf rtkbase.tar.gz
    

    If you prefer, you can clone this repository to get the latest code.

  4. Install the rtkbase requirements:

    
    $ python3 -m pip install --upgrade pip setuptools wheel  --extra-index-url https://www.piwheels.org/simple
    $ python3 -m pip install -r rtkbase/web_app/requirements.txt  --extra-index-url https://www.piwheels.org/simple
    $ python3 -m pip install rtkbase/tools/pystemd-0.8.1590398158-cp37-cp37m-linux_armv7l.whl
  5. Install the systemd services with sudo ./install.sh --unit-files, or do it manually with:

    • Edit them (rtkbase/unit/) to replace {user} with your username.
    • If you log the raw data inside the base station, you may want to compress these data and delete the too old archives. archive_and_clean.sh will do it for you. The default settings compress the previous day data and delete all archives older than 90 days. To automate these 2 tasks, enable the rtkbase_archive.timer. The default value runs the script everyday at 04H00.
    • Copy these services to /etc/systemd/system/ then enable the web server, str2str_tcp and rtkbase_archive.timer:
      $ sudo systemctl daemon-reload
      $ sudo systemctl enable rtkbase_web
      $ sudo systemctl enable str2str_tcp
      $ sudo systemctl enable rtkbase_archive.timer
  6. Install and configure chrony and gpsd with sudo ./install.sh --gpsd-chrony, or:

    • Install chrony with sudo apt install chrony then add this parameter in the chrony conf file (/etc/chrony/chrony.conf):

      refclock SHM 0 refid GPS precision 1e-1 offset 0.2 delay 0.2

      Edit the chrony unit file. You should set After=gpsd.service

    • Install a gpsd release >= 3.2 or it won't work with a F9P. Its conf file should contains:

      
      # Devices gpsd should collect to at boot time.
      # They need to be read/writeable, either by user gpsd or the group dialout.
      DEVICES="tcp://127.0.0.1:5015"
      
      # Other options you want to pass to gpsd
      GPSD_OPTIONS="-n -b"
    Edit the gpsd unit file. You should have someting like this in the "[Unit]" section: 

    [Unit] Description=GPS (Global Positioning System) Daemon Requires=gpsd.socket BindsTo=str2str_tcp.service After=str2str_tcp.service

    + Reload the services and enable them:
    ```bash
      $ sudo systemctl daemon-reload
      $ sudo systemctl enable chrony
      $ sudo systemctl enable gpsd
  7. Connect your gnss receiver to raspberry pi/orange pi/.... with usb or uart, and check which com port it uses (ttyS1, ttyAMA0, something else...). If it's a U-Blox usb receiver, you can use sudo ./install.sh --detect-usb-gnss. Write down the result, you may need it later.

  8. If you didn't have already configure your gnss receiver you must set it to output raw data:

    If it's a U-Blox ZED-F9P (usb), you can use

    $ sudo ./install.sh -detect-usb-gnss --configure-gnss

    If it's a U-Blox ZED-F9P (uart), you can use this command (change the ttyS1 and 115200 value if needed)):

    $ rtkbase/tools/set_zed-f9p.sh /dev/ttyS1 115200 rtkbase/receiver_cfg/U-Blox_ZED-F9P_rtkbase.txt

    If you need to use a config tool from another computer (like U-center), you can use socat:

    $ sudo socat tcp-listen:128,reuseaddr /dev/ttyS1,b115200,raw,echo=0

    Change the ttyS1 and 115200 value if needed. Then you can use a network connection in U-center with the base station ip address and the port n°128.

  9. Now you can start the services with sudo ./install.sh --start-services, or:

      $ sudo systemctl start rtkbase_web
      $ sudo systemctl start str2str_tcp
      $ sudo systemctl start gpsd
      $ sudo systemctl start chrony
      $ sudo systemctl start rtkbase_archive.timer

    Everything should be ready, now you can open a web browser to your base station ip address.

How it works:

RTKBase use several RTKLIB str2str instances started with run_cast.sh as systemd services. run_cast.sh gets its settings from settings.conf

internal

The web gui is available when the rtkbase_web service is running.

Other usages:

A gnss receiver with a timepulse output is a very accurate stratum 0 clock thus, your gnss base station could act as a stratum 1 ntp peer for your local network and/or the ntp pool. There are a few steps to do this:

License:

RTKBase is licensed under AGPL 3 (see LICENSE file).

RTKBase uses some parts of others software:

RTKBase uses OpenStreetMap tiles, courtesy of Empreinte digitale.