Hide last authors
Xiaoling 53.3 1 (% class="wikigeneratedid" %)
2 **Table of Contents:**
3
4 {{toc/}}
5
6
Edwin Chen 1.1 7 = 1. The use of this guideline =
8
Xiaoling 1.2 9
Edwin Chen 1.1 10 This configure instruction is for Dragino NB-IoT models with -NB or -NS suffix, for example DDS75-NB. These models use the same NB-IoT Module **[[BC660K-GL>>https://www.quectel.com/product/lpwa-bc660k-gl-nb2]]** and has the same software structure. The have the same configure instruction to different IoT servers. Use can follow the instruction here to see how to configure to connect to those servers.
11
12
Xiaoling 1.4 13 = 2. Network Connection =
Edwin Chen 1.1 14
15
Xiaoling 1.3 16 The -NB and -NS models support (% style="color:blue" %)**LTE Cat NB2**(%%), with below frequency band: multiple frequency bands of (% style="color:blue" %)**B1/B2/B3/B4/B5/B8/B12/B13/B14/B17/B18/B19/B20/B25/B28/B66/B70/B85**(%%) . Make sure you use a the NB-IoT SIM card.
Edwin Chen 1.1 17
Xiaoling 53.3 18 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %)
19 |(% style="background-color:#4f81bd; color:white" %)**SIM Provider**|(% style="background-color:#4f81bd; color:white" %)**APN**|(% style="background-color:#4f81bd; color:white" %)**NB-IoT Coverage**|(% style="background-color:#4f81bd; color:white" %)**Comments**
20 |1NCE| | |
21 |China Mobile| | |
Edwin Chen 1.1 22
Xiaoling 53.27 23
24
Xiaoling 1.4 25 == 2.1 1NCE SIM Card. ==
Xiaoling 1.2 26
27
Xiaoling 53.2 28
Edwin Chen 1.1 29 = 3. Configure to connect to different servers =
30
Xiaoling 53.3 31 == 3.1 General UDP Connection ==
Xiaoling 53.2 32
33
34 The NB-IoT Sensor can send packet to server use UDP protocol.
35
36
Xiaoling 53.3 37 === 3.1.1 Simulate UDP Connection by PC tool ===
38
39
Xiaoling 53.2 40 We can use PC tool to simulate UDP connection to make sure server works ok.
41
42 [[image:image-20230802112413-1.png]]
43
44
Xiaoling 53.3 45 === 3.1.2 Configure NB-IoT Sensor ===
Xiaoling 53.2 46
Xiaoling 53.3 47 ==== 3.1.2.1 AT Commands ====
Xiaoling 53.2 48
Xiaoling 53.3 49
Xiaoling 53.4 50 (% style="color:blue" %)**AT Commands:**
Xiaoling 53.3 51
Xiaoling 53.5 52 * (% style="color:#037691" %)**AT+PRO=2,0**  (%%) ~/~/  Set to use UDP protocol to uplink ,Payload Type select Hex payload
Xiaoling 53.8 53
Xiaoling 53.5 54 * (% style="color:#037691" %)**AT+SERVADDR=120.24.4.116,5601**  (%%) ~/~/  Set UDP server address and port
Xiaoling 53.8 55
Xiaoling 53.5 56 * (% style="color:#037691" %)**AT+CFM=1**    (%%) ~/~/  If the server does not respond, this command is unnecessary
Xiaoling 53.2 57
58 [[image:image-20230802112413-2.png]]
59
60
Xiaoling 53.3 61 ==== 3.1.2.2 Uplink Example ====
Xiaoling 53.2 62
Xiaoling 53.3 63
Xiaoling 53.2 64 [[image:image-20230802112413-3.png]]
65
66
Xiaoling 53.7 67 == 3.2 General MQTT Connection ==
Xiaoling 53.2 68
Xiaoling 53.6 69
Xiaoling 53.2 70 The NB-IoT Sensor can send packet to server use MQTT protocol.
71
Xiaoling 53.6 72 Below are the commands.
Xiaoling 53.2 73
Xiaoling 53.8 74 (% style="color:blue" %)**AT Commands:**
Xiaoling 53.2 75
Xiaoling 53.9 76 * (% style="color:#037691" %)**AT+PRO=3,0**   (%%) ~/~/  Set to use MQTT protocol to uplink, Payload Type select Hex payload.
Xiaoling 53.2 77
Xiaoling 53.9 78 * (% style="color:#037691" %)**AT+SERVADDR=120.24.4.116,1883**  (%%) ~/~/  Set MQTT server address and port
Xiaoling 53.8 79
Xiaoling 53.9 80 * (% style="color:#037691" %)**AT+CLIENT=CLIENT**     (%%) ~/~/  Set up the CLIENT of MQTT
Xiaoling 53.8 81
Xiaoling 53.9 82 * (% style="color:#037691" %)**AT+UNAME=UNAME**        (%%) ~/~/  Set the username of MQTT
Xiaoling 53.8 83
Xiaoling 53.9 84 * (% style="color:#037691" %)**AT+PWD=PWD**             (%%) ~/~/  Set the password of MQTT
Xiaoling 53.8 85
86 * (% style="color:#037691" %)**AT+PUBTOPIC=NSE01_PUB**  (%%) ~/~/  Set the sending topic of MQTT
87
88 * (% style="color:#037691" %)**AT+SUBTOPIC=NSE01_SUB**  (%%) ~/~/  Set the subscription topic of MQTT
89
Xiaoling 53.2 90 [[image:image-20230802112413-4.png]]
91
92 [[image:image-20230802112413-5.png]]
93
Xiaoling 53.9 94 (% style="color:red" %)**Notice: MQTT protocol has a much higher power consumption compare with UDP/CoAP protocol. Please check the power analyze document and adjust the uplink  period to a suitable interval.**
Xiaoling 53.2 95
96
Xiaoling 53.7 97 == 3.3 [[ThingSpeak>>url:https://thingspeak.com/]] (via MQTT) ==
Xiaoling 53.2 98
Xiaoling 53.9 99 === 3.3.1 Get MQTT Credentials ===
Xiaoling 53.2 100
Xiaoling 53.9 101
Xiaoling 53.2 102 [[ThingSpeak>>url:https://thingspeak.com/]] connection uses MQTT Connection. So we need to get MQTT Credentials first. You need to point MQTT Devices to ThingSpeak Channel as well.
103
104 [[image:image-20230802112413-6.png]]
105
106 [[image:image-20230802112413-7.png]]
107
108
Xiaoling 53.27 109 === 3.3.2 Simulate with MQTT.fx ===
Xiaoling 53.2 110
Xiaoling 53.27 111 ==== 3.3.2.1 Establish MQTT Connection ====
Xiaoling 53.2 112
Xiaoling 53.9 113
Xiaoling 53.2 114 After we got MQTT Credentials, we can first simulate with PC tool MQTT.fx tool to see if the Credentials and settings are fine.
115
116 [[image:image-20230802112413-8.png]]
117
Xiaoling 53.9 118 * (% style="color:#037691" %)**Broker Address:**(%%) mqtt3.thingspeak.com
Xiaoling 53.2 119
Xiaoling 53.9 120 * (% style="color:#037691" %)**Broker Port:**(%%) 1883
Xiaoling 53.10 121
Xiaoling 53.9 122 * (% style="color:#037691" %)**Client ID:**(%%) <Your ThingSpeak MQTT ClientID>
Xiaoling 53.10 123
Xiaoling 53.9 124 * (% style="color:#037691" %)**User Name:**(%%) <Your ThingSpeak MQTT User Name>
Xiaoling 53.10 125
Xiaoling 53.9 126 * (% style="color:#037691" %)**Password:**(%%) <Your ThingSpeak MQTT Password>
Xiaoling 53.2 127
Xiaoling 53.9 128
Xiaoling 53.28 129
130 ==== 3.3.2.2 Publish Data to ThingSpeak Channel ====
131
132
Xiaoling 53.2 133 [[image:image-20230802112413-9.png]]
134
135 [[image:image-20230802112413-10.png]]
136
Xiaoling 53.10 137 (% style="color:blue" %)**In MQTT.fx, we can publish below info:**
Xiaoling 53.2 138
Xiaoling 53.10 139 * (% style="color:#037691" %)**Topic:**(%%) channels/YOUR_CHANNEL_ID/publish
Xiaoling 53.2 140
Xiaoling 53.10 141 * (% style="color:#037691" %)**Payload:**(%%) field1=63&field2=67&status=MQTTPUBLISH
142
Xiaoling 53.2 143 Where 63 and 67 are the value to be published to field1 & field2.
144
145
Xiaoling 53.10 146 (% style="color:blue" %)**Result: **
Xiaoling 53.2 147
148 [[image:image-20230802112413-11.png]]
149
150
Xiaoling 53.28 151 === 3.3.3 Configure NB-IoT Sensor for connection ===
Xiaoling 53.2 152
Xiaoling 53.28 153 ==== 3.3.3.1 AT Commands: ====
Xiaoling 53.2 154
Xiaoling 53.10 155
Xiaoling 53.2 156 In the NB-IoT, we can run below commands so to publish the channels like MQTT.fx
157
Xiaoling 53.27 158 * (% style="color:blue" %)**AT+PRO=3,1** (%%) ~/~/ Set to use ThingSpeak Server and Related Payload
Xiaoling 53.9 159
Xiaoling 53.26 160 * (% style="color:blue" %)**AT+CLIENT=<Your ThingSpeak MQTT ClientID>**
Xiaoling 53.9 161
Xiaoling 53.26 162 * (% style="color:blue" %)**AT+UNAME=<Your ThingSpeak MQTT User Name>**
Xiaoling 53.9 163
Xiaoling 53.26 164 * (% style="color:blue" %)**AT+PWD=<Your ThingSpeak MQTT Password>**
Xiaoling 53.9 165
Xiaoling 53.26 166 * (% style="color:blue" %)**AT+PUBTOPIC=<YOUR_CHANNEL_ID>**
Xiaoling 53.9 167
Xiaoling 53.26 168 * (% style="color:blue" %)**AT+SUBTOPIC=<YOUR_CHANNEL_ID>**
Xiaoling 53.2 169
Xiaoling 53.26 170
Xiaoling 53.28 171 ==== 3.3.3.2 Uplink Examples ====
Xiaoling 53.10 172
173
Xiaoling 53.2 174 For S31-NB
175
176 For SE01-NB
177
178 For DDS20-NB
179
180 For DDS45-NB
181
182 For DDS75-NB
183
184 For NMDS120-NB
185
186 For SPH01-NB
187
188 For NLM01-NB
189
190 For NMDS200-NB
191
192 For CPN01-NB
193
194 For DS03A-NB
195
196 For SN50V3-NB
197
198
Xiaoling 53.28 199 ==== 3.3.3.3 Map fields to sensor value ====
Xiaoling 53.2 200
Xiaoling 53.10 201
Xiaoling 53.2 202 When NB-IoT sensor upload to ThingSpeak. The payload already specify which fileds related to which sensor value. Use need to create fileds in Channels Settings. with name so to see the value correctly.
203
204
205 [[image:image-20230802112413-12.png]]
206
207 [[image:image-20230802112413-13.png]]
208
209
210 Below is the NB-IoT Product Table show the mapping.
211
Xiaoling 53.25 212 (% border="1" cellspacing="4" style="background-color:#f2f2f2; width:1386px" %)
213 |(% style="background-color:#4f81bd; width:124px" %) |(% style="background-color:#4f81bd; color:white; width:91px" %)Field1|(% style="background-color:#4f81bd; color:white; width:102px" %)Field2|(% style="background-color:#4f81bd; color:white; width:159px" %)Field3|(% style="background-color:#4f81bd; color:white; width:153px" %)Field4|(% style="background-color:#4f81bd; color:white; width:152px" %)Field5|(% style="background-color:#4f81bd; color:white; width:148px" %)Field6|(% style="background-color:#4f81bd; color:white; width:164px" %)Field7|(% style="background-color:#4f81bd; color:white; width:152px" %)Field8|(% style="background-color:#4f81bd; color:white; width:66px" %)Field9|(% style="background-color:#4f81bd; color:white; width:66px" %)Field10
214 |(% style="background-color:#4f81bd; color:white; width:124px" %)S31x-NB|(% style="width:91px" %)Temperature |(% style="width:102px" %)Humidity|(% style="width:159px" %)Battery|(% style="width:153px" %)RSSI|(% style="width:152px" %) |(% style="width:148px" %) |(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
215 |(% style="background-color:#4f81bd; color:white; width:124px" %)SE01-NB|(% style="width:91px" %)Temperature |(% style="width:102px" %)Humidity|(% style="width:159px" %)conduct|(% style="width:153px" %)dielectric_constant|(% style="width:152px" %)Battery|(% style="width:148px" %)RSSI|(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
216 |(% style="background-color:#4f81bd; color:white; width:124px" %)DDS20-NB|(% style="width:91px" %)distance|(% style="width:102px" %)Battery|(% style="width:159px" %)RSSI|(% style="width:153px" %) |(% style="width:152px" %) |(% style="width:148px" %) |(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
217 |(% style="background-color:#4f81bd; color:white; width:124px" %)DDS45-NB|(% style="width:91px" %)distance|(% style="width:102px" %)Battery|(% style="width:159px" %)RSSI|(% style="width:153px" %) |(% style="width:152px" %) |(% style="width:148px" %) |(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
218 |(% style="background-color:#4f81bd; color:white; width:124px" %)DDS75-NB|(% style="width:91px" %)distance|(% style="width:102px" %)Battery|(% style="width:159px" %)RSSI|(% style="width:153px" %) |(% style="width:152px" %) |(% style="width:148px" %) |(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
219 |(% style="background-color:#4f81bd; color:white; width:124px" %)NMDS120-NB|(% style="width:91px" %)distance|(% style="width:102px" %)Battery|(% style="width:159px" %)RSSI|(% style="width:153px" %) |(% style="width:152px" %) |(% style="width:148px" %) |(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
220 |(% rowspan="1" style="background-color:#4f81bd; color:white; width:124px" %)SPH01-NB|(% style="width:91px" %)ph|(% style="width:102px" %)Temperature|(% style="width:159px" %)Battery|(% style="width:153px" %)RSSI|(% style="width:152px" %) |(% style="width:148px" %) |(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% colspan="1" rowspan="1" style="width:66px" %)
221 |(% style="background-color:#4f81bd; color:white; width:124px" %)NLM01-NB|(% style="width:91px" %)Humidity|(% style="width:102px" %)Temperature|(% style="width:159px" %)Battery|(% style="width:153px" %)RSSI|(% style="width:152px" %) |(% style="width:148px" %) |(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
222 |(% style="background-color:#4f81bd; color:white; width:124px" %)NMDS200-NB|(% style="width:91px" %)distance1|(% style="width:102px" %)distance2|(% style="width:159px" %)Battery|(% style="width:153px" %)RSSI|(% style="width:152px" %) |(% style="width:148px" %) |(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
223 |(% style="background-color:#4f81bd; color:white; width:124px" %)CPN01-NB|(% style="width:91px" %)alarm|(% style="width:102px" %)count|(% style="width:159px" %)door open duration|(% style="width:153px" %)calc flag|(% style="width:152px" %)Battery|(% style="width:148px" %)RSSI|(% style="width:164px" %) |(% style="width:152px" %) |(% style="width:66px" %) |(% style="width:66px" %)
224 |(% colspan="1" rowspan="1" style="background-color:#4f81bd; color:white; width:124px" %)DS03A-NB|(% colspan="1" rowspan="1" style="width:91px" %)level|(% colspan="1" rowspan="1" style="width:102px" %)alarm|(% colspan="1" rowspan="1" style="width:159px" %)pb14door open num|(% colspan="1" rowspan="1" style="width:153px" %)pb14 last open time|(% colspan="1" rowspan="1" style="width:152px" %)pb15 level status|(% colspan="1" rowspan="1" style="width:148px" %)pb15 alarm status|(% colspan="1" rowspan="1" style="width:164px" %)pb15 door open num|(% colspan="1" rowspan="1" style="width:152px" %)pb15 last open time|(% colspan="1" rowspan="1" style="width:66px" %)Battery|(% colspan="1" rowspan="1" style="width:66px" %)RSSI
225 |(% colspan="1" rowspan="1" style="background-color:#4f81bd; color:white; width:124px" %)SN50V3-NB|(% colspan="1" rowspan="1" style="width:91px" %) |(% colspan="1" rowspan="1" style="width:102px" %) |(% colspan="1" rowspan="1" style="width:159px" %) |(% colspan="1" rowspan="1" style="width:153px" %) |(% colspan="1" rowspan="1" style="width:152px" %) |(% colspan="1" rowspan="1" style="width:148px" %) |(% colspan="1" rowspan="1" style="width:164px" %) |(% colspan="1" rowspan="1" style="width:152px" %) |(% colspan="1" rowspan="1" style="width:66px" %) |(% colspan="1" rowspan="1" style="width:66px" %)
226 |(% colspan="1" rowspan="1" style="background-color:#4f81bd; color:white; width:124px" %)mod1|(% colspan="1" rowspan="1" style="width:91px" %)mod|(% colspan="1" rowspan="1" style="width:102px" %)Battery|(% colspan="1" rowspan="1" style="width:159px" %)RSSI|(% colspan="1" rowspan="1" style="width:153px" %)DS18B20 Temp|(% colspan="1" rowspan="1" style="width:152px" %)exit_state/input PA4|(% colspan="1" rowspan="1" style="width:148px" %)adc0|(% colspan="1" rowspan="1" style="width:164px" %)Temperature |(% colspan="1" rowspan="1" style="width:152px" %)Humidity|(% colspan="1" rowspan="1" style="width:66px" %) |(% colspan="1" rowspan="1" style="width:66px" %)
227 |(% colspan="1" style="background-color:#4f81bd; color:white; width:124px" %)mod2|(% colspan="1" style="width:91px" %)mod|(% colspan="1" style="width:102px" %)Battery|(% colspan="1" style="width:159px" %)RSSI|(% colspan="1" style="width:153px" %)DS18B20 Temp|(% colspan="1" style="width:152px" %)exit_state/input PA4|(% colspan="1" style="width:148px" %)adc0|(% colspan="1" style="width:164px" %)distance|(% colspan="1" style="width:152px" %) |(% colspan="1" style="width:66px" %) |(% colspan="1" style="width:66px" %)
228 |(% colspan="1" style="background-color:#4f81bd; color:white; width:124px" %)mod3|(% colspan="1" style="width:91px" %)mod|(% colspan="1" style="width:102px" %)Battery|(% colspan="1" style="width:159px" %)RSSI|(% colspan="1" style="width:153px" %)adc0|(% colspan="1" style="width:152px" %)exit_state/input PA4|(% colspan="1" style="width:148px" %)adc1|(% colspan="1" style="width:164px" %)Temperature|(% colspan="1" style="width:152px" %)Humidity|(% colspan="1" style="width:66px" %)adc4|(% colspan="1" style="width:66px" %)
229 |(% colspan="1" style="background-color:#4f81bd; color:white; width:124px" %)mod4|(% colspan="1" style="width:91px" %)mod|(% colspan="1" style="width:102px" %)Battery|(% colspan="1" style="width:159px" %)RSSI|(% colspan="1" style="width:153px" %)DS18B20 Temp|(% colspan="1" style="width:152px" %)adc0|(% colspan="1" style="width:148px" %)exit_state/input PA4|(% colspan="1" style="width:164px" %)DS18B20 Temp2|(% colspan="1" style="width:152px" %)DS18B20 Temp3|(% colspan="1" style="width:66px" %) |(% colspan="1" style="width:66px" %)
230 |(% colspan="1" style="background-color:#4f81bd; color:white; width:124px" %)mod5|(% colspan="1" style="width:91px" %)mod|(% colspan="1" style="width:102px" %)Battery|(% colspan="1" style="width:159px" %)RSSI|(% colspan="1" style="width:153px" %)DS18B20 Temp|(% colspan="1" style="width:152px" %)adc0|(% colspan="1" style="width:148px" %)exit_state/input PA4|(% colspan="1" style="width:164px" %)Weight|(% colspan="1" style="width:152px" %) |(% colspan="1" style="width:66px" %) |(% colspan="1" style="width:66px" %)
231 |(% colspan="1" style="background-color:#4f81bd; color:white; width:124px" %)mod6|(% colspan="1" style="width:91px" %)mod|(% colspan="1" style="width:102px" %)Battery|(% colspan="1" style="width:159px" %)RSSI|(% colspan="1" style="width:153px" %)count|(% colspan="1" style="width:152px" %) |(% colspan="1" style="width:148px" %) |(% colspan="1" style="width:164px" %) |(% colspan="1" style="width:152px" %) |(% colspan="1" style="width:66px" %) |(% colspan="1" style="width:66px" %)
Xiaoling 53.2 232
Xiaoling 53.11 233 == 3.4 Datacake ==
Xiaoling 53.2 234
Xiaoling 53.29 235 === 3.4.1 Define Product ===
Xiaoling 53.2 236
Xiaoling 53.11 237
Xiaoling 53.24 238 Firstly, we need to set the MQTT mode to datacake, and we need to run(% style="color:blue" %)** AT+PRO=3,2**(%%). This command is set to datacake. After running the command, the device automatically sets the server address, port.
Xiaoling 53.11 239
Xiaoling 53.24 240 By chosing to add the device under a (% style="color:blue" %)**"New Product"**(%%) you are required to give a name for this product. You can name it something like (% style="color:blue" %)**"My First MQTT Product"**.
Xiaoling 53.11 241
Xiaoling 53.2 242 [[image:image-20230802112413-14.png]]
243
244
Xiaoling 53.21 245 === 3.4.2 Create Device ===
246
247
Xiaoling 53.2 248 In the second step you have to define the device which should be added to the product.
249
Xiaoling 53.29 250 [[image:image-20230802112413-15.png||height="859" width="1290"]]
Xiaoling 53.2 251
Xiaoling 53.24 252 Enter a name here (such as "My First MQTT Device") and complete the creation of the device by clicking on the (% style="color:blue" %)**"Next"**(%%) button.
Xiaoling 53.2 253
254
Xiaoling 53.21 255 === 3.4.3 Create Database Fields ===
Xiaoling 53.2 256
Xiaoling 53.21 257
Xiaoling 53.2 258 After creating the device, it is listed in the table of the fleet view. Now open the device by clicking on the entry in the list.
259
Xiaoling 53.24 260 You will then see a device view with an empty dashboard. Now, the first thing we want to do is navigate to the Device configuration. To do this, use the tab bar and click on (% style="color:blue" %)**"Configuration"**.
Xiaoling 53.2 261
Xiaoling 53.29 262 [[image:image-20230802112413-16.png||height="495" width="1310"]]
Xiaoling 53.2 263
Xiaoling 53.29 264 [[image:image-20230802112413-17.png||height="741" width="1303"]]
Xiaoling 53.2 265
Xiaoling 53.24 266 To create a first database field, please click on the (% style="color:blue" %)**"Add Field"**(%%) button as marked in the screenshot above.
Xiaoling 53.2 267
268 This will open another modal asking for some required input for your first field.
269
Xiaoling 53.29 270 [[image:image-20230802112413-18.png||height="878" width="1305"]]
Xiaoling 53.2 271
272 [[image:image-20230802112413-19.png]]
273
274
Xiaoling 53.21 275 === 3.4.4 Set up Broker ===
276
277
Xiaoling 53.24 278 The broker is running on mqtt.datacake.co on ports (% style="color:blue" %)**1883 and 8883**(%%). Port 1883 is unsecured and should not be used in production environments. Port 8883 uses a CA signed server certificate.
Xiaoling 53.2 279
280 You will need an access token to log into the Datacake MQTT Broker. You can use your own personal token or create a token explicitly for individual devices or groups of devices.
281
282 View your Personal Access Token
283
Xiaoling 53.24 284 You can view your own token via the User-Settings-Menu. You can reach this menu by clicking on (% style="color:blue" %)**"Edit Profile"**(%%) at the end of the list using the Workspace Selector:
Xiaoling 53.2 285
286 [[image:image-20230802112413-20.png]]
287
Xiaoling 53.21 288 (% style="color:blue" %)**MQTT Client-ID**
Xiaoling 53.2 289
290 The Datacake Broker manages the client IDs internally. You do not need to worry about a client ID. If your client optionally supports the specification of a client ID, please leave this specification blank. Your client then creates a randomly generated ID.
291
Xiaoling 53.21 292 (% style="color:blue" %)**AT+CLIENT=“Any value”**
Xiaoling 53.2 293
Xiaoling 53.21 294 (% style="color:blue" %)**AT+UNAME=Token**
Xiaoling 53.2 295
Xiaoling 53.21 296 (% style="color:blue" %)**AT+PWD=Token**
Xiaoling 53.2 297
298 [[image:image-20230802112413-21.png]]
299
300
Xiaoling 53.21 301 === 3.4.5 Create your first Subscription ===
Xiaoling 53.2 302
303
Xiaoling 53.21 304 (% style="color:blue" %)**Subscribe**
305
Xiaoling 53.31 306 Data is published according to the following structure: (% style="color:blue" %)**dtck~/~//**(%%)** **
Xiaoling 53.2 307
308 Subscribe to topics using this structure to receive messages via MQTT when readings (via API or MQTT) arrive in the Datacake Cloud. Messages are published whenever there is a change to a corresponding database field.
309
310
311 [[image:image-20230802112413-22.png]]
312
313
314 [[image:image-20230802112413-23.png]]
315
316
317 [[image:image-20230802112413-24.png]]
318
319
Xiaoling 53.21 320 (% style="color:blue" %)**example:**
Xiaoling 53.2 321
322 AT+PUBTOPIC=dtck-pub/nbmattest/936c0db6-e9a5-4353-9fdb-3f63c8bfce7e/Temperature
323
324 [[image:image-20230802112413-25.png]]
325
326
Xiaoling 53.21 327 === 3.4.6 Define Publish Topic ===
Xiaoling 53.2 328
Xiaoling 53.21 329
330 (% style="color:blue" %)**Publish**
331
Xiaoling 53.2 332 To upload data into the Datacake Cloud and into a specific device, you publish the data to the respective topic structure.
333
Xiaoling 53.30 334 Due to the nature of MQTT, the topic prefix differs as follows: (% style="color:blue" %)**dtck-pub~/~//**
Xiaoling 53.2 335
Xiaoling 53.21 336 (% style="color:blue" %)**example:**
Xiaoling 53.2 337
338 AT+SUBTOPIC=dtck/nbmattest/936c0db6-e9a5-4353-9fdb-3f63c8bfce7e/Temperature
339
340
Xiaoling 53.21 341 === 3.4.7 upload data ===
342
343
Xiaoling 53.2 344 [[image:image-20230802112413-26.png]]
345
346 [[image:image-20230802112413-27.png]]
347
348 [[image:image-20230802112413-28.png]]
349
350
Xiaoling 53.21 351 == 3.5 Node-Red (via MQTT) ==
Xiaoling 53.2 352
Xiaoling 53.21 353 === 3.5.1 Configure Node-Red ===
Xiaoling 53.2 354
355 [[image:image-20230802112413-29.png]]
356
357 [[image:image-20230802112413-30.png]]
358
Xiaoling 53.24 359
Xiaoling 53.21 360 === 3.5.2 Simulate Connection ===
Xiaoling 53.2 361
Xiaoling 53.21 362
Xiaoling 53.2 363 [[image:image-20230802112413-31.png]]
364
365
Xiaoling 53.21 366 === 3.5.3 Configure NB-IoT Sensors ===
Xiaoling 53.2 367
368
Xiaoling 53.21 369 * (% style="color:blue" %)**AT+PRO=3,0(hex format) or 3,5(json format)**(%%)    ~/~/Set to mqtt Server and  Payload
Xiaoling 53.2 370
Xiaoling 53.25 371 * (% style="color:blue" %)**AT+CLIENT=any value**
Xiaoling 53.21 372
Xiaoling 53.25 373 * (% style="color:blue" %)**AT+UNAME=any value**
Xiaoling 53.21 374
Xiaoling 53.25 375 * (% style="color:blue" %)**AT+PWD=any value**
Xiaoling 53.21 376
Xiaoling 53.25 377 * (% style="color:blue" %)**AT+PUBTOPIC=any value**
Xiaoling 53.21 378
Xiaoling 53.25 379 * (% style="color:blue" %)**AT+SUBTOPIC=any value**
Xiaoling 53.21 380
381 == 3.6 ThingsBoard.Cloud (via MQTT) ==
382
383 === 3.6.1 Configure ThingsBoard ===
384
Xiaoling 53.22 385 ==== 3.6.1.1 Create Device ====
Xiaoling 53.2 386
387 Create a New Device in [[ThingsBoard>>url:https://thingsboard.cloud/]].
388
389 [[image:image-20230802112413-32.png]]
390
391
Xiaoling 53.23 392 ==== 3.6.1.2 Create Uplink & Downlink Converter ====
393
Xiaoling 53.22 394 (% style="color:blue" %)**Uplink Converter**
Xiaoling 53.2 395
396 The purpose of the decoder function is to parse the incoming data and metadata to a format that ThingsBoard can consume. deviceName and deviceType are required, while attributes and telemetry are optional. Attributes and telemetry are flat key-value objects. Nested objects are not supported.
397
398 To create an uplink converter go to the Integrations center -> Data converters page and click “plus” button. Name it “MQTT Uplink Converter” and select type Uplink. Use debug mode for now.
399
400 [[image:image-20230802112413-33.png]]
401
402
Xiaoling 53.22 403 (% style="color:blue" %)**Downlink Converter**
Xiaoling 53.2 404
405 The Downlink converter transforming outgoing RPC message and then the Integration sends it to external MQTT broke
406
407 [[image:image-20230802112413-34.png]]
408
Xiaoling 53.22 409 (% style="color:red" %)**Note:Our device payload is already human readable data. Therefore, users do not need to write decoders. Simply create by default.**
Xiaoling 53.2 410
Xiaoling 53.22 411
Xiaoling 53.23 412 ==== 3.6.1.3 MQTT Integration Setup ====
Xiaoling 53.2 413
414
Xiaoling 53.24 415 Go to the Integrations center -> Integrations page and click **“plus”** icon to add a new integration. Name it “MQTT Integration”, select type MQTT;
416
Xiaoling 53.2 417 [[image:image-20230802112413-35.png]]
418
419 * The next steps is to add the recently created uplink and downlink converters;
420
421 [[image:image-20230802112413-36.png]]
422
423 [[image:image-20230802112413-37.png]]
424
Xiaoling 53.24 425 (% style="color:blue" %)**Add a topic filter:**
Xiaoling 53.2 426
427
428 tb/mqtt-integration-tutorial/sensors~/~/temperature ~-~-> Temperature 固定的? 对的。
429
430 You can also select an MQTT QoS level. We use MQTT QoS level 0 (At most once) by default;
431
432 [[image:image-20230802112413-38.png]]
433
434
Xiaoling 53.23 435 === 3.6.2 Simulate with MQTT.fx ===
436
Xiaoling 53.2 437 [[image:image-20230802112413-39.png]]
438
439 [[image:image-20230802112413-40.png]]
440
441
Xiaoling 53.23 442 === 3.6.3 Configure NB-IoT Sensor ===
Xiaoling 53.2 443
Xiaoling 53.25 444
Xiaoling 53.23 445 (% style="color:blue" %)**AT Commands**
Xiaoling 53.2 446
Xiaoling 53.25 447 * (% style="color:#037691" %)**AT+PRO=3,3  **(%%)** **~/~/ Use MQTT to connect to ThingsBoard.
Xiaoling 53.2 448
Xiaoling 53.25 449 * (% style="color:#037691" %)**AT+SUBTOPIC=device name** (%%) ~-~-> 只需要 Device Name 吗?对的
Xiaoling 53.2 450
Xiaoling 53.25 451 * (% style="color:#037691" %)**AT+PUBTOPIC=device name** (%%) ~-~-> 只需要 Device Name 吗?对的
Xiaoling 53.2 452
453 Users do not need to fill in the client, username, and password. But the configuration information of the device requires setting the client, username, and password, which can be entered freely. (软件自动填充为 Device Name 吧).这边不用提示了,客户不需要输入。(大部分客户还是会自己去设置这个的,提高安全性)
454
Xiaoling 53.23 455 (% style="color:blue" %)**CLIENT :“Any value”**
Xiaoling 53.2 456
Xiaoling 53.23 457 (% style="color:blue" %)**User Name:“Any value”**
Xiaoling 53.2 458
Xiaoling 53.23 459 (% style="color:blue" %)**Password:“Any value”**
Xiaoling 53.2 460
461
462 Test Uplink by click the button for 1 second
463
464 [[image:image-20230802112413-41.png]]
465
466 [[image:image-20230802112413-42.png]]
467
468 [[image:image-20230802112413-43.png]]
469
470
Xiaoling 53.23 471 == 3.7 [[Tago.io>>url:https://admin.tago.io/]] (via MQTT) ==
Xiaoling 53.2 472
Xiaoling 53.23 473 === 3.7.1 Create device & Get Credentials ===
Xiaoling 53.2 474
Xiaoling 53.23 475
Xiaoling 53.2 476 We use MQTT Connection to send data to [[Tago.io>>url:https://admin.tago.io/]]. We need to Create Device and Get MQTT Credentials first.
477
478 [[image:image-20230802112413-44.png]]
479
480 [[image:image-20230802112413-45.png]]
481
482
483 Go to the Device section and create a device. Then, go to the section tokens and copy your device-token.
484
485 [[image:image-20230802112413-46.png]]
486
487
488 On the Connection Profile window, set the following information: (这边加一个截图)
489
Xiaoling 53.23 490 * (% style="color:blue" %)**Profile Name: “Any name”**
Xiaoling 53.2 491
Xiaoling 53.23 492 * (% style="color:blue" %)**Broker Address: mqtt.tago.io**
493
494 * (% style="color:blue" %)**Broker Port: 1883**
495
496 * (% style="color:blue" %)**Client ID: “Any value”**
497
Xiaoling 53.2 498 On the section User credentials, set the following information:(这边加一个截图)
499
Xiaoling 53.25 500 * **User Name: “Any value”**  Tago validates your user by the token only
Xiaoling 53.2 501
Xiaoling 53.23 502 * **Password: “Your device token”**
Xiaoling 53.2 503
Xiaoling 53.23 504 * **PUBTOPIC: “Any value”**
505
506 * **SUBTOPIC: “Any value”**
507
508 === 3.7.2 Simulate with MQTT.fx ===
509
510
Xiaoling 53.2 511 [[image:image-20230802112413-47.png]]
512
513 [[image:image-20230802112413-48.png]]
514
515 Users can run the AT+PRO=3,5 command, and the payload will be converted to JSON format.
516
517 [[image:image-20230802112413-49.png]]
518
519
Xiaoling 53.23 520 === 3.7.3 tago data ===
Xiaoling 53.2 521
Xiaoling 53.23 522
Xiaoling 53.2 523 [[image:image-20230802112413-50.png]]
524
525 [[image:image-20230802112413-51.png]]
526
527
Xiaoling 53.23 528 === 3.7.4 TLS mode ===
Xiaoling 53.2 529
530
Xiaoling 53.23 531 Users can choose to use (% style="color:blue" %)**SSL/TLS**(%%) mode.
Xiaoling 53.2 532
Xiaoling 53.23 533 On the SSL/TLS section, check the option **Enable SSL/TLS**, and click OK.
Xiaoling 53.2 534
Xiaoling 53.23 535 The device needs to enable the TLS mode and set the (% style="color:blue" %)**AT+TLSMOD=1,0**(%%) command.
536
537 * (% style="color:blue" %)**Profile Name: “Any name”**
538
539 * (% style="color:blue" %)**Broker Address: mqtt.tago.io**
540
541 * (% style="color:blue" %)**Broker Port: 8883**
542
543 * (% style="color:blue" %)**Client ID: “Any value”**
544
Xiaoling 53.25 545 * (% style="color:blue" %)**User Name: “Any value”** (%%) Tago validates your user by the token only
Xiaoling 53.23 546
547 * (% style="color:blue" %)**Password: “Your device token”**
548
549 * (% style="color:blue" %)**PUBTOPIC: “Any value”**
550
551 * (% style="color:blue" %)**SUBTOPIC: “Any value”**
552
Xiaoling 53.2 553 [[image:image-20230802112413-52.png]]
554
555
556
Copyright ©2010-2024 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0