In the previous article described how to install the software for the RasPiGNSS module. After installing the software a short check was performed that the Raspberry Pi together with the RasPiGNSS GPS receiver is working in general.
This article describes how the base stations for the precise GPS positioning setup has to be configured. The base stations operates outdoors during sunny and rainy days. This is the reason why all the electronics have to be protected against bad weather conditions. It is important to use a water resistant / water proof case for all the electronic components. I build a water resistant case by my own. I build the case by my own because a cheap water proof case was not available in the home depot next to me. The next chapter describes how I build my own water proof case for the RasPiGNSS GPS receiver.
Water proof case
I bought a lunch box as case for the base station which I found by IKEA. The lunch box was very cheap with 4,99 € and big enough to store the Raspberry Pi, the step-down converter, the RasPiGNSS GPS receiver, the power bank and the XBee Pro radio module inside the box. For the connectors for the external WIFI antenna and GPS antenna I drilled two holes into the box and screwed the connectors. I plugged the cable of the Tallysman™ TW-2410 GPS antenna through a cable gland which has the size M16 and is a standard IP68 water proof cable gland. The cable for the power supply was also plugged through a cable gland which is a M12 with a IP68 class from outside into the box with the Raspberry Pi and RasPiGNSS module. The picture below shows the box with the two antennas and the two cable glands on the left and right side of the box.
Base station configuration
All the software the base stations needs to operate was already installed as described in the article before. The only thing you need to configure is the str2str server which streams the received GPS signal by WIFI or a XBee radio module to the mobile unit. I will use the str2str server for this job which is already a part of the RTK library.
You should download the “rtkbase” script from the web site www.drfasching.at with the name “rtkbase” which is a part of the RPGTOOLS. The script is a pre-configured configuration file for the str2str server which should work out of the box. This script configures the GPS data transmission via TCP/IP or via a serial connection with the XBee modules.
Download RTKBASE script: www.drfasching/downloads
The script will be installed in the folder /usr/bin/ after the installation of the RPGTOOLS.
The RasPiGNSS module of the base station has to be set into BINR mode to receive the raw GPS data. To set the RasPiGNSS Module into BINR mode to receive the raw GPS data the following commands have to be executed after each reboot of the Raspberry Pi.
I configured the commands with the help from www.drfasching.at as a startup process after each reboot of the Raspberry Pi. This makes the correct start process of the RasPiGNSS module very easy. The RasPiGNSS module has to be configured after each restart because it has no memory to store the configuration. After a restart it will always be in the default NMEA mode.
I configured the commands as root in the /etc/rc.local file. This combination of commands sets the RasPiGNSS module into the operation mode we need for the base station and will start with the last command the str2str server. To edit the rc.local as root you have to execute the following command.
Command: sudo nano /etc/rc.local
Please add the following commands at the end of the rc.local and save the changes.
(/bin/sleep 5 && /usr/bin/nvsctl -v reset)
(/bin/sleep 7 && /usr/bin/nvsmode -v binr)
(/bin/sleep 9 && /usr/bin/binrcmd -v /home/pi/gnss/rpgtools/etc/init.cmd)
(/bin/sleep 11 && /usr/bin/rtkbase &)
The rc.local should look like as shown in the picture below. Please restart the Raspberry Pi after saving the changes.
To perform a check if the RasPiGNSS module is working now in the BINR mode please execute the following command and check the speed of the communication of the module.
Command: stty -aF /dev/ttyAMA0
As shown in the picture below the baud rate is “230400” which is right for BINR mode. Now we know that the module is working in BINR mode because the NMEA mode has a lower baud rate of “115200”.
Manual start of the base station
With the following command you could start the base station manual if you need to. If you changed the rc.local as explained above the str2str server will start automatically after each restart of the Raspberry Pi.
Command: sudo ./usr/bin/rtkbase
If you manually start the rtkbase script the output of the script should look like similar to the picture below. If another device is connected to the str2str server and reads the GPS data stream you will see the IP address. If more than one device is reading the GPS stream you will only see a counter and not all the IP addresses.
With the next chapter I will explain how you could configure the str2str server for your individual demands.
rtkbase GPS raw data stream
If you would like to send raw GPS data via a TCP/IP stream with the str2str server to the mobile unit you have to change the configuration of the rtkbase script. You will find the script in the following folder “/usr/bin/rtkbase”. The only thing you have to to is to let the outformat configuration as well the messages configuration blank as shwon below.
The rtkbase script should now look like as shown in the picture below. The the outformat and the messages are blank.
With this two changes the GPS raw data will be send to the mobile unit. Depending on the bandwidth of the used radio connection the raw data stream may be too big and you have to switch to the RTCM3 stream which uses a smaller bandwidth. I will explain the configuration of the RTCM3 stream in the next chapter.
rtkbase GPS RTCM3 stream
If you would like to send a RTCM3 GPS data stream via a TCP/IP with the str2str server to the mobile unit you have to change the configuration of the rtkbase script. You will find the script in the following folder “/usr/bin/rtkbase”. The only thing you have to do is to set the outformat=”RTCM3″ configuration as well the messages=”1002, 1004, etc.” you want to transmit as shown below.
rtkbase TCP-IP or serial XBee transmission
If you would like to send the GPS data via TCP/IP or serial via a XBee module you have to configure the type of transmission in the rtkbase script.
If the GPS data from the base station has to be streamed in the local network via WIFI as a RTCM3 stream the “/usr/bin/rtkbase” configuration file has to be changed as follows. The next listing show the complete configuration of the rtkbase to stream the GPS data via TCP/IP as a RTCM3 stream.
The configuration only for the setup of the TCP/IP stream looks like as shown in the picture below.
serial XBee configuration
If the GPS data from the base station has to be streamed in via a XBee module as a RTCM3 stream the “/usr/bin/rtkbase” configuration file has to be changed as follows. The next listing show the complete configuration of the rtkbase to stream the GPS data via a serial XBee connection as a RTCM3 stream.
The configuration only for the setup of the serial XBee stream looks like as shown in the picture below.
rtkbase GPS coordinates configuration
You should configure the GPS coordinate as well the altitude in the “/usr/bin/rtkbase”. This configuration is important for the mobile unit to calculate a relative position to the base station. The configuration should look like as shown in the picture below.
GPS data stream – base station
You could receive the GPS data stream for example as an RTCM3 stream form the base station via the following address on your mobile unit <IP-Adresse>:<5800>.
With the app RTK+ GPS on your tablet you could receive the GPS stream and show the position on a map like google maps.
You could also install the RTKNAVI program on you PC and have a close look at your GPS data stream you receive from the base station.
The program RTKNAVI for windows is available from the following ULR: Open Repository in GitHub (binary programs for Windows).
After working with the RTL library and get familiar with the configuration of the library it was easy to setup the base station and to operate the base station. It was not so easy to find a cheap and water proof case for the Raspberry Pi and all the other electronic components. I used a lunch box which was very cheap and easy to enhance with a few holes for the cables. To install and configure the RTKLIB I needed one day. The configuration of the str2str server is very complex but I hope with my explanation very easy to understand. The setup of the base station works very well and reliable and now I have time setup the mobile unit, the rover and the XBee connection.
Article list - GPS module RasPiGNSS:Precise GPS GNSS positioning with a Raspberry Pi and the RTKLIB – introduction
Precise GPS GNSS positioning with a Raspberry Pi and the RTKLIB – theoretical setup
Precise GPS GNSS positioning with a Raspberry Pi and the RTKLIB – GPS antenna setup
Precise GPS GNSS positioning with a Raspberry Pi and the RTKLIB – software installation
Precise GPS GNSS positioning with a Raspberry Pi and the RTKLIB – configuration RTKLIB base station
Precise GPS GNSS positioning with a Raspberry Pi and the RTKLIB – configuration RTKLIB mobile unit
Precise GPS GNSS positioning with a Raspberry Pi and the RTKLIB – XBee serial data transmission