There are two methods of accessing the GNSS receiver on the OzzMaker SARA-R5 LTE-M GPS + 10DOF module;
- Using AT commands through the cellular module.
- 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
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.
Activate storing of the last value of a NMEA sentence. These only need to be configured once and are persistent across power downs.
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.
You can now use the below commands to read the last NMEA sentence.
AT+UGGLL?
AT+UGGSV?
AT+UGGGA?
E.g. reading the last RMC sentence;
+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
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.
Configure the dataflow on the SARA-R5 serial interface to the right variant. Persistent across power downs.
Once this is done, you can continue on with configuring and enabling the GNSS receiver.
Activate the unsolicited aiding result
Activate storing of last value of NMEA. These are persistent across power down and only need to be configured once.
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.
You can now connect to /dev/ttyGSM2 to view the streaming NMEA sentences
GPSD, gpsmon and tools
GPSD and gpsmon can now use /dev/ttyGSM2 to view GPS data.
Install gpsd, gpsmon and tools
Edit the gpsd conf file and specify /dev/ttyGSM2
DEVICES=""
and change it to
DEVICES="/dev/ttyGSM2"
Under [Service] add
User=pi
Reload the server config into systemctl
Add Pi user to the tty group
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