In this article we will discuss what Microsoft* Azure* is and how you can use it in order to set up your IoT project. Here you will also learn about the role of cloud services, specific features of Azure such as software patching, network load balancing, high-availability features and more. This section also showcases the implementation of cloud APIs and explains the gateway relationship to the cloud, along with code samples that help you connect your IoT device to the Hub and receive device-to-cloud data.
The Role of Cloud Services
A cloud can be defined as an entity that stores pieces of information on a server. You can access the cloud from anywhere in the world and from any device with an Internet connection (personal computer, smartphone, or any other IoT device). Azure* is a cloud solution from Microsoft that comes with a wide array of services.
The cloud platform provided by Microsoft plays the role of “hardware” framework in the process of software building and developing. The main purpose of the platform is to offer developers the opportunity of focusing on what they want to create while Microsoft takes care of servers, data centers and other technical aspects. It provides multiple cloud services such as Azure* IoT Hub, Event Hub, Stream Analytics etc.
High Level Overview of Azure Services
Azure makes available a large collection of cloud services; Azure* IoT Hub being one of those that enables the development of IoT solutions, and was designed so it can interact especially well with your IoT device. The Azure IoT Hub is specialized with flexible and scalable solutions for IoT development and maintenance. This is a fully managed service that provides bi-directional communication with your IoT device in a secure fashion. Azure Event Hubs is another specialized solution for storing and analyzing data gathered by your board. There are various device SDKs for the popular programming languages and frameworks, such as C, .NET, Java*, and Node.js*, as well as service SDKs for Node.js* and Java*.
Leveraging Azure-Specific Features
Azure comes with a collection of features that you can successfully use in the implementation of your project.
One of the most important is the support of managed SQL and noSQL data services that provides you the possibility of getting valuable insights from the data. It also has built-in support for analyzing the data. To build Hadoop clusters for analyzing the data you can also use HDInsight.
Another valuable feature of Azure is the Windows* Azure* Active Directory, a cloud solution useful to identity and access management. Using this feature, you can manage user accounts, get single sign-in across Azure and other apps, synchronize with local directories and use many other of its traits.
Furthermore, you can establish at scale bidirectional communication with your IoT device, with devices from the cloud and use the cloud to device messaging feature. The authentication for the messaging or other functionalities is done using per device security credentials.
Azure also provides monitoring features for connectivity or identifying events.
In Azure, you work with popular programming languages and platforms, using open source device SDKs, and using HTTP, AMQP or MQTT protocols.
Microsoft Azure* is a powerful tool with a large collection of features that will ease the development of your solution and will analyze the data, helping you gain valuable insights from it.
See Connecting to Microsoft Azure* IoT Hub Using MQTT to learn more.
Implementation of Cloud APIs
Azure Event Hubs provides a telemetry processing service and a hyper scale event that can be used for common applications and monitoring of the user workflow at any scale. This service processes large amounts of event data from applications and connected devices and allows low-latency, high-volume data transfers.
You can store the data collected into the Event Hubs using a storage cluster or transform it using a real-time analytics provider. This processing capability and large scale event collection is a key component of modern application architectures including the IoT. For IoT development you need to be able to process from millions of devices.
Using Azure you can make use of the APIs that are provided to ease your work with the data. One such functionality that can be implemented is the notification feature. The purpose of the following code sample is to show you how you could make use of the notification service to send notifications as emails.
If you prefer to use email notifications you can configure the NotificationServiceType enumerable in your Visual Studio* solution and you will use two variables as shown below:
private static MailAddress _FromAddress;
private static MailAddress _ToAddress;
which means you have an address (_FromAddress) that sends emails to a list of users’ emails (_ToAddress).
We may have an enum with different notification service types. Here we have SMTP (Simple Mail Transfer Protocol), which is a standard email transmission protocol, Twilio which is used for phone calls or text messaging and SendGridWeb which is a web API for handling emails.
Smtp = 1,
SendGridWeb = 2,
Twilio = 3,
TwilioCall = 4
For example, we use SMTP:
_SmtpClient = new SmtpClient
Port = _Config.SmtpEnableSSL ? 587 : 25,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
EnableSsl = false,
Host = _Config.SmtpHost,
Credentials = credentials
The code is a sample from GitHub, written in C#. For the complete sample application that can be built and run from Visual Studio, please refer to the link.
Azure Stream Analytics
A possible approach to realizing an in-depth analysis of the data gathered by the sensors is by using Azure Stream Analytics which is another cloud service provided by Microsoft that can perform real-time analytics on the data gathered by your board and send it to the Event hub. The Stream Analytics can stream millions of events and correlate across multiple streams of data and makes it easy to set up a real-time analytic computation on data streaming from applications, devices, sensors, web sites, infrastructure systems and more. Details of a practical application can be found on GitHub.
For querying a Stream Analytics database, an SQL-like syntax is used:
(temp > 20)
Here, a query is made in a temperature database in order to find where temperatures are greater than 20 degrees. You can read more about this query language Read more about this query language.
Gateway relationship to the Cloud
The Gateway relationship to the Cloud can be described as a client node-to-hub communication, asynchronously.
The Microsoft Azure cloud is used for analyzing, processing and aggregating the data sent by the gateway. The gateway receives the data from the Intel board using the serial protocol. After the data has been received by the gateway, it is processed and the information is posted to the cloud. The event hub permits low-latency, high-volume data transfers. The node reads and posts the data to the hub asynchronously.
At the Gateway layer, at first you will need to initialize a hub with your hub details (hub namespace, hub name, key name and key). This information is needed for establishing a connection from the gateway to a specific hub.
Using serial protocol to connect with the board, you can receive the data transmitted by the board. The data is then routed by the gateway to the hub on the cloud.
For the notifications from the cloud you can use another application which monitors the event hub and pushes the data to the notification service specified by using an Azure Cloud Service.
When the Intel® Edison board with its high specifications (build with the purpose for creating scaleable and high-performance IoT projects) is combined with Microsoft Azure and its large collection of services and tools for storing and analyzing, it can improve the performance of your IoT project greatly. The gateway is the entity that connects the two, and routes the information in an efficient way.
For more such intel IoT resources and tools from Intel, please visit the Intel® Developer Zone
Other Popular Deals
- The 10 best job hunting apps on AndroidTop 10 Android launchers (June 2017)
- The 10 scariest horror games on AndroidAndroid app stores: 5 best alternatives to Google Play Store
- Best Android apps for rooted devices18 apps for a memorable Valentine's Day
- Top 15 Android games that you should playThe 20 best looking games for mobile phones
- 8 Android apps to tickle your funny bone17 must have apps for any Android device (plus alternatives)
- 5 apps to get the Android Lollipop look on your smartphoneTake control of your Android device with these apps
- 7 weird and strange apps for your Smartphone10 neat Google apps you may not know of
- 10 essential Indian apps for Android devicesPerfect Viewer