Introduction

The Monarch Go Pi HAT is a cellular connectivity add-on card for SBC boards that have a Raspberry Pi HAT-compatible connector. Fitted with Sequans Monarch Go (or Monarch Go GPS) LTE Cat-M1 modem, this HAT board also facilitates expansion via Click boards using a compact onboard Click Shuttle connector. Noteworthy is that an integrated onboard USB-UART bridge interface allows this LTE HAT to also be used with other platforms.

 

Version

DateVersionRevision
06 August 2001Initial Release

 

Prerequisites - Before starting this Getting Started Guide, you will need to register your Monarch Go Modem with the Verizon Thing Space network. You will need to sign up and select your desired service plan. Please visit https://thingspace.verizon.com/

 

Required Equipment

 

     Demo 1. Monarch GO Pi Hat Standalone Operation     The Monarch Go Pi hat can be operated in standalone operation via the MicroUSB interface    

            

           Hardware Setup

               1. Set the Moanrch Go Pi Hat Jumpers to Standalone operation

    • J6 : 3-5 / 4-6
    • J7 : 3-5 / 4-6
    • J10 : 1-2

          

               2. Connect the Monarch Go Pi using the microUSB J8 connector on the Monarch Go Pi Hat to your PC using a microUSB cable

                     

          Software Configuration 

               1. Now that the hardware is all setup, open a terminal such as Tera Term or Putty and connect to the Monarch Go UART interface.    

                  Please note your COM port will vary from the image below. If you cannot connect to the UART interface please verify the jumpers are configured correctly.   

               

               2. In the Terminal enter : AT+CMEE=2  You should receive the message OK back from the modem indicating success              

                   This will allow verbose error messages from AT Commands

              

               3. Now lets check the SIM Card state to verify if the SIM is present and unlocked. Enter AT+CPIN? if everything is operating correctly you will receive back +CPIN:Ready incating the SIM card is present and unlocked              

               4. Now that we have verified the present of the SIM lets make sure you are connected to the Verizon Thing Space network. Enter AT+CEREG?   

                  You should get back somthing along the lines of +CEREG: 2,1 "XXXX", "XXXXXXX",X if everything is operating correctly.     

                   If you don't recevie this back you should verify your Verizon ThingSpace account and Modem and connected.                

 

               5. Now that the connection has been verified lets do a simple ping using AT commands. Enter AT+PING="8.8.8.8" This command will ping google.com. You shoudl recieve 4 ping indicators back followed by an OK.

                   

               6. Now you have successfull connected and started working with the Monarch Go Pi Hat Standalone. Lets move over to Single Board Computer development moving into Demo 2.            

 

     Demo 2. Raspberry Pi 4 B Monarch GO Pi Hat Implementatin                

           Operating System SD Card Setup              

               1. Take your 16GB microSD Card and connect it to your PC

               2. Download the "Raspberry Pi OS (32-bit) with desktop and recommended software" by going to Link           

               3.  You can then use a program such as Win32DiskImager or Etcher.io to flash the .img image onto the 16GB SD Card.              

               4. Leave the SD Card in your PC as some changes will need to be made.         

         

         Enable SSH Support via Wifi

               1. Open the boot directory on the SD card you just imaged

               2.Create a empty file named SSH in the boot directory of the SD Card

               .

               3.Make sure to remove any extension on this file, for instance in my case, I created the SSH file by creating a TXT file named SSH, I then enabled viewing extensions and removed it from the file. To enable viewing extension, follow this guide

                   --->

               4. Create a new file named wpa_supplicant.conf and add the following text into the file. Please note where is says your_wifi_ssid and your_wifi_password you must put your wifi SSID and Password

              

 

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
scan_ssid=1
ssid="your_wifi_ssid"
psk="your_wifi_password"
}

  

               5. Similiary to the SSH file, make sure to remove the .txt extension from the end of the file.

 

          Customizing the OS and Application              

               1. For the Raspberry Pi 4 B, the default UART used by console for communicating with the SBC is the primary UART which is the same UART interface the Monarch Go Pi Hat needs to use.                  

                  We will need to change our console UART from primary UART to secondary UART. Open the boot directory on the SD Card in the windows explorer.                  

                  Open the cmdline.txt file using a text editor, change console=serial0 to console=serial1                  

                  See completed change in image below for reference. Make sure to save and exit the text editor

                    

               2. Now that the console UART interface is configured correctly, lets grab the application we will be using from the Avnet GitHub.                  

                  Go to github.com/Avnet/sequans_python Click Clone -> Download ZIP

                          

               3. Unzip the ZIP file and paste the http_demo.py onto the microSD Card

            

                  4. Before we eject the microSD Card open the http_demo.py application using a text editor.    

                  We must edit the UART interface to use the primary UART. Change "/dev/ttymxc0" to "/dev/serial0"    

                  

              

               5. Save the file and safely eject the MicroSD Card.

         

          Hardware Setup

               1. Set the Monarch Go Pi Hat Jumpers to Single Board Computer Operation

    • J6 : 1-3 / 2-4
    • J7 : 1-3 / 2-4
    • J10 : No Connect

         

               2. Connect the Monarch Go Pi Hat to your SBC 40 pin GPIO Raspberry Pi Hat

 

 

 

               3. Insert the microSD Card into the Raspberry Pi 4 B and connect the power supply. The SBC should power on.

                                          

          Connect the Raspberry Pi 4 B via SSH

               1. Now that the board has powered on, you should have enabled SSH and automatically connect the board to your wireless network

               2. Now the fun part of determing the IP address of your Raspberry Pi 4 B!

               3. In my case I logged into my router and determined the IP address of the Raspberry Pi 4 B

              

               4. You can refer to your router which should have information in regards to how to login to your router. Or do a quick google search on how to login to your router!

                    If you can't find your raspberry pi IP address when you logged into the modem, you most likely left the extensions on your wapsupplicant.conf file on the sd card.

 

               5. Now that we have determined the Raspberry Pi IP address in my case (192.168.0.29). Open a terminal in my case putty and type in the IP address, make sure the port is 22 and SSH is selected. Then select open to start your session.

              

            

 

               7. You have successfully connected to the Raspberry Pi 4 B

 

 

          Running the Application

 

               1.Earlier we changed the default console UART to the Seconday UART we must now enable the primary UART for the Sequans communciation.

               2. Open the raspberry Pi configs enter sudo raspi-config

                   

               3.Select option 5 - Interfacing Options

               4.Select option P6 - Serial

               5. At the prompt "Would you like a login shell to be accessible over serial? answer No

               6. At the prompt "Would you like the serial port hardware to be enabled?" answer Yes

               7. Select Finish to exit, and yes to reboot the Raspberry Pi 4 B

               8. Relogin to your Raspberry Pi 4 B as you did earlier.

 

               . Type ls /dev to verify both serial interfaces are enabled.

              

               9. Go to the boot directory in the image to find the http_demo.py application. Enter the following commands cd /boot and then enter ls to see the files in your location.

                        

        

               10. Now that the requried packages are available, lets configure the RTS and CTS GPIO signals approaprately. Run the following commads.

               

                    RTS

                    a. echo 17 > /sys/class/gpio/export  

                    b. echo out > /sys/class/gpio/gpio17/direction  

                    c. echo 0 > /sys/class/gpio/gpio17/value 

                

                    CTS

                    d. echo 16 > /sys/class/gpio/export 

                    e. echo in > /sys/class/gpio/gpio16/direction

 

                   These five commands will set RTS (GPIO 17) as an ouput fulled low and CTS (GPIO 16) as an input on the Raspberry Pi 4 B

 

               11. Now lets run the Python3 application enter python3 ./http_demo.py You should see a menu similiar to what is shown below.

              

     Running the Application          

               1. I'd reccomend starting with Entering 1 This will show your frimware version and verify communication between the modem and the SBC

 

 

               2. For the HTTP communications examples, 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".

 

 

 

                3. Using the MQTT Interface

                    a.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:

 

                        

                    b.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:

                        

                    c.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: