BG96_GNSS Module

This module implements the Zerynth driver for the Quectel BG96 GNSS functionality on its dedicated UART port (Product page).

The following functionalities are implemented:

  • retrieve the current location fix if present
  • retrieve the current UTC time

The driver starts a background thread continuously tracking the last available location fix. The frequency of fixes can be customized. The driver support serial mode only.

Location fixes are obtained by parsing NMEA sentences of type RMC and GGA. Obtaining a fix or UTC time are thread safe operations.

class BG96_GNSS(ifc, baud=9600)

Create an instance of the BG96_GNSS class.

  • ifc – serial interface to use (for example SERIAL1, SERIAL2, etc...)
  • baud – serial port baudrate


from quectel.bg96gnss import bg96gnss


gnss = bg96gnss.BG96_GNSS(SERIAL1)
alt = mpl.get_alt()
pres = mpl.get_pres()

Start the BG96 GNSS and the receiver thread.

Parameters:use_uart – 1 if BG96’s UART3 must be used, 0 otherwise
Returns:True if receiver thread has been started, False if already active.

Stop the BG96 GNSS and terminates the receiver thread. It can be restarted by calling start.

Returns:True if receiver thread has been stopped, False if already inactive.

Pause the BG96 GNSS by putting it into standby mode. It can be restarted by calling resume.


Wake up the BG96_GNSS from standby mode.


Set the frequency for location fix (100-10000 milliseconds is the available range).


Additional methods from the base class nmea.NMEA_Receiver.

Return the current fix or None if not available. A fix is a tuple with the following elements:

  • latitude in decimal format (-89.9999 - 89.9999)
  • longitude in decimal format (-179.9999 - 179.9999)
  • altitude in meters
  • speed in Km/h
  • course over ground as degrees from true north
  • number of satellites for this fix
  • horizontal dilution of precision (0.5 - 99.9)
  • vertical dilution of precision (0.5 - 99.9)
  • positional dilution of precision (0.5 - 99.9)
  • UTC time as a tuple (yyyy,MM,dd,hh,mm,ss,microseconds)

Return True if a fix is available


Return the current UTC time or None if not available. A UTC time is a tuple of (yyyy,MM,dd,hh,mm,ss,microseconds).

UTC time can be wrong if no fix has ever been obtained.


Return True if a UTC time is available