Changes for page Notes for ChirpStack
Last modified by Edwin Chen on 2025/01/30 09:53
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,32 +1,335 @@ 1 -{{box cssClass="floatinginfobox" title="**Contents**"}} 1 +**Contents:** 2 + 2 2 {{toc/}} 3 -{{/box}} 4 4 5 -= Paragraph1 =5 += 1. Introduction = 6 6 7 - Loremipsum dolorsitmet,consecteturadipiscingelit,sed do eiusmodtemporincididunt ut laboreetdoloremagna aliqua. Utenimadminim veniam, quisnostrudexercitation ullamcolaboris nisiutaliquipex eaommodoconsequat. Duisauteiruredolor inreprehenderit involuptatevelitessecillumdoloreeu fugiatnullapariatur.Excepteursintccaecatcupidatat non proident,suntinculpa qui officia deserunt mollit anim id estlaborum.7 +The ChirpStack open-source LoRaWAN Network Server stack provides open-source components for LoRaWAN networks And the Chirpstack supports the users in building a private LoRaWAN Server. For more info please refer to this [[link>>url:https://www.chirpstack.io/]] 8 8 9 - ==Sub-paragraph==9 +The dragino gateway can connect the ChirpStack server via Semtech UDP or Semtech Basic Station. 10 10 11 - Lorem ipsum dolorsit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quisnostrud exercitation ullamco laboris nisi ut aliquipex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.11 +**Prerequisite** 12 12 13 - ==Sub-paragraph==13 +1) Have a Chirstack Server. 14 14 15 - Loremipsumdolor sitamet, consectetur adipiscing elit, seddo eiusmod temporididunt ut labore et doloremagna aliqua. Ut enimd minim veniam, quisnostrud exercitation ullamco laboris nisi utliquip ex eacommodo consequat. Duis auteirure dolor inreprehenderit in voluptate velit essecillum doloreeu fugiat nullapariatur. Excepteur sint occaecat cupidatatnon proident, sunt in culpa qui officia deserunt mollit anim id est laborum.15 +[[image:https://wiki.dragino.com/images/thumb/f/f4/ChirpStack_home_page.png/600px-ChirpStack_home_page.png||height="320" width="600"]] 16 16 17 - ===Sub-subparagraph ===17 +ChirpStack home page 18 18 19 - Loremipsum dolor sitamet, consecteturadipiscingelit, sed do eiusmodtempor incididunt utlaboreet dolore magna aliqua. Ut enim ad minim veniam, quisnostrud exercitation ullamco laboris nisi ut aliquipex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiatnulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.19 +2) Gateway model support 20 20 21 +(% class="box" %) 22 +((( 23 +Semtech UDP : **All Model** 24 +Basic Station : , , 25 +**Note** : the firmware needs > if use the Bais station 26 +))) 21 21 22 -= Paragraph2=28 += 2. Semtech UDP = 23 23 24 - Loremipsumdolor sitamet, consectetur adipiscingelit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Ut enim adminim veniam, quis nostrudexercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderitin voluptatevelitesse cillum dolore eu fugiat nulla pariatur. Excepteursint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id estlaborum.30 +== 2.1 Step 1. Add the Network-servers == 25 25 26 - ==Sub-paragraph==32 +The network-Servers address varies depending on the ChirpStack server setup environment 27 27 28 -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 34 +(% class="box" %) 35 +((( 36 + Windows ~-~->Network-server server * : localhost:8000 37 + Linux ~-~->Network-server server * : chirpstack-network-server:8000 38 +))) 29 29 30 - ==Sub-paragraph==40 +If the user cannot add network-Servers, re-check the ChirpStack code or the server building process. 31 31 32 -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 42 +[[image:https://wiki.dragino.com/images/thumb/6/6b/Add_the_Network-servers.png/600px-Add_the_Network-servers.png||height="363" width="600"]] 43 + 44 +Add the Network-servers 45 + 46 +== 2.2 Step 2. Create Gateway-profiles == 47 + 48 +[[image:https://wiki.dragino.com/images/thumb/a/a9/Create_Gateway-profiles.png/600px-Create_Gateway-profiles.png||height="363" width="600"]] 49 + 50 +Create Gateway-profiles 51 + 52 +== 2.3 Step 3. Create Service-profiles == 53 + 54 +[[image:https://wiki.dragino.com/images/thumb/1/1f/Create_Service-profiles.png/600px-Create_Service-profiles.png||height="363" width="600"]] 55 + 56 +Create Service-profiles 57 + 58 +In Step 3. Create Service-profiles, the above parameters can be set. If necessary, you can set them by yourself. This is only an example. 59 + 60 +Note : Before add the gateway, the user needs to complete the preceding three steps. 61 + 62 +If the user has completed the preceding steps, proceed to the next step. 63 + 64 +== 2.4 Step 4. Add the gateway == 65 + 66 +The example gateway id is: a840411e96744150 67 + 68 +Note : The Gateway EUI and server addresses must match the ChirpStack configuration. 69 + 70 +[[image:https://wiki.dragino.com/images/thumb/c/c6/Add_the_gateway.png/600px-Add_the_gateway.png||height="363" width="600"]] 71 + 72 +Add the gateway 73 + 74 +[[image:https://wiki.dragino.com/images/thumb/1/14/ChirpStack_Configure_the_gateway.png/600px-ChirpStack_Configure_the_gateway.png||height="304" width="600"]] 75 + 76 +Configure the gateway 77 + 78 +== 2.5 Step 5. Checking gateway Status == 79 + 80 +[[image:https://wiki.dragino.com/images/thumb/2/2c/Gateway_Status_cao_1.png/600px-Gateway_Status_cao_1.png||height="363" width="600"]] 81 + 82 +gateway Status 83 + 84 +[[image:https://wiki.dragino.com/images/thumb/1/11/Gateway_Status_cao_2.png/600px-Gateway_Status_cao_2.png||height="363" width="600"]] 85 + 86 +gateway Status 87 + 88 += 3. Semtech Basic Station = 89 + 90 += 4. Downlink = 91 + 92 +== 4.1 Chirpstack Downlink Note == 93 + 94 +[[image:https://wiki.dragino.com/images/thumb/b/ba/ChirpStack_Down_5.png/600px-ChirpStack_Down_5.png||height="293" width="600"]] 95 + 96 +Convert the data to Base64 97 + 98 +[[image:https://wiki.dragino.com/images/thumb/2/2c/ChirpStack_Down_6.png/600px-ChirpStack_Down_6.png||height="300" width="600"]] 99 + 100 +Check ChripStack downlink DataRate 101 + 102 +[[image:https://wiki.dragino.com/images/thumb/d/dc/ChirpStack_Down_7.png/600px-ChirpStack_Down_7.png||height="711" width="600"]] 103 + 104 +Make sure the RX2DR is the same in the end node 105 + 106 +== 4.2 Loraserver Downlink Note == 107 + 108 +User can use MQTT to send downlink payload to ChirpStack to perform downstream to LoRaWAN End 109 + 110 +Below is examples: 111 + 112 +{{{Connect to your server via MQTT: 113 +MQTT Client ID: Any 114 +Protocol:mqtt/tcp Server IP:loraserver_ip:1883 115 +User name: User name Password: password 116 +}}} 117 + 118 +[[image:https://wiki.dragino.com/images/thumb/0/06/ChirpStack_Down_1.png/600px-ChirpStack_Down_1.png||height="578" width="600"]] 119 + 120 +MQTT Connect to ChirpStack 121 + 122 +After connect 123 + 124 +{{{Subscribe : Format:application/ID/device/ Device EUI/rx 125 +Example: application/7/device/00aedb3da649cb23/rx 126 + 127 +Publish: 128 +Format: Top: application/ID/device/ Device EUI/tx 129 +Payload: {"confirmed":true or false,"fPort":XX,"data":"xxxx"} 130 +Example: Top: application/7/device/00aedb3da649cb23/tx 131 +Payload: {"confirmed":true,"fPort":2,"data":"AwEB"} 132 +}}} 133 + 134 +[[image:https://wiki.dragino.com/images/thumb/c/c8/ChirpStack_Down_2.png/600px-ChirpStack_Down_2.png||height="342" width="600"]] 135 + 136 +MQTT Connect to ChirpStack 137 + 138 + 139 +Note: Chirpstack use base64 to downlink, so need to convert the downlink payload from HEX to base64 [[https:~~/~~/base64.us/>>url:https://base64.us/]] 140 + 141 +[[image:https://wiki.dragino.com/images/thumb/f/f8/ChirpStack_Down_3.png/600px-ChirpStack_Down_3.png||height="309" width="600"]] 142 + 143 +Choose to Use Hex for Encode 144 + 145 +If we want send downstream hex 030101 to end node, the BASE64 payload is AwEB 146 + 147 +[[image:https://wiki.dragino.com/images/thumb/d/d2/ChirpStack_Down_4.png/600px-ChirpStack_Down_4.png||alt="ChirpStack Down 4.png" height="344" width="600"]] 148 + 149 +Downlink payload encode javescript code: 可以在网站上运行以下Javsscript代码: 150 + 151 +{{{function sha1_to_base64(sha1) 152 +{ 153 + var digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 154 + var base64_rep = ""; 155 + var cnt = 0; 156 + var bit_arr = 0; 157 + var bit_num = 0; 158 + 159 + for(var n = 0; n < sha1.length; ++n) 160 + { 161 + if(sha1[n] >= 'A' && sha1[n] <= 'Z') 162 + { 163 + ascv = sha1.charCodeAt(n) - 55; 164 + } 165 + else if(sha1[n] >= 'a' && sha1[n] <= 'z') 166 + { 167 + ascv = sha1.charCodeAt(n) - 87; 168 + } 169 + else 170 + { 171 + ascv = sha1.charCodeAt(n) - 48; 172 + } 173 + 174 + bit_arr = (bit_arr << 4) | ascv; 175 + bit_num += 4; 176 + if(bit_num >= 6) 177 + { 178 + bit_num -= 6; 179 + base64_rep += digits[bit_arr >>> bit_num]; 180 + bit_arr &= ~(-1 << bit_num); 181 + } 182 + } 183 + 184 + if(bit_num > 0) 185 + { 186 + bit_arr <<= 6 - bit_num; 187 + base64_rep += digits[bit_arr]; 188 + } 189 + 190 + var padding = base64_rep.length % 4; 191 + 192 + if(padding > 0) 193 + { 194 + for(var n = 0; n < 4 - padding; ++n) 195 + { 196 + base64_rep += "="; 197 + } 198 + } 199 + return base64_rep; 200 +} 201 + 202 +console.log(sha1_to_base64("data")); 203 + 204 +data is downlink payload required by end node. 205 + e.g console.log(sha1_to_base64("030101")); 206 + result: AwEB 207 + AwEB is the 0x030101's base 64 Encode. 208 + 209 + e.g console.log(sha1_to_base64("030000")); 210 + result: AwAA 211 + AwAA is 0x030000's base 64 Encode.}}} 212 + 213 +== 4.3 Add the decode function in Chirpstack for the payload == 214 + 215 +User enters the payload code according to the steps. 216 + 217 +[[image:https://wiki.dragino.com/images/thumb/9/9f/Step2.png/600px-Step2.png||alt="Step2.png" height="224" width="600"]] 218 + 219 +[[image:https://wiki.dragino.com/images/thumb/0/08/Step3.png/600px-Step3.png||alt="Step3.png" height="289" width="600"]] 220 + 221 +[[image:https://wiki.dragino.com/images/thumb/8/83/Step6.png/600px-Step6.png||alt="Step6.png" height="259" width="600"]] 222 + 223 +[[image:https://wiki.dragino.com/images/thumb/4/4f/Step5.png/600px-Step5.png||alt="Step5.png" height="221" width="600"]] 224 + 225 += 5. Multiply Uplink in ChirpStack = 226 + 227 +nbtrans field is the value to determine the re-transmission time for unconfirmed uplink data. 228 + 229 + 230 +ChirpStack will auto adjust nbtrans according to uplink rssi. [[link to source>>url:https://github.com/brocaar/chirpstack-network-server/blob/master/internal/adr/adr.go]] 231 + 232 +[[image:https://wiki.dragino.com/images/thumb/6/63/Nbtrans_1.png/600px-Nbtrans_1.png||alt="Nbtrans 1.png" height="103" width="600"]] 233 + 234 +nbtrans is a field of ADR message, in unconfirm mode, it tells end node how many time it needs to transmit for every frame. 235 + 236 +[[image:https://wiki.dragino.com/images/thumb/1/17/Nbtrans_2.png/300px-Nbtrans_2.png||alt="Nbtrans 2.png" height="462" width="300"]] 237 + 238 + 239 +Above behaviour will cause the platform shows below two cases of error: 240 + 241 +Error of duplicate Frame Counter 242 + 243 +[[image:https://wiki.dragino.com/images/7/7e/Nbtrans_3.png||alt="Nbtrans 3.png" height="677" width="600"]] 244 + 245 +Duplicate transmission in short time 246 + 247 +[[image:https://wiki.dragino.com/images/thumb/c/c4/Nbtrans_4.png/600px-Nbtrans_4.png||alt="Nbtrans 4.png" height="301" width="600"]] 248 + 249 +== 5.1 Solution == 250 + 251 +This example uses the Windows version as a template, other versions can refer to this. Similiar reference: [[https:~~/~~/confluence.alitecs.de/plugins/servlet/mobile?contentId=79790102#content/view/79790102>>url:https://confluence.alitecs.de/plugins/servlet/mobile?contentId=79790102#content/view/79790102]] 252 + 253 +~1. Install the GO compilation environment: Download the corresponding version of the Go compiler at [[https:~~/~~/go.dev/dl/>>url:https://go.dev/dl/]] and install it. 254 + 255 +[[image:https://wiki.dragino.com/images/3/37/Chirpstacksolution-1.png||alt="Chirpstacksolution-1.png" height="199" width="554"]] 256 + 257 +installation path: 258 + 259 +[[image:https://wiki.dragino.com/images/c/ca/Chirpstacksolution-2.png||alt="Chirpstacksolution-2.png" height="283" width="361"]] 260 + 261 +2. Environment variable settings:. 262 + 263 +1) Open Computer -> Properties -> Advanced System Settings -> Environment Variables and add a "new" system variable: 264 + 265 +2)Set the variable name GOROOT and the variable value C:\Go\ (installation directory) 266 + 267 +[[image:https://wiki.dragino.com/images/f/f9/Chirpstacksolution-3.png||alt="Chirpstacksolution-3.png" height="152" width="554"]] 268 + 269 +3)Modify the system variable Path and add C:\Go\bin\: 270 + 271 +[[image:https://wiki.dragino.com/images/1/1b/Chirpstacksolution-4.png||alt="Chirpstacksolution-4.png" height="152" width="554"]] 272 + 273 +User variable setting file generation directory: D:\go: 274 + 275 +[[image:https://wiki.dragino.com/images/9/9b/Chirpstacksolution-5.png||alt="Chirpstacksolution-5.png" height="278" width="371"]] 276 + 277 +3. Modify the ADR configuration file according to your own needs, adr.setting.go is an example of the ADR configuration file. 278 + 279 +The name of the plugin: Example ADR plugin: 280 + 281 +[[image:https://wiki.dragino.com/images/1/12/Chirpstacksolution-6.jpg||alt="Chirpstacksolution-6.jpg" height="89" width="554"]] 282 + 283 +Set Nbtrans: Nbtrans=1 (Nbtrans is the number of retransmissions, if it is 1, no retransmission, it is recommended to be 1). To enable it, you need to uncomment. 284 + 285 +[[image:https://wiki.dragino.com/images/2/25/Chirpstacksolution-7.png||alt="Chirpstacksolution-7.png" height="98" width="426"]] 286 + 287 +4. Compile the ADR configuration file and generate the exe file. 288 + 289 +1) Create a folder named adr-setting 290 + 291 +2) Open the adr-setting folder 292 + 293 +3) Put adr.setting.go in this folder. 294 + 295 +4) Open the computer cmd and run the following commands in sequencecd adr-setting 296 + 297 +go mod init adr-setting 298 + 299 +go get github.com/brocaar/chirpstack-network-server/v3/adr 300 + 301 +go get github.com/hashicorp/go-plugin 302 + 303 +go get adr-setting 304 + 305 +go build 306 + 307 +5) Finally generate this file: 308 + 309 +[[image:https://wiki.dragino.com/images/6/66/Chirpstacksolution-8.png||alt="Chirpstacksolution-8.png" height="96" width="554"]] 310 + 311 +5. Add the plugin and run the plugin. 312 + 313 +The exe file generated in the previous step is placed in the same root directory as chirpstack-network-server.toml, and the ADR plugin is added to the toml file. The location of the addition is as follows: 314 + 315 +[[image:https://wiki.dragino.com/images/8/82/Chirpstacksolution-9.png||alt="Chirpstacksolution-9.png" height="73" width="554"]] 316 + 317 +For example: adr_plugins=[“adr-setting”] 318 + 319 +* Adding a single plugin format is adr_plugins=["filename"] 320 + 321 +* Adding multiple plugins The format is adr_plugins=["file name 1", "file name 2",...] 322 + 323 +Finally, re-run chirpstack-network-server.exe, and then select the plugin you just compiled in Device-profiles, 324 + 325 +[[image:https://wiki.dragino.com/images/3/39/Chirpstacksolution-10.png||alt="Chirpstacksolution-10.png" height="275" width="554"]] 326 + 327 +Finish. 328 + 329 += 6. Trouble Shooting = 330 + 331 +== 6.1 MIC Mismatch or MIC Failed == 332 + 333 +When the device is registered or the device is working normally, the problem of MIC mismatch and MIC failed occurs. 334 + 335 +Under normal circumstances, users need to change the APPKEY to solve this problem.