This module implements the Zerynth driver for the Quectel BG96 LTE Cat-M1, LTE Cat-NB1 and EGPRS modem (Product page).
The driver must be used together with the standard library GSM Module.
The following functionalities are implemented:
- attach/detach from gprs network
- retrieve and set available operators
- retrieve signal strength
- retrieve network and device info
- socket abstraction
- secure sockets
- GNSS positioning
- RTC clock
Listening sockets for TCP and UDP protocols are not implemented due to the nature of GSM networks. Moreover, UDP sockets must be connected or bound explicitly in the code to select which kind of function to perform (send vs sendto and recv vs recvfrom). NB IoT support is not ready yet.
The communication with BG96 is performed via UART without hardware flow control at 115200 baud.
This module provides the
bg96Exception to signal errors related to the hardware initialization and management.
Initialize the BG96 device given the following parameters:
- serial, the serial port connected to the BG96 (
- dtr, the DTR pin of BG96
- rts, the RTS pin of BG96
- power, the power up pin of BG96
- reset, the reset pin of BG96
- status, the status pin of BG96
- power_on, the active level of the power up pin
- reset_on, the active level of the reset pin
- status_on, the value of status pin indicating successful power on (can be zero in some pcb designs)
Bypass the modem driver to use the serial port directly. It has one parameter:
- mode, can be 1 (non-zero) to enter bypass mode, or 0 (zero) to exit.
Power off the module by pulsing the power pin (clean power-down).
If forced is given, use the reset pin (faster, do not detach from network).
Power on the module by pulsing the power pin.
The BG96 has an internal Real Time Clock that is automatically synchronized with the Network Time. The current time can be retrieved with the following function:
Return a tuple of seven elements:
- current year
- current month (1-12)
- current day (1-31)
- current hour (0-23)
- current minute (0-59)
- current second (0-59)
- current timezone in minutes away from GMT 0
The returned time is always UTC time with a timezone indication.
The BG96 has an integrated GNSS that can be activated and queried for location fixes, regardless of the network status.
A separate module
bg96gnss is also provided to parse NMEA senteces directly from the BG96 dedicated serial port. When using the
BG96_GNSS class, do not also call the following methods to avoid conflicts.
Initializes the GNSS subsystem, given the following parameters:
- fix_rate, configure GNSS fix or NMEA output rate in seconds
- use_uart, use the secondary serial port (UART3) of the BG96 to output NMEA sentences
Shutdown the GNSS subsystem.
Return a tuple of 10 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)
- Not supported
- Not supported
- UTC time as a tuple (yyyy,MM,dd,hh,mm,ss)
The function return None if a fix can’t be obtained.