Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.
This article demonstrates how to use an Intel® Next Unit Computing (NUC) device to connect sensors on an Arduino 101* board to the IBM Watson* IoT Platform. You learn how to read real-time sensor data from the Arduino 101 board, view it locally on the Intel® NUC device, and send it to the IBM Watson IoT Platform, where the data can be stored, visualized, and processed in the cloud. To do all this, you use Node-RED on the Intel® NUC device to create processing flows that perform input, processing, and output functions that drive your application.
Setup and Prerequisites
Read Sensors and Display Data on the Intel® IoT Gateway Developer Hub
Log in to the Intel® NUC device’s Intel® IoT Gateway Developer Hub by entering the Intel® NUC device’s IP address in your browser and using gwuser as both the default user name and password. You’ll see basic information about the Intel® NUC device, including its model number, version, Ethernet address, and network connectivity status.
Click the Sensors icon, and then click Manage Sensors to open the Node-RED* canvas, where you’ll see Sheet 1 with a default flow for an RH-USB sensor. You won’t use the RH-USB sensor for this project, so drag a box around the entire flow and delete it. You’re left with a blank canvas.
Along the left side of the Node-RED screen, you see a series of nodes. These are the building blocks for creating a Node-RED application on the Intel® NUC device. For this application, you’ll use the nodes shown in Table 1.
Table 1. Nodes used in the sample application
| Read button presses | | On/off LED indicator |
| Measure light level | | Format chart display on the Intel® NUC device |
| Measure rotary position | | Send data to the IBM Watson IoT Platform |
| Relay open/closed | | Send data to the IBM Watson IoT Platform |
Drag nodes onto the canvas and arrange them as shown in Figure 1. You will need multiple copies of some of the nodes. Use your mouse to connect wires between the nodes as shown.
Note: You’ll use the Watson IoT node later; don’t include it now.
Figure 1. Arranging nodes on the Node-RED canvas
When you first place nodes on the canvas, they are in a default state. You must configure them before they’ll work. To do so, double-click each node, and then set parameters in their configuration panels.
Double-click each node on the canvas and set its parameters as shown in Table 2. In some cases, the Name field is left blank (it uses the default name of the node). Pin numbers correspond to the Base Shield jack to the sensor or actuator is connected.
Table 2. Nodes and their parameters
Node | Parameters |
Grove Button |
- Platform: Firmata
- Pin: D4
- Interval (ms): 1000
|
Grove Light |
- Platform: Firmata
- Pin: A1
- Unit: Raw Value
- Interval (ms): 1000
|
Grove Rotary |
- Platform: Firmata
- Pin: A2
- Unit: Absolute Raw
- Interval (ms): 1000
|
Grove LED |
- Platform: Firmata
- Pin: D5
- Mode: Output
|
Grove Relay (upper)
|
- Platform: Firmata
- Pin: D7
|
Grove Relay (lower) |
- Name: Grove Buzzer
- Platform: Firmata
- Pin: D6 (you can use this note to control the buzzer)
|
chart tag connected to Grove |
- Title: Button
- Type: Status Text
|
chart tag connected to Grove |
- Title: Light
- Type: Gauge
- Units: RAW
|
chart tag connected to Grove |
- Title: Rotary
- Type: Gauge
- Units: RAW
|
mqtt |
- Server: localhost:1883
- Topic: /sensors
- Name: Charts
|
Verify your settings and wiring connections, and then click Deploy to deploy your changes and make them active on the Intel® NUC device. After deploying the flow, you should see a data display toward the top of the Intel® IoT Gateway Developer Hub, with live values for Rotary, Light, and Button (Figure 2). Turning the rotary knob and covering the light sensor should make the numbers change up and down; pressing the button should turn on the LED, sound the buzzer, and energize the relay.
Figure 2. The deployed Intel® NUC Device in the Intel® IoT Gateway Developer Hub
Send Data to IBM Watson* IoT Platform Quickstart
Next, add an IBM Watson* IoT Platform output node and send your data to IBM Watson IoT Platform Quickstart. Quickstart lets you connect a device to the IBM Watson IoT Platform quickly and with minimal setup. It’s often used during the first steps of building a new Internet of Things application.
In the Intel® IoT Gateway Developer Hub, drag a Watson IoT output node onto the canvas. When the node is on the canvas, its name changes to IBM IoT Device. Connect a wire from the output of Grove Rotary to the input of IBM IoT Device. Double-click the IBM IoT Device node on the canvas, and sets its parameters as shown in Figure 3, including setting the Name to Watson IoT Quickstart. The Quickstart Id is generated automatically; you don’t need to change it.
Figure 3. Parameters for the IBM IoT Device
Click Ok, and then click Deploy to deploy your updated flow to the Intel® NUC device. At this point, the data values for your Grove Rotary sensor should be flowing to Quickstart once per second. To view the data in Quickstart, double-click the Watson IoT Quickstart node on the canvas, and then click the Quickstart link to the right of the Quickstart Id—(1) in the Figure 3. Doing so launches the Quickstart page in your browser, with your Grove Rotary data appearing in a live display (Figure 4). Adjust the rotary sensor in either direction, and you should see the data chart change up and down.
Figure 4. Values for the Seeed Studio Grove* - Rotary sensor in IBM Watson* IoT Platform Quickstart
Each new sensor reading that the Arduino 101 board generates and the Intel® NUC device sends appears toward the bottom of the display, along with the time it was received. These values should match what you see in the Intel® NUC device’s Intel® IoT Gateway Developer Hub. You can compare the two displays to verify that the data is flowing properly.
Where to Go from Here
This application provides a foundation for connecting your Arduino 101 board and Intel NUC device to the IBM Watson IoT Platform. From here, you would typically wire up other sensors to Quickstart to check their data, and then move to IBM Watson IoT Registered mode to build more complex applications that store, process, and visualize your sensor data.