Using the GPS on OzzMaker SARA-R5 LTE-M GPS + 10DOF

There are two methods of accessing the GNSS receiver on the OzzMaker SARA-R5 LTE-M GPS + 10DOF module;

  1. Using AT commands through the cellular module.
  2. Enabling multiplexing on the serial interface and then stream the GPS data to a dedicated virtual serial interface.

The second method is the preferred method as it will continuously stream the data to the virtual interface and you can use programs like gpsmon to read this information.

Using AT commands through the cellular module to access the GNSS receiver

The first step is to setup your Pi to use a GNSS. If you haven't already done so, you can follow this guide.

Connect to the SARA-R5 cellular module

pi@raspberrypi ~ $ minicom 115200 -D /dev/serial0

From here, you can issue AT commands to configure or retrieve information from the SARA-R5 cellular module, this includes access to the GNSS receiver.

Do a quick test, type AT and confirm you get OK as a response

Now to configure the GNSS receiver.
First, we will activate the unsolicited aiding result.

AT+UGIND=1

Activate storing of the last value of a NMEA sentence. These only need to be configured once and are persistent across power downs.

AT+UGRMC=1
AT+UGGLL=1
AT+UGGSV=1
AT+UGGGA=1

 

The +UGPS command is used to control the GPS module and the assist mode. Here is its syntax and options;
AT+UGPS=[mode],[aid_mode],[GNSS_systems]
[mode]
0 : Off
1 : On
[aid_mode]
0 (default value): no aiding
1: automatic local aiding
2: AssistNow Offline
4: AssistNow Online
8: AssistNow Autonomous
[GNSS_systems]
1: GPS
2: SBAS
4: Galileo
8: BeiDou
16: IMES
32: QZSS
64: GLONAS

 

Start the GNSS with GPS+SBAS+GLONASS systems and local aiding.

AT+UGPS=1,1,67

You can now use the below commands to read the last NMEA sentence.

AT+UGRMC?
AT+UGGLL?
AT+UGGSV?
AT+UGGGA?

E.g. reading the last RMC sentence;

AT+UGRMC?
+UGRMC: 1,$GNRMC,005007.00,A,3343.22678,S,15224.63191,E,0.083,,310123,,,D*7E

Stream GNSS data to a dedicated interface

This is the preferred method of viewing NMEA sentences from the GNSS receiver, as the data will be streamed continuously to a specific tty interface, which you can than use to point other programs to.

To be able to do this, multiplexing needs to be enabled between the Raspberry Pi and SARA-R5 module, you can follow this guide to enable multiplexing .

Once mutliplxiung is up and running, it is now time to tell the SARA-R5 module where to stream GNSS data.

Connect to the first multiplexer channel to perform AT commands to configure the SARA-R5

pi@raspberrypi ~ $ minicom 115200 -D /dev/ttyGSM0

Use +UGPRF command to tell the module to send and receive GNSS data through the multiplexer. This is needed to be configured once and then it is persistent across power downs.

AT+UGPRF=2

Configure the dataflow on the SARA-R5 serial interface to the right variant. Persistent across power downs.

AT+USIO=2

Once this is done, you can continue on with configuring and enabling the GNSS receiver.
Activate the unsolicited aiding result

AT+UGIND=1

Activate storing of last value of NMEA. These are persistent across power down and only need to be configured once.

AT+UGRMC=1
AT+UGGLL=1
AT+UGGSV=1
AT+UGGGA=1

 

The +UGPS command is used to control the GPS module and the assist mode. Here is its syntax and options;
AT+UGPS=[mode],[aid_mode],[GNSS_systems]
[mode]
0 : Off
1 : On
[aid_mode]
0 (default value): no aiding
1: automatic local aiding
2: AssistNow Offline
4: AssistNow Online
8: AssistNow Autonomous
[GNSS_systems]
1: GPS
2: SBAS
4: Galileo
8: BeiDou
16: IMES
32: QZSS
64: GLONAS

Start the GNSS with GPS+SBAS+GLONASS systems and local aiding.

AT+UGPS=1,1,67

 

You can now connect to /dev/ttyGSM2 to view the streaming NMEA sentences

pi@raspberrypi ~ $ minicom 115200 -D /dev/ttyGSM2

GPSD, gpsmon and tools

GPSD and gpsmon can now use /dev/ttyGSM2 to view GPS data.

Install gpsd, gpsmon and tools

pi@raspberrypi ~ $ sudo apt-get install gpsd-clients gpsd -y

Edit the gpsd conf file and specify /dev/ttyGSM2

pi@raspberrypi ~ $ sudo nano /etc/default/gpsd
Look for
DEVICES=""
and change it to
DEVICES="/dev/ttyGSM2"
Update the gspd service profile to be used under user "pi"
pi@raspberrypi ~ $sudo nano /usr/lib/systemd/system/gpsd.service

Under [Service] add
User=pi

Reload the server config into systemctl

pi@raspberrypi ~ $ sudo systemctl daemon-reload

Add Pi user to the tty group

pi@raspberrypi ~ $ sudo adduser pi tty

Reboot your Pi, once it loads and and you have GPS streaming enabled through the multiplexer, you can use gpsmon to view the GPS data.

Automatically start GPS streaming

We can add to the script used to autoload the multiplexer. Add the commands below after the command which starts the multiplexer "gsmMuxd"

sleep 10
echo -e "AT+UGPS=1,4,67\r\n" > /dev/ttyGSM0

Other Information and Guides

Blip, blop, bloop…