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.
When you connect Internet of Things (IoT) devices (devices that support Intel microcontrollers such as the Intel® Edison board, Intel® Curie™ Compute Module, and Intel® IoT gateways) to the IBM Watson* IoT Platform, you can rapidly build IoT apps that realize your IoT use case. This article provides guidelines to help you make just such a connection to your Watson IoT Platform environment.
IBM Watson* IoT Platform and IBM Bluemix*
The Watson* IoT Platform is a fully managed, cloud-hosted service that makes it simple to derive value from IoT devices. The platform provides device management capabilities as well as data collection and management in a time series format. As part of IBM’s Platform as a Service offering, IBM Bluemix*, you can use the Watson IoT Platform to rapidly build IoT apps from the catalog of services available in Bluemix. You can choose from such IoT app options as storage services, rules, analytics services, stream analytics, machine learning, visualization, and user apps (web or mobile). You can also embed cognitive capabilities in your IoT apps by using IBM Watson services available in Bluemix.
Communication Strategy
The IBM Watson* IoT Platform supports the MQ Telemetry Transport (MQTT) protocol, which is the foundation for all communication between Intel or other IoT devices and the IBM Watson IoT Platform. MQTT is lightweight message-oriented middleware based on a publish-subscribe model. The protocol was designed for machine-to-machine communication that involves a small data footprint. The publish-subscribe model relies on a message broker, which mediates interactions between interested clients based on the topic of message. Clients can act as subscribers, consuming messages from topics, or as publishers, publish messages to corresponding topics. In the context of the IoT, IoT devices connect to a central MQTT broker over TPC to send and receive messages. MQTT is widely used in resource-constrained devices and networks where high bandwidth is an issue. For details about MQTT, see A Comparison of IoT Gateway Protocols: MQTT and Modbus.
The Watson IoT Platform provides device client libraries that make it easier to connect devices to the platform. Client libraries are available in the Python*, Java*, Embedded C, Node.js*, and C# programming languages. For details about the client library application programming interface (API), see IBM Documentation and Reference Material.
An alternative to connecting Intel devices to the Watson IoT Platform is using the open source Eclipse* Paho MQTT Library, which provides a client implementations of MQTT. To use Paho, you’ll need to pick up a supported Paho MQTT library—for example, Microsoft .Net for Windows* 10 devices or a C client for devices that support that programming language.
Figure 1 illustrates how Intel IoT devices can communicate with the Watson IoT platform.
Figure 1. Connecting Intel® Internet of Things (IoT) devices to the IBM Watson* IoT Platform over the MQ Telemetry Transport protocol
Connecting the Intel® Edison Board to the Watson IoT Platform
For connecting Intel® Edison boards to the Watson* IoT platform, you have your choice of C or C++, JavaScript*, or the Java library that the Watson IoT Platform provides. You can also use the Paho MQTT Library directly to connect the devices to the Watson IoT Platform.
For development and debugging device code, you can download the required integrated development environment (IDE) for your programming environment. For instance, you can download Intel® XDK IoT Edition for JavaScript, Intel® System Studio IoT Edition for C and C++, Intel® System Studio IoT Edition for Java, or the Arduino* IDE for programming Intel® Edison boards with Arduino technology. You can then import the required Watson IoT Platform API or MQTT library in your code to connect to the Watson IoT Platform and send data (that is, sensor data) to it.
To interact with sensors and actuators on boards, Intel provides the libmraa library. This library provides an abstraction layer on top of supported hardware so that you can read data from sensors and actuators in a standard way and create portable code that works across supported platforms.
When the sensor data is read, it is transmitted to the Watson IoT Platform using the MQTT protocol over the supported network. You typically convert the data into a format like JavaScript Object Notation instead of sending the raw data over MQTT using the device client library. The device can connect directly to the Internet and to the Watson IoT Platform by using Wi-Fi or an Ethernet connection, or it can connect to an Intel gateway that then connects to the Watson IoT Platform.
To connect to the Watson IoT Platform, you must register your device with the Watson IoT Platform. Then, you receive an organization ID—a unique six-character identifier for your account. A Watson IoT Platform Organization acts like a domain, where data is accessible only from devices and apps in that domain. When you have registered your devices, those devices and API keys are bound to that Organization. When an application connects to the Watson IoT Platform by using an API key, that connection registers with the Organization that “owns” the API key. The combination makes it impossible for devices and apps that aren’t part of the same Organization to communicate with each other. For detailed instructions on registering devices, see How to Register Devices in IBM IoT Foundation.
Connect the Intel® Curie™ Compute Module to the Watson IoT Platform
The Intel® Curie™ module is a system on a chip that uses an Intel® Quark™ processor. It provides a complete low-power solution that’s designed for wearable devices and consumer and industrial edge products. The Intel® Curie™ module has a built-in six-axis combo sensor and features a Bluetooth* Low Energy (Bluetooth LE) radio and low power usage, making it the perfect board for “always-on” projects like health and fitness monitors.
To start prototyping and developing apps, you can use the Arduino 101*/Genuino 101* development board, which ships with the Intel® Curie™ module. The Arduino* IDE lets you write a program (called as sketch in Arduino) that reads values from sensors. The sensor data is then transmitted to the Watson* IoT Platform over MQTT using the supported network. The Intel® Curie™ module provides support for Bluetooth LE, and one option is to connect the Intel® Curie™ module to a smartphone over Bluetooth, using the smartphone’s cellular or Wi-Fi connectivity as a hub to connect to the Internet. The Intel® Curie™ module provides dedicated Bluetooth LE libraries, which make it easier to communicate with other devices that support Bluetooth (read the Intel® Curie® Bluetooth Reference Guide for more details). Another option is to connect the Intel® Curie™ module to an Intel gateway by Bluetooth; the gateway then connects to the Watson IoT Platform. Other options are available, as well, such as using a Wi-Fi shield with an Arduino 101 board to enable the development board to connect to the Internet directly. The network strategy you choose depends on your use case and how the end product will be used.
Note: Stay tuned for Intel® System Studio for Microcontrollers, an Eclipse-integrated software suite that eases development and helps you create exciting consumer and industrial solutions with the Intel Curie module.
Connect an Intel Gateway to the Watson* IoT Platform
An Intel gateway is required when devices are unable to connect directly to the Watson* IoT Platform because of protocol-incompatibility issues or require that existing data from the device pass through a central entity for various requirements. Typical requirements include filtering out the data at the edge and transferring the relevant data to the Watson IoT Platform, performing local analytics for real-time insights, or ensuring network security and compliance.
The protocol-incompatibility issues are particularly common when connecting and integrating with legacy industrial devices or home automation devices (for example, smart building solutions), which typically employ protocols like ZigBee* or Z-Wave*. Employing an Intel gateway device gives you the option of connecting these smart devices to your gateway and collecting the data using the protocol that these devices support. The gateway then transfers the data to the cloud using the protocol that the cloud platform supports.
Watson* IoT Intel Device Recipes
To start connecting Intel IoT devices to your Watson* IoT Platform, IBM provides a set of recipes (running code and documentation) as part of the IBM developerWorks* Recipe community. The following recipes are currently available for Intel IoT devices:
Build IoT Apps with the Watson* IoT Platform and Bluemix*
When device data is available to the Watson* IoT Platform, you can start to visualize the data. The data from devices is available in a corresponding topic for consumption and apps (that is, Bluemix* services) can subscribe to the topic to consume the device data. For instance, you can create a Node-RED Bluemix service that you would invoke when the message arrives on the corresponding topic. In the Node-RED service, you can create an application flow based on your requirements to invoke other Bluemix services (for example, MongoDB* to store the device data), create rules to filter and process the data using rules service, and invoke IBM SPSS* machine learning services to analyze the data and predict an outcome. Finally, you could use the IBM Push Notification service to send notifications to mobile devices.
Summary
In this article, you learned how to connect Intel IoT devices to the Watson* IoT Platform. When data is made available to the Watson IoT Platform, you can consume it and rapidly build IoT apps by composing corresponding Bluemix* services, realizing your IoT use case.