u-Center from u-Blox is a graphical interface which can be used to monitor and configure all aspects of the GPS module on a BerryGPS-IMU or BerryGPS-GSM.
u-Center only runs on Windows. It can connect over the network to a Raspberry Pi. This will require us to redirect the serial interface on the Raspberry Pi to a network port using ser2net.
Do an upt-get update and then install ser2net;
pi@raspberrypi ~ $ sudo apt-get install ser2net
Edit the ser2net config file and add the serial port redirect to a network port. We will use network port 6000
And add this line at the bottom;
6000:raw:600:/dev/serial0:9600 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS
This is a breakdown of the syntax for the line above;
TCP port : connection type : timeout : serial port : serial port speed : serial options
you can now start ser2net using;
And you can use the below command to check if it is running by seeing if the port is open and assigned to the ser2net process;
If it is running, you should see something similar to the output below;
Windows PC Setup and Connecting to the GPS module
You can download u-Center from here.
Once installed, open u-Center. You will get the default view as shown below. No data will be shown as we are not connected to a GPS.
The next step, is to create a new network connection and connect to the GPS which is connected to our Raspberry Pi. You can create a new connection under the Receiver and then Network connection menus.
In the new window, enter the IP address of the Raspberry Pi and specify port 6000. This is the port we configured in ser2net on the Raspberry Pi.
This is what the default view looks like when connected and the GPS has a fix.
Below I will list of the more useful windows/tools within u-Center.
You can also click on the images below for a larger version.
This window will show you the longitude, latitude, altitude and fix mode. It will also show the HDOP, which is the Horizontal Dilution of Precision. Lower is better, anything below 1.0 means you have a good signal.
This window will show you where the satellites are as well as what time.
Sky view is an excellent tool for analyzing the performance of antennas as well as the conditions of the satellite observation environment.
This map shows the average of all previously measured positions.
Satellite Signal History
This window shows the satellite signal strength over time.
The text console is were the raw NME sentences can be viewed.
Making Configuration changes to the GPS Module
U-Center allows you to make configuration changes to the GPS module on the BerryGPS-IMU and BerryGPS-GSM.
Some examples of what can be configured;
- Disable or enable specific NMEA sentences
- Change output update rate
- Modify power mode
You make changes from the Configuration View window. It can be found under the View menu;
At the bottom of the window, you see a Send button, this is how you apply changes.
There is also a Poll button which is used to poll the device for the current config. The number at the top right is how long it as been since the config has been sent or the device has been polled.
Example Change - Increase update rate
Here is how you would change the update rate, by default it is 1Hz (once a second). This is how you would change it to 5Hz (five times a second)
Find RATE(rates) in the left pain. Then on the right hand side you can see the Measured Period is 1000ms. This is how fast the GPS module prints out NMEA sentence. Change the Measured Period value to 200, which is 5Hz. Now click the send button. The GPS update rate should be instant.
Example Change - Remove GxGSV sentence
The GxGSV sentence contains detailed satellite information. If you are only interested in Longitude and Latitude, you can disable to sentence from being display as you would not need it.
Select MSG (Messages) from the left pane. On the right, in the drop down, find the NMEA GxGSV as shown below and untick the checkbox for UART1. Hit send. The change will be instant.
Making Changes without u-Center
The instruction above only work if u-Center is connected to the GPS module. When you hit the Send button, u-Center will send the change to the GPS module using the UBX protocol which is a string of HEX data.
It is possible to make changes manually without u-Center by sending the HEX data via the Raspberry Pi terminal.
The first thing to do is find out what the HEX string is for a specific change. We will do the change again to remove the GxGSV sentences, but this time manually.
Open Messages View from the view menu and in the left pain navigate to UBX->CFG->MSG (Messages). On the right, in the drop down, find the NMEA GxGSV as shown below and untick the checkbox for UART1.
If the window isn't showing the HEX code, you need to click on the button highlighted below with the red arrow.
This HEX code is the UBX protocol. It is documented here.
Select the code, as I have below and copy it to the clipboard.
You can send this to the GPS unit using an echo command which is redirect to the serial0 interface on the Raspberry Pi.
-e enable interpretation of backslash escapes
-n do not output the trailing newline
\x means a HEX value
UBX Code Structure
The below information describes the frames structure used for the UBX protocol.
- Every Frame starts with a 2-byte Preamble consisting of two synchronization characters: 0xB5 0x62.
- A 1-byte Message Class field follows. A Class is a group of messages that are related to each other.
- A 1-byte Message ID field defines the message that is to follow.
- A 2-byte Length field follows. The length is defined as being
that of the payload only. It does not include the Preamble, Message Class, Message ID, Length, or CRC fields. The number format of the length field is a Little-Endian unsigned 16-bit integer.
- The Payload field contains a variable number of bytes.
- The two 1-byte CK_A and CK_B fields hold a 16-bit checksum.
10 thoughts on “Using u-Center to connect to the GPS on Raspberry Pi”
I'm using a M8T in my x86-64 time server.. I have the server's internal serial port headers for NTP's GPS data. I also attached it to the server's USB headers and using ser2net on the USB device.
I love this so much! It’s exactly what I was looking for! I am running into a problem though. I have everything set up and it updates the data but only for a few seconds, then it stops. I ran cat /dev/serial0 and it’s still running so I’m thinking either it’s the net2ser piece, the u-center configurations or a router issue. It’s weird because u-center says it’s still connected when it’s not pulling data, but if I disconnect and reconnect from the green connection button, it works immediately for a couple of seconds. I assume there is a setting somewhere that needs to be changed from 2 seconds to continuous but I don’t know where. Please help!
did anyone get back to you with this issue? I'm seeing the same issue you are having as well.
Hi Brad, Hi Gus,
Are you sure that nothing else uses your serial port (like goad, ntp/ntpsec)?
Overall, it works great, but did you manage to update the firmware via ser2net on a u-blox device with updatable firmware? – This somehow does not work in my setup, any hints are much appreciated!
Hello. I did everything on your guide, but I am not getting a fix on anything. The "Fix Mode" says "No Fix". I have waited for over ten minutes, but ublox center is not showing any data. It is connected to tcp://PiIPadress:6000, but it is still not working. I am using a GPS/Glonass U-blox7 USB dongle. Should it be connected to a particular USB port?
Hi. Do you have that version of u-center, because I coudn't find Network connection at the lastes version.
Thanks in advance
You have to download ucenter, not ucenter 2.
There's an update to ser2net where the ser2net.conf is now a .yaml file. What is the new line/chunk of yaml code I need to add that is equivalent to:
6000:raw:600:/dev/serial0:9600 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS