Introduction
The Huawei ME906s (datasheet) is an M.2 WWAN card, compatible with 4G LTE, 3G HSDPA/HSUPA/HSPA/UMTS and 2G EDGE/GPRS. In addition to an Internet connection, it can also send SMS. But there is also another very useful feature: this card has an integrated GPS/GLONASS receiver. It can, for instance, be used for OpenCPN, or to give precise positioning and timing information to WXtoIMG for weather satellites decoding. However, this feature is not enabled by default, but it can be enabled easily on Linux.
Preliminary steps
Because of a bug in usb_modeswitch
, sometimes the card might end up in a weird state where it is not able to work properly (this should be fixed in the latest version of Ubuntu at least).
To solve this, open a root shell with sudo -s
and do these commands:
echo 0 > /sys/bus/usb/devices/1-3/bConfigurationValue
echo 3 > /sys/bus/usb/devices/1-3/bConfigurationValue
This will reset the module.
Enabling GPS
The GPS is enabled with an AT command sent to the serial CDC port of the module, usually /dev/ttyUSB0
, but it could vary depending on whether you have other USB to serial devices connected, like an Arduino.
The command is AT^WPDGP
.
You might use utilities such as minicom
or screen
, but the quickest way is to use a simple script.
#!/bin/bash
echo AT^WPDGP > /dev/ttyUSB0
Then you can also create a launcher or a hotkey combination to invoke that script and enable GPS with a simple click or key stroke.
Checking GPS
Like most GPSs out there, the Huawei module uses NMEA to communicate data, on the same serial port we used before to enable the GPS in the first place.
Typing cat /dev/ttyUSB0
, should yield a similar result:
$GPGGA,092313.00,4300.000000,N,00612.000000,E,1,16,0.4,1.2,M,48.9,M,,*66
$GPGSV,3,1,10,27,72,332,44,16,60,195,37,10,58,125,39,23,49,070,31*79
$GPGSV,3,2,10,08,33,301,35,26,33,177,38,18,19,058,35,21,19,251,23*7D
$GPGSV,3,3,10,07,09,309,27,15,06,044,27*7E
$GLGSV,2,1,07,77,41,297,23,76,40,227,37,87,32,284,40,71,29,115,43*64
$GLGSV,2,2,07,85,23,064,38,78,04,341,32,75,02,186,18*5D
$GPGSA,A,3,07,08,10,15,16,18,21,23,26,27,,,1.7,0.8,1.4*3E
$GNGSA,A,3,07,08,10,15,16,18,21,23,26,27,,,1.7,0.8,1.4*20
$GNGSA,A,3,71,76,77,78,85,87,,,,,,,1.7,0.8,1.4*2D
$QZGSA,A,3,,,,,,,,,,,,,1.7,0.8,1.4*25
$GPRMC,092313.00,A,4300.000000,N,00612.000000,E,000.1,,180722,,,A*70
For further technical informations regarding the NMEA sentences sent out by the Huawei ME906s, I've written an appendix at the bottom.
Using the GPS with gpsd
Installing and configuring gpsd
gpsd
is a powerful daemon that enables many applications to access the GPS using the network.
On Debian-based distros, it can easily be installed with sudo apt install gpsd
We then need to make a small amendment in its configuration file, located at /etc/default/gpsd
.
The row with DEVICES=""
must be edited so that it reads DEVICES="/dev/ttyUSB0"
.
After this is done, restart the daemon with sudo systemctl restart gpsd.socket
.
Show GPS data with gpsd
By installing the Debian package gpsd-clients
it will be possible to use several small utilities that can display various kinds of GPS data retrieved from gpsd
.
For example, xgps
shows the GPS satellites in use and available among other data, xgpsspeed
is a speedometer, cgps
is the same as xgps
but is a command-line application.
Interfacing the GPS with OpenCPN
OpenCPN is a chart plotter program, with the GPS it can show your location among other things. The GPS can be accessed both with the serial port and with gpsd
, the latter is more practical.
To set up the GPS, go to Connections
, Add Connection
, select type Network
, protocol gpsd
and address 127.0.0.1
.
For the serial port, select type Serial
, select the port /dev/ttyUSB0
and baudrate to 9600
.
Interfacing the GPS with WXtoIMG
WXtoIMG is a program that decodes APT images transmitted from NOAA 15, 18 and 19 polar weather satellites.
To interface this program with the GPS so it can automatically determine the ground station location and sync time, you just need to go to Options
and then Ground Station Location
, check Use GPS
, set the port to /dev/ttyUSB0
and finally set the baud rate to 9600.
If the program complains about the port being busy, stop gpsd
with sudo systemctl stop gpsd.socket
.
Interfacing the GPS with Google Earth
This is very simple: go to Tools -> GPS and click on Start GPS.
Interfacing the GPS with Wine (Windows) programs
You just need to select the correct COM port that corresponds to the Huawei module serial port.
It is possible to check which COM port corresponds to which serial port by issuing ls .wine/dosdevices | grep com
.
In my case, this is the output: lrwxrwxrwx 1 jacopo jacopo 12 lug 15 20:07 com33 -> /dev/ttyUSB0
Then, in the Windows program, select the correct port which in this example will be COM33.
Technical explanation of NMEA
The NMEA protocol is based on a series of strings called sentences. Each sentence begins with a dollar and a two character identification code, GP
for GPS, GL
for GLONASS, QZ
for QZSS, GN
for GNSS.
Ecco tutte le sentence emesse dal ME906s:
GPGGA
(GPS Fix Data) - GPS position (longitude/latitude)GPGSV
(GPS Satellites in View) - American GPS satellites in viewGLGSV
(GLONASS Satellites in View) - Russian GLONASS satellites in viewGPGSA
(GPS Satellites Active) - American GPS satellites that are being used to determine the positionGNGSA
(GNSS Satellites Active) - Other satellites that are being used to determine the positionQZGSA
(QZSS Satellites Active) - Japanese QZSS satellites that are being used to determine the positionGPRMC
(Recommended Minium Navigation Information) - speed, altitude, bearing, course information