Last modified by Mengting Qiu on 2025/03/08 11:33
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -21,7 +21,6 @@ 21 21 |1NCE| | | 22 22 |China Mobile| | | 23 23 24 - 25 25 == 2.1 1NCE SIM Card. == 26 26 27 27 ... ... @@ -50,7 +50,9 @@ 50 50 (% style="color:blue" %)**AT Commands:** 51 51 52 52 * (% style="color:#037691" %)**AT+PRO=2,0** (%%) ~/~/ Set to use UDP protocol to uplink ,Payload Type select Hex payload 52 + 53 53 * (% style="color:#037691" %)**AT+SERVADDR=120.24.4.116,5601** (%%) ~/~/ Set UDP server address and port 54 + 54 54 * (% style="color:#037691" %)**AT+CFM=1** (%%) ~/~/ If the server does not respond, this command is unnecessary 55 55 56 56 [[image:image-20230802112413-2.png]] ... ... @@ -62,7 +62,7 @@ 62 62 [[image:image-20230802112413-3.png]] 63 63 64 64 65 -= 3.2 General MQTT Connection = 66 +== 3.2 General MQTT Connection == 66 66 67 67 68 68 The NB-IoT Sensor can send packet to server use MQTT protocol. ... ... @@ -69,27 +69,33 @@ 69 69 70 70 Below are the commands. 71 71 72 -**AT Commands:** 73 +(% style="color:blue" %)**AT Commands:** 73 73 74 -* **AT+PRO=3,0** ~/~/ Set to use MQTT protocol to uplink, Payload Type select Hex payload. 75 -* **AT+SERVADDR=120.24.4.116,1883** ~/~/ Set MQTT server address and port 76 -* **AT+CLIENT=CLIENT** ~/~/ Set up the CLIENT of MQTT 77 -* **AT+UNAME=UNAME** ~/~/ Set the username of MQTT 78 -* **AT+PWD=PWD** ~/~/ Set the password of MQTT 79 -* **AT+PUBTOPIC=NSE01_PUB** ~/~/ Set the sending topic of MQTT 80 -* **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. 81 81 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 + 82 82 [[image:image-20230802112413-4.png]] 83 83 84 84 [[image:image-20230802112413-5.png]] 85 85 86 -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.** 87 87 88 88 96 +== 3.3 [[ThingSpeak>>url:https://thingspeak.com/]] (via MQTT) == 89 89 90 -= 3. [[ThingSpeak>>url:https://thingspeak.com/]](viaMQTT)=98 +=== 3.3.1 Get MQTT Credentials === 91 91 92 -== 1.1 Get MQTT Credentials == 93 93 94 94 [[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. 95 95 ... ... @@ -98,54 +98,71 @@ 98 98 [[image:image-20230802112413-7.png]] 99 99 100 100 101 -== 1.2.108 +== 3.3.2 Simulate with MQTT.fx == 102 102 103 -=== 1.2.1 Establish MQTT Connection ===110 +=== 3.3.2.1 Establish MQTT Connection === 104 104 112 + 105 105 After we got MQTT Credentials, we can first simulate with PC tool MQTT.fx tool to see if the Credentials and settings are fine. 106 106 107 107 [[image:image-20230802112413-8.png]] 108 108 109 -* Broker Address: mqtt3.thingspeak.com 110 -* Broker Port: 1883 111 -* Client ID: <Your ThingSpeak MQTT ClientID> 112 -* User Name: <Your ThingSpeak MQTT User Name> 113 -* Password: <Your ThingSpeak MQTT Password> 117 +* (% style="color:#037691" %)**Broker Address:**(%%) mqtt3.thingspeak.com 114 114 115 - ===1.2.2 Publish Data to ThingSpeak Channel===119 +* (% style="color:#037691" %)**Broker Port:**(%%) 1883 116 116 121 +* (% style="color:#037691" %)**Client ID:**(%%) <Your ThingSpeak MQTT ClientID> 122 + 123 +* (% style="color:#037691" %)**User Name:**(%%) <Your ThingSpeak MQTT User Name> 124 + 125 +* (% style="color:#037691" %)**Password:**(%%) <Your ThingSpeak MQTT Password> 126 + 127 + 128 + 129 +=== 3.3.2.2 Publish Data to ThingSpeak Channel === 130 + 117 117 [[image:image-20230802112413-9.png]] 118 118 119 119 [[image:image-20230802112413-10.png]] 120 120 121 -In MQTT.fx, we can publish below info: 135 +(% style="color:blue" %)**In MQTT.fx, we can publish below info:** 122 122 123 -* Topic: channels/YOUR_CHANNEL_ID/publish 124 -* Payload: field1=63&field2=67&status=MQTTPUBLISH 137 +* (% style="color:#037691" %)**Topic:**(%%) channels/YOUR_CHANNEL_ID/publish 125 125 139 +* (% style="color:#037691" %)**Payload:**(%%) field1=63&field2=67&status=MQTTPUBLISH 140 + 126 126 Where 63 and 67 are the value to be published to field1 & field2. 127 127 128 128 129 -Result: 144 +(% style="color:blue" %)**Result: ** 130 130 131 131 [[image:image-20230802112413-11.png]] 132 132 133 133 134 -== 1.3 Configure NB-IoT Sensor for connection ==149 +== 3.3 Configure NB-IoT Sensor for connection == 135 135 136 -=== 1.3.1 AT Commands: ===151 +=== 3.3.1 AT Commands: === 137 137 153 + 138 138 In the NB-IoT, we can run below commands so to publish the channels like MQTT.fx 139 139 140 -* AT+PRO=3,1 ~/~/Set to use ThingSpeak Server and Related Payload 141 -* AT+CLIENT=<Your ThingSpeak MQTT ClientID> 142 -* AT+UNAME=<Your ThingSpeak MQTT User Name> 143 -* AT+PWD=<Your ThingSpeak MQTT Password> 144 -* AT+PUBTOPIC=<YOUR_CHANNEL_ID> 145 -* AT+SUBTOPIC=<YOUR_CHANNEL_ID> 156 +* **AT+PRO=3,1** ~/~/ Set to use ThingSpeak Server and Related Payload 146 146 147 - ===1.3.2UplinkExamples ===158 +* **AT+CLIENT=<Your ThingSpeak MQTT ClientID>** 148 148 160 +* **AT+UNAME=<Your ThingSpeak MQTT User Name>** 161 + 162 +* **AT+PWD=<Your ThingSpeak MQTT Password>** 163 + 164 +* **AT+PUBTOPIC=<YOUR_CHANNEL_ID>** 165 + 166 +* **AT+SUBTOPIC=<YOUR_CHANNEL_ID>** 167 + 168 + 169 + 170 +=== 3.3.2 Uplink Examples === 171 + 172 + 149 149 For S31-NB 150 150 151 151 For SE01-NB ... ... @@ -171,8 +171,9 @@ 171 171 For SN50V3-NB 172 172 173 173 174 -=== 1.3.2Map fields to sensor value ===198 +=== 3.3.3 Map fields to sensor value === 175 175 200 + 176 176 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. 177 177 178 178