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,10 +8,3 @@ 1 -(% class="wikigeneratedid" %) 2 -**Table of Contents:** 3 - 4 -{{toc/}} 5 - 6 - 7 - 8 8 = 1. The use of this guideline = 9 9 10 10 ... ... @@ -16,87 +16,76 @@ 16 16 17 17 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. 18 18 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| | | 23 23 24 24 == 2.1 1NCE SIM Card. == 25 25 26 26 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| | | 27 27 21 + 28 28 = 3. Configure to connect to different servers = 29 29 30 -== 3.1 General UDP Connection == 31 31 25 += NB-IoT 服务器对接例子 = 32 32 27 += 1. General UDP Connection = 28 + 33 33 The NB-IoT Sensor can send packet to server use UDP protocol. 34 34 31 +== 1.1 Simulate UDP Connection by PC tool == 35 35 36 -=== 3.1.1 Simulate UDP Connection by PC tool === 37 - 38 - 39 39 We can use PC tool to simulate UDP connection to make sure server works ok. 40 40 41 41 [[image:image-20230802112413-1.png]] 42 42 37 +== 1.2 Configure NB-IoT Sensor == 43 43 44 -=== 3.1.2 Configure NB-IoT Sensor===39 +=== 1.2.1 AT Commands === 45 45 46 - ==== 3.1.2.1AT Commands====41 +AT Commands: 47 47 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 48 48 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 - 57 57 [[image:image-20230802112413-2.png]] 58 58 49 +=== 1.2.2 Uplink Example === 59 59 60 -==== 3.1.2.2 Uplink Example ==== 61 61 62 - 63 63 [[image:image-20230802112413-3.png]] 64 64 65 65 66 -= =3.2=55 += 2. General MQTT Connection = 67 67 68 - 69 69 The NB-IoT Sensor can send packet to server use MQTT protocol. 70 70 71 -Below are the commands .59 +Below are the commands 72 72 73 - (% style="color:blue" %)**AT Commands:**61 +AT Commands: 74 74 75 -* (% style="color:#037691" %)**AT+PRO=3,0** (%%) ~/~/ Set to use MQTT protocol to uplink, Payload Type select Hex payload. 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 76 76 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 - 89 89 [[image:image-20230802112413-4.png]] 90 90 91 91 [[image:image-20230802112413-5.png]] 92 92 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.**75 +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. 94 94 95 95 96 -== 3.3 [[ThingSpeak>>url:https://thingspeak.com/]] (via MQTT) == 97 97 98 -= ==3.3.1Get MQTTCredentials===79 += 3. [[ThingSpeak>>url:https://thingspeak.com/]] (via MQTT) = 99 99 81 +== 1.1 Get MQTT Credentials == 100 100 101 101 [[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. 102 102 ... ... @@ -105,23 +105,22 @@ 105 105 [[image:image-20230802112413-7.png]] 106 106 107 107 108 -== 3.3.290 +== 1.2. Simulate with MQTT.fx == 109 109 110 -=== 3.3.2.1 Establish MQTT Connection ===92 +=== 1.2.1 Establish MQTT Connection === 111 111 112 - 113 113 After we got MQTT Credentials, we can first simulate with PC tool MQTT.fx tool to see if the Credentials and settings are fine. 114 114 115 115 [[image:image-20230802112413-8.png]] 116 116 117 -* (% style="color:#037691" %)**Broker Address:**(%%) mqtt3.thingspeak.com 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> 118 118 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> 123 123 124 -=== 3.3.2.2 Publish Data to ThingSpeak Channel ===105 +=== 1.2.2 Publish Data to ThingSpeak Channel === 125 125 126 126 [[image:image-20230802112413-9.png]] 127 127 ... ... @@ -132,6 +132,7 @@ 132 132 * Topic: channels/YOUR_CHANNEL_ID/publish 133 133 * Payload: field1=63&field2=67&status=MQTTPUBLISH 134 134 116 + 135 135 Where 63 and 67 are the value to be published to field1 & field2. 136 136 137 137 ... ... @@ -147,17 +147,14 @@ 147 147 In the NB-IoT, we can run below commands so to publish the channels like MQTT.fx 148 148 149 149 * AT+PRO=3,1 ~/~/Set to use ThingSpeak Server and Related Payload 150 - 151 151 * AT+CLIENT=<Your ThingSpeak MQTT ClientID> 152 - 153 153 * AT+UNAME=<Your ThingSpeak MQTT User Name> 154 - 155 155 * AT+PWD=<Your ThingSpeak MQTT Password> 156 - 157 157 * AT+PUBTOPIC=<YOUR_CHANNEL_ID> 158 - 159 159 * AT+SUBTOPIC=<YOUR_CHANNEL_ID> 160 160 138 + 139 + 161 161 === 1.3.2 Uplink Examples === 162 162 163 163 For S31-NB ... ... @@ -293,6 +293,7 @@ 293 293 294 294 )))|(% 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" %) 295 295 275 + 296 296 = 4. Datacake = 297 297 298 298 == 1.1 Define Product == ... ... @@ -415,7 +415,7 @@ 415 415 416 416 [[image:image-20230802112413-30.png]] 417 417 418 -== 1.2 Simulate Connection == 398 +== 1.2 Simulate Connection == 419 419 420 420 [[image:image-20230802112413-31.png]] 421 421 ... ... @@ -428,9 +428,10 @@ 428 428 * AT+PUBTOPIC=any value 429 429 * AT+SUBTOPIC=any value 430 430 411 + 431 431 = 6. ThingsBoard.Cloud (via MQTT) = 432 432 433 -== 1.1 Configure ThingsBoard == 414 +== 1.1 Configure ThingsBoard == 434 434 435 435 === 1.1.1 Create Device === 436 436 ... ... @@ -537,6 +537,7 @@ 537 537 * Broker Port: 1883 538 538 * Client ID: “Any value” 539 539 521 + 540 540 On the section User credentials, set the following information:(这边加一个截图) 541 541 542 542 * User Name: “Any value” Tago validates your user by the token only ... ... @@ -544,6 +544,7 @@ 544 544 * PUBTOPIC: “Any value” 545 545 * SUBTOPIC: “Any value” 546 546 529 + 547 547 == 5.2 Simulate with MQTT.fx == 548 548 549 549 [[image:image-20230802112413-47.png]] ... ... @@ -578,6 +578,7 @@ 578 578 * PUBTOPIC: “Any value” 579 579 * SUBTOPIC: “Any value” 580 580 564 + 581 581 [[image:image-20230802112413-52.png]] 582 582 583 583