Skip to content

M95 Module

This module implements the Zerynth driver for the Quectel M95 GSM/GPRS 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
  • RTC clock
  • SM
  • SMS

Listening sockets for TCP and UDP protocols are not implemented due to the nature of GSM networks. Moreover, UDP sockets must be connected or bind explicitly in the code to select which kind of function to perform (send vs sendto and recv vs recvfrom).

The communication with M95 is performed via UART without hardware flow control at 115200 baud.

This module provides the m95Exception to signal errors related to the hardware initialization and management.

init

init(serial, dtr, rts, power, kill, status, power_on=LOW, kill_on=LOW, status_on=HIGH)

Initialize the M95 device given the following parameters:

  • serial, the serial port connected to the M95 (SERIAL1, SERIAL2, etc…)
  • dtr, the DTR pin of M95 (not used yet)
  • rts, the RTS pin of M95 (not used yet)
  • power, the power key pin of M95
  • kill, the emergency off (kill) pin of M95
  • status, the status pin of M95
  • power_on, the active level of the power pin (can be HIGH in some pcb designs)
  • kill_on, the active level of the kill pin (can be HIGH in some pcb designs)
  • status_on, the value of status pin indicating successful poweron (can be LOW in some pcb designs)
bypass

bypass(mode)

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.
shutdown

shutdown(forced=False)

Power off the module by pulsing the power pin (clean power-down).

If forced is given, use emergency off (faster, do not detach from network).

startup

startup()

Power on the module by pulsing the power pin.

Network Time

The M95 has an internal Real Time Clock that is automatically synchronized with the Network Time. The current time can be retrieved with the following function:

rtc

rtc()

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.