As cloud computing fast growing, we’re turning to focus more on managed serviced provided by cloud computing platform than traditional infrastructure services. Such as the term Internet of Things ( IoT ) which has been talked about around many technology companies for a few years now, but IoT is still in its infancy and there is not a unified standard or precise definition that everyone has agreed on, so let’s talk about what really is the Internet of Things and why should you invest in IoT?
What is Internet of things ( IoT ) ?
Evidently, the terms of Internet of Things, we have INTERNET and THINGS, here “Internet” is the global system that connects all of the computer networks from around the world so that they can talk to one another, in this case, “Things” is referring to devices that are capable of communicating data electronically over an Internet connection.
So what is the Internet of Things? For now, you can think of IoT as a system that uses the infrastructure of the Internet to establish a connection to and between our electronic devices. Microsoft talk about the Internet of Things in a more vast definition: “The Internet of Things (IoT) is not a futuristic trend, it’s the first step toward becoming a truly digital business and it starts with your things – your line-of-business assets and the data they produce, your cloud services, and your business intelligence tools. That’s the Internet of Your Things, and with it, you no longer must settle for the status quo. With an IoT strategy in place, you can make your business thrive.”
IoT general architecture and cloud services in IoT ecosystem
When we talk about IoT on the cloud, we saw AWS and Azure even Google has done the similar work to implement the general process of IoT.
Which is device registry to make your device connected with cloud, device management on the cloud, messaging via some popular protocols which use a standard publisher-subscriber or pub/sub model so that your devices will connect using the appropriate protocol and publish data in the form of topics? Applications will subscribe to that topic and be notified of any data published relating to the topic to which they are subscribing, then execute real-time data analytics process with the data which sent by your device sensor and then monitoring IoT device with different status information by data virtualisation tool on cloud.
So, let’s take a look at how these process implemented by AWS and Azure.
How does AWS IoT work ?
Maybe you’re already worked with AWS IoT, let’s take a review of it here before talk about Azure IoT. AWS IoT is a platform that enables you to connect devices to AWS Services and other devices, secure data and interactions, process and act upon device data and enable applications to interact with devices even when they are offline.
The main process of AWS IoT is to make your device recognised or connected by IoT Hub, that is ‘device connected or registry process’, so, how should we do this?
Firstly, is to install Amazon Device SDK on your device. The AWS IoT Device SDK enables your devices to connect, authenticate, and exchange messages with AWS IoT using the MQTT, HTTP, or WebSockets protocols. SDKs are available in some popular languages such as C, Node.js, Java, Python, Arduino, and mobile SDKs for Android and iOS etc. The registry is used to establish an identity for your devices and can keep data about your devices, store device attributes, and keep track of devices.
Another way is to directly start with AWS IoT Starter Kits, these physical kits are designed to help accelerate cloud-powered prototype development of connected devices and connect securely to AWS IoT. The kits include development microcontroller development boards, sensors and actuators, the AWS IoT Device SDK, and a simple getting started guide so that you can easily find the best fit for your products, to know more about how to start with AWS IoT Starter Kits, please refer to Getting Started with AWS IoT section AWS IoT Starter Kits.Visit the APN partner portal to learn more about partners who provide AWS IoT Starter Kits.
During the connected process, AWS provided authentication and authorization with your own certificate or certificate provided by AWS which are built into the AWS IoT Service to securely connect your devices to the platform. This means that AWS IoT is able to identify which devices are connected and verify that it’s not some other device impersonating your device, and then also those devices can verify that they are connecting to AWS IoT and not some other entity impersonating the platform.
Caption: AWS IoT certificates
Caption: ‘Thing’ in AWS
After registered your device, we should have a mechanism to exchange data messages between your device and AWS IoT, which is known as Device gateway. It supports standard protocols such as MQTT, HTTP, and WebSockets. Devices that are connected to Amazon’s IoT Service are represented by things in the registry. They are managed by AWS IoT Rules Engine which provides message processing, transformation, and integration with other AWS services. It uses a SQL-based language to select data from message payloads, process the data, and send the data to other Amazon services such as S3, Lambda, DynamoDB, and others.
Caption: how does AWS IoT interact with other services
To persist the last reported state and desired future state of each device even when the device is offline, AWS implemented also Device shadows. Device shadows are virtual representations of physical things or devices. You can retrieve the last reported state of a device or set a desired future state through the REST API or using the rules engine.
Caption: AWS IoT architecture
Finally, monitoring is an important part of maintaining the reliability, availability, and performance of AWS IoT, it will collect monitoring data from all parts of your AWS solution so that we can more easily debug a multi-point failure if one occurs. AWS IoT is integrated with CloudTrail, a service that captures all of the AWS IoT API calls and delivers the log files to an Amazon S3 specified bucket. CloudTrail captures API calls from the AWS IoT console or from your code to the AWS IoT APIs. Using the information collected by CloudTrail, we can determine the request that was made to AWS IoT, the source IP address from which the request was made, who made the request, when it was made, and so on.
Caption : AWS Monitoring devices
For those didn’t have occasion to work on AWS IoT, I recommend to take online course Introduction to the AWS IoT on cloud academy to know more about it.
How does Azure IoT work ?
Then we can take a look at Azure IoT. The Azure internet of things (IoT) services offer a broad range of capabilities. These enterprise-grade services used to:
- Data Ingestion process (collect data from devices and ingress of data at scale to the cloud )
- Device management
- Analyze data streams in-motion
- Store and query large data sets
- Visualize both real-time and historical data
- Integrate with back-office systems
Here is a architecture schema to show how does it work.
Caption: AWS IoT workflow
Related services in IoT suite ecosystem on Microsoft Azure
The Microsoft Azure IoT Suite is an enterprise-grade solution that enables you to get started quickly through a set of extensible preconfigured solutions. These solutions address common IoT scenarios, such as remote monitoring, predictive maintenance, and connected factory. The
preconfigured solutions are complete, working, end-to-end solutions that include:
- Azure IoT Hub service. This service provides the device-to-cloud and cloud-to-device messaging capabilities and acts as the gateway to the cloud and the other key IoT Suite services. The service enables you to receive messages from your devices at scale, and send commands to your devices and also enables you to manage your devices.
- Azure Stream Analytics provides in-motion data analysis for IoT Suite to process incoming telemetry, perform aggregation, detect events, and to process the messages from your devices and deliver those messages to other services.
- Azure Storage or Microsoft prefered to use Azure Cosmos DB to provide the data storage capabilities in this scenario. Usually, we use blob storage to store telemetry and to make it available for analysis. The Cosmos DB to store device metadata and enable the device management capabilities of the solutions.
- Azure Web Apps and Microsoft Power BI provide the data visualization capabilities especially to quickly build your own interactive dashboards that use IoT Suite data.
Azure IoT in action :
Now let’s get our hands dirty, we’re going to create a Azure IoT hub. On the left side of Azure portal in the Search textbox, type IoT Hub and then press Enter to create a IoT Hub. Then we can fill the basic information in the IoT hub blade, for IoT Hub units which determines your daily message quota, so we can calculate the daily message needs and purchase the required units. Device-to-cloud partitions which is the number of partitions for device-to-cloud messages. The right pricing tier, it depends on the number of messages across all devices, here we can choose or scale the tier in the basic settings.
Caption : Azure IoTHub pricing
Similarly to AWS, we should connect devices to Azure IoT by using Azure IoT SDK. There are three categories of software development kits (SDKs) for working with IoT Hub:
- Device SDKs enable you to build apps that run on your IoT devices. These apps send telemetry to your IoT hub, and optionally receive messages from your IoT hub.
- Service SDKs enable you to manage your IoT hub, and optionally send messages to your IoT devices.
- Azure IoT Edge enables you to build gateways for devices that don’t use one of the supported protocols. Gateways can also process messages on the edge.
SDKs are provided to support multiple programming languages such as C, node.js, Java, .Net and Python.
Microsoft Azure also provides its own IoT Developer Kit to help developer quick start an IoT project, it is prototyping board with lots of sensors, buttons, OLED display, Wifi, and other things all built in. To find right IoT Device for your project, please refer to Find your IoT device.
Here I’d like to recommend two useful tools to help you manage your IoT devices on Azure cloud: The IoT hub explorer which is a CLI tool to manage device identities in IoT hub registry, send and receive messages and files from your devices, and monitor your IoT hub operations and also lets you simulate a device connected to IoT hub.
Another is Device Explorer which runs on the local machine and connects to IoT hub to manage devices.
Caption: How does Azure IoTHub interact with other Azure services
Data Analytics job
Most data that comes into an IoT Hub will need some sort of processing or analytics executed to discern meaningful data. Microsoft implements the Stream Analytics job which is a function that takes input, runs a query against that data, and then sends the results on to some form of output. While a Stream Analytics Job can handle many different input sources, here we’ll be using our IoT Hub’s messages as our source. Likewise, there can also be many outputs. These can be anything from a storage location to a database or additional function.
Data virtualization – Power BI ( Data analytic job )
Then Microsoft provides a real-time data virtualization tool which is known as Power BI, it is a suite of business analytics tools that deliver insights throughout your organization. Connect to hundreds of data sources, simplify data prep, and drive ad hoc analysis. Produce beautiful reports, then publish them for your organization to consume on the web and across mobile devices. Everyone can create personalized dashboards with a unique, 360-degree view of their business. And scale across the enterprise, with governance and security built-in.
Here is an example of the report generated by PowerBI:
Caption: data virtualisation via PowerBI
Azure Device Management and lifecycle
Azure IoT Hub provides the features that, along with an extensibility model, enable device and back-end developers to build robust device management solutions. To be successful, a solution must accommodate devices that range from constrained sensors and single purpose microcontrollers to powerful gateways that route communications between groups of devices. There are five device management stages within the device lifecycle that are common to all enterprise IoT projects:
- Plan: Enable operators to create a device metadata scheme that enables them to easily and accurately query for, and target a group of devices for bulk management operations.
- Provision: Securely provision new devices to IoT Hub and enable operators to immediately discover device capabilities.
- Configure: Facilitate bulk configuration changes and firmware updates to devices while maintaining both health and security.
- Monitor: Monitor overall device collection health, the status of ongoing operations, and alert operators to issues that might require their attention.
- Retire: Replace or decommission devices after a failure, upgrade cycle, or at the end of the service lifetime. Use the device twin to maintain device info if the physical device is being replaced, or archived if being retired. Use the IoT Hub identity registry for securely revoking device identities and credentials.
To know more about IoT, I recommend to take two great courses on Cloud Academy by Ben Lambert : Building an Information Display Solution with Azure IoT Hub and Developing For The Raspberry Pi and Azure IoT Hub .
I hope this article will help you understand how AWS and Azure IoT work and may decide which is the most appropriate choice for your organization’s. I’m preparing some interesting topics on my next post about Lambda architecture, data processing on Azure, and machine learning for a predictive purpose, I’m trying to have a global vision about the solutions implemented by Microsoft Azure, AWS and GCP, let’s keep learning!