LG01-P Dragino LoRa Gateway Examle

Simple LoRa Wireless Example

In order to test the LoRa wireless transceiver function, we need at least two devices that support LoRa. In this example, we will use the following devices:

  LoRa server: LG01;
  LoRa client: LoRa Shield + Arduino Uno

In this example, we will demonstrate basic LoRa communication. The LoRa client broadcasts packets over LoRa. After receiving these packets, the LG01 gateway will display their debug windows on the computer.

Install the LoRa library

The library here is the Radiohead library, which can be downloaded from https://github.com/dragino/RadioHead/archive/master.zip
Download it and unzip it into the Arduino library folder. The final path should look like this:

To ensure that Radiohead’s library is properly installed, we restart the Arduino IDE, and then we will see Radiohead appear in the Examples directory, as follows:

Upload the firmware of the LoRa client

First open the Arduino IDE and select Dragino Yun – LG01.

Then choose an example: LoRa_Simple_Client_Arduino

In the programming window of LoRa_Simple_Client_Arduino, select the board information back to Arduino UNO. The board represented by this is LoRa Shield + UNO:

From the USB com port last example LoRa_Simple_Client_Arduino to LoRa Shield + UNO. Open the serial monitor at the same time to view the output.

Upload LG01 LoRa Gateway Side Firmware

Click Arduino.exe again to open another Arduino IDE window. This is important because we need two separate window monitors, one for the monitoring client and one for the LG01 gateway.

In the new window, select LG01 as the board you want to use, then select and upload the example:

After the example upload is complete, open the serial monitor to view the program output.

Analyze test results

The bottom window shows the result of the output.

  The window above shows the LoRa client continuously broadcasting LoRa packets out and waiting for a reply.
  The following window is the window of the LG01 gateway. It shows that LG01 waited for a “Hello, World” packet and replied “And hello back to you”. When the LoRa client receives the reply packet, it will print it to its own window. on

Note: In this example, the LoRa client will broadcast the LoRa packet after powering up. The LG01 will not receive the packet and reply after the user opens the serial monitor. The reason is that we have this code in the gateway:

  While (!Console) ; // Wait for console port to be available

Indicates that it is looped until the user connects through the serial port.

If you want LG01 to send without waiting for the serial monitor connection, you can directly block this code.
When using another LG01 as a LoRa node

The method is the same as above, but using the following example:
IDE –> File –> Examples –> Dragino –> LoRa –> LoRa_Simple_Client_Yun