QNAP, Inc. - Network Attached Storage (NAS)

Language

Support

Connect Intel Edison to QNAP NAS via QIoT Suite Lite

Get started with Intel Edison (Nodejs)

In this tutorial, you will learn the basics of using Intel Edison (that runs on the Linux-based Yocto). You will then learn how to seamlessly connect your devices to QNAP NAS using QIoT Suite Lite.

Please ensure your Intel Edison and NAS is on the same LAN.

Lesson 1: Configure your devices

In this lesson, you configure your Intel Edison device with an operating system, set up your development environment, and deploy an application to Intel Edison.

1.1 Download the Intel Edison drivers

Download the drivers for Intel Edison based on your host PC:

1.2 Configure and test your device

  • Getting started with Intel Edison
    If this is your first time using Intel Edison, you will have to follow some steps to assemble it.
    Please follow steps 1-3 in the instructions.
    - Step 1: Assemble boards and sensors.
    - Step 2: Run setup tools.
    Use the setup tool to flash the latest firmware on the Intel Edison development board via a convenient wizard. The setup tool also lets you enable SSH and Wi-Fi* connectivity to your board, as described in the steps to follow.
    - Step 3: Download development environment.
    Download the Intel® XDK cross-platform integrated development environment
  • Verify and upload your onBoardBlink project to Intel Edison
    • Creating your project
      1. Launch the Intel XDK.
      2. Follow the on-screen instructions to log in to your Intel® XDK account or sign up for a new Intel XDK account.
      3. From the Projects tab, click Start a New Project in the bottom left. The Start a New Project page opens.
      4. In the Internet of Things Embedded Application list on the left, click Templates. A list of templates are displayed on the right.
      5. Select the Onboard LED Blink template and click Continue.
      6. You can modify the directory to store your projects in the Project Directory.
      7. Enter a name for the project in Project Name.
      8. Click Create.
  • Connecting to the board
    1. From the IoT Device drop-down list in the bottom left, select your development board. The Connect to your IoT Device dialog box will open.

      If your development board is not included in the drop-down list, you must connect to your board manually. Select Add Manual Connection and enter your board's IP address in Address.
    2. If you have created a user name and password to log in to your board, enter them in User Name and Password. Otherwise, leave the default values.
    3. Click Connect.
    4. The daemon must be updated if it is out of date. This will disconnect from the board, as the daemon has to be restarted. Follow the instructions to reconnect when prompted.
    5. If the clock on your board and the Intel XDK IoT Edition is out of sync, click Sync.
    6. A confirmation message will display the connection status and IP address of your development board. Click Dismiss. Your board is now connected.
  • Upload and run the project
    1. Click the Develop tab and look for the IoT toolbar at the bottom of the window.
    2. Click the Upload icon to upload your project to the board.
    3. Click the Run icon to run your code. You should see a flashing LED on your board. Click the Stop icon to stop the LED.
      Congratulations, you have run your first IoT app using the Intel XDK IoT Edition.
  • For more information on setting up Intel Edison, please refer to https://software.intel.com/en-us/get-started-edison-windows

1.3 Install Nodejs and required libraries

  • Open a terminal application on your computer and connect to Intel Edison.
  • Install the latest nodejs
    root@Edison:~# opkg update
    root@Edison:~# opkg install nodejs
  • Install MQTT library and Promises library by entering the following commands.
    root@Edison:~# npm install mqtt
    root@Edison:~# npm install q

Lesson 2: Create your device in QIoT Suite Lite

In this lesson, you will provision your QNAP QIoT Suite Lite software, and create your first device in QIoT Suite Lite.

2.1 Install QIoT Suite Lite

QIoT Suite Lite can be installed from the App Center.

Launch and log in QIoT Suite Lite. The default username and password is “admin”.

 

2.2 Create a new IoT Application

IoT Applications are a combination of Things, Rules, and Dashboards. We recommend that you first create a “Things” in IoT Application. This IoT Application allows you to keep a record of all of the devices that are connected to your NAS.

Rules make it possible to build IoT applications that gather, process, analyze and act on data generated by connected devices. Rules can apply to data from one or many devices, and it can take one or many actions in parallel.

Dashboards turn your data into analytics and reports that provide real-time insights.

All these elements provide user a complete IoT Application environment.

If this is your first time using QIoT Suite Lite, use QIoT Quick Setup to guide you through a quick setup of an IoT application. After reading the introduction, click Next.


In the IoT Application tab, enter a name for your IoT Application. Rule and Dashboard names will be generated automatically based on the IoT Application name. Click Next.

In the Thing tab, click Add. Enter a name for your device and provide the device information (such as serial number and manufacturer) in Add attribute. If your device is already supported by QIoT, choose a pre-defined Thing Type. Click Add to add the device.


Enter the IP address, User Name, and Password of your device and click the Connect icon. QIoT Suite Lite will check the connection with the device. After the connection is verified, click Next.

In the Resource tab, click Add Resource. Enter the name and ID for the sensor in Resource Name and Resource ID. Please note that the Resource ID will be used to create a Topic in the QIoT Broker. This ID should be unique for the device and no duplicates should be allowed for the same device.


Click Next after you add all the resources (sensors) on your device.

If you want to embed QIoT dashboard widgets into web pages or access QIoT APIs from third-party applications, go to the API Keys tab and click Generate New API Key. Click Done.

Your IoT application will now be created. Node.js sample codes and related files (certificate, resource information) will be uploaded to the specified path on your device.

A sample dashboard will be created.

Go to the Rule tab to define the flow or rules on how to process the data sent from the device, and how to present in a dashboard.

Lesson 3: Connect your device to QIoT Suite Lite using MQTTS

In this lesson, you will generate a certificate from QIoT Suite Lite, download the SDK, and connect Intel Edison to QIoT Suite Lite.

3.1 Generate certificate and Resource information Inside QIoT Suite.

  • Open a Terminal application (e.g., PuTTY) on your PC.
  • Go to the directory where QIoT Suite Lite uploads sample codes to.
  • Run the sample application.
    root@Edison:~ $ cd bundle/nodejs/device/edison/examples/DHT11
    root@Edison:~ $ node qiot-DHT11-example.js

Lesson 4: Integrate Power BI

4.1 Get your first Power BI account

Sign up for a free PowerBI account at https://powerbi.microsoft.com/en-us/


After registering, you will see the following page:

4.2 Setup your streaming dataset API

Go to “Datasets -> Streaming datasets” on the left menu, and click “+ Add streaming dataset” in the top-right corner.

Select “API” as your source of data, and click “Next”.

Define your values from stream, and you will get a JSON result in the textbox. We will use this JSON code to push data to the IoT application. Click “Create” to finish.

Once you create your data stream, you get a REST API URL which IoT applications can call using POST requests to push your live data to the streaming data dataset you created.

4.3 Configure Node-RED’s nodes in IoT application

Create an IoT application in QIoT Suite. The following is your first Node-RED flow, and then you can start creating your own IoT flow. You can learn more about Node-RED at https://nodered.org/

Before you start pushing live data to Power BI. We need a “function” node to convert IoT data to a streaming data dataset. Here you can replace msg.payload to your JSON dataset.

We need an “http request” node to help us to push live data to Power BI. Just drag and drop the “http request” node and connect to the tail of the “function“ node.

Copy and paste the REST API URL that you got from the Power BI console, and set http method to POST. Click “Deploy” to save changes.

Your Node-RED flow will look like below.

4.4 Add tiles to display real-time data

Go to “Dashboards +” to create your first dashboard, then click “+ Add tile” to configure a widget.

Select “CUSTOM STREAMING DATA” and click “Next”.

Select datasets and click “Next”.

You will have a streaming dataset to work with, and you can get a real time gauge that looks as following.

Release date: 2017-05-16
Was it helpful?
Thank you for your feedback.
Thank you for your feedback. If you have any question, please contact support@qnap.com