Linovision Gateway -The Things Stack(TTN) Integration via Basic Station

CONTENTS

  • Description
  • Requirement
  • Configuration
    • 1. Login The Thing Stack and Add Gateway
      • Step1. Login The Thing Stack
      • Step2. Add Gateway
      • Step3. Create API Key
    • 2. Connect Gateway to The Thing Stack via LNS
      • Step1. Prepare the CA File (*. trust)
      • Step2. Prepare the Client Key file (*.key)
      • Step3. Configure the Gateway
    • 3. Connect Gateway to The Thing Stack via CUPS
      • Step1. Prepare the CA File (*. trust)
      • Step2. Configure CUPS to Send the LNS API Key
      • Step3. Prepare the Client Key file (*.key)
      • Step4. Configure the Gateway

 

Description

The Things Network, a leading provider of LoRaWAN networks and services, is upgrading its stack to v3 (The Thing Stack v3). As a leading LoRaWAN end-devices and gateways provider, Linovision IoT’s gateway can be easily connected to The Thing Stack, no matter it’s via ‘Semtech Packet forwarder’ or the Basic Station. 

Basics Station contains two sub protocols for connecting Gateways to Network Servers, LoRaWAN Network Server (LNS) and Configuration and Update Server (CUPS). This document will guide you how to connect toThe Thing Stack via CUPS or LNS, you can select one of both to complete the configurations.

 

If you prefer using Semtech Packet forwarder, please click here.

 

Requirement

 

Configuration

1. Login The Thing Stack and Add Gateway

Step1. Login The Thing Stack

Select the cluster according to your gateway location and login The Thing Stack using the credentials/the things ID.

This is the login page, choose Login with The Things ID

 

Input the credentials and click Submit

 

When done, you will see this console page successfully.

 

 

Step2. Add Gateway

1. Login the web interface of the gateway to check frequency plan. In this example, the frequency plan is EU868.

 

 

You will need to take a note of the Gateway ID and Gateway EUI, which is needed when Register a device in The Thing Stack.

  

The default Gateway ID in Linovision gateway is the same as Gateway EUI. You can change the Gateway ID to yours. In this example, Gateway ID= g65, Gateway EUI= 24E124FFFEF1272B. Note that the gateway ID must have less than 36 characters and only use lowercase letters, numbers and dashes(-). 

2. Click Register a Gateway in The Thing Stack page and input the gateway information.

 

  • Gateway EUI: this can be found on the status page of gateway web GUI. You can also click Continue without EUI to leave blank
  • Gateway ID: the same the ID you configured in gateway web GUI. In this example is iot-g65
    Gateway name: user-defined
  • Frequency plan: the same as the gateway setting, in this example is EU868
  • Require authenticated connection: enabled

Note:

1) The Gateway ID cannot be reuse if you delete it in The Thing Stack

2) It is suggested to check the boxes of Generate API key and download the key files directly. 

 

 When done, the gateway is created well.

Step3. Create API Key

Note: if you already generate API key when adding a new gateway, please skip this Step.

If you need gateway to connect to LNS, please create a LNS API key; if you need gateway to connect to CUPS, please create a LNS API key and a CUPS API key.

 

1. Create a LNS API Key

Click API Keys > Add API Key

 

Input any name you like, tick Grant Individual rights and select the rights as below, then click Create API Key.

 

There will be a window pop-up to let you know copy the API Key.

 In this example, the LNS API key is: NNSXS.KDSXSAHLASC6REZDI3RV3ZTU27FDTNQVSRT7TYQ.MD7XXFD5D7ZOJW7XT2G3IV3QSVCTMVKJLKB2RF7HPPQOJPRUH6LQ

 

2. Create a CUPS API Key

Note: if you need to connect gateway to The Thing Stack via LNS protocol, skip this step.

Click API Keys > Add API Key, input any name you like, tick Grant Individual rights and select the rights as below, then click Create API Key and copy the key.

 

 

In this example, the CUPS key is:

NNSXS.O75NDWBFXFP2PVPGJU7NL5GBAUFNUWPLCUT57XA.BBMHEII2FJT433QJX37CNOQBBJ74465BJC5BZSF6JPT4OLB4XXAQ

Note: The Key is unique for the application created for each device.

 

2. Connect Gateway to The Thing Stack via LNS

Step1. Prepare the CA File (*. trust)

This is the CA certificate which secures your domain. Which contains links to common root SSL certificates used in The Things Stack, issued by trusted certificate authorities (CAs), in Linovision Gateway, we can just download the ISRG Root X1 Trust file to deploy, you will get a CA file named isrgrootx1.pem, we should rename it to *.trust.

 

img

 

 Besides, you can find more CA files here.

 

Step2. Prepare the Client Key file (*.key)

Note: if you already generate API key when adding a new gateway, please skip this Step.

 

Execute the following command to generate the LNS.key file, replace <your-lns-api-key> with the LNS API key you copied before.

On Linux or macOS use the following commands:

export LNS_KEY="your-lns-api-key"
echo "Authorization: Bearer $LNS_KEY" | perl -p -e 's/\r\n|\n|\r/\r\n/g' > lns.key
HTML

On Windows Command Prompt use the following commands:

set LNS_KEY=your-lns-api-key
echo Authorization: Bearer %LNS_KEY% > lns.key
JavaScript

 

In this example, here are the details in Command Prompt:

 

 

Then you will find the lns.key file under the corresponding path.

Here are the files used to upload in Linovision Gateway.

 

Step3. Configure the Gateway

1. Make sure that your gateway can connect to Internet successfully.

 

2. Go to Packet Forwarder > General, disable Embedded NS and create a new Destination. 

3. Click + to create a new destination

 

Select the type as Basic Station,  enable this option and input the information of Connecting to an LNS, and then click Save&Apply.

  • URI: the format is wss://<server-address>:8887, you can click here to fill in the information to get the correct URI.
  • CA File: import .trust format file
  • Client Key File: import lns.key format file

 

 

Click Import for both CA file and Client Key, then click Save.

 

4. Check the gateway status in The Thing Stack side. It’s online successfully.

 

 

In the above screenshots, we can see the packets from the gateway.

3. Connect Gateway to The Thing Stack via CUPS

Step1. Prepare the CA File (*. trust)

This is the CA certificate which secures your domain. Which contains links to common root SSL certificates used in The Things Stack, issued by trusted certificate authorities (CAs), in Linovision Gateway, we can just download the ISRG Root X1 Trust file to deploy, you will get a CA file named isrgrootx1.pem, we should rename it to *.trust.

 

img

 

 Besides, you can find more CA files here.

 

Step2. Configure CUPS to Send the LNS API Key

Note: if you already generate API key when adding a new gateway, please skip this Step.

 

Click General settings, paste the content of LNS Key (start with "NNSXS....") you generated in the previous step here.

 

 

Step3. Prepare the Client Key file (*.key)

Note: if you already generate API key when adding a new gateway, please skip this Step.

Execute the following command to generate the CUPS.key file, replace <your-cups-api-key> with the CUPS API key you copied before.

On Linux or macOS use the following commands:

CUPS_KEY="your-cups-api-key"
echo "Authorization: Bearer $CUPS_KEY" | perl -p -e 's/\r\n|\n|\r/\r\n/g'  > cups.key
HTML

On Windows Command Prompt use the following commands:

set CUPS_KEY=your-cups-api-key
echo Authorization: Bearer %CUPS_KEY% > cups.key
JavaScript

 

In this example, here are the details in Command Prompt:

 

Then you will find the lns.key file under the corresponding path.

Here are the files used to upload in Linovision Gateway.

 

 

Step4. Configure the Gateway

1. Make sure that your gateway can connect to Internet successfully.

 

2. Go to Packet Forwarder > General, disable Embedded NS and create a new Destination. 

3. Click + to create a new destination

 

Select the type as Basic Station,  enable this option and input the information of Connecting to an CUPS, and then click Save&Apply.

  • URI: the format is https://<server address>:443, you can click here to fill in the information to get the correct URI.
  • CA File: import .trust format file
  • Client Key File: import Cups.key format file

4. Check the gateway status in The Thing Stack side. It’s online successfully.

 

 

In the above screenshots, we can see the packets from the gateway.

Add a comment

Your email address will not be published.