<
From version < 94.1 >
edited by Kilight Cao
on 2022/11/09 15:10
To version < 101.1 >
edited by Edwin Chen
on 2022/11/14 19:39
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.Kilight
1 +XWiki.Edwin
Content
... ... @@ -283,40 +283,27 @@
283 283  )))
284 284  
285 285  
286 -== **5.2 Example: LG01**-**V2 Peer-to-Peer** ==
286 +== **5.2 Example: LG01v2** ==
287 287  
288 +=== **5.2.1 Introduce for the example:** ===
288 288  
289 289  [[image:image-20221104102736-3.png||height="282" width="723"]]
290 290  
291 291  
292 -The user can run the AT command to set the LG01-V2 RX window always opeas a Receiver, The LG01-V2 can display the received data in the built-in server Node-Red, Here are the specific steps:
293 +In this example, there are two devices:
293 293  
294 -(% style="color:red" %)**Prerequisites: **(%%)The configuration of LG01-V2 and  LA66 Shield must match and the LA66 Shield firmware is **[[LA66 Peer-to-Peer firmware>>http://wiki.dragino.com/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/LA66%20LoRaWAN%20Shield%20User%20Manual/Instruction%20for%20LA66%20Peer%20to%20Peer%20firmware/]]**, users can use **AT+CFG** to check all configurations.
295 +* **LA66 Shield + UNO + DHT11**: The UNO will get the temperature and humidity and broadcast the value via LoRa protocol.
296 +* **LG01v2** : LG01v2 is set to listening the LoRa Channel which LA66 is broadcasting. When LG01v2 get the data from LA66, LG01v2 will plot the data in built-in IoT server.
295 295  
296 296  
297 -=== **Log Temperature Sensor(DHT11) and send data to LG01-V2, show it in Node-RED.** ===
299 +=== 5.2.2 Set Up LA66 Shield + UNO ===
298 298  
299 299  
300 -(% style="color:red; font-weight:bold" %)**LG01-V**(% style="color:red" %)**2 as Receiver: (configured as AT+RXMOD=65535,2)**
302 +==== **Set up LA66 Module** ====
301 301  
302 -(% class="box infomessage" %)
303 -(((
304 -**LG01-V2 configuration:**
304 +LA66 Module is loaded with the firmware **[[LA66 Peer-to-Peer firmware>>http://wiki.dragino.com/xwiki/bin/view/Main/User%20Manual%20for%20LoRaWAN%20End%20Nodes/LA66%20LoRaWAN%20Shield%20User%20Manual/Instruction%20for%20LA66%20Peer%20to%20Peer%20firmware/]] **and user can use AT Command to set up LA66 with below parameters:
305 305  
306 -AT+FRE=868.100,868.100  ~-~--> TX and RX frequency set: 868100000
307 -AT+BW=0,0  ~-~--> TX and RX Bandwidth set: 125kHz
308 -AT+SF=12,12  ~-~--> TX and RX Spreading Factor set: SF12
309 -AT+POWER=14  ~-~--> TX Power Range set: 14dBm
310 -AT+CRC=1,1  ~-~--> TX and RX CRC Type
311 -AT+HEADER=0,0  ~-~--> TX and RX Header Type
312 -AT+CR=1,1  ~-~--> TX and RX Coding Rate
313 -AT+IQ=0,0  ~-~--> TX and RX InvertIQ
314 -AT+PREAMBLE=8,8  ~-~--> TX and RX Preamble Length set: 8
315 -AT+SYNCWORD=0  ~-~-->  Syncword**(0: private,1: public)**
316 -AT+RXMOD=65535,0  ~-~-->  Rx Timeout and Reply mode, RX window always open
317 -)))
318 -
319 -
306 +(((
320 320  (% style="color:red" %)**LA66 Shield as Sender: **
321 321  
322 322  (% class="box infomessage" %)
... ... @@ -338,20 +338,10 @@
338 338  )))
339 339  
340 340  
341 -After the above configuration is complete, users can send test simulation data to check whether the configuration is correct, In LA66 sheild serial console send:(% style="color:red" %)**(AT+SEND=1,hello world,2,3).**
328 +==== **Set up Arduino UNO** ====
342 342  
343 -When LG01-V2 replies with ACK when it receives a packet sent by LA66 sheild.
330 +(% id="cke_bm_1033249S" style="display:none" %)** **(%%)**Hardware Connection**
344 344  
345 -[[image:image-20221108164413-2.png]]
346 -
347 -
348 -In the real-time log of LG01-V2:
349 -
350 -[[image:image-20221108170314-3.png]]
351 -
352 -
353 -**Hardware Connection**
354 -
355 355  (% class="box infomessage" %)
356 356  (((
357 357  **The DHT11 sensor connects to the LA66 Shield:**
... ... @@ -364,14 +364,13 @@
364 364  [[image:image-20221108170731-5.png||height="588" width="441"]]
365 365  
366 366  
367 -==== **1. Open Arduino IDE** ====
344 +===== **1. Open Arduino IDE** =====
368 368  
369 369  [[image:image-20221108172149-6.png||height="650" width="542"]]
370 370  
371 371  
372 -==== **2. Open project** ====
349 +===== **2. Open project** =====
373 373  
374 -
375 375  Users can download Arduino files from this link: [[attach:Log-Temperature-Sensor-and-send-data-to-Node-red.ino||target="_blank"]]
376 376  
377 377  Then click Compile and Upload to LA66 Shield,
... ... @@ -379,21 +379,66 @@
379 379  [[image:image-20221108172432-7.png]]
380 380  
381 381  
382 -==== **3. Open the Serial Monitor to check the LA66 Shield data** ====
358 +===== **3. Open the Serial Monitor to check the LA66 Shield data** =====
383 383  
360 +The UNO will now reads the temperature and humidity data from the sensor and broadcast it via LoRa wireless,
384 384  
385 -The LA66 Shield reads the temperature and humidity data from the sensor and sends it to LG01-V2,
386 -
387 387  [[image:image-20221108174840-8.png||height="731" width="671"]]
388 388  
364 +
365 +Sending out data as below.
366 +
389 389  [[image:image-20221108175113-9.png||height="556" width="998"]]
390 390  
391 391  
392 -==== **4. Import the flow to the built-in server on LG01-V2** ====
393 393  
371 +=== 5.2.3 Set Up LG01v2 ===
394 394  
395 -Users can import this example in Node-Red: [[attach:Log-Temperature-Sensor-and-send-data-to-node-red.json||target="_blank"]]
396 396  
374 +Configure LG01v2 LoRa channel parameters so it can get data from LA66 Shield
375 +
376 +(% style="color:red; font-weight:bold" %)**LG01v**(% style="color:red" %)**2 as Receiver: (configured as AT+RXMOD=65535,2)**
377 +
378 +(% class="box infomessage" %)
379 +(((
380 +**LG01-V2 configuration:**
381 +
382 +AT+FRE=868.100,868.100  ~-~--> TX and RX frequency set: 868100000
383 +AT+BW=0,0  ~-~--> TX and RX Bandwidth set: 125kHz
384 +AT+SF=12,12  ~-~--> TX and RX Spreading Factor set: SF12
385 +AT+POWER=14  ~-~--> TX Power Range set: 14dBm
386 +AT+CRC=1,1  ~-~--> TX and RX CRC Type
387 +AT+HEADER=0,0  ~-~--> TX and RX Header Type
388 +AT+CR=1,1  ~-~--> TX and RX Coding Rate
389 +AT+IQ=0,0  ~-~--> TX and RX InvertIQ
390 +AT+PREAMBLE=8,8  ~-~--> TX and RX Preamble Length set: 8
391 +AT+SYNCWORD=0  ~-~-->  Syncword**(0: private,1: public)**
392 +AT+RXMOD=65535,0  ~-~-->  Rx Timeout and Reply mode, RX window always open
393 +)))
394 +
395 +
396 +=== 5.2.4 Test result ===
397 +
398 +After the above configuration is complete, users can send test simulation data to check whether the configuration is correct, In LA66 sheild serial console send:(% style="color:red" %)**(AT+SEND=1,hello world,2,3).**
399 +)))
400 +
401 +When LG01v2 replies with ACK when it receives a packet sent by LA66 sheild.
402 +
403 +[[image:image-20221108164413-2.png]]
404 +
405 +
406 +In the real-time log of LG01v2:
407 +
408 +[[image:image-20221108170314-3.png]]
409 +
410 +
411 +=== **5.2.5 Plot data chart in LG01v2** ===
412 +
413 +
414 +User can plot the temperature and humidity chat via LG01v2 built-in IoT server.
415 +
416 +User can import this example in Node-Red: [[attach:Log-Temperature-Sensor-and-send-data-to-node-red.json||target="_blank"]]
417 +
397 397  [[image:image-20221108180334-10.png||height="651" width="1141"]]
398 398  
399 399  
... ... @@ -404,7 +404,7 @@
404 404  [[image:image-20221108180458-11.png||height="402" width="1137"]]
405 405  
406 406  
407 -= (% style="color:inherit; font-family:inherit; font-size:29px" %)**6. How users can access LG01**(%%)**-V(% style="color:inherit; font-family:inherit; font-size:29px" %)2 using serial USB(%%)** =
428 += (% style="color:inherit; font-family:inherit; font-size:29px" %)**6. How users can access LG01**(%%)**v(% style="color:inherit; font-family:inherit; font-size:29px" %)2 using serial USB(%%)** =
408 408  
409 409  
410 410  (% style="color:blue" %)**USB TTL to LG01-V2  Connection:**
... ... @@ -442,7 +442,7 @@
442 442  == **7.1 How does LG01-V2 communicate with Lora shield (LoRa.h)** ==
443 443  
444 444  
445 -This example describes how to use LG01-V2, LoRa Shield to set up a LoRa network
466 +This example describes how to use LG01-V2, LoRa Shield to set up a LoRa network,
446 446  
447 447  [[image:image-20221103152238-8.png||height="251" width="654"]]
448 448  
... ... @@ -484,6 +484,44 @@
484 484  [[image:image-20221101162527-4.png]]
485 485  
486 486  
508 +== **7.2 How does LG01-V2 communicate with Heltec LoRa Node** ==
509 +
510 +
511 +This example describes how to use LG01-V2 and Heltec LoRa Node to set up a LoRa network,
512 +
513 +[[image:image-20221112161111-2.png||height="258" width="692"]]
514 +
515 +(% style="color:red" %)**Prerequisites: The configurations of LG01-V2 and Lora shield must match**
516 +
517 +**LG01-V2 configuration:**
518 +
519 +(% class="box infomessage" %)
520 +(((
521 +AT+FRE=868.100,868.100  ~-~--> TX and RX frequency set: 868100000
522 +AT+BW=0,0  ~-~--> TX and RX Bandwidth set: 125kHz
523 +AT+SF=12,12  ~-~--> TX and RX Spreading Factor set: SF12
524 +AT+POWER=14  ~-~--> TX Power Range
525 +AT+CRC=1,1  ~-~--> TX and RX CRC Type
526 +AT+HEADER=0,0  ~-~--> TX and RX Header Type
527 +AT+CR=1,1  ~-~--> TX and RX Coding Rate
528 +AT+IQ=0,0  ~-~--> TX and RX InvertIQ
529 +AT+PREAMBLE=8,8  ~-~--> TX and RX Preamble Length set: 8
530 +AT+SYNCWORD=0  ~-~-->  Syncword**(0: private,1: public), **the corresponding Lora shield syncword is 0x12
531 +AT+RXMOD=65535,0  ~-~-->  Rx Timeout and Reply mode,RX window always open
532 +AT+RXDAFORM=1  ~-~--> RX data format**(0: Hex ,1: String)**
533 +)))
534 +
535 +After we upload the sketch to Heltec LoRa Node, we can see below output from Arduino.
536 +
537 +Lora Shield example: [[attach:LoRa_send_trial.ino||target="_blank"]]
538 +
539 +[[image:image-20221112162733-3.png||height="524" width="927"]]
540 +
541 +
542 +And we can see the logread of gateway as below, means the packet arrive gateway:
543 +
544 +[[image:image-20221112163119-4.png||height="808" width="560"]]
545 +
487 487  = (% style="color:inherit; font-family:inherit; font-size:29px" %)**8. Supports**(%%) =
488 488  
489 489  
LoRa_send_trial.ino
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Kilight
Size
... ... @@ -1,0 +1,1 @@
1 +3.4 KB
Content
... ... @@ -1,0 +1,124 @@
1 +#include "LoRaWan_APP.h"
2 +#include "Arduino.h"
3 +
4 +
5 +#define RF_FREQUENCY 868100000 // Hz
6 +
7 +#define TX_OUTPUT_POWER 5 // dBm
8 +
9 +#define LORA_BANDWIDTH 0 // [0: 125 kHz,
10 + // 1: 250 kHz,
11 + // 2: 500 kHz,
12 + // 3: Reserved]
13 +#define LORA_SPREADING_FACTOR 12 // [SF7..SF12]
14 +#define LORA_CODINGRATE 1 // [1: 4/5,
15 + // 2: 4/6,
16 + // 3: 4/7,
17 + // 4: 4/8]
18 +#define LORA_PREAMBLE_LENGTH 8 // Same for Tx and Rx
19 +#define LORA_SYMBOL_TIMEOUT 0 // Symbols
20 +#define LORA_FIX_LENGTH_PAYLOAD_ON false
21 +#define LORA_IQ_INVERSION_ON false
22 +
23 +
24 +#define RX_TIMEOUT_VALUE 1000
25 +#define BUFFER_SIZE 30 // Define the payload size here
26 +
27 +float tem,hum;
28 +char tem_1[8]={"\0"},hum_1[8]={"\0"};
29 +char *node_id = "<GW01>"; //From LG01 via web Local Channel settings on MQTT.Please refer <> dataformat in here.
30 +
31 +char txpacket[BUFFER_SIZE];
32 +char rxpacket[BUFFER_SIZE];
33 +
34 +double txNumber;
35 +
36 +bool lora_idle=true;
37 +
38 +static RadioEvents_t RadioEvents;
39 +void OnTxDone( void );
40 +void OnTxTimeout( void );
41 +
42 +void dhtTem()
43 +{
44 + tem = random(15,40);
45 + hum = random(40,80);
46 + Serial.println(F("The temperature and humidity:"));
47 + Serial.print("[");
48 + Serial.print(tem);
49 + Serial.print("℃");
50 + Serial.print(",");
51 + Serial.print(hum);
52 + Serial.print("%");
53 + Serial.print("]");
54 + Serial.println("");
55 +}
56 +
57 +void dhtWrite()
58 +{
59 + char data[50] = "\0";
60 + for(int i = 0; i < 50; i++)
61 + {
62 + data[i] = node_id[i];
63 + }
64 +
65 + dtostrf(tem,0,1,tem_1);
66 + dtostrf(hum,0,1,hum_1);
67 +
68 + strcat(data,"tem_a=");
69 + strcat(data,tem_1);
70 + strcat(data,"&hum_a=");
71 + strcat(data,hum_1);
72 + strcpy((char *)txpacket,data);
73 +
74 + Serial.println((char *)txpacket);
75 +}
76 +
77 +void setup() {
78 + Serial.begin(115200);
79 + Mcu.begin();
80 +
81 + txNumber=0;
82 +
83 + RadioEvents.TxDone = OnTxDone;
84 + RadioEvents.TxTimeout = OnTxTimeout;
85 +
86 + Radio.Init( &RadioEvents );
87 + Radio.SetChannel( RF_FREQUENCY );
88 + Radio.SetTxConfig( MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
89 + LORA_SPREADING_FACTOR, LORA_CODINGRATE,
90 + LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
91 + true, 0, 0, LORA_IQ_INVERSION_ON, 3000 );
92 + }
93 +
94 +
95 +
96 +void loop()
97 +{
98 + if(lora_idle == true)
99 + {
100 + delay(5000);
101 + txNumber += 0.01;
102 + Serial.println(txNumber);
103 +
104 + dhtTem();
105 + dhtWrite();
106 + Radio.Send( (uint8_t *)txpacket, strlen(txpacket) ); //send the package out
107 + lora_idle = false;
108 + }
109 + Radio.IrqProcess( );
110 +}
111 +
112 +void OnTxDone( void )
113 +{
114 + Serial.println("TX done......");
115 + lora_idle = true;
116 +}
117 +
118 +void OnTxTimeout( void )
119 +{
120 + Radio.Sleep( );
121 + Serial.println("TX Timeout......");
122 + lora_idle = true;
123 +}
124 +
image-20221112161031-1.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Kilight
Size
... ... @@ -1,0 +1,1 @@
1 +35.1 KB
Content
image-20221112161111-2.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Kilight
Size
... ... @@ -1,0 +1,1 @@
1 +34.8 KB
Content
image-20221112162733-3.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Kilight
Size
... ... @@ -1,0 +1,1 @@
1 +78.7 KB
Content
image-20221112163119-4.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Kilight
Size
... ... @@ -1,0 +1,1 @@
1 +32.6 KB
Content
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0