Wiki source code of LA66 LoRaWAN Module

Version 87.10 by Xiaoling on 2022/07/13 10:03

Hide last authors
Xiaoling 87.2 1
2
Edwin Chen 1.1 3 {{toc/}}
4
5
Edwin Chen 6.1 6
Xiaoling 87.2 7 = 1.  LA66 LoRaWAN Module =
8
9
10 == 1.1  What is LA66 LoRaWAN Module ==
11
12
Edwin Chen 65.1 13 (% style="color:blue" %)**Dragino LA66**(%%) is a small wireless LoRaWAN module that offers a very compelling mix of long-range, low power consumption, and secure data transmission. It is designed to facilitate developers to quickly deploy industrial-level LoRaWAN and IoT solutions. It helps users to turn the idea into a practical application and make the Internet of Things a reality. It is easy to create and connect your things everywhere.
Edwin Chen 1.1 14
Edwin Chen 65.1 15 (% style="color:blue" %)**LA66**(%%) is a ready-to-use module that includes the (% style="color:blue" %)**LoRaWAN v1.0.4 protocol**(%%). The LoRaWAN stack used in LA66 is used in more than 1 million LoRaWAN End Devices deployed world widely. This mature LoRaWAN stack greatly reduces the risk to make stable LoRaWAN Sensors to support different LoRaWAN servers and different countries' standards. External MCU can use AT command to call LA66 and start to transmit data via the LoRaWAN protocol.
Edwin Chen 1.1 16
Edwin Chen 65.1 17 Each LA66 module includes a (% style="color:blue" %)**world-unique OTAA key**(%%) for LoRaWAN registration.
Edwin Chen 1.1 18
Edwin Chen 65.1 19 Besides the support of the LoRaWAN protocol, LA66 also supports (% style="color:blue" %)**open-source peer-to-peer LoRa Protocol**(%%) for the none-LoRaWAN application.
Edwin Chen 1.1 20
Edwin Chen 65.1 21 LA66 is equipped with (% style="color:blue" %)**TCXO crystal**(%%) which ensures the module can achieve stable performance in extreme temperatures.
Edwin Chen 1.1 22
Edwin Chen 67.1 23
Xiaoling 87.2 24 == 1.2  Features ==
Edwin Chen 64.1 25
Edwin Chen 68.1 26 * Support LoRaWAN v1.0.4 protocol
27 * Support peer-to-peer protocol
28 * TCXO crystal to ensure RF performance on low temperature
29 * SMD Antenna pad and i-pex antenna connector
30 * Available in different frequency LoRaWAN frequency bands.
31 * World-wide unique OTAA keys.
Edwin Chen 69.1 32 * AT Command via UART-TTL interface
33 * Firmware upgradable via UART interface
34 * Ultra-long RF range
Edwin Chen 64.1 35
Xiaoling 87.7 36
37
Xiaoling 87.2 38 == 1.3  Specification ==
39
Edwin Chen 68.1 40 * CPU: 32-bit 48 MHz
41 * Flash: 256KB
42 * RAM: 64KB
Edwin Chen 66.1 43 * Input Power Range: 1.8v ~~ 3.7v
44 * Power Consumption: < 4uA.
45 * Frequency Range: 150 MHz ~~ 960 MHz
46 * Maximum Power +22 dBm constant RF output
47 * High sensitivity: -148 dBm
48 * Temperature:
49 ** Storage: -55 ~~ +125℃
50 ** Operating: -40 ~~ +85℃
51 * Humidity:
52 ** Storage: 5 ~~ 95% (Non-Condensing)
53 ** Operating: 10 ~~ 95% (Non-Condensing)
54 * LoRa Tx Current: <90 mA at +17 dBm, 108 mA at +22 dBm
55 * LoRa Rx current: <9 mA
56 * I/O Voltage: 3.3v
Edwin Chen 1.1 57
Xiaoling 87.7 58
59
Xiaoling 87.2 60 == 1.4  AT Command ==
61
Edwin Chen 66.1 62 AT Command is valid over Main TXD and Main RXD. Serial Baud Rate is 9600. AT commands can be found in AT Command documents.
Edwin Chen 1.1 63
Edwin Chen 3.1 64
Xiaoling 87.2 65 == 1.5  Dimension ==
Edwin Chen 3.1 66
Edwin Chen 66.1 67 [[image:image-20220517072526-1.png]]
Edwin Chen 3.1 68
69
Edwin Chen 5.1 70
Xiaoling 87.2 71 == 1.6  Pin Mapping ==
72
73
Xiaoling 10.2 74 [[image:image-20220523101537-1.png]]
Edwin Chen 5.1 75
76
Xiaoling 87.2 77
78 == 1.7  Land Pattern ==
79
Edwin Chen 5.1 80 [[image:image-20220517072821-2.png]]
81
82
83
Xiaoling 87.2 84 = 2.  LA66 LoRaWAN Shield =
Edwin Chen 6.1 85
86
Xiaoling 87.2 87 == 2.1  Overview ==
88
Edwin Chen 71.1 89 LA66 LoRaWAN Shield is the Arduino shield base on LA66. Users can use LA66 LoRaWAN Shield to rapidly add LoRaWAN or peer-to-peer LoRa wireless function to  Arduino projects.
90
91
Xiaoling 87.2 92 == 2.2  Features ==
Edwin Chen 71.1 93
94 * Arduino Shield base on LA66 LoRaWAN module
95 * Support LoRaWAN v1.0.4 protocol
96 * Support peer-to-peer protocol
97 * TCXO crystal to ensure RF performance on low temperature
98 * SMA connector
99 * Available in different frequency LoRaWAN frequency bands.
100 * World-wide unique OTAA keys.
101 * AT Command via UART-TTL interface
102 * Firmware upgradable via UART interface
103 * Ultra-long RF range
104
Xiaoling 87.8 105
106
Xiaoling 87.2 107 == 2.3  Specification ==
108
Edwin Chen 71.1 109 * CPU: 32-bit 48 MHz
110 * Flash: 256KB
111 * RAM: 64KB
112 * Input Power Range: 1.8v ~~ 3.7v
113 * Power Consumption: < 4uA.
114 * Frequency Range: 150 MHz ~~ 960 MHz
115 * Maximum Power +22 dBm constant RF output
116 * High sensitivity: -148 dBm
117 * Temperature:
118 ** Storage: -55 ~~ +125℃
119 ** Operating: -40 ~~ +85℃
120 * Humidity:
121 ** Storage: 5 ~~ 95% (Non-Condensing)
122 ** Operating: 10 ~~ 95% (Non-Condensing)
123 * LoRa Tx Current: <90 mA at +17 dBm, 108 mA at +22 dBm
124 * LoRa Rx current: <9 mA
125 * I/O Voltage: 3.3v
126
Xiaoling 87.8 127
128
Xiaoling 87.2 129 == 2.4  Pin Mapping & LED ==
Edwin Chen 11.1 130
131
132
Xiaoling 87.2 133 == 2.5  Example: Use AT Command to communicate with LA66 module via Arduino UNO. ==
Edwin Chen 11.1 134
135
Xiaoling 87.2 136
137 == 2.6  Example: Join TTN network and send an uplink message, get downlink message. ==
138
139
140
141 == 2.7  Example: Log Temperature Sensor(DHT11) and send data to TTN, show it in DataCake. ==
142
143
144
145 == 2.8  Upgrade Firmware of LA66 LoRaWAN Shield ==
146
147
148 === 2.8.1  Items needed for update ===
149
Edwin Chen 74.1 150 1. LA66 LoRaWAN Shield
151 1. Arduino
152 1. USB TO TTL Adapter
Edwin Chen 13.1 153
Edwin Chen 75.1 154 [[image:image-20220602100052-2.png||height="385" width="600"]]
Herong Lu 20.1 155
156
Xiaoling 87.2 157 === 2.8.2  Connection ===
Herong Lu 20.1 158
Xiaoling 87.2 159
Edwin Chen 75.1 160 [[image:image-20220602101311-3.png||height="276" width="600"]]
Herong Lu 20.1 161
162
Xiaoling 87.2 163 (% style="color:blue" %)**LA66 LoRaWAN Shield**(%%)  **<->** (% style="color:blue" %)**USB TTL**
164
165 (% style="background-color:yellow" %)**GND  <-> GND
Xiaoling 87.8 166 TXD  <->  TXD
167 RXD  <->  RXD**
Xiaoling 87.2 168
169
Edwin Chen 77.1 170 Put a jumper cap on JP6 of LA66 LoRaWAN Shield. ( the jumper is to power on LA66 module)
Herong Lu 20.1 171
Edwin Chen 75.1 172 Connect USB TTL Adapter to PC after connecting the wires
Herong Lu 20.1 173
174
Edwin Chen 75.1 175 [[image:image-20220602102240-4.png||height="304" width="600"]]
Herong Lu 20.1 176
177
Xiaoling 87.2 178 === 2.8.3  Upgrade steps ===
Herong Lu 20.1 179
180
Xiaoling 87.2 181 ==== 1.  Switch SW1 to put in ISP position ====
182
183
Edwin Chen 75.1 184 [[image:image-20220602102824-5.png||height="306" width="600"]]
Herong Lu 32.1 185
186
Xiaoling 87.9 187
Xiaoling 87.2 188 ==== 2.  Press the RST switch once ====
Herong Lu 32.1 189
Xiaoling 87.10 190
Edwin Chen 75.1 191 [[image:image-20220602104701-12.png||height="285" width="600"]]
Herong Lu 32.1 192
Edwin Chen 75.1 193
Xiaoling 87.9 194
Xiaoling 87.2 195 ==== 3.  Open the Upgrade tool (Tremo Programmer) in PC and Upgrade ====
Edwin Chen 75.1 196
Herong Lu 39.1 197
Xiaoling 87.2 198 (% style="color:blue" %)**1. Software download link:  [[https:~~/~~/www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/Utility/LSN50N/>>https://www.dragino.com/downloads/index.php?dir=LSN50-LoRaST/Utility/LSN50N/]]**
199
200
Herong Lu 32.1 201 [[image:image-20220602103227-6.png]]
202
Xiaoling 87.2 203
Herong Lu 32.1 204 [[image:image-20220602103357-7.png]]
205
206
Xiaoling 87.2 207
Edwin Chen 76.1 208 (% class="wikigeneratedid" id="HSelecttheCOMportcorrespondingtoUSBTTL" %)
Xiaoling 87.2 209 (% style="color:blue" %)**2. Select the COM port corresponding to USB TTL**
Edwin Chen 76.1 210
Xiaoling 87.2 211
Herong Lu 32.1 212 [[image:image-20220602103844-8.png]]
213
214
Xiaoling 87.2 215
Edwin Chen 76.1 216 (% class="wikigeneratedid" id="HSelectthebinfiletoburn" %)
Xiaoling 87.2 217 (% style="color:blue" %)**3. Select the bin file to burn**
Edwin Chen 76.1 218
Xiaoling 87.2 219
Herong Lu 32.1 220 [[image:image-20220602104144-9.png]]
221
Xiaoling 87.2 222
Herong Lu 32.1 223 [[image:image-20220602104251-10.png]]
224
Xiaoling 87.2 225
Herong Lu 32.1 226 [[image:image-20220602104402-11.png]]
227
228
Xiaoling 87.2 229
Edwin Chen 76.1 230 (% class="wikigeneratedid" id="HClicktostartthedownload" %)
Xiaoling 87.2 231 (% style="color:blue" %)**4. Click to start the download**
Edwin Chen 76.1 232
Herong Lu 32.1 233 [[image:image-20220602104923-13.png]]
234
235
Xiaoling 87.10 236
Edwin Chen 76.1 237 (% class="wikigeneratedid" id="HThefollowingfigureappearstoprovethattheburningisinprogress" %)
Xiaoling 87.2 238 (% style="color:blue" %)**5. Check update process**
Edwin Chen 76.1 239
Xiaoling 87.2 240
Herong Lu 32.1 241 [[image:image-20220602104948-14.png]]
242
243
Xiaoling 87.2 244
Edwin Chen 76.1 245 (% class="wikigeneratedid" id="HThefollowingpictureappearstoprovethattheburningissuccessful" %)
Xiaoling 87.2 246 (% style="color:blue" %)**The following picture shows that the burning is successful**
Edwin Chen 76.1 247
Herong Lu 32.1 248 [[image:image-20220602105251-15.png]]
249
Edwin Chen 72.1 250
251
Xiaoling 87.2 252 = 3.  LA66 USB LoRaWAN Adapter =
Edwin Chen 6.1 253
Edwin Chen 7.1 254
Xiaoling 87.2 255 == 3.1  Overview ==
256
Edwin Chen 73.1 257 LA66 USB LoRaWAN Adapter is designed to fast turn USB devices to support LoRaWAN wireless features. It combines a CP2101 USB TTL Chip and LA66 LoRaWAN module which can easy to add LoRaWAN wireless feature to PC / Mobile phone or an embedded device that has USB Interface.
Herong Lu 52.1 258
Edwin Chen 73.1 259
Xiaoling 87.2 260 == 3.2  Features ==
Edwin Chen 73.1 261
262 * LoRaWAN USB adapter base on LA66 LoRaWAN module
263 * Ultra-long RF range
264 * Support LoRaWAN v1.0.4 protocol
265 * Support peer-to-peer protocol
266 * TCXO crystal to ensure RF performance on low temperature
267 * Spring RF antenna
268 * Available in different frequency LoRaWAN frequency bands.
269 * World-wide unique OTAA keys.
270 * AT Command via UART-TTL interface
271 * Firmware upgradable via UART interface
272
Xiaoling 87.10 273
274
Xiaoling 87.3 275 == 3.3  Specification ==
Edwin Chen 73.1 276
277 * CPU: 32-bit 48 MHz
278 * Flash: 256KB
279 * RAM: 64KB
280 * Input Power Range: 5v
281 * Frequency Range: 150 MHz ~~ 960 MHz
282 * Maximum Power +22 dBm constant RF output
283 * High sensitivity: -148 dBm
284 * Temperature:
285 ** Storage: -55 ~~ +125℃
286 ** Operating: -40 ~~ +85℃
287 * Humidity:
288 ** Storage: 5 ~~ 95% (Non-Condensing)
289 ** Operating: 10 ~~ 95% (Non-Condensing)
290 * LoRa Tx Current: <90 mA at +17 dBm, 108 mA at +22 dBm
291 * LoRa Rx current: <9 mA
292
Xiaoling 87.10 293
294
Xiaoling 87.3 295 == 3.4  Pin Mapping & LED ==
Edwin Chen 7.1 296
297
Xiaoling 87.3 298
299 == 3.5  Example: Send & Get Messages via LoRaWAN in PC ==
300
301
Edwin Chen 78.2 302 Assume user already input the LA66 USB LoRaWAN Adapter OTAA Keys in TTN and there is already TTN network coverage.
Herong Lu 58.1 303
304
Xiaoling 87.3 305 (% style="color:blue" %)**1. Connect the LA66 USB LoRaWAN adapter to PC**
306
307
Edwin Chen 78.2 308 [[image:image-20220602171217-1.png||height="538" width="800"]]
309
Xiaoling 87.3 310
Herong Lu 58.1 311 Open the serial port tool
312
313 [[image:image-20220602161617-8.png]]
314
Edwin Chen 78.2 315 [[image:image-20220602161718-9.png||height="457" width="800"]]
Herong Lu 58.1 316
317
318
Xiaoling 87.3 319 (% style="color:blue" %)**2. Press the reset switch RST on the LA66 USB LoRaWAN Adapter to reset it.**
320
Edwin Chen 78.2 321 The following picture appears to prove that the LA66 USB LoRaWAN Adapter successfully Join the LoRaWAN network
Herong Lu 58.1 322
Xiaoling 87.3 323
Edwin Chen 78.2 324 [[image:image-20220602161935-10.png||height="498" width="800"]]
Herong Lu 58.1 325
Edwin Chen 78.2 326
327
Xiaoling 87.3 328 (% style="color:blue" %)**3. See Uplink Command**
Edwin Chen 78.2 329
Xiaoling 87.3 330 Command format: (% style="color:#4472c4" %)** AT+SENDB=<confirn_status>,<Fport>,<data_len>,<data>**
331
Herong Lu 58.1 332 example: AT+SENDB=01,02,8,05820802581ea0a5
333
Edwin Chen 78.2 334 [[image:image-20220602162157-11.png||height="497" width="800"]]
Herong Lu 58.1 335
336
337
Xiaoling 87.3 338 (% style="color:blue" %)**4. Check to see if TTN received the message**
339
Edwin Chen 78.2 340 [[image:image-20220602162331-12.png||height="420" width="800"]]
341
342
343
Xiaoling 87.3 344 == 3.6  Example: Send PC's CPU/RAM usage to TTN via python ==
Edwin Chen 81.1 345
Xiaoling 87.3 346
Edwin Chen 87.1 347 **Use python as an example:**[[https:~~/~~/github.com/dragino/LA66/blob/main/Send_information_to_TTN_WindosPC.py>>https://github.com/dragino/LA66/blob/main/Send_information_to_TTN_WindosPC.py]]
Edwin Chen 81.1 348
349
Xiaoling 87.3 350 (% style="color:red" %)**Preconditions:**
Edwin Chen 81.1 351
Xiaoling 87.3 352 (% style="color:red" %)**1. LA66 USB LoRaWAN Adapter works fine**
Edwin Chen 81.1 353
Xiaoling 87.3 354 (% style="color:red" %)**2. LA66 USB LoRaWAN Adapter  is registered with TTN**
Edwin Chen 81.1 355
356
357
Xiaoling 87.3 358 (% style="color:blue" %)**Steps for usage:**
359
360 (% style="color:blue" %)**1.**(%%) Press the reset switch RESET on the LA66 USB LoRaWAN Adapter
361
362 (% style="color:blue" %)**2.**(%%) Run the python script in PC and see the TTN
363
Edwin Chen 81.1 364 [[image:image-20220602115852-3.png||height="450" width="1187"]]
365
366
367
Xiaoling 87.4 368 == 3.7  Example: Send & Get Messages via LoRaWAN in RPi ==
Edwin Chen 11.1 369
Xiaoling 87.4 370
Edwin Chen 79.1 371 Assume user already input the LA66 USB LoRaWAN Adapter OTAA Keys in TTN and there is already TTN network coverage.
Edwin Chen 12.1 372
Edwin Chen 79.1 373
Xiaoling 87.5 374 (% style="color:blue" %)**1. Connect the LA66 USB LoRaWAN Adapter to the Raspberry Pi**
Xiaoling 87.4 375
Edwin Chen 78.2 376 [[image:image-20220602171233-2.png||height="538" width="800"]]
Herong Lu 43.1 377
Herong Lu 52.1 378
379
Xiaoling 87.4 380 (% style="color:blue" %)**2. Install Minicom in RPi.**
381
Edwin Chen 79.1 382 (% id="cke_bm_509388S" style="display:none" %) (%%)Enter the following command in the RPi terminal
Herong Lu 52.1 383
Xiaoling 87.4 384 (% style="background-color:yellow" %)**apt update**
Herong Lu 52.1 385
Xiaoling 87.4 386 (% style="background-color:yellow" %)**apt install minicom**
Herong Lu 52.1 387
388
Edwin Chen 79.1 389 Use minicom to connect to the RPI's terminal
Herong Lu 52.1 390
Edwin Chen 79.1 391 [[image:image-20220602153146-3.png||height="439" width="500"]]
Herong Lu 52.1 392
393
Xiaoling 87.4 394
Xiaoling 87.5 395 (% style="color:blue" %)**3. Press the reset switch RST on the LA66 USB LoRaWAN Adapter.**(%%)
396 (% style="color:blue" %)The following picture appears to prove that the LA66 USB LoRaWAN Adapter successfully entered the network
Edwin Chen 8.1 397
Edwin Chen 79.1 398 [[image:image-20220602154928-5.png||height="436" width="500"]]
Herong Lu 46.1 399
400
401
Xiaoling 87.4 402 (% style="color:blue" %)**4. Send Uplink message**
Herong Lu 46.1 403
Xiaoling 87.5 404 Format: (% style="color:#4472c4" %)**AT+SENDB=<confirn_status>,<Fport>,<data_len>,<data>**
Xiaoling 87.4 405
Edwin Chen 79.1 406 example: AT+SENDB=01,02,8,05820802581ea0a5
Herong Lu 46.1 407
Xiaoling 87.4 408
Edwin Chen 79.1 409 [[image:image-20220602160339-6.png||height="517" width="600"]]
410
Xiaoling 87.4 411
412
Edwin Chen 79.1 413 Check to see if TTN received the message
414
415 [[image:image-20220602160627-7.png||height="369" width="800"]]
416
417
418
Xiaoling 87.4 419 == 3.8  Example: LA66 USB Module got a message from LA66 LoRa Shield and send the sensor data to NodeRed. ==
Edwin Chen 11.1 420
Edwin Chen 13.1 421
Herong Lu 63.1 422
Xiaoling 87.4 423 == 3.9  Upgrade Firmware of LA66 USB LoRaWAN Adapter ==
Edwin Chen 73.1 424
425
426
427
Xiaoling 87.4 428 = 4.  Order Info =
Edwin Chen 73.1 429
Xiaoling 87.4 430
Xiaoling 87.5 431 **Part Number:**  (% style="color:blue" %)**LA66-XXX**(%%), (% style="color:blue" %)**LA66-LoRaWAN-Shield-XXX** (%%) **or**  (% style="color:blue" %)**LA66-USB-LoRaWAN-Adapter-XXX**
Xiaoling 87.4 432
433
Xiaoling 87.5 434 (% style="color:blue" %)**XXX**(%%): The default frequency band
Edwin Chen 86.1 435
Xiaoling 87.5 436 * (% style="color:red" %)**AS923**(%%):  LoRaWAN AS923 band
437 * (% style="color:red" %)**AU915**(%%):  LoRaWAN AU915 band
438 * (% style="color:red" %)**EU433**(%%):  LoRaWAN EU433 band
439 * (% style="color:red" %)**EU868**(%%):  LoRaWAN EU868 band
440 * (% style="color:red" %)**KR920**(%%):  LoRaWAN KR920 band
441 * (% style="color:red" %)**US915**(%%):  LoRaWAN US915 band
442 * (% style="color:red" %)**IN865**(%%):  LoRaWAN IN865 band
443 * (% style="color:red" %)**CN470**(%%): LoRaWAN CN470 band
444 * (% style="color:red" %)**PP**(%%):  Peer to Peer LoRa Protocol
Edwin Chen 73.1 445
Edwin Chen 78.1 446
Xiaoling 87.4 447
448
449 = 5.  Reference =
450
Edwin Chen 78.1 451 * Hardware Design File for LA66 LoRaWAN Shield, LA66 USB LoRaWAN Adapter : [[Download>>https://www.dropbox.com/sh/a3wbmdcvqjxaqw5/AADZfvAiykJTK624RgMquH86a?dl=0]]
452
Edwin Chen 79.1 453