SIM7070_SIM7080_SIM7090
Series_MQTT(S)
_Application Note
LPWA 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
SIM7070_SIM7080_SIM7090 Series_MQTT(S)_Application Note_V1.02
SIM7070_SIM7080_SIM7090 Series_MQTT(S)_Application Note
1.02
2020.7.8
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 / 16
SIM7070_SIM7080_SIM7090 Series_MQTT(S)_Application Note_V1.02
About Document
Version History
Version
V1.00
V1.02
V1.02
Owner
Zhiyuan.tang
Date
2019.9.2
2020.2.26 Wenjie.Lai
Ping.zhang
2020.7.8
What is new
First Release
Add product types
All
Scope
This document applies to the following products
Name
SIM7080G
SIM7070G/SIM7070E
SIM7070G-NG
SIM7090G
Type
CAT-M/NB
CAT-M/NB/GPRS
NB/GPRS
CAT-M/NB
Size(mm)
17.6*15.7*2.3
24*24*2.4
24*24*2.4
14.8*12.8*2.0
Comments
N/A
N/A
N/A
N/A
www.simcom.com
3 / 16
SIM7070_SIM7080_SIM7090 Series_MQTT(S)_Application Note_V1.02
Contents
About Document.................................................................................................................................. 3
Version History.........................................................................................................................................................3
Scope........................................................................................................................................................................ 3
Contents................................................................................................................................................. 4
Introduction.................................................................................................................................... 5
1
Purpose of the document...........................................................................................................................5
1.1
Related documents.....................................................................................................................................5
1.2
Conventions and abbreviations................................................................................................................ 5
1.3
2 MQTT(S) Introduction.................................................................................................................. 6
3 AT Commands for MQTT(S)....................................................................................................... 7
4 Bearer Configuration....................................................................................................................8
PDN Auto-activation....................................................................................................................................8
APN Manual Configuration........................................................................................................................9
5 MQTT(S) Examples.....................................................................................................................11
5.1 MQTT Function..........................................................................................................................................11
5.2 MQTTS Function.......................................................................................................................................12
Connecting Ali Cloud Function............................................................................................................... 13
5.3
MQTT Connecting Ali Cloud Function.......................................................................................14
MQTTS Connecting Ali Cloud Function....................................................................................15
5.3.1
5.3.2
4.1
4.2
www.simcom.com
4 / 16
SIM7070_SIM7080_SIM7090 Series_MQTT(S)_Application Note_V1.02
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] SIM7070_SIM7080_SIM7090 Series_AT Command Manual
[2] SIM7070_SIM7080_SIM7090 Series_SSL_Application Note
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 / 16
SIM7070_SIM7080_SIM7090 Series_MQTT(S)_Application Note_V1.02
2 MQTT(S) Introduction
MQTT (Message Queue Telemetry Transport) is a messaging protocol based on the publish/subscribe
paradigm under the ISO standard (ISO/IEC PRF 20922). It works on the TCP/IP protocol suite and is a
publish/subscribe messaging protocol designed for remote devices with poor hardware performance and
poor network conditions.
The MQTT protocol is a protocol designed for the communication of remote sensors and control devices
with limited computing power and working on low-bandwidth, unreliable networks. It has the following main
features:
Use the publish/subscribe message mode to provide one-to-many message publishing and uncouple
the application;
Message transmission for shielding the payload content;
Provide network connection using TCP/IP;
There are three types of message publishing service quality:
"At most once," message publishing relies entirely on the underlying TCP/IP network. Message
loss or duplication can occur. This level can be used in the following situations, environmental
sensor data, loss of a read record does not matter, because there will be a second transmission in
the near future.
"At least once" to ensure that the message arrives, but message duplication may occur.
"Only once" to ensure that the message arrives once. This level can be used in situations where
repeated or missing messages can result in incorrect results.
small transmission, low overhead (fixed length of the head is 2 bytes), protocol exchange is minimized
to reduce network traffic;
Use the Last Will and Testament features to notify the parties about the mechanism of client abort.
www.simcom.com
6 / 16
SIM7070_SIM7080_SIM7090 Series_MQTT(S)_Application Note_V1.02
3 AT Commands for MQTT(S)
Command
AT+CSSLCFG
AT+SMCONF
AT+SMSSL
AT+SMCONN
AT+SMPUB
AT+SMSUB
AT+SMUNSUB
AT+SMSTATE
AT+SMPUBHEX
AT+SMDISC
+SMSUB
Description
Configure SSL parameters of a context identifier
Set MQTT Parameter
Select SSL Configure
MQTT Connection
Send Packet
Subscribe Packet
Unsubscribe Packet
Inquire MQTT Connection Status
Set SMPUB Data Format to Hex
Disconnection MQTT
MQTT Receive Subscribe Data
For detail information, please refer to "SIM7070_SIM7080_SIM7090 Series_AT Command Manual".
www.simcom.com
7 / 16
SIM7070_SIM7080_SIM7090 Series_MQTT(S)_Application Note_V1.02
4 Bearer Configuration
Usually module will register PS service automatically.
4.1 PDN Auto-activation
//Example of PDN Auto-activation.
AT+CPIN?
+CPIN:READY
OK
AT+CSQ
+CSQ: 20,0
OK
AT+CGATT?
+CGATT: 1
OK
AT+COPS?
+COPS: 0,0,"CHN-CT",9
OK
AT+CGNAPN
+CGNAPN: 1,"ctnb"
OK
AT+CNCFG=0,1,"ctnb"
OK
AT+CNACT=0,1
OK
+APP PDP: 0,ACTIVE
www.simcom.com
//Check SIM card status
//Check RF signal
//Check PS service. 1 indicates PS has attached.
//Query Network
network.
//Mode 9 means NB-IOT network.
information,
operator
and
//Query the APN delivered by the network after the
CAT-M or NB-IOT network
successfully
registered.
//"ctnb" is APN delivered by the CAT-M or NB-IOT
network. APN is empty under the GSM network.
is
//Before activation please use AT+CNCFG to set
APN\user name\password if needed.
//Activate network, Activate 0th PDP.
8 / 16