The Sequans Monarch Module is a LTE-M cellular modem that comes in two styles; one has GPS integrated, and one does not. Both starter kits are available for purchased from Avnet using the following links:
https://www.avnet.com/wps/portal/us/products/new-product-introductions/npi/sequans-monarch-go
Using the Monarch Module in an IoT solution allows easy addition of Cellular communications capabilities--great for remote placement of sensors. This Blog discusses the setup of the Monarch-GO Module and utilizing it with AT commands over a serial connection. I have posted an example Python script (at https://github.com/Avnet/sequans_python ) that implements a typical HTTP/HTTPS and MQTT connection
Sequans Monarch-GO setup
The Sequans Monarch-Go Module comes configured to use the Verizon cellular network. To begin, ensure the Verizon SIM card is installed properly by removing the module from the PCB (two screws holding the module to the PCB board) and accessing the SIM card via the access door:
With the SIM card installation verified, connect the module to a PC using the serial port on the PCB to allow communications with a connected computer. It is necessary to use a Serial Terminal program such as minicom or Putty when communicating with the module.
Once the mini-USB cable in connected, the Monarch-Go module and should automatically connect. On a Windows PC the drivers will be auto-installed, on a Linux PC the connection is made as VCP ports (usually identified as /dev/ttyUSBx). In total, there are 4 ports enabled by the module but only UART 1 is utilized:
UART | Description | Baudrate | Data Bits | Flow Control | Parity | Stop Bits |
---|---|---|---|---|---|---|
0 | AT Commands | 921600 | 8 | Hardware | None | 1 |
1 | AT Commands | 115200 | 8 | Hardware | None | 1 |
2 | Console | 115200 | 8 | None | None | 1 |
3 | Unused | NA | NA | NA | NA | NA |
After you have connected the module to your PC, use the Serial Terminal program to verify the module is responding correctly by entering an ‘AT’ and return. You will see an “OK” response generated by the Monarch.
Verizon SIM sign-up
Because the module was provided with a Verizon SIM card, it has to be associated with a ThingSpace account. This association is made by going to the web page https://thingspace.verizon.com/service/connectivity-for-developers/ and following the signup procedure.
With the serial communications between the Monarch and PC confirmed and the SIM card association complete, you can verify a network connection by observing the power-up log of the Monarch. The log will report:
+SYSSTART +CEREG: 2 +CEREG: 0 +CEREG: 2 +CEREG: 1,"9B01","02610402",7
Note: the values following CEREG: 1 may be different
The SYSSTART indicates the module is starting and the CEREG command reports registration status after startup. The status of ‘2’ indicates that the device isn’t registered and ‘0’ indicates that a search is underway for an operator to register with. Once the operator is found--in this case Verizon--the device registers and the network information is shown after the ‘1’ status. At this point, the module has registered with the network using the SIM that you associated with a ThingSpace account and you can issue commands. An easy way to verify operation is to issue a Ping command to google.com (8.8.8.8), e.g.:
AT+PING="ping 8.8.8.8"
PING 8.8.8.8 with 32 bytes of data
from 8.8.8.8 icmp_seq=1 ttl=51 time=200 ms
OK
As shown above, Google received the ping and responded as you would expect.
The HTTP/HTTPS Interface
With internet connectivity confirmed, AT commands can be used in Python scripts for network communications. The example (implemented in Python3) provided at https://github.com/Avnet/sequans_python demonstrates both HTTP and MQTT communications. When started, the example script displays the following to the user:
For HTTP communications, the script interacts with http://httpbin.org--a simple HTTP Request & Response service--by sending PUT, POST, GET, DELETE, and STREAM commands. When httpbin.org receives the commands, it echos the command back. An example using a PUT command is:
You can also use HTTPS rather than HTTP by toggling TLS prior to issuing the command. In the example above, TLS was enabled so the response url is displayed as "https://httpbin.org/put".
MQTT Interface
The example script also supports posting and subscribing to an MQTT exchange. To demonstrate interaction with an MQTT broker, the script uses HiveMQ and the Chrome browser application MQTTBox. To begin, setup the MQTTBox application to use an MQTT Client id of 'client-test1' and a Host address of 'broker.hivemq.com'. This will allow you to monitor and post to topics from within MQTTBox. The setup should look similar to:
Once configured, you can monitor and post topics. In the script, 'sqn/test' is the topic used so when posting to the Sequans module, use this topic (in the Topic to publish box) and whatever Payload you would like will be sent to this topic. When the 'Publish' button is pressed, the payload will be displayed on the right side of the dialog showing the payload for the 'sqn/test' topic. An example of this is shown below:
Using the example script provided, select either 7 or 8 to Subscribe/Post messages between HiveMQ, the MQTTBox application, and the Python script. For example, in the following screen shot, an MQTT Subscribe action has been executed and the script then waits for a subscribed message to be received. When the payload is posted to the 'sqn/test' topic using MQTTBox, it will also be displayed in the Python Script as shown below.
Similarly, when a Post is executed by the Python script (selection 8), the published message is displayed within MQTTBox as shown below:
Summary
The Sequans Monarch-Go module has an extensive set of AT commands that can be utilized, the currently implemented script is but a limited sub-set. For a complete listing of AT commands, reference the Sequans Monarch AT Command Reference Guide.