Precise GPS GNSS positioning with a Raspberry Pi and the RTKLIB – software installation

Dec 28th, 2016 | By | Category: Electronic, Top story

This chapter explains which software needs to be installed on your Raspbian installation to get the RasPiGNSS Aldebaran module which should now be mounted on top of your Raspberry Pi working. For this explanation I will use Raspbian as operation system. I am using the Raspbian version “2016-09-23-raspbian-jessie.img“. From my experiences I would suggest that this explanation will work with older versions as well with newer version of Raspbian. Maybe we will see some differences in future Raspberry Pi SBC models then in the operation system. You will learn the actual differences between the Raspberry Pi models which are necessary to know in the chapter below.

RasPiGNSS module - Software setup

RasPiGNSS module – Software setup

RasPiGNSS software installation:

For the base station I will use a Raspberry Pi 1 Model B. The Raspberry Pi 1 Model B has enough CPU power for the setup as base station. The base station has only to receive the GPS signal and transmit the raw or RTCM3 stream of the GPS signal to the mobile station. The mobile station needs more CPU power to calculate the precise GPS position. This is the reason why the mobile station is equipped with a Raspberry Pi 2 Model B which has more CPU power then the Raspberry Pi 1 Model B

Installation of Raspbian on a micro-SD card:

First of all the latest version of Raspbian needs to be installed on a micro-SD card. The latest images are available from the official Raspberry Pi homepage.

Download Link: Raspbian

I decided to use the full version of Raspbian. But I will not boot Raspbian with the graphical interface. But who knows if I will need the graphical interface in the future. In general the following How To works as well with the lite version of Raspbian.

After the installation of Raspbian on the micro-SD card the installation should be updated to the latest Raspbian support packages.

To update Raspbian please login and first extend the file system to get full space of your micro-sd card available (Expand Filesystem). To expand the file system the configuration toll is very help full. Please start the configuration tool via the terminal window. The command to start the configuration tool is as follows.

  • sudo raspi-config

After this step please reboot the Raspberry Pi to get the change working and to have full access to your micro-SD card available space.

Now it is time to update and upgrade your Raspbian installation. This two steps will take several minutes. Please execute the following commands.

  • sudo apt-get update
  • sudo apt-get upgrade

Sometimes a new firmware version for your Raspberry Pi is available. To update the firmware please execute the following two command in the terminal window.

  • sudo apt-get install rpi-update
  • sudo rpi-update

If all the commands where executed successfully the Raspbian installation is updated and the latest version of all the software packages are installed. The next chapter explains how to setup the RasPiGNSS module.

RasPiGNSS module setup:

For the installation of the RasPiGNSS module I used the installation guide from For the following steps you need the terminal window. To open the terminal window you could plug the Raspberry Pi to a monitor or remotely connect to the Raspberry Pi via PuTTY / SSH. The next steps are for the base station and for the mobile unit the same.

1. UART interface speed

You have to check if the clock rate of the UART interface is set to 6 MHZ. To check this setting please open the /boot/config.txt file with the text editor Nano. With the following command you could start Nano and open the config.txt file.

  • sudo nano /boot/config.txt

Now search for the line init_uart_clock=6000000 inside the file config.txt. If you do not find the line please add the line at the end of the config.txt file. If you changed the file please save the changes and reboot the Raspberry Pi.

  • sudo reboot

This changes are necessary to use the RasPiGNSS module in BINR mode. The module needs a baud rate of 230400 baud at the UART interface.

2. Usage of /dev/ttyAMA0

Now you have to check that the serial port /dev/ttyAMA0 is not used by the Raspberry Pi. You have to check the settings in the file /boot/cmdline.txt and /etc/inittab:

  • /boot/cmdline.txt
  • /etc/inittab (this file was not available inside the Raspbian version I used)

Search inside the two files for the following entry. If you see the entry please delete the entry and save the changes.

  • console=ttyAMA0,115200
  • console=serial0,115200

3. File /ect/inittab missing

If the file /ect/inittab is missing in your installation from Raspbian you have to execute the following two commands. With this two commands the getty process is deactivated which access the /dev/ttyAMA0 device.

  • sudo systemctl stop serial-getty@ttyAMA0.service
  • sudo systemctl disable serial-getty@ttyAMA0.service

4. Characteristics of the Raspberry Pi 3 Model B

The Raspberry Pi 3 Model B is the first Raspberry Pi with a WIFI and Bluetooth module. This modules are using the UART interface by default. But the RasPiGNSS modules needs this UART interface for communication. To deactivate the usage of the UART interface by the Raspberry Pi 3 Model B the following changes have to be done in the /boot/config.txt file.

  • dtoverlay=pi3-miniuart-bt
  • enable_urt=1
Raspberry Pi 3 /boot/config.txt

Raspberry Pi 3 /boot/config.txt

5. Installing the BCM2835 library for Raspberry Pi

Now install the DEBIAN package with the BCM2835 library which is also available for download from the following website The direct link for download is as follows: bcm2835 library.

Now install the downloaded BCM2835 library with the following command on your Raspberry Pi.

  • sudo dpkg -i <packagename.deb>

Note about the source of the BCM2835 library:

6. Installing the Perl BCM2835 binding for Raspberry Pi

Now you have to install the Perl binding. The Perl binding for libbcm2835 to access the Broadcom BCM2835 chip from Perl.

Now install the downloaded BCM2835 library “libdevice-bcm2835-perl_1.9_armhf.deb” with the following command on your Raspberry Pi. The actual version could be different from the file name posted here.

  • sudo dpkg -i <packagename.deb>

Note about the source of the Perl BCM2835 library:

  • Website:
  • Author: Mike McCauley
  • License: Perl Artistic License
  • Note: This is the Debian Jessie version (for Perl 5.20.2)

7. Installing the lrzsz program

Next you have to install the lrzsz programm. Lrzsz is a cosmetically modified zmodem/ymodem/xmodem package built from the public-domain version of Chuck Forsberg’s rzsz package. These programs use error correcting protocols ({z,x,y}modem) to send (sz, sx, sb) and receive (rz, rx, rb) files over a dial-in serial port from a variety of programs running under various operating systems (Source:

Command:  sudo apt-get install lrzsz

8. Installing the RPGTOOLS

The next step is to install the RasPiGNSS Tools from These tools are available for download in the latest version with an English how to guide from the following website rpgtools.

Please download the latest rpgtools as a DEBIAN package from the website and save the file in the Raspberry Pi home directory. I saved the rpgtools in the following directory /home/pi/raspignss/.

With the following command are the rpgtools as DEBIAN package installed on the Raspberry Pi with Raspbian as operating system.

  • sudo dpkg -i <packagename.deb>

All the installed rpgtools files are stored in the directory /usr/bin/.

9. Installing the RTKLIB CUI tools for Raspberry Pi

Now install the DEBAIN package of the RTKLIB CUI Tools which are available from the website as a download package from the following direct link rtklib.

Now install the downloaded RTKLIB CUI Tools with the following command.

  • sudo dpkg -i <packagename.deb>

Note about the source of the RTK library:

  • Website
  • Author: Tomoji Takasu
  • License: BSD 2-clause

Now all the software is installed to get the RasPiGNSS module running together with your Raspberry Pi.

Test of the RasPiGNSS modules:

With the following command you could test if the RasPiGNSS module is working in general. You should see the received GPS coordinates in your terminal window after executing the two commands.

  • nvsmode nmea
  • nmeaparse

The program nvsmode as well all the other programs from the RPGTOOLS are stored in the folder /usr/bin.

Note in case of an ERROR

If you get the following error message “Can’t locate in @INC” then you have to process the following installation routine to get the Device::BCM2835 installed on your Raspberry Pi

  • sudo cpan -i Device::BCM2835

If everything works fine you should now the fellowing result in your terminal windows after executing the nvsmode nmea program.

RasPiGNSS module - nmeaparse

RasPiGNSS module – nmeaparse

FAQs @

During the installation the FAQ site from was very helpful. The direct link is as follows FAQ.


The installation process of the RasPiGNNS module and software worked very well as a result of the good installation guide from The first results of the received GPS coordinates are shown up in the terminal window with the small program nmeaparse. Now I have to take care of the setup of the base station and configuration of the RTK library. After setting up the base station and mobile unit with the RTK library I will construct the next robot which will use these setup for navigation. As a starting point I will make a clone of the sd-card and save the image. This image is the starting point for the configuration of the base station and mobile unit.

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
(Visited 318 times, 5 visits today)
Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a Comment