The goal of this guide is for you to collect and visualize some IoT device data using ThingsBoard. This guide will let you:

  • Provision your device
  • Manage device credentials
  • Push data from device to your ThingsBoard instance using MQTT, CoAP or HTTP protocols
  • Create dashboard to visualize the data


  • 置备设备。
  • 管理设备凭证。
  • 使用MQTT, CoAP 或者HTTP协议将设备数据添加到ThingsBoard实例。
  • 创建仪表盘实现数据可视化。


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

如果你无法访问正在运行中的ThingsBoard实例,可查阅在线演示Live Demo或安装指南进行修复。


All ThingsBoard installations are equipped with a demo account that simplifies the first user experience. This demo account contains several pre-provisioned devices, dashboards, rules, and plugins installed. Please note that you are free to delete this account in the production deployment.


You can use ThingsBoard device emulators to simulate real-life devices and play-around with server-side APIs, data visualization, and processing logic.


We will use these emulators in advanced tutorials, however, the for the purpose of this guide, we will just use pre-provisioned tenant administrator account.



The first step is to login into administration Web UI. If you are using local ThingsBoard installation you can login to administration Web UI using default account:

第一步是登录到管理界面。 如果你使用的是本地ThingsBoard安装,你可以使用默认账户登录到管理界面:

If you are using Live Demo you can login to Live Demo server using Tenant Administrator account (the one that you created during sign-up).

如果你使用的是在线演示Live Demo账号,你可以使用租户管理账号(你之前创建的账号)登录在线演示服务器。


Open Devices panel and click on “+” button in the bottom-right corner of the page.

打开设备面板(Devices panel)点击右下角“+”

Populate and save device name (for example, “SN-001”). It will be referred to later as $DEVICE_NAME. Device names must be unique. Populating device name based on a unique serial number or other device identifier is generally a good idea. Click “Add” button will add corresponding device card to the panel.



Click on the “device card” we have created in the previous step. This action will open “device details” panel. Click on the “manage credentials” button on the top of the panel. This action will open a popup window with device credentials.

点击上一步骤中创建的“device card”打开“device details”面板。 点击面板顶部“manage credentials”按钮弹出设备凭证弹窗。

Device credentials window will show auto-generated device access token that you can change. Please save this device token. It will be referred to later as $ACCESS_TOKEN.


Congratulations! You have just provisioned your first device! Now you can push some data from this device to ThingsBoard for visualization and analysis.



In order to simplify this guide, we will push data using MQTT, CoAP or HTTP protocol from your local PC. Please refer to samples for advanced examples of for various hardware platforms.



Install preferred MQTT (Mosquitto or MQTT.js), CoAP (CoAP.js) or HTTP (cURL) client using following commands.

使用以下命令安装MQTT (Mosquitto or MQTT.js), CoAP (CoAP.js) or HTTP (cURL) 客户端。

MQTT.js Mosquitto (Ubuntu) Mosquitto (macOS) CoAP.js cURL (Ubuntu) cURL (macOS)
resources/node-mqtt.sh resources/mosquitto-ubuntu.sh resources/mosquitto-macos.sh resources/node-coap.sh resources/curl-ubuntu.sh resources/curl-macos.sh
npm install mqtt -g sudo apt-get install mosquitto-clients brew install mosquitto-clients sudo npm install coap-cli -g sudo apt-get install curl brew install curl


Create some folder to store all necessary files for this tutorial. Download to this folder or create the following data files:

  • attributes-data.json - contains two device attributes values: firmware version and serial number.
  • telemetry-data.json - contains three time-series values: temperature, humidity and active flag.


  • attributes-data.json - 包含两个设备属性值:固件版本和序列号。
  • telemetry-data.json - 包含三个时间序列值:temperature, humidity and active flag。

Please note that data in this files is basically in key-value format. You can use your own keys and values. See MQTT, CoAP or HTTP protocol reference for more details.


attributes-data.json telemetry-data.json
{"firmware_version":"1.0.1", "serial_number":"SN-001"} {"firmware_version":"1.0.1", "serial_number":"SN-001"}

使用MQTT, CoAP or HTTP传送数据

Download the following files to previously created folder according to the preferred client:


Mosquitto (MQTT)
CoAP.js (CoAP)

If you are using a shell script (*.sh) make sure that it is executable:


chmod +x *.sh

Before executing script don’t forget to:

  • replace $ACCESS_TOKEN with one from Device credentials window.
  • replace $THINGSBOARD_HOST with either (in case of local installation) or demo.thingsboard.io (in case of live-demo).


  • 使用设备凭证窗口的访问token替换$ACCESS_TOKEN
  • 使用127.0.0.1 (本地安装) 或者demo.thingsboard.io (在线演示)替换$THINGSBOARD_HOST

Finally, execute corresponding .sh or .bat script to push data to the server.

最后,执行相应的.sh 或者.bat脚本向服务器传送数据。

Below are tabs with the content of the scripts provided.

MQTT.js(Ubuntu & MacOS) MQTT.js(Windows) publish.js Mosquitto (MQTT) CoAP.js(CoAP) cURL (HTTP)
resources/node-mqtt.sh resources/mosquitto-ubuntu.sh resources/mosquitto-macos.sh resources/node-coap.sh resources/curl-ubuntu.sh resources/curl-macos.sh
# Assuming you have Node.js and NPM installed on your Windows/Linux/MacOS machine
npm install mqtt -g
sudo apt-get install mosquitto-clients brew install mosquitto-clients sudo npm install coap-cli -g sudo apt-get install curl brew install curl


Once you execute commands listed above you should see attributes and latest telemetry data in corresponding device detail tabs.



The easiest way to create new dashboard is to select device attributes and show them on widget


Once you click on “Show on widget” button, you will see a “widget preview” panel where you can

  • Select widget bundle
  • Select preferred widget
  • Add widget to new or existing dashboard

点击“Show on widget”按钮以后,显示“widget preview”面板,在该面板中可进行如下操作:

  • 选择小部件包。
  • 选择首选小部件*
  • 将小部件添加到新的或者已存在的仪表盘中。

Let’s add our first widget to new dashboard named “SN-001 Dashboard”

我们将第一个小部件添加到名为“SN-001 Dashboard”的仪表盘上。

Let’s also add widget to visualize temperature


Click Show on widget and select Digital gauges bundle. Use carousel to select thermometer widget as shown below.

点击“Show on widget”并选择“Digital gauges”。使用carousel(旋转进度条)来选择温度计小部件,如下所示。

Please note that in this case, we will add a widget to an already existing dashboard. We will also select “Open dashboard” option to see results of our work.

请注意,在此示例中我们将为已经存在的仪表盘添加小部件。我们仍然选择的是“Open dashboard”选项来查看结果。

Finally, we are able to see our new dashboard. Now we can edit the dashboard to

  • Configure dashboard settings
  • Tune widget sizes and layout
  • Modify advanced settings of individual widget
  • Add new widgets or remove existing
  • Widgets import/export


  • 配置仪表盘设置
  • 调节小部件的尺寸和布局。
  • 修改每一个小部件的高级设置。
  • 添加或者移除小部件。
  • 小部件导入/导出。

Next steps

Explore guides related to main ThingsBoard features:

  • Device attributes - how to use device attributes.
  • Telemetry data collection - how to collect telemetry data.
  • Using RPC capabilities - how to send commands to/from devices.
  • Rule Engine - how to use rule engine to analyze data from devices.
  • Data Visualization - how to visualize collected data.

results matching ""

    No results matching ""