IoT Gateway
ThingsBoard Documentation
Cloud Professional Edition Community Edition IoT Gateway License Server Trendz Analytics
Try it now Pricing
Documentation > Getting Started
Getting Started
Installation

On this page

Getting started with ThingsBoard IoT Gateway

This guide covers initial IoT Gateway installation and configuration. We will connect IoT Gateway to ThingsBoard server and visualize some basic gateway statistics: the amount of devices connected and messages processed. We will also configure MQTT and OPC-UA extension in order to subscribe to device data feed from external devices or applications.

Prerequisites

If you don’t have access to a running ThingsBoard instance, use either Live Demo or Installation Guide to fix this.

Step 1: Provision the gateway

In order to connect your IoT gateway to ThingsBoard server, you need to provision gateway credentials first. We will use access token credentials as the most simple one. See device authentication options for more details.

Login as tenant administrator. Use default credentials in case of local ThingsBoard server. Open Devices and click on big red “+” button in the bottom right corner.

image

Populate your gateway name and select “Is gateway” checkbox.

image

NOTE: Gateway and device names should be unique in the scope of a tenant.

Open your new device card and click on “Copy Access Token” button. Paste the token to a safe place. We will use it for ThingsBoard configuration in the next steps.

image

Step 2: Install the gateway

Browse available gateway installation options and choose the most suitable installation guide. Follow steps in chosen gateway installation guide. The Gateway configuration steps are covered below.

Step 3: Gateway configuration

Navigate to the gateway configuration folder and edit tb-gateway.yaml file.

1
/etc/thingsboard-gateway/config/tb_gateway.yaml

Change host and port properties in the section “thingsboard” to your ThingsBoard host.

Change accessToken property in the section “security” to your access token that was copied during step 3.

You gateway configuration should look similar to this file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
thingsboard:
  host: thingsboard.cloud
  port: 1883
  security:
    accessToken: FUH2Fonov6eajSHi0Zyw
storage:
  type: memory
  read_records_count: 10
  max_records_count: 1000
connectors:

  -
    name: MQTT Broker Connector
    type: mqtt
    configuration: mqtt.json

You can read more in this article about configuration files and their properties.

Step 4: Restart gateway to accept new configuration

This step depends on chosen type of installation. If you install thingsboard-gateway as daemon - you should use following command:

1
systemctl restart thingsboard-gateway.service

In other case, if you have installed the gateway as python module - you should just rerun gateway process.

Step 5: Review gateway statistics

Open the web UI of your ThingsBoard server and review statistics that is uploaded from your thingsboard gateway.
Login as Tenant Administrator and open Devices page. Click on the gateway device card.
Open “Latest Telemetry” tab and review following statistics: “SummaryReceived”, “SummarySent” and parameters that provide information about every connector.
All values should be set to “0”.

Step 6: Add connectors to the main configuration file

For connection to some devices we use connectors, they are connect to different devices and servers to collect data.
To provide for gateway information about connectors that you need - you should write a configuration to section “connectors” in tb_gateway.yaml (At least one connector needed for correct work).
For correct configuration please use this article.

Step 7: Configure connectors

After successful installation you should configure the connectors to connect to different devices, please use one (or more) following articles to configure connector files: