v3.19.1

Getting Started Devices Gateways Integrations Reference
Get The Things Stack

Gateways

    Overview
  • Adding Gateways
  • Gateway Claiming
  • Troubleshooting Gateways
  • LoRa Basics™ Station
  • Semtech UDP Packet Forwarder
  • RAK7240 WisGate Edge Prime
  • Cisco Wireless Gateway for LoRaWAN
  • CloudGate
  • Dragino LPS8
  • Kerlink Wirnet iStation
  • Kerlink Wirnet Station
  • Laird Sentrius™ RG1xx LoRaWAN Gateway
  • MikroTik KNOT
  • MikroTik LtAP
  • MikroTik Routerboard wAP LoRa8 kit
  • Milesight UG6X LoRaWAN Gateway
  • Milesight UG8X LoRaWAN Gateway
  • MOKOSMART MKGW2-LW LoRaWAN Gateway
  • MultiTech Conduit AEP
  • MultiTech Conduit mLinux
  • NASys LoRaWAN Outdoor Gateway
  • Tektelic Kona Micro IoT LoRaWAN Gateway
  • The Things Indoor Gateway
  • The Things Kickstarter Gateway
  • The Things Outdoor Gateway
  • Wifx LORIX One

Adding Gateways

This section contains instructions for adding Gateways in The Things Stack.

Some gateways, like The Things Indoor Gateway, have special instructions for claiming. Look for your gateway in the left hand menu for specific instructions, as this guide does not apply to those gateways.

Note:
Do not follow this guide for a The Things Indoor Gateway.

If your The Things Stack deployment is connected to Packet Broker, you can take advantage of coverage from The Things Network without adding any gateways of your own. See the community sourced TTN Mapper to find out if your location has nearby gateways.

Adding gateways using the Console or the CLI is usually most convenient, so those methods are extensively explained in this section. However, it is also possible to add gateways using the API.

  • Console
  • CLI

Adding Gateways using the Console

In addition to the written instructions below, a video with instructions for adding a gateway is available on The Things Network youtube channel.

Show video

Go to Gateways in the top menu, and click + Add Gateway to reach the gateway registration page.

Fill the Gateway ID, Gateway EUI (if your gateway has an EUI) and Frequency Plan. The other fields are optional. Click Create Gateway to finish.

Gateway creation

Your gateway will be created and you will be redirected to the gateway overview page of your newly created gateway.

Gateway overview

You can now connect your gateway to The Things Stack.

Create Gateway API Key

Some gateways require an API Key with Link Gateway Rights to be able to connect to The Things Stack.

In order to do this, navigate to the API Keys menu of your gateway and select Add API Key.

Enter a name for your key, select the Link as Gateway to a Gateway Server for traffic exchange, i.e. write uplink and read downlink right and then press Create API Key.

Gateway API Key creation

You will see a screen that shows your newly created API Key. You now can copy it in your clipboard by pressing the copy button. After saving the key in a safe place, press I have copied the key. You will not be able to see this key again in the future, and if you lose it, you can create a new one to replace it in the gateway configuration.

Gateway API Key created

Set Gateway Location

Once you have added your gateway to The Things Stack, you can also set its location to be displayed on a map widget by clicking Change location settings.

If you do not mind your gateway’s location to be publicly displayed, check the Publish location box.

The gateway location can be manually set by entering the Latitude, Longitude and Altitude values.

You can also check the Update from status messages box if you want to update the location based on the metadata from the incoming uplink gateway status messages. The location settings you manually entered will be overwritten by the updates from the gateway status messages.

Note:
The Things Stack Console currently supports setting one antenna location per gateway.
Gateway location

Adding Gateways using the CLI

We define some user parameters that will be used below:

GTW_ID="gtw1" 
FREQUENCY_PLAN="EU_863_870"
GTW_EUI="00800000A00009EF"
USER_ID="admin"

Make sure to modify these according to your setup.

First, list the available frequency plans:

ttn-lw-cli gateways list-frequency-plans

Then, create the first gateway with the chosen frequency plan:

ttn-lw-cli gateways create $GTW_ID \
  --user-id $USER_ID \
  --frequency-plan-id $FREQUENCY_PLAN \
  --gateway-eui $GTW_EUI \
  --enforce-duty-cycle

This creates a gateway gtw1 with user admin as collaborator, frequency plan EU_863_870, EUI 00800000A00009EF and respecting duty-cycle limitations. You can now connect your gateway to The Things Stack.

Create Gateway API Key

Some gateways require an API Key with Link Gateway Rights to be able to connect to The Things Stack.

Create an API key for the gateway:

API_KEY_NAME="API key for connecting my gateway"
ttn-lw-cli gateways api-keys create \
  --name $API_KEY_NAME \
  --gateway-id $GTW_ID \
  --right-gateway-link

The CLI will return an API key such as NNSXS.VEEBURF3KR77ZR.... This API key has only link rights and can therefore only be used for linking this gateway. Make sure to copy the key and save it in a safe place. You will not be able to see this key again in the future, and if you lose it, you can create a new one to replace it in the gateway configuration.

Set Gateway Location

Once you have added your gateway to The Things Stack, you can also set the locations of the gateway antennas.

Add an antenna and set its location with:

LAT="43.84"
LONG="18.32"
ALT="500"
ttn-lw-cli gateways set $GTW_ID \
  --antenna.location.latitude $LAT \
  --antenna.location.longitude $LONG \
  --antenna.location.altitude $ALT \
  --antenna.add \

If you do not mind your gateway’s location to be publicly displayed, append the --location-public flag.

You can also set the gateway location to be updated from various sources with the --antenna.location.source flag. The source of the location data can be the registry, GPS data, results of the LoRa RSSI geolocation, etc.

Use ttn-lw-cli gateways set $GTW_ID --help command to see the full list of the available location sources and other relatable info. Keep in mind that if you set the alternative location source, the location settings you manually set will be overwritten by the automatic updates from that source.

The CLI will return something like:

{
  "ids": {
    "gateway_id": "gtw1"
  },
  "created_at": "2020-05-27T14:43:13.606Z",
  "version_ids": {
  },
  "auto_update": true,
  "antennas": [
    {
      "location": {
        "latitude": 43.84,
        "longitude": 18.32,
        "altitude": 500,
        "source": "SOURCE_REGISTRY"
      }
    }
  ],
  "location_public": true
}

Keep in mind that if you change the physical location of your gateway, the location update in The Things Stack will take place only after you restart the gateway.

Set Gateway Antenna Gain

Command-line interface only

The instructions below use the command-line interface (CLI).

Learn how to install the CLI

A preffered way for adjusting a downlink path gain is setting the gateway antenna gain, instead of changing the gateway Tx power. The following command will set the gateway antenna gain to 3 dB:

GAIN="3"
ttn-lw-cli gateways set $GTW_ID --antenna.gain $GAIN

The CLI output will be similar to:

{
  "ids": {
    "gateway_id": "gtw1"
  },
  "created_at": "2020-05-27T14:43:13.606Z",
  "version_ids": {
  },
  "auto_update": true,
  "antennas": [
    {
      "gain": 3,
      "location": {
        "latitude": 43.84,
        "longitude": 18.32,
        "altitude": 500,
        "source": "SOURCE_REGISTRY"
      }
    }
  ],
  "location_public": true
}

Keep in mind that the antennas.location object will be empty if you have not previously set the gateway antenna location.

Once a gateway has been added, get started with Adding Devices and Integrations to process and act on data.

Forwarding Uplinks to Packet Broker

In deployments connected to Packet Broker, you can control if you want uplinks received by your gateway to be forwarded to Packet Broker or not. In these deployments, uplinks received by your gateway are being forwarded to Packet Broker by default, but you can choose to disable this behavior.

To disable forwarding uplink messages from your gateway to Packet Broker in The Things Stack Console, navigate to the General settings tab on the left hand menu in your gateway’s overview, scroll to the bottom of the Basic settings section and tick the Disabled box under Packet Broker option.

Forwarding uplinks to Packet Broker

To disable forwarding uplink messages from your gateways to Packet Broker using the CLI, use the following command:

ttn-lw-cli gateways set $GTW_ID --disable-packet-broker-forwarding

Keep in mind that changes will apply only after restarting the gateway.

← Gateways Gateway Claiming →

On this page

  • Adding Gateways using the Console
  • Set Gateway Location
  • Adding Gateways using the CLI
  • Set Gateway Location
  • Set Gateway Antenna Gain
  • Forwarding Uplinks to Packet Broker

The Things Stack

Getting Started

Devices

Gateways

Integrations

Reference

Contributing

GitHub

Forum

About Us

The Things Network

The Things Industries

About this page

Last changed by Ben Olayinka on 04 Apr 2022.
doc: Add ttn mapper note (#795)

Edit on Github