Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

​Using Microsoft Azure* IoT Suite with Intel® IoT Devices and Gateways

$
0
0

This article provides general guidelines for connecting any Intel Internet of Things (IoT) devices (that is, devices that support Intel microcontrollers like the Intel® Edison board and the Intel® Curie™ Compute Module) and Intel® IoT Gateways to the Microsoft Azure* IoT Suite. When the devices are connected and data from devices is available to the Azure IoT Suite, together with Microsoft’s Platform as a Service (that is, Microsoft Azure) offering you can rapidly build IoT applications to realize your IoT use case.

Azure* IoT Suite and Microsoft Azure*

Azure* is an open, flexible, enterprise­grade cloud computing platform—a growing collection of integrated services such as analytics, database, mobile, networking, storage, and web for building scalable solutions rapidly. Microsoft provides Azure IoT Suite as part of its preconfigured IoT solutions built on the Azure platform and makes it easy to connect devices securely. Azure supports a broad set of protocols, and Azure IoT Suite consists of set of IoT services (referred to as Azure IoT services) to help build IoT apps rapidly. These services enable you to collect data from devices, analyze data streams in motion, store and query large data sets, and analyze and visualize both real­time and historical data. Services include Azure IoT Hub, Azure Machine Learning, Azure Stream Analytics, Azure Notification Hubs, and Microsoft Power BI. You can combine these services with other Azure services, such as those for data and storage, to store device data in an Azure Blob or use cognitive services to build intelligent IoT apps.

Azure IoT Hub is a fully managed bidirectional device­to­cloud connectivity bus that provides device management, device security, identity, and MQ Telemetry Transport (MQTT) protocol support with HTTP and Advanced Message Queuing Protocol (AMQP). Azure IoT Hub provides complete device access through its device identity registry. It provides per­device authentication and secure bidirectional connectivity between devices and Azure IoT Hub. Azure IoT Hub can also integrate with your custom device registry through a token service to create a device­scoped token for secure communication. In addition, Azure IoT Hub provides local storage of messages and a dedicated device queue for each connected device for storing device messages that devices consume securely, eliminating the overhead of creating separate queues for sending messages back to devices.

Azure Machine Learning gives you a visual way to build a machine learning model that supports R and Python* custom packages. Prebuilt algorithms enable you to build custom models by adding custom code based on your requirements. Azure Stream Analytics provides real­time stream processing of millions of events per second, enabling you to compare and correlate multiple real­time streams, query data using familiar Structured Query Language (SQL), and create real­time dashboard and alerts.

Azure Notification Hubs provides a common interface in which to send out push notifications to mobile devices. The Power BI cloud service allows you to visualize and analyze data in powerful, flexible dashboards. Azure Stream Analytics can feed real­time data events into Power BI, you can design dashboards that use the data and can be updated at runtime.

Communication Strategy

Azure IoT Hub supports HTTP, AMQP, and MQTT. All communication between Intel devices (or any other IoT devices) and Azure IoT Hub must happen over these supported protocols.

MQTT is a lightweight Message Oriented Middleware (MOM) based on the publish–subscribe model. The protocol is designed to be used for machine­to­machine communication that involves small data footprint. The publish–subscribe model consists of a message broker that mediates interactions between interested clients based on the topic (named logical channels for communication) of the message. The client can act as a subscriber to consume the messages from topics or act as a publisher to publish the messages to corresponding topics. In the context of the IoT, IoT devices connect to a central MQTT broker over TCP to send or receive messages. The MQTT protocol is widely used in resource­constrained devices and networks where high bandwidth is an issue. For details about the MQTT protocol, check out A Comparison of IoT Gateway Protocols: MQTT and Modbus.

AMQP is another popular MOM. The protocol supports both queue­based and publish–subscribe messaging models, and messages can be processed in a transactional context. AMQP operates over TCP and ensures reliable message delivery. AMQP is also interoperable: Disparate client systems with different software languages can interoperate with AMQP servers. From an IoT perspective, sensor devices that generate loads of data are streamed to AMQP servers (either in a raw or processed form), then consumed by receivers to perform monitoring and analytics.

The Azure IoT Hub provides device software development kits (SDKs) for platforms like Linux*, Windows*, and real­time operating systems, which makes it easier to get started on any device and connect to Azure IoT Hub. The device SDKs are optional; device manufacturers can also use application programming interfaces (APIs) to get started quickly or add their own device connectivity code to connect to the Azure platform—for example, using a JavaScript* device API for an Intel® Edison board, or an optimized C SDK for a Linux device. The Azure IoT SDKs are available in GitHub* to connect devices to Azure IoT Hub.

Figure 1 illustrates how Intel IoT devices can communicate with Azure IoT Hub.

Figure 1.​ Connecting Intel® Internet of Things devices to Azure* IoT Hub over Advanced Message Queuing Protocol or MQ Telemetry Transport

 

Connecting the Intel® Edison Board to Microsoft Azure* IoT Hub

To connect Intel® Edison devices to Microsoft Azure* IoT Hub, you have a choice of C, JavaScript* (Node.js*), or the Java* library that the Azure IoT SDKs provide. For development and debugging device code, you can download the required integrated development environment (IDE) based on the 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 to program the Intel® Edison board with Arduino. You can then import the required Azure IoT SDK into your code to connect to Azure IoT Hub and send data (that is, senor data) to the Azure IoT Hub.

Another option is to generate the device client connectivity code from the Connect your device to Azure IoT Hub page. Then, complete these steps:

  1. Under Select a Device​, click Intel Edison​.
  2. Under Select a Platform​, click Linux​.
  3. Under Select a language​, click the tab that corresponds to your chosen programming language (C, C#, JavaScript, or Java).

The connectionString value that appears in the resulting code should point to your Azure IoT Hub instance. You can find the value of connectionString the Azure IoT Hub instance configuration details in the Azure portal.

To interact with sensors and actuators on device 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, then create portable code that works across supported platforms.

When the sensor data has been read, it’s transmitted to Azure IoT Hub by AQMP or MQTT over the supported network. You would typically convert the data in a format like JavaScript Object Notation and send it over AQMP or MQTT using the Azure IoT Hub device client library. If the device has the capability, it could connect directly to the Internet and to Azure IoT Hub over Wi­Fi* or an Ethernet connection or to an Intel Gateway that connects to Azure IoT Hub.

Connecting the Intel® Curie™ Compute Module to Azure IoT Hub

The Intel® Curie™ module uses the Intel® Quark™ system on a chip, which provides a complete low­power solution for wearable devices and consumer and industrial edge products. The Intel® Curie™ module has a built­in six­axis combination sensor, Bluetooth* low energy radio, and low power usage, making it the perfect board for building “always­on” projects like health and fitness monitors.

To start prototyping and developing apps, you can use the Arduino* development board—also called Genuino 101* or Arduino 101*—which ships with the Intel® Curie™ module. To start developing, you can use the Arduino IDE and write the program (called as sketch in Arduino) that reads the values you’re your sensors.

The sensor data is then transmitted to Azure IoT Hub over AQMP or MQTT using the supported network. The Intel® Curie™ module provides support for Bluetooth low energy, so one option is to connect the module to a smartphone over Bluetooth and use the smartphone’s cellular or Wi­Fi connectivity as a hub to connect to the Internet. The Intel® Curie™ module provides dedicated Bluetooth low energy libraries, which make it easier to communicate with other devices supporting Bluetooth (for details, see the Intel® Curie™ Bluetooth LE Library). The other option is to connect the Intel® Curie™ module to an Intel gateway using Bluetooth, with Intel gateway then connecting to Azure IoT Hub. 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. Your choice of network strategy depends on the use case and how the final product will be used.

Note:​ Stay tuned for a Software Development Kit (SDK) that will allow you to run an RTOS on the Intel® Curie™ Module. Sign up to receive more information.

Connecting an Intel Gateway to Microsoft Azure* IoT Hub

Intel® IoT Gateway Technology is primarily required where devices are unable to connect directly to Azure* IoT Hub because of protocol incompatibility issues or because existing data from the devices are required to pass through a central entity for various requirements, such as filtering out the data at the edge and transferring the relevant data to Azure IoT Hub, 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 (such as smart building solutions), which typically employ protocols like ZigBee* or Z­Wave*. Employing Intel Gateway devices gives you the option of connecting these devices to an Intel gateway and collecting the data by using the protocol these industrial devices support. The data is then transferred to the cloud platform from the Intel gateway over a protocol that the cloud platform supports.

For connecting Intel Gateway devices to Azure IoT Hub, you have your choice of C or C++, Python*, JavaScript*, or the Java* library that the Azure IoT SDKs provide. The steps required to connect Intel Gateway devices are similar to the steps for connecting an Intel® Edison board to Azure IoT Hub.

Building IoT Apps with Microsft Azure* IoT Hub and Azure Services

When the device data is available to Azure* IoT Hub, you can start visualizing it. Typically, other Azure services would consume the data for further processing. For instance, you can create an Azure Stream Analytics service that you invoke after the device data arrives in Azure IoT Hub. The service would use rules to filter and process the input device data using SQL­like queries and output the results to storage (like an Azure Blob), Azure Event Hubs, or even Power BI for visualization using flexible dashboards. Azure Event Hubs acts a central processing engine, where multiple event handlers can consume the messages from Azure Event Hubs to carry out the required functionality. For instance, event handlers can invoke the Azure Machine Learning service to analyze the filtered data and predict an outcome, while another event handler can invoke the Azure Notification Hub service to send notifications to mobile devices.

Summary

This article showed you how to connect Intel IoT devices to Microsoft Azure* IoT Hub. When your data is made available to Azure IoT Hub, you can consume it and rapidly build IoT apps by composing corresponding Azure services to realize your IoT use case.


Viewing all articles
Browse latest Browse all 3384

Trending Articles