Jacopo's Lair


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.

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:


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

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: