fbpx

In this article I tell you how to connect a LoRa node LSN50 (Dragino) to TTN through a two-channel gateway (LG02).

Some points about the Dragino LG02 gateway

The Dragino gateway LG02 It has two LoRa channels, one for uplink and one for downlink. It also has LAN and WAN ethernet connection, WiFi connection (in AP or client mode) and an optional interface for cellular connection.

To begin with, keep in mind that a two-channel gateway has its limitations.

First of all, it can process the connection of a limited number of nodes. The manufacturer recommends no more than 300 nodes, but I suggest smaller networks of less than 100 nodes. I think that a network of 50 can work without complications.

lg02 dragino gateway
Gateway LG02

It should also be taken into account that these numbers depend on other factors, such as the frequency of sending information from the nodes.

The second point has to do with the impossibility of using OTAA to activate the nodes, since we will only use one channel for the uplink. This forces us to use ABP, which can be a very laborious method when the number of nodes grows.

Luckily, Dragino devices already come with keys included, which prevents us from having to generate them for each of the nodes. On the other hand, we will not save ourselves from entering them in the LoRaWAN network server.

Activating LoRaWAN

To connect the node to TTN using the LG02 gateway, it is necessary to follow a series of steps precisely.

The LoRaWAN service that we are going to use is that of The Things Network, so you must have an account there.

LoRaWAN setup on the LG02 is very simple. You only have to enter the data as shown in the image.

LoRaWAN Configuration

Then, using the Gateway ID you configured on the gateway, you create a new gateway in the TTN console (I don't know how many times I said gateway anymore, haha).

Gateway configuration in TTN

After doing all this, you should already see the active gateway in TTN. Now let's move on to LoRa.

Configuring LoRa

As I said before, it is necessary to configure the parameters of the uplink (we will not use the downlink in this tutorial).

In my case I have used the following configuration.

LoRa Configuration

The frequency is optional, but I suggest using a channel according to the chosen band. In my case I use the AU915 band and I have chosen the first channel, which is 915200000 Hz.

As for the SF and BW, I recommend using SF7 and 125KHz respectively. The rest of the parameters are the ones that come by default and it is best not to touch them. If the preamble, coding rate or synchronization word is changed, it is most likely that we will not be able to communicate with the gateway.

Configuring the LSN50 node

First of all, we are going to power up the node using the jumper shown in the photo.

Source: LSN50 Manual

To configure the node it is necessary to connect to it, for which a couple of tools are needed.

  • The software: Since the configuration is done using AT commands, I suggest you use Serial PortUtility, which is quite handy for this. You could also use Putty, but it gets very tedious to enter each command with this software.
  • hardware: You will need a USB serial converter to be able to communicate with the node. I have used one that comes with the FTDI chip, but it is not the only option.
Serial-USB adapter

We make the connection as shown in the figure below.

Source: LSN50 Manual – Dragino

Now we are going to configure the LNS node to work in ABP with the correct LoRa parameters.

For this we configure the node by running the following commands:

AT+FDR Reset to factory settings, keys are preserved.

AT+NJM=0 ABP mode.

AT+ADR=0 Do not use ADR (Adaptive Data Rate).

AT+DR=5 Data Rate = 5 (this is what goes for AU915, see figure below).

AT+TDC=300000 Set the sending period to 5 minutes (can be changed).

AT+CHS=915200000 Set the frequency to 915.2 Mhz.

AT+DADDR=26 01 1A F1 Set the device address if necessary (I used the default one).

ATZ Reboot for it to take the settings.

Source: LoRa Alliance

As seen in the figure, for SF7 and 125 KHz corresponds DR = 5. This information can be consulted in this link (corresponding to LoRa 1.03).

Adding node LSN50 in TTN

To add the node in TTN, we simply go to the console, open our application and add a new device (device).

Once we do this, an option will appear to load devices automatically or manually. We select the manual and begin to enter the parameters of our node.

Registering the new device
ABP configuration in TTN.

In the advanced network configuration, we will support the reset of the frame counter. This poses a minimal security risk, but in the event that it is disconnected and does not respect the frame numbering, it will still be processed.

Support Resets Frames Counters

Decoding the payload

To decode the payload and obtain the data from the sensors, it is necessary to go to the device, select the Payload formatters tab, choose Javascript and replace the code with the one from this link.

Decoding the payload

Checking the operation

If all went well, you should now be receiving frames from the sensor on the TTN network server.

Data sent by the LSN50 node

conclusion

In this article we saw how to connect an LG02 gateway to TTN and use it to receive information from an LSN50 node.

The procedure is not that difficult, but you have to follow the steps to the letter for everything to work. Above all, it is VERY important to specify the same frequency and LoRa parameters on the node and on the gateway.

I hope this article has been useful to you and I invite you to comment or ask below.


3 Comments

Guille · 3 May, 2021 at 3:20 PM

Hello Rodrigo, I have the same gateway and I have connected to TTN. Now how to pass that data to a dasboard?
I have had success connecting LG02 via MQTT to a server on an Orange pi; but I can't connect to Ubidot with it.
Any suggestion?
Thank you very much

Juan · 12 December, 2021 at 10:24 AM

Hello, thanks for your contributions with this post, I'm telling you I'm one step ahead and I can't connect my dragino to the internet. The Web Interface proposal is like the one in the article, although I have seen that there are others, but that is not a problem today. Thanks in advance if you can tell me how to achieve this. greetings john

    IoT Consulting · 16 December, 2021 at 12:09 PM

    Hello John.
    Which gateway interface are you connecting to the Internet? Note that the gateway also works as a router (it has a LAN interface and a WAN interface)

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

en_USEnglish
%d bloggers like this: