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.
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
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.
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:
- Connect your Intel® Edison Board to the IBM Watson IoT Platform and visualize your data
- Connect an Intel® Galileo Board to the IBM Watson IoT Platform
- Connect an Intel® IoT Gateway to IBM Watson IoT Platform
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.
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.
For more such intel IoT resources and tools from Intel, please visit the Intel® Developer Zone