Last modified by Mengting Qiu on 2025/03/08 11:33
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,3 +1,10 @@ 1 +(% class="wikigeneratedid" %) 2 +**Table of Contents:** 3 + 4 +{{toc/}} 5 + 6 + 7 + 1 1 = 1. The use of this guideline = 2 2 3 3 ... ... @@ -9,76 +9,87 @@ 9 9 10 10 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. 11 11 19 +(% border="1" cellspacing="4" style="background-color:#f2f2f2; width:510px" %) 20 +|(% 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** 21 +|1NCE| | | 22 +|China Mobile| | | 12 12 13 13 == 2.1 1NCE SIM Card. == 14 14 15 15 16 -(% border="1" cellspacing="4" style="width:510px;background-color:#F2F2F2" %) 17 -|(% 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 18 -|1NCE| | | 19 -|China Mobile| | | 20 20 21 - 22 22 = 3. Configure to connect to different servers = 23 23 30 +== 3.1 General UDP Connection == 24 24 25 -= NB-IoT 服务器对接例子 = 26 26 27 -= 1. General UDP Connection = 28 - 29 29 The NB-IoT Sensor can send packet to server use UDP protocol. 30 30 31 -== 1.1 Simulate UDP Connection by PC tool == 32 32 36 +=== 3.1.1 Simulate UDP Connection by PC tool === 37 + 38 + 33 33 We can use PC tool to simulate UDP connection to make sure server works ok. 34 34 35 35 [[image:image-20230802112413-1.png]] 36 36 37 -== 1.2 Configure NB-IoT Sensor == 38 38 39 -=== 1.2 .1ATCommands ===44 +=== 3.1.2 Configure NB-IoT Sensor === 40 40 41 -AT Commands :46 +==== 3.1.2.1 AT Commands ==== 42 42 43 -* AT+PRO=2,0 ~/~/ Set to use UDP protocol to uplink , Payload Type select Hex payload 44 -* AT+SERVADDR=120.24.4.116,5601 ~/~/ Set UDP server address and port 45 -* AT+CFM=1 ~/~/ If the server does not respond, this command is unnecessary 46 46 49 +(% style="color:blue" %)**AT Commands:** 50 + 51 +* (% style="color:#037691" %)**AT+PRO=2,0** (%%) ~/~/ Set to use UDP protocol to uplink ,Payload Type select Hex payload 52 + 53 +* (% style="color:#037691" %)**AT+SERVADDR=120.24.4.116,5601** (%%) ~/~/ Set UDP server address and port 54 + 55 +* (% style="color:#037691" %)**AT+CFM=1** (%%) ~/~/ If the server does not respond, this command is unnecessary 56 + 47 47 [[image:image-20230802112413-2.png]] 48 48 49 -=== 1.2.2 Uplink Example === 50 50 60 +==== 3.1.2.2 Uplink Example ==== 51 51 62 + 52 52 [[image:image-20230802112413-3.png]] 53 53 54 54 55 -= 2.66 +== 3.2 General MQTT Connection == 56 56 68 + 57 57 The NB-IoT Sensor can send packet to server use MQTT protocol. 58 58 59 -Below are the commands 71 +Below are the commands. 60 60 61 -AT Commands: 73 +(% style="color:blue" %)**AT Commands:** 62 62 63 -* AT+PRO=3,0 ~/~/ Set to use MQTT protocol to uplink, Payload Type select Hex payload. 64 -* AT+SERVADDR=120.24.4.116,1883 ~/~/ Set MQTT server address and port 65 -* AT+CLIENT=CLIENT ~/~/ Set up the CLIENT of MQTT 66 -* AT+UNAME=UNAME ~/~/ Set the username of MQTT 67 -* AT+PWD=PWD ~/~/ Set the password of MQTT 68 -* AT+PUBTOPIC=NSE01_PUB ~/~/ Set the sending topic of MQTT 69 -* AT+SUBTOPIC=NSE01_SUB ~/~/ Set the subscription topic of MQTT 75 +* (% style="color:#037691" %)**AT+PRO=3,0** (%%) ~/~/ Set to use MQTT protocol to uplink, Payload Type select Hex payload. 70 70 77 +* (% style="color:#037691" %)**AT+SERVADDR=120.24.4.116,1883** (%%) ~/~/ Set MQTT server address and port 78 + 79 +* (% style="color:#037691" %)**AT+CLIENT=CLIENT** (%%) ~/~/ Set up the CLIENT of MQTT 80 + 81 +* (% style="color:#037691" %)**AT+UNAME=UNAME** (%%) ~/~/ Set the username of MQTT 82 + 83 +* (% style="color:#037691" %)**AT+PWD=PWD** (%%) ~/~/ Set the password of MQTT 84 + 85 +* (% style="color:#037691" %)**AT+PUBTOPIC=NSE01_PUB** (%%) ~/~/ Set the sending topic of MQTT 86 + 87 +* (% style="color:#037691" %)**AT+SUBTOPIC=NSE01_SUB** (%%) ~/~/ Set the subscription topic of MQTT 88 + 71 71 [[image:image-20230802112413-4.png]] 72 72 73 73 [[image:image-20230802112413-5.png]] 74 74 75 -Notice: MQTT 93 +(% 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.** 76 76 77 77 96 +== 3.3 [[ThingSpeak>>url:https://thingspeak.com/]] (via MQTT) == 78 78 79 -= 3. [[ThingSpeak>>url:https://thingspeak.com/]](viaMQTT)=98 +=== 3.3.1 Get MQTT Credentials === 80 80 81 -== 1.1 Get MQTT Credentials == 82 82 83 83 [[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. 84 84 ... ... @@ -87,22 +87,23 @@ 87 87 [[image:image-20230802112413-7.png]] 88 88 89 89 90 -== 1.2.108 +== 3.3.2 Simulate with MQTT.fx == 91 91 92 -=== 1.2.1 Establish MQTT Connection ===110 +=== 3.3.2.1 Establish MQTT Connection === 93 93 112 + 94 94 After we got MQTT Credentials, we can first simulate with PC tool MQTT.fx tool to see if the Credentials and settings are fine. 95 95 96 96 [[image:image-20230802112413-8.png]] 97 97 98 -* Broker Address: mqtt3.thingspeak.com 99 -* Broker Port: 1883 100 -* Client ID: <Your ThingSpeak MQTT ClientID> 101 -* User Name: <Your ThingSpeak MQTT User Name> 102 -* Password: <Your ThingSpeak MQTT Password> 117 +* (% style="color:#037691" %)**Broker Address:**(%%) mqtt3.thingspeak.com 103 103 119 +* (% style="color:#037691" %)**Broker Port:**(%%) 1883 120 +* (% style="color:#037691" %)**Client ID:**(%%) <Your ThingSpeak MQTT ClientID> 121 +* (% style="color:#037691" %)**User Name:**(%%) <Your ThingSpeak MQTT User Name> 122 +* (% style="color:#037691" %)**Password:**(%%) <Your ThingSpeak MQTT Password> 104 104 105 -=== 1.2.2 Publish Data to ThingSpeak Channel124 +=== 3.3.2.2 Publish Data to ThingSpeak Channel === 106 106 107 107 [[image:image-20230802112413-9.png]] 108 108 ... ... @@ -113,7 +113,6 @@ 113 113 * Topic: channels/YOUR_CHANNEL_ID/publish 114 114 * Payload: field1=63&field2=67&status=MQTTPUBLISH 115 115 116 - 117 117 Where 63 and 67 are the value to be published to field1 & field2. 118 118 119 119 ... ... @@ -129,14 +129,17 @@ 129 129 In the NB-IoT, we can run below commands so to publish the channels like MQTT.fx 130 130 131 131 * AT+PRO=3,1 ~/~/Set to use ThingSpeak Server and Related Payload 150 + 132 132 * AT+CLIENT=<Your ThingSpeak MQTT ClientID> 152 + 133 133 * AT+UNAME=<Your ThingSpeak MQTT User Name> 154 + 134 134 * AT+PWD=<Your ThingSpeak MQTT Password> 156 + 135 135 * AT+PUBTOPIC=<YOUR_CHANNEL_ID> 158 + 136 136 * AT+SUBTOPIC=<YOUR_CHANNEL_ID> 137 137 138 - 139 - 140 140 === 1.3.2 Uplink Examples === 141 141 142 142 For S31-NB ... ... @@ -272,7 +272,6 @@ 272 272 273 273 )))|(% colspan="1" rowspan="1" %)RSSI|(% colspan="1" rowspan="1" %)count|(% colspan="1" rowspan="1" %) |(% colspan="1" rowspan="1" %) |(% colspan="1" rowspan="1" %) |(% colspan="1" rowspan="1" %) |(% colspan="1" rowspan="1" %) |(% colspan="1" rowspan="1" %) 274 274 275 - 276 276 = 4. Datacake = 277 277 278 278 == 1.1 Define Product == ... ... @@ -395,7 +395,7 @@ 395 395 396 396 [[image:image-20230802112413-30.png]] 397 397 398 -== 1.2 Simulate Connection 418 +== 1.2 Simulate Connection == 399 399 400 400 [[image:image-20230802112413-31.png]] 401 401 ... ... @@ -408,10 +408,9 @@ 408 408 * AT+PUBTOPIC=any value 409 409 * AT+SUBTOPIC=any value 410 410 411 - 412 412 = 6. ThingsBoard.Cloud (via MQTT) = 413 413 414 -== 1.1 Configure ThingsBoard 433 +== 1.1 Configure ThingsBoard == 415 415 416 416 === 1.1.1 Create Device === 417 417 ... ... @@ -518,7 +518,6 @@ 518 518 * Broker Port: 1883 519 519 * Client ID: “Any value” 520 520 521 - 522 522 On the section User credentials, set the following information:(这边加一个截图) 523 523 524 524 * User Name: “Any value” Tago validates your user by the token only ... ... @@ -526,7 +526,6 @@ 526 526 * PUBTOPIC: “Any value” 527 527 * SUBTOPIC: “Any value” 528 528 529 - 530 530 == 5.2 Simulate with MQTT.fx == 531 531 532 532 [[image:image-20230802112413-47.png]] ... ... @@ -561,7 +561,6 @@ 561 561 * PUBTOPIC: “Any value” 562 562 * SUBTOPIC: “Any value” 563 563 564 - 565 565 [[image:image-20230802112413-52.png]] 566 566 567 567