SIM7500_SIM7600_SIM7800
Series
MQTT(S)_Application Note
LTE Module
SIMCom Wireless Solutions Limited
Building B, SIM Technology Building, No.633, Jinzhong Road
Changning District, Shanghai P.R. China
Tel: 86-21-31575100
support@simcom.com
www.simcom.com
SIM7500_SIM7600_SIM7800 Series_MQTT(S)_Application Note_V2.00
SIM7500_SIM7600_SIM7800 Series_MQTT(S)_Application Note
2.00
2020.8.6
Released
Document Title:
Version:
Date:
Status:
GENERAL NOTES
SIMCOM OFFERS THIS INFORMATION AS A SERVICE TO ITS CUSTOMERS, TO SUPPORT
APPLICATION AND ENGINEERING EFFORTS THAT USE THE PRODUCTS DESIGNED BY SIMCOM.
THE INFORMATION PROVIDED IS BASED UPON REQUIREMENTS SPECIFICALLY PROVIDED TO
SIMCOM BY THE CUSTOMERS. SIMCOM HAS NOT UNDERTAKEN ANY INDEPENDENT SEARCH
FOR ADDITIONAL RELEVANT INFORMATION, INCLUDING ANY INFORMATION THAT MAY BE IN THE
CUSTOMER’S POSSESSION. FURTHERMORE, SYSTEM VALIDATION OF THIS PRODUCT
DESIGNED BY SIMCOM WITHIN A LARGER ELECTRONIC SYSTEM REMAINS THE RESPONSIBILITY
OF THE CUSTOMER OR THE CUSTOMER’S SYSTEM INTEGRATOR. ALL SPECIFICATIONS
SUPPLIED HEREIN ARE SUBJECT TO CHANGE.
COPYRIGHT
THIS DOCUMENT CONTAINS PROPRIETARY TECHNICAL INFORMATION WHICH IS THE PROPERTY
OF SIMCOM WIRELESS SOLUTIONS LIMITED COPYING, TO OTHERS AND USING THIS DOCUMENT,
ARE FORBIDDEN WITHOUT EXPRESS AUTHORITY BY SIMCOM. OFFENDERS ARE LIABLE TO THE
PAYMENT OF INDEMNIFICATIONS. ALL RIGHTS RESERVED BY SIMCOM IN THE PROPRIETARY
TECHNICAL INFORMATION ,INCLUDING BUT NOT LIMITED TO REGISTRATION GRANTING OF A
PATENT , A UTILITY MODEL OR DESIGN. ALL SPECIFICATION SUPPLIED HEREIN ARE SUBJECT TO
CHANGE WITHOUT NOTICE AT ANY TIME.
SIMCom Wireless Solutions Limited
Building B, SIM Technology Building, No.633 Jinzhong Road, Changning District, Shanghai P.R. China
Tel: +86 21 31575100
Email: simcom@simcom.com
For more information, please visit:
https://www.simcom.com/download/list-863-en.html
For technical support, or to report documentation errors, please visit:
https://www.simcom.com/ask/ or email to: support@simcom.com
Copyright © 2020 SIMCom Wireless Solutions Limited All Rights Reserved.
www.simcom.com
2 / 17
SIM7500_SIM7600_SIM7800 Series_MQTT(S)_Application Note_V2.00
About Document
Version History
Version
V2.00
Date
2020.8.6
Owner
Ning.lv
What is new
Update the format
www.simcom.com
3 / 17
SIM7500_SIM7600_SIM7800 Series_MQTT(S)_Application Note_V2.00
Contents
About Document............................................................................................................ 3
Version History.........................................................................................................................................................3
Contents........................................................................................................................... 4
1.
2.
3.
4.
5.
1.1
1.2
1.3
2.1
2.2
Introduction......................................................................................................... 5
Purpose of the document...........................................................................................................................5
Related documents.....................................................................................................................................5
Conventions and abbreviations................................................................................................................ 5
MQTT Introduction.......................................................................................... 6
Characteristic...............................................................................................................................................6
Request Method.......................................................................................................................................... 6
AT Commands for MQTT(S)............................................................................8
Bearer Configuration........................................................................................ 9
PDN Auto-activation....................................................................................................................................9
4.1
5.1.1
5.1.2
MQTT(S) Samples............................................................................................10
5.1 MQTT Function......................................................................................................................................... 10
Access to MQTT server without SSL/TLS................................................................................10
Access to MQTT server without checking UTF8 coding........................................................ 11
5.2 MQTTS Function.......................................................................................................................................12
Connect to SSL/TLS MQTT server (not verify server)........................................................... 12
Access to SSL/TLS MQTT server (only verify the server).....................................................14
Access to SSL/TLS MQTT server (verify server and client)..................................................16
5.2.1
5.2.2
5.2.3
www.simcom.com
4 / 17
SIM7500_SIM7600_SIM7800 Series_MQTT(S)_Application Note_V2.00
1.Introduction
1.1 Purpose of the document
Based on module AT command manual, this document will introduce MQTT(S) application process.
Developers could understand and develop application quickly and efficiently based on this document.
1.2 Related documents
[1] SIM7600 Series_AT Command Manual
1.3 Conventions and abbreviations
In this document, the GSM engines are referred to as following term:
ME (Mobile Equipment);
MS (Mobile Station);
TA (Terminal Adapter);
DCE (Data Communication Equipment) or facsimile DCE (FAX modem, FAX board);
In application, controlling device controls the GSM engine by sending AT Command via its serial interface.
The controlling device at the other end of the serial line is referred to as following term:
TE (Terminal Equipment);
DTE (Data Terminal Equipment) or plainly "the application" which is running on an embedded system;
www.simcom.com
5 / 17
SIM7500_SIM7600_SIM7800 Series_MQTT(S)_Application Note_V2.00
2. MQTT Introduction
MQTT (Message Queuing Telemetry Transport) is a lightweight broker-based publish/subscribe messaging
protocol. It is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an
extremely lightweight publish/subscribe messaging transport.
for connections with remote
locations where a small code footprint is required and/or network bandwidth is at a premium.
is useful
It
2.1 Characteristic
Support client/server mode;
The publish/subscribe message pattern to provide one-to-many message distribution and
decoupling of applications
A messaging transport that is agnostic to the content of the payload
The use of TCP/IP to provide basic network connectivity
Three qualities of service for message delivery
A small
transport overhead (the fixed-length header is just 2 bytes), and protocol
exchanges minimised to reduce network traffic
A mechanism to notify interested parties to an abnormal disconnection of a client using the
Last Will and Testament feature
2.2 Request Method
According to the MQTT standard, MQTT provides a variety of request methods.
CONNECT, SUBSCRIBE, PUBLISH, UNSUBSCRIBE, DISCONNECT, PINGREQ
No Method
1
2
CONNECT
SUBSCRIB
E
Description
When a TCP/IP socket connection is established from a client to a server, a
protocol level session must be created using a CONNECT flow.
The SUBSCRIBE message allows a client to register an interest in one or more
topic names with the server. Messages published to these topics are delivered
from the server to the client as PUBLISH messages. The SUBSCRIBE message
also specifies the QoS level at which the subscriber wants to receive published
www.simcom.com
6 / 17
SIM7500_SIM7600_SIM7800 Series_MQTT(S)_Application Note_V2.00
messages.
A PUBLISH message is sent by a client to a server for distribution to interested
subscribers. Each PUBLISH message is associated with a topic name (also
known as the Subject or Channel). This is a hierarchical name space that
defines taxonomy of information sources for which subscribers can register an
interest. A message that is published to a specific topic name is delivered to
connected subscribers for that topic.
An UNSUBSCRIBE message is sent by the client to the server to unsubscribe
from named topics.
The DISCONNECT message is sent from the client to the server to indicate that
it is about to close its TCP/IP connection. This allows for a clean disconnection,
rather than just dropping the line.
The PINGREQ message is an "are you alive?" message that is sent from a
connected client to the server.
3
4
5
6
PUBLISH
UNSUBSCR
IBE
DISCONNE
CT
PINGREQ
The SIM7600 series supports several methods: CONNECT, SUBSCRIBE, PUBLISH, UNSUBSCRIBE,
DISCONNECT.
www.simcom.com
7 / 17
SIM7500_SIM7600_SIM7800 Series_MQTT(S)_Application Note_V2.00
3.AT Commands for MQTT(S)
Input the topic of will message
Description
Start MQTT service
Stop MQTT service
Acquire a MQTT client
Release a MQTT client
Set the SSL context
Command
AT+CMQTTSTART
AT+CMQTTSTOP
AT+CMQTTACCQ
AT+CMQTTREL
AT+CMQTTSSLCFG
AT+CMQTTWILLTOPI
C
AT+CMQTTWILLMSG Input the will message
AT+CMQTTCONNECT Connect to a MQTT server
AT+CMQTTDISC
Disconnect from server
AT+CMQTTTOPIC
Input the publish message topic
AT+CMQTTPAYLOAD Input the publish message body
AT+CMQTTPUB
AT+CMQTTSUBTOPI
C
AT+CMQTTSUB
AT+CMQTTUNSUBTO
PIC
AT+CMQTTUNSUB
AT+CMQTTCFG
Unsubscribe a message to server
Configure the MQTT Context
Publish a message to server
Input a subscribe message topic
Subscribe a message to server
Input a unsubscribe message topic
For detail information, please refer to “SIM7600 Series_AT Command Manual“.
www.simcom.com
8 / 17