Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / IoT

Intel® IoT Gateways with the GE PREDIX Developers Kit

0.00/5 (No votes)
25 Oct 2017CPOL12 min read 7K  
This guide contains all the information you need to get started using the Intel® IoT Gateway to connect to GE Predix

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Getting Started

This section contains steps to set up your Intel® IoT Gateway and connect to the PREDIX Developer Kit page.

  1. Unbox the PREDIX Developer kit:

     
  2. Remove the Grove* Base Shield from the Grove Starter Kit and attach it to the Arduino 101 board:

    Grove* Base Shield
    Grove Base Shield
  3. IMPORTANT: Ensure the base shield's voltage selector switch is set to 5V (move the VCC switch to the right):

    Base Shield set to 5V
    Base Shield set to 5V
  4. Connect the LCD screen to any I2C socket and rotary angle to A0 socket with a Grove connector cable as shown below, the cables are in the green box:

    Attach the Rotary Angle and LCD RGB Backlight to the Grove Shield
    Attach the Arduino 101 board
  5. Connect the Arduino 101 board to the Intel IoT Gateway using the USB cable provided:

    Intel IoT Gateway connected to ethernet and power
    Attach Arduino 101
  6. Connect the Intel IoT Gateway to Ethernet and power:
    Connect the gateway to Ethernet and power
    IoT Gateway Ethernet and Power
  7. Press the power button on the IoT Gateway to boot it. It will take about two minutes or so for the device to boot. Once it has booted, the default Node-RED* flow on the gateway will run and display the gateway's IP address on the LCD panel attached to the Arduino 101 board. The IP address displayed is the IP address of your Intel IoT Gateway. You will use this to connect to your gateway throughout the rest of this lab.

    IP address on the LCD panel
    IP Address on LCD Panel
  8. Once the IP address has been displayed, open your favorite browser and navigate to the IP address from the previous step.
  9. If you are presented with a Privacy Statement, click Continue.

  10. Log in with the user name:
    user name: gwuser
    password: gwuser
    Click Go.

  11. Setup proxy if you want to use the gateway on corporate network.
  12. License Agreement – Click Agree button.

  13. Once you have successfully logged in, you should see the PREDIX Developer Kit page (a.k.a. the Developer Hub or "Dev Hub").

    The Developer Hub is a front-end interface for the Gateway. It has 5 main functions:

    • Display sensor data and basic gateway information on a configurable dashboard
    • Send sensor data to the GE Predix cloud securely
    • Add repositories, install and upgrade packages
    • Administer the gateway: access the Node-RED development environment network configuration settings
    • Access documentation
  14. Edge experience: The "Sensors" page can be used to monitor the sensor data that is being published to the dashboard. By default the gateway is configured to display the value of the rotary angle sensor (knob) attached to the Arduino 101.

  15. As suggested in Overlay Help, you can twist the knob to see the values change in the Device and Sensor Information panel on this page. You can see immediate sensor value change on DevHub tab after rotating the knob.
  16. You can collapse the Device and Sensor Information panel along the top of the page to make the other information below easier to see by clicking the arrow at the top of the navigation bar. Click the button again to expand the panel again.

    Collapsed Panel
  17. Click on Edge to cloud tab. Here you will setup the Intel® NUC to send data to GE Predix cloud. Click Get Started.
  18. Register Device: This step will register the Intel® NUC as an asset on Predix cloud. It gets the configuration parameters for predix machine to send data to cloud securely.
  19. Enter any Name Device and Group Name to register your device on Predix cloud. Click the button Register Device.
  20. You will be redirected to predix page and asked to enter credentials. Enter your predix account credentials. If you don’t have predix account then create one.
  21. You will get following screen:

    If you don’t get this screen, refresh page after 15-20 sec. This time is required to complete the registration process. You should see a little gif showing data being sent to Predix.
  22. Click on “View in Cloud” button to see rotary sensor data flowing in Predix cloud app.
  23. You will be again asked for credentials. Enter your predix account credentials. You will be redirected to predix cloud app. This app is pre-created in shared space in Predix cloud.
  24. Click on Kit Data. Find your NUC based on the group name you gave for registration. You will see the rotary angle sensor data in %. Notice your group name (in my case its “DocUser”) and Device name (in my case its WR-IDP-F237) (highlighted in the box).
  25. Click on Refresh Frequency button and choose the refresh page frequency.
  26. Once the initial walkthrough is done, you can take this shared clod app and port it to your personal cloud app space, following this tutorial: https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1475&tag=2365&journey=Predix%20Developer%20Kit&environment=workshop&resources=1475,2368
  27. Alternatively, you can customize the Predix machine to point it to your personal time series and to a different predix cloud app. Click on Customize Predix Machine to get started.
  28. After you use Customize Predix Machine or Personal Cloud App and want to go back to factory resets (the shared cloud app), you can use the “Reset Device” functionality on the DevHub. Re-register your device.

Tutorials

This section contains tutorials to walk you through viewing sensor data, adding new sensors, sending sensor data to the cloud, and more.

See the links below for details:

View Sensor Data Locally

  1. The Sensors page on the Developer Hub can be used to monitor the sensor data that is being published to the dashboard. By default, the gateway is configured to display the value of a Grove* Rotary Angle sensor (the rotary knob) attached to the Arduino 101* (branded Genuino 101* outside the U.S.) board.

  2. Click Help to turn on Overlay Help. This will provide guidance as you navigate through the Developer Hub.

  3. As suggested in Overlay Help, you can twist the knob on the Grove Rotary Angle to see the values change in the Device and Sensor Information panel on this page.

  4. You can see an immediate sensor value change on the Developer Hub after you rotate the knob.

  5. You can collapse the Device and Sensor Information panel along the top of the page to make the other information below easier to see. Click the arrow at the top of the navigation bar. Click the button again to expand the panel again.

    Collapsed panel in the Developer Hub

Sending Sensor Data to the Cloud

Your Intel® IoT Gateway, the Intel® NUC, communicates with GE Predix* via Predix Machine*, which is an OSGi container deployed on the Intel NUC. Predix Machine ensures secure communication between the hardware and the cloud.

  1. Click the Edge to cloud tab. Here, you'll set up the Intel NUC to send data to GE Predix. Click Get Started.

  2. Next, you'll register the Intel NUC as an asset on Predix. This provides the configuration parameters for required for Predix Machine to send data to the cloud securely.

  3. Type a group name in the Group Device field. Click Register Device to register your device on Predix.

  4. You will be redirected to the Predix page and asked to enter credentials. Enter your Predix account credentials. If you don’t have predix account, you'll need to create one first.

  5. Next, you'll get the following screen:



    If you don’t get this screen, refresh the page after 15-20 seconds. This time is required to complete the registration process. You should see a little gif showing data being sent to Predix, as shown below.

  6. Click View in Cloud to see the rotary sensor data flowing into the Predix cloud application.

  7. When prompted, enter your Predix account credentials again. You will be redirected to the Predix cloud application. This app was precreated in shared space in the Predix cloud.

  8. Click Kit Data. Find your Intel NUC based on the group name you gave for registration.

    You will see the rotary angle sensor data displayed as a percentage. Notice your group name (in this example, the group name is DocUser) and device name (in this example, WR-IDP-F237), which should be in the upper left area of the application, as shown below.



    Click Refresh Frequency and choose the frequency with which you want to have this page refresh.

Overview

This tutorial gives a recipe of how to create a new Node-RED* flow to connect new sensors and send the sensor data to GE Predix*. The Grove* Temperature Sensor from the Grove* Starter Kit is used as the example sensor in this tutorial.

Connect Temperature Sensor to Arduino 101* (branded Genuino 101* outside the U.S.)

Connect the temperature sensor to A1 socket of the Arduino 101* (branded Genuino 101* outside the U.S.) board with a grove connector cable as shown below. The cables are in the green box. Please do not remove the rotary sensor and the LCD to preserve the IP address flow.

Hardware Setup

Access Node-RED* environment from the Developer Hub

  1. Enter the IP address of your Intel® NUC into your internet browser to access the Developer Hub. On the Administrator tab of the Developer Hub, click the Node-RED Launch button.

    Locate Node-RED
  2. When prompted, enter your login credentials.
    User Name: gwuser
    Password: gwuser
    Then click Log In.
    Log-in to Node-RED Environment

Default Node-RED* flow

  1. The default Node-RED flow enables the display of the IP address on the Grove* LCD RGB Backlight, as well as sending data to Predix.

    Default Node-red flow

Create a New Flow with Temperature Sensor

  1. Click + to open a new Node-RED flow.

    Add new flow
  2. From the UPM_Sensors group in the nodes panel (leftmost column of the Node-RED interface), drag a Grove Temperature Sensor into the visual editor for Flow 2. Then double click on the new node, and set the properties as follows. Click the Done button to save the changes:

    Note: The interval of 10000ms really means the temperature will only update once every 10 seconds. You can speed that up by lowering the number to 5000ms or even 1000ms.
    • Platform: Firmata
    • Pin: A1
    • Unit: Raw Value
    • Interval (ms): 10000
       
    Add Grove Temperature Sensor
  3. From the function group add a function node to Flow 2 and place it next it to the existing Temperature node as shown below. Double click on the new function node and complete the properties as follows. Click the Done button to save the changes:

    Note: The purpose of this function is to provide the correct temperature when the sensor is being read with a 5V source. The sensor functions at 3.3 by default.
    • Name: Data Conversion
    • Function: Use the following code:
      var rawVal = Number(msg.payload.value);
      rawVal = rawVal * 3.3 / 5;
      var B = 4275.0; // value of the thermistor
      var R0 = 100000.0; // 100k
      var R = R0 * (1023.0 - rawVal) / rawVal; // resistance of the sensor which tells us the temperature value
       
      // Convert temperature value from resistance to Celsius:
      var T =  1.0 / ( (Math.log(R/R0))/B + 1.0/298.15 ) - 273.15;
      //Convert to Fahrenheit
      T = 32 + (T*9)/5; // Comment this line for readings in Celsius
      msg.payload.value = T; 
      return msg;
    • Outputs: 1
    Data Conversion Function
  4. Connect the existing temperature node to the new Data Conversion function node by dragging a line from the square box at on the right end of the temperature node to the square box on the left edge of the Data Conversion node.
  5. In order to chart temperature sensor data on the Developer Hub, three nodes are required. Create them as follows:
    1. First, from the function group, add a template node to Flow 2 and place it below the existing Temperature node as shown in the following figure. Double-click the new template node and complete the properties as follows. Click the Done button to save the changes:

      Note: The purpose of this format is to get the temperature data from the payload.
      • Name: Format
      • Set Property: msg.payload
      • Function: Use the following code:
        {{payload.value}}
      • Format: Mustache template
         
      Add Format Node
    2. From the function group, add a chart tag node to Flow 2 and place it next to the existing format node, as shown in the following figure. Double-click the new chart tag node and complete the properties as follows. Click the Done button to save the changes:

      Note: The chart tag node allows user to decide on graph type, range etc.
      • Title: Temperature
      • Type: Line
      • Units: Fahrenheit
      • Range: 0 -100
         
      Add Chart Tag
    3. From the output group add a mqtt node to Flow 2 and place it next to the existing temperature node, as shown in the following figure. Double-click the new mqtt node and complete the properties as follows. Click the Done button to save the changes:

      Note: The purpose of this mqtt node is to send sensor data over mqtt to the chart.
      • Server: localhost:1883
      • Topic: /sensors
      • Name: Temp chart
      Add mqtt Node
  6. To send data to charting component, connect the existing Data Conversion node to the Format node, then connect Format node to Temperature node and connect the Temperature node to the Temp Chart node.


    Connect Nodes
  7. To send temperature sensor data to Predix cloud, from the output group add a Predix Edge node to Flow 2 and place it below the existing format node as shown in the following figure. Double click on the new Predix Edge node to edit Server property.
    Add Predix Edge Node

    In a new window, set properties as:
    • Server: localhost
    • Port: 1883
    • Keep alive time: 60

    Click the Add button to save the changes. Then click Done on the next window.

    mqtt Broker Config
  8. Connect Data Conversion node to Predix Edge node to send data to Predix cloud respectively. Connect the nodes as shown in the following figure.

    Connect Node
  9. Go ahead and deploy the new flow by clicking Deploy in the top right corner of the Node-RED window:

    Deploy
  10. When the temperature flow is successfully deployed, a temperature chart is added to the dashboard before the rotatory sensor chart on the Developer Hub. The chart shows real time-temperature sensor values, as shown in the image below:

    Temperature data on DevHub
  11. To see temperature data being sent to Predix, click View on Cloud” button on the Edge to Cloud tab in the Developer Hub. A new page for the Predix cloud application will open. Click Kit Data to see the charts.

    View in cloud button

    The temperature sensor data gets sent to the shared cloud app securely, via Predix Machine. A chart to graph temperature data from the Intel® NUC is added next to the rotary sensor chart. Charts for sensors from the Grove Starter Kit are already configured for the Predix shared cloud app. This helps developers to immediately see data from sensors from the base kit on the shared cloud app.

Troubleshooting

  1. If the cloud app does not show the sensor data, make sure to click the View Log and ensure that both the Temperature and Rotary data is in the Predix Machine log.
    View Log

    Predix Machine Log

Gain Insights with Predix* Studio

For further insight into Predix* Studio, visit this link: http://sc.ge.com/*WorkshopStudioExperience

Setting up a Personal Cloud App in GE Predix*

For steps, see the following: https://www.predix.io/resources/tutorials/tutorial-details.html?tutorial_id=1475&tag=2365&journey=Predix%20Developer%20Kit&environment=dev

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)