If you connect devices for IoT, based on Intel microcontrollers, to the Microsoft Azure IoT Suite PAAS solution, you get the environment for implementing countless projects in the field of the Internet of things. Today we will talk about the features of the Azure IoT Suite and talk about how to associate Intel Edison, Intel Curie and Intel gateways with this set of cloud services.
Azure IoT Suite and Microsoft Azure
Azure is an open, flexible, enterprise-class cloud computing platform. It is a constantly evolving complex of integrated services, such as analytics services, tools for working with databases and network tools. Azure supports mobile systems and data warehouses, allows you to create complex web projects. One of the features of Azure is the ability to quickly scale. That is, if the project, at some stage of its development, needs more power, it will receive it.
Microsoft offers the Azure IoT Suites toolkit, which is part of the company's pre-configured IoT solutions built on the basis of Azure. This approach simplifies, in particular, the secure connection of “things” to the cloud.
')
A wide set of protocols that supports Azure and a set of IoT services from Azure IoT Suites allow you to quickly create applications for the Internet of things. IoT services enable developers to collect data from devices, analyze data streams in real time, store large data sets and work with them, analyze and visualize both real-time data and historical information.
The services we are talking about include the following:
- Azure IoT Hub - connection point for IoT devices.
- Azure Machine Learning is a machine learning system.
- Azure Stream Analytics - a tool for processing streaming information.
- Azure Notification Hubs - notification hubs.
- Microsoft Power BI is a business intelligence toolkit.
They can be combined with other Azure features, such as blob storage and cognitive services, which allows, for example, building intelligent IoT applications.
Azure IoT Hub is a medium for organizing bidirectional data exchange between devices and the cloud. This service provides features such as device management and identification, security. It supports the MQ Telemetry Transport (MQTT), HTTP, and Advanced Message Queuing Protocol (AMQP) protocols. Azure IoT Hub provides full access to the device through its own registry. It supports device authentication and secure bidirectional data exchange between them and the cloud. The service can also be integrated with its own device registry using an identity service, it is possible to create device identifiers and organize secure communication channels.
In addition, Azure IoT Hub provides a local message store and a dedicated message queue for each connected device, allowing you to safely work with messages. This eliminates the extra work of creating separate message queues for devices.
Azure Machine Learning provides the developer with graphical tools for building machine learning models. The system supports specialized packages R and Python. Pre-prepared algorithms allow you to add your own code to the system and build models that meet the needs of a specific project.
Azure Stream Analytics provides real-time data streaming capabilities. We are talking about millions of events per second. This allows you to compare and reconcile multiple streams, work with data using SQL, create dashboards, set reminders.
Azure Notifications Hub provides a universal interface for sending push notifications to mobile devices.
Power BI is a cloud-based service that, in close collaboration with other Microsoft tools, allows you to visualize and analyze data using powerful and flexible tools. For example, Azure Stream Analytics can deliver Power BI data, after which they are displayed in real time on an information panel intended for further work with the information received by the system.
How Azure interacts with remote devices
As already mentioned, Azure IoT Hub supports the HTTP, AMQP, and MQTT protocols. The interaction between Intel devices (and any other IoT devices) and Azure should only be done using these protocols.
MQTT is a resource-less messaging (Message Oriented Middleware, MOM), publisher-subscriber model. The protocol is designed for communication between devices in conditions when the volume of transmitted data is small.
The publisher-subscriber model includes a broker who serves as an intermediary between clients interested in messaging. The interaction is based on the use of so-called themes - named logical channels of communication.
The client can act as a subscriber and receive messages published in a topic. If the client plays the role of the publisher, it publishes messages, also indicating the topic. In the context of IoT, devices for receiving or sending messages are connected to a central MQTT broker over TCP.
MQTT is widely used in devices whose resources are limited, as well as in networks where it is necessary to ensure the least possible load on the infrastructure.
Here is the material from which you can learn more about this protocol.
AMQP is another popular messaging method. The protocol supports the query-based model, and also, like the MQTT, the publisher-subscriber model. In addition, messages can be processed as part of a transaction. AMQP runs on top of TCP and provides the means for reliable message delivery.
The AMQP protocol, in addition, through the use of AMQP servers, allows you to organize communication between various client systems created on the basis of various hardware and software platforms.
From the point of view of IoT, for example, this means that some sensors that generate data can send them to the AMQP server (in raw or processed form), and this data is then transmitted to other systems for monitoring and analysis.
Azure IoT Hub provides auxiliary SDK for working with devices, designed for Linux, Windows, real-time operating systems. This greatly simplifies the deployment of relevant clients on different devices and connecting them to the Azure IoT Hub. However, using the SDK is optional. Device manufacturers can use the appropriate APIs to build software modules into their products that are required to connect to the Azure platform. For example, this is a JavaScript-API for the Intel Edison board or an optimized C-library for Linux devices. The above SDKs can be found
here .
Here is a diagram of the interaction of IoT devices with the Azure IoT Hub.
Connect Intel Intel IoT devices to Azure IoT Hub using AMQP or MQTT protocols
Connecting Intel Edison Board to Azure IoT Hub
In order to connect Intel Edison to Microsoft Azure IoT Hub, you can use one of the libraries (in C, in JavaScript for Node.js, or in Java) from the Azure IoT SDK. For development and debugging purposes, you will need to download the appropriate IDE. For example, Intel XDK IoT Edition is suitable for JavaScript, Intel System Studio IoT Edition can be used for development in C and C ++. Java programmers can work in the Intel System Studio IoT Edition environment, which is designed for Java. If you plan to write for Edison Arduino-sketches, you can take the Arduino IDE.
After the choice is made, the relevant libraries from the Azure IoT SDK can be integrated into your own code, connect the device to the cloud and organize data exchange. For example - to transfer indicators of sensors to Azure.
Another way to connect your device to the cloud is to generate code to insert into your own applications using the
Connect Device to Azure IoT Center page. Here's how to work with this page:
- In the Select Device section, click the Intel Edison icon.
- In the Platform Choice section - by the Linux icon.
- In the section Language selection, select the bookmark that corresponds to the desired programming language. C, C #, JavaScript and Java are available here.
The system will generate code for the specified device, platform, and language. The
connectionString
variable must contain the value corresponding to the developer account in the Azure IoT Hub. You can learn about the parameters that must be present in this variable on the Azure portal.
In order to interact with sensors and actuators connected to Edison, Intel provides the Libmraa library. This library creates an abstraction layer on top of supported hardware. As a result, you can organize a comfortable work with devices connected to the board. For example, read the sensors. In addition, the library is suitable for creating applications designed for different platforms.
After the sensor readings have been read, you can transfer them to the Azure IoT Hub using AMQP or MQTT protocols. Typically, the data is converted into some convenient for work format, like JSON, and sent using the Azure IoT Hub client library. If the device has this capability, it can connect directly to the Internet and to the Azure IoT Hub via Wi-Fi or via Ethernet. Another option is to connect to the Intel gateway, which, in turn, is connected to Azure.
Connect the Intel Curie Compute Module to the Azure IoT Hub
The Intel Curie module uses the Intel Quark integrated system. It is an economical solution for creating wearable devices, consumer and industrial electronics. The Intel Curie has a built-in 6-axis combined sensor that combines a gyroscope and an accelerometer, an energy-efficient Bluetooth transmitter. This makes Curie the ideal choice for creating devices that must be constantly turned on, for example, instruments for monitoring physical fitness and body vital signs.
In order to start prototyping devices and creating applications, you can use the appropriate Arduino-compatible board - Genuino 101 (Arduino 101). These boards come with Intel Curie. Arduino IDE is used to develop Arduino sketches. Here, in particular, you can create an application that will receive information from sensors connected to the board.
This information can be transferred to Azure IoT Hub. One of the options for connecting to the Internet devices based on Intel Curie, is as follows. The device connects via Bluetooth to a smartphone, which, in turn, is connected to the Internet via a cellular network or via Wi-Fi. As a result, data from the device can be transferred to Azure. There are special Bluetooth support
libraries for Intel Curie. They greatly facilitate interaction with other devices that support Bluetooth.
Another option to connect the board to Azure is to work with the cloud service through the Intel Gateway for the Internet of Things.
The way Intel Curie interacts with Azure is not limited to the options listed above. So, for example, you can connect Curie to the Internet directly using a Wi-Fi expansion card. The method of connecting the device to the Internet depends on the particular project.
The Intel Curie software ecosystem is constantly evolving, in particular, work is underway on a real-time OS for this module. On
this page you can find out the details and subscribe to the project news.
Connect Intel Gateways to Azure IoT Hub
Intel's Internet IoT gateways are used mainly in situations where devices cannot directly connect to Azure IoT Hub. This happens when the supported protocols are incompatible, or if the data from the devices is needed, before being sent to the cloud, be processed, for example, filtered or promptly analyzed at the place of their collection. In addition, the gateway can be used in cases where data networks have special requirements, such as security.
The problem with incompatible protocols is especially common when connecting to cloud services of devices that already work in certain projects, for example, in industrial systems or in home automation systems, such as “smart home”.
Such devices typically use highly specialized protocols, such as ZigBee or ZWave. Directly to Azure IoT Hub, these devices are not connected, but using the gateway, you can collect data from them and send them to the cloud using the appropriate protocol.
To arrange communication of Intel gateways with Azure IoT Hub, you can use one of the Azure IoT SDK libraries. In particular, libraries are available for C, C ++, Python, JavaScript, Java. Setting up an Azure gateway is very similar to connecting to an Intel Edison cloud.
About developing IoT applications using Azure IoT Hub and Azure services
When the data from the device is in the Azure IoT Hub, you can start working with them. For example - to visualize. Typically, other Azure services use data from the Azure IoT Hub for further processing.
Let's say you can create an Azure Stream Analytics service that is accessed after the data has arrived in Azure IoT Hub. This service will use the specified rules for filtering and processing incoming data from the device, using SQL-like queries and outputting results to the repository (for example, in Azure Blob), transferring them to Azure Event Hubs or even to Power BI for visualization.
Azure Event Hubs operates as a central processing hub where multiple event handlers can receive messages from the main service and perform the required actions. For example, event handlers can call the Azure Machine Learning service to analyze filtered data and predict some future metrics based on them, and another handler can contact the Azure Notification Hub to send notifications to mobile devices.
Results
We talked about the set of Microsoft Azure IoT Suite services and how to connect Intel devices to the Internet of Things to them.
When data is in the cloud, it is time to work with them. In particular, thanks to the extensive integrated infrastructure, you can quickly create IoT applications by combining various Azure services and implementing IoT projects of any complexity.