Notes for TTN

Version 14.2 by Xiaoling on 2022/05/25 08:56

     Contents:

1. The Things Network-V3

1.1 Introduction

1.1.1 What is The Things Network

The Things Network is a global collaborative Internet of Things ecosystem that creates networks, devices and solutions using LoRaWAN.

The Things Network runs The Things Stack Community Edition, which is a crowdsourced, open and decentralized LoRaWAN network. This network is a great way to get started testing devices, applications, and integrations, and get familiar with LoRaWAN.

1.1.2 Login or crate an account

Login or create an account to get started with The Things Network and start using The Things Stack Console.

Once you have an account,get started by following steps for adding Gateway,Device and Intergrations.

1.1.3 List the support products and Requirements

LoRaWAN Gateway model: Existing Gateway

2. Gateway Registration for Semtech UDP

2.1 Primary LoRaWAN Server

image-20220525084853-1.png

Register Gateway

image-20220525084923-2.png

Put Gateway ID

image-20220525085016-3.png

Choose Frequency Band

image-20220525085054-4.png

Show Status

2.2 Secondary LoRaWAN Server

2.2.1 Introduction

The Dragino gateway has supports the Secondary server settings.

2.2.2 Below list the support products and Requirements:

1. LoRaWAN Gateway model: LIG16LG308DLOS8 LPS8

2. Firmware version since :lgw--build-v5.4.1644658774

2.2.3 Example

The following takes Helium as a Secondary LoRaWAN server as an example,

2.2.4 Step 1: Download and Install the helium gateway-rs

The users is needing to download and install the helium gateway-rs then click the button of Save&Apply

image-20220525085117-5.png

Download and Install gateway-rs

2.2.5 Step 2: Back to Semtech UDP page

Back to the page of Semtech UDP check the secondary server settings and click the button of Save&Apply

image-20220525085152-6.png

Configuration of helium

3. Gateway Registration for Basics Station

3.1 Introduction

The LoRa Basics™ Station protocol simplifies management of large scale LoRaWAN networks. LoRa Basics™ Station is the preferred way of connecting Gateways to The Things Stack. The LoRa Basics Station doc

Below list the support products and Requirements:

      1. LoRaWAN Gateway model: LIG16LG308DLOS8 LPS8

      2. Firmware version since :lgw--build-v5.4.1640315898

What do you need to prepare

A gateway that can access the internet normally

3.2 Step 1. Add Gateway

The example for EU

User can add your gateway into The Things Network V3 according to the previous step

Following picture is the successful added.

image-20220525085231-7.png

Add Gateway

3.3 Step 2. Create the API key

user need to create the CUPS API key and LNS API key.

image-20220525085329-8.png

Create CUPS API key

image-20220525085414-9.png

Create LNS API key

Note : Please copy the API key.

3.4 Step 3. Update the gateway setting

In the LoRa Basics Station LNS Authentication Key field, paste the API key you generated in the previous step.

image-20220525085441-10.png

paste the API key

3.5 Step 4. Access the gateway GUI

User need to update the API key and install the Certificate

image-20220525085522-11.png

Access the gateway GUI

3.6 Step 5. Configure Station

User need to input Server URI, Server CUPS Key and LNS Key, as well as install CUPS certificate.

just to clarify.

   CUPS Server URI                     --> Server Adress
   CUPS Authorization Key         --> Server CUPS API Key
   LNS Authorization Key           --> Server LNS API Key
   CUPS certificate                     --> Server CA(user can use the button to install the certificate by default)

image-20220525085557-12.png

Congfigure Station

3.7 Start Station

When the user has finished the configuration,Please click Sace&Apply to start station to connect The Things Network.

3.8 Siccessful Connection

If user completes the above steps,which will see live date in the TTN.

https://wiki.dragino.com/images/thumb/4/49/Station_live_date_cao.png/600px-Station_live_date_cao.png

Station live date

3.9 Trouble Shooting

User can check the station log in the logread/system log page.

https://wiki.dragino.com/images/thumb/7/7c/Station_log_xiao.png/600px-Station_log_xiao.png

Station Log

and recode the station log in the system/Recode log page.

https://wiki.dragino.com/images/thumb/5/50/Recore_log_xiao.png/600px-Recore_log_xiao.png

Recore Log

4. Configure node connection to TTNv3

Following is an example for how to join the TTN v3 LoRaWAN Network.

The gateway is already set up to connect to the TTN network, so we now need to configure the TTNv3 server.

We take LES01 as an example.

4.1 Step1

Create a device in TTN with the OTAA keys from LSE01.

Each LSE01 is shipped with a sticker with the default device EUI as below:

You can enter this key in the LoRaWAN Server portal. Below is TTN screen shot:

TTNv3--01.png

TTNv3--02.png

4.2 Step2

There are all our nodes in the repository. Users can choose the corresponding brand, model, firmware version and frequency.The decoder and configuration information of the node are pre-configured.Users do not need to configure them.

TTNv3--03.png

4.3 Step3

Add APP EUI in the application:

TTNv3--04.png

4.4 Step4

Add APP KEY and DEV EUI:

TTNv3--05.png

5. TTN V3 integrated into MQTT server

5.1 Introduction

The Application Server exposes an MQTT server to work with streaming events. In order to use the MQTT server you need to create a new API key, which will function as connection password. You can also use an existing API key, as long as it has the necessary rights granted.

5.2 Create device steps at MQTT

The user creates a new API KEY after creating a device on TTN V3.

Then copy the password and open MQTT.fx.

Fill in Broker Address and Broker port.

V3 MQTT1 .png

Fill in the username and password into MQTT.

V3 MQTT2.png

The Application Server publishes uplink traffic on the following topics:

   v3/{application id}@{tenant id}/devices/{device id}/join
   v3/{application id}@{tenant id}/devices/{device id}/up
   v3/{application id}@{tenant id}/devices/{device id}/down/queued
   v3/{application id}@{tenant id}/devices/{device id}/down/sent
   v3/{application id}@{tenant id}/devices/{device id}/down/ack
   v3/{application id}@{tenant id}/devices/{device id}/down/nack
   v3/{application id}@{tenant id}/devices/{device id}/down/failed
   v3/{application id}@{tenant id}/devices/{device id}/service/data
   v3/{application id}@{tenant id}/devices/{device id}/location/solved

Note: Remember that the format of these topics for The Things Stack Open Source would contain {application id} instead of {application id}@{tenant id}.

V3 MQTT3.png

While you could subscribe to all of these topics separately, for the simplicity of this tutorial we use # to subscribe to all topics, i.e. to receive all uplink traffic.

V3 MQTT4.jpg

Downlinks can be scheduled by publishing the message to the topic v3/{application id}@{tenant id}/devices/{device id}/down/push.

Note: Remember that the format of this topic for The Things Stack Open Source deployment would be v3/{application id}/devices/{device id}/down/push.

Instead of /push, you can also use /replace to replace the downlink queue. Replacing with an empty array clears the downlink queue. Example:

V3 MQTT5.png

To send an unconfirmed downlink message to the device dev1 in application app1 in tenant tenant1 with the hexadecimal payload BE EF on FPort 15 with normal priority, use the topic v3/app1@tenant1/devices/dev1/down/push with the following contents:

Note: Use this handy tool to convert hexadecimal to base64.

V3 MQTT6.png

5.3 Send Downlink message

How to configure downlink in TTN V3?

A few examples: set the transmission interval to 90 seconds.

Downlink command:01 00 00 5A

https://wiki.dragino.com/images/thumb/9/90/Downlink_50.png/600px-Downlink_50.png

downlink

After sending, you can view it in live data.

https://wiki.dragino.com/images/thumb/1/15/Downlink_51.png/600px-Downlink_51.png

downlink

When downlink is successfully sent, the downlink information can be received on the serial port.

Note: If the downlink byte sent is longer, the number of bytes will be displayed.

https://wiki.dragino.com/images/thumb/c/c9/Downlink_52.png/600px-Downlink_52.png

downlink

If you want to get a successful reply to send downlink in TTN v3. You need to set the response level.

If the equipment uses CLASS A. You can set AT+RPL=2 or send the downlink command: 2102

If the equipment uses CLASS C. You can set AT+RPL=4 or send the downlink command: 2104

When the device successfully receives the downlink, the server will receive a confirmation packet of 00.

https://wiki.dragino.com/images/thumb/d/d9/Downlink_54.png/600px-Downlink_54.png

downlink

6. Request Remote Support

These pages are useful to check what is wrong on the Join process. Below shows the four steps that we can check the Join Process.

If problem not solve, and you need dragino remote support, please follow to this document: TTN Support instruction If user has checked below steps and still can't solve the problem, please send us (support @ dragino.com) the screenshots for each step to check. They include:

  • End node is connected to serial port to show the Join frequency and DR. (If possible)
  • Gateway (from gateway UI) traffic to show the packet got from end node and receive from Server. (If possible)
  • Gateway traffic (from server UI) to shows the data exchange between gateway and server. (Normally possible)
  • End Node traffic (from server UI) to shows end node activity in server. (Normally possible)
  • End Node Keys screen shot shows in end node and server. so we can check if the keys are correct. (In most case, we found keys doesn't match, especially APP EUI)

1. End Device Join Screen shot, we can check:

  • If the device is sending join request to server?
  • What frequency the device is sending?

https://wiki.dragino.com/images/thumb/7/77/LoRaWAN_Communication_Debug1.png/600px-LoRaWAN_Communication_Debug1.png

Console Output from End device to see the transmit frequency

User can run AT+CFG command to print configuration information.

  • Is the device in OTAA mode or ABP mode? AT+NJM=1 (OTAA mode), AT+NJM=0 (ABP mode)

https://wiki.dragino.com/images/thumb/c/c5/LoRaWAN_Communication_Debug23.png/600px-LoRaWAN_Communication_Debug23.png

Console Output from End device to see the transmit frequency

2. Gateway packet traffic in gateway web or ssh. we can check:

  • If the gateway receive the Join request packet from sensor? (If this fail, check if the gateway and sensor works on the match frequency)

  • If the gateway gets the Join Accept message from server and transmit it via LoRa?

https://wiki.dragino.com/images/thumb/1/1c/OTAA_Join-2.png/600px-OTAA_Join-2.png

Console Output from Gateway to see packets between end node and server.

3. Gateway Traffic Page in LoRaWAN Server

  • If the Join Request packet arrive the gateway traffic in server? If not, check the internet connection and gateway LoRaWAN server settings.

  • If the server send back a Join Accept for the Join Request? if not, check if the keys from the device match the keys you put in the server, or try to choose a different server route for this end device.

  • If the Join Accept message are in correct frequency? If you set the server to use US915 band, and your end node and gateway is EU868, you will see the Join Accept message are in US915 band so no possible to Join success.

https://wiki.dragino.com/images/thumb/d/da/LoRaWAN_Communication_Debug22.png/600px-LoRaWAN_Communication_Debug22.png

The Traffic for the End node in the server, use TTNv3 as example

https://wiki.dragino.com/images/thumb/4/4b/LoRaWAN_Communication_Debug3.png/600px-LoRaWAN_Communication_Debug3.png

The Traffic for the End node in the server, use TTNv3 as example

4. Data Page in LoRaWAN server

  • If this data page shows the Join Request message from the end node? If not, most properly you have wrong settings in the keys. Keys in the server doesn't match the keys in End Node.

https://wiki.dragino.com/images/thumb/9/99/LoRaWAN_Communication_Debug4.png/600px-LoRaWAN_Communication_Debug4.png

The data for the end device set in server

https://wiki.dragino.com/images/thumb/6/69/LoRaWAN_Communication_Debug5.png/600px-LoRaWAN_Communication_Debug5.png

Check if OTAA Keys match the keys in device

Tags:
    
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0