QNAP Systems, Inc. - Network Attached Storage (NAS)

Language

Support

Connect Intel Edison to QNAP NAS via QIoT Suite Lite

Get started with Intel Edison (Node.js)

QIoT Suite Lite

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 are under the same LAN.

1. Configure your device 

Configure your Intel Edison with an operating system, set up your development environment, and deploy an application to Intel Edison.

1.1 Download Intel Edison drivers

Download dicers for Intel Edison based on your host PC, available here:

Windows users
Mac users
Linux users

1.2 Configure and test your device

Getting started with Intel Edison

If this is your first time using Intel Edison, you must follow some steps to assemble it.

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 will opens.
    4. In the Internet of Things Embedded Application list on the left, click Templates. A list of templates will be displayed on the right.
      QIoT Suite Lite
    5. Select the Onboard LED Blink template, and click Continue.
    6. You can modify the directory to store your projects in Project Directory.
    7. Enter a name for the project in Project Name.
      QIoT Suite Lite

Connecting to the board

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.
QIoT Suite Lite

  1. If your development board is not included in the drop-down list, you must connect to your board manually. Select Add Manual Connectionand 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. Go to "Develop" tab and look for the IoT toolbar at the bottom of the window.
    QIoT Suite Lite
  2. Click the Upload icon QIoT Suite Lite to upload your project to the board.
  3. Click the Run icon QIoT Suite Lite to run your code. You should see a flashing LED on your board.
  4. Click the Stop icon QIoT Suite Lite to stop the LED.
    Congratulations, you have run your first IoT app using the Intel XDK IoT Edition, please refer to https://software.intel.com/en-us/get-started-edison-windows

1.3 Install Node.js and required libraries

Open a terminal application on your computer and connect to Intel Edison.

Install the latest Node,js

QIoT Suite Lite

2. Create your device in QIoT Suite Lite

2.1 Install QIoT Suite Lite

  • QIoT Suite Lite can be installed from the App Center.
    QIoT Suite Lite
  • Launch and log in to QIoT Suite Lite. The default username and password is "admin".
    QIoT Suite Lite

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.
QIoT Suite Lite

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

    QIoT Suite Lite
  • Create a New IoT application
    • Enter the IoT Application name (for example: "app_1").
    • The Rule name and Dashboard name will be automatically generated based on the IoT Application Name.
    • Click "Next".
      QIoT Suite Lite
  • Click "+ Add" to add this application’s device.
    QIoT Suite Lite
  • Click "+Add", In "Add Things":
    • Enter a name for your device (for example: "edison") and enter the device information (such as serial number and manufacturer) in Add attribute.
    • If your device is already supported by QIoT (Arduino Yun,Raspberry Pi, Edison, and Linkit 7688 (Duo)), choose a pre-defined Thing Type.
    • Click Add.
      QIoT Suite Lite
  • 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.
    QIoT Suite Lite
  • In "Resources", click "Add Resource".
    QIoT Suite Lite
  • In "Add Thing 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.
      QIoT Suite Lite
  • In "API Keys":
    • 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".
      QIoT Suite Lite
  • 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.
    QIoT Suite Lite
  • A sample dashboard will be created
    QIoT Suite Lite
  • 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.
    QIoT Suite Lite

3. Connect your device to QIoT Suite Lite using MQTTS

3.1 Run Sample Code

  • Open a Terminal application (such as PuTTY) on your PC.Connect to your device using SSH and enter the folder where the sample code is stored (for example: /home/root/bundle).
    QIoT Suite Lite
  • To install sample code dependencies, enter the following commands:
    QIoT Suite Lite
  • Run the sample code
    QIoT Suite Lite
  • The device will send a message to the topic "temp" (or the topic you defined).
    QIoT Suite Lite

3.2 Using another protocol

  • Click "Connect a Device".
  • You can select another protocol.
    QIoT Suite Lite
  • Connect to your device using SSH, and enter the following commands:
    QIoT Suite Lite

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/
    QIoT Suite Lite
  • After a sequence of registration, the page will lead you to below page, you can press "My workspace", and "skip for now" button appear. You could click "skip for now "to start create dataset.
    QIoT Suite Lite

4.2 Setup your streaming dataset API

  • Create "Datasets"
    • Click "Create" in the top-right corner
    • Click "Streaming dataset"
      QIoT Suite Lite
  • Select "API", the source of your data, and click "Next".
    QIoT Suite Lite
  • Define your values from stream (e.g., temp, max, min), and you will get a JSON result in the textbox. We will use this JSON code to push data to the QIoT Suite Lite application. Click "Create" to finish.
    QIoT Suite Lite
  • 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.
    QIoT Suite Lite

4.3 Configure Node-RED’s nodes in IoT application

  • Create 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/
    QIoT Suite Lite
  • 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.
    QIoT Suite Lite
  • Function code as following:
    QIoT Suite Lite
  • We need an "http request" node to help us to push live data to Power BI. Just drop and drag "http request" node and connect to tail of "function" node.
    QIoT Suite Lite
  • 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
    QIoT Suite Lite
  • Your Node-RED flow will look like below.
    QIoT Suite Lite

4.4 Add tile to display real-time data

  • Create "Dashboard"
    • Click "Create" in screen upper right corner
    • And then click "Dashboard"
    • Enter dashboard’s name, and click "Create" to complete create dashboard.
      QIoT Suite Lite

      QIoT Suite Lite
  • Click "Add tile" in screen upper right corner
    QIoT Suite Lite
  • Select "CUSTOM STREAMING DATA" and then select the "Next" button.
    QIoT Suite Lite
  • Select datasets and click "Next".
    QIoT Suite Lite
  • Select visualization type (e.g., gauge), and set value, min, and max value.
    QIoT Suite Lite
  • You have a streaming dataset to work with; you can get a real time gauge that looks like as following.
    QIoT Suite Lite
    Please visit QNAP github for QIoT Suite Lite sample code "QNAP-Github"
Datum vydání: 2017-05-16
Bylo to pro vás to užitečné?
Děkujeme vám za vaši zpětnou vazbu.
Děkujeme vám za vaši zpětnou vazbu. Máte-li nějaké dotazy, kontaktujte prosím adresu support@qnap.com