This article provides general guidelines for connecting any Intel® Internet of Things (IoT) devices (that is, devices that support Intel microcontrollers, such as the Intel® Edison board and the Intel® Curie™ Compute Module) and Intel gateways to the Amazon Web Servives* (AWS*) IoT platform. When the devices are connected and data from devices is available to the AWS IoT platform, together with Amazon Web Services, you can rapidly build IoT applications to realize your IoT use case.
AWS* IoT and Amazon Web Services*
AWS* IoT is a highly scalable, managed cloud platform that allows devices to connect securely and interact with AWS services and other devices over standardized MQTT, WebSocket, and HTTP connections. AWS IoT makes it easier to build IoT apps, and the AWS IoT platform allows you to collect, store, analyze, and take actions against large volumes of data streaming from your connected devices.
The AWS IoT platform consists of a core set of capabilities, shown in Figure 1.
Figure 1. AWS* IoT components
The platform includes the following components:
Device Gateway– The AWS IoT Device Gateway is a highly scalable managed service that enables devices to communicate securely with AWS IoT. The Device Gateway supports a publish–subscribe model and provides support for MQTT, WebSocket, and HTTP 1.1. The main advantage of using this pattern is that it decouples sender and consumer, thereby allowing new devices to connect and start receiving the messages by subscribing to relevant topics.
Device Registry– Device Registry stores metadata about the devices and acts as an identity store of devices. Device Registry assigns each device a unique identity during registration.
Device Shadows – Device Shadows is a unique capability provided as part of the AWS IoT platform that creates a virtual device, or shadow, of the device that contains its latest state. Apps can communicate with the shadow device through application programming interfaces even if the actual physical device is offline. When the actual device is connected, AWS IoT automatically synchronizes the state and pushes changes to the actual device based on changes on the virtual device.
Rules Engine – The AWS IoT Rules Engine is a highly scalable engine that transforms and routes incoming messages from devices to AWS services based on business rules you create. You create these rules by using Structured Query Language (SQL)–like syntax and make queries against an MQTT topic to extract the required data from the incoming message. The incoming message must be in JavaScript* Object Notation (JSON) format. You can filter the messages based on SQL-like queries, with configured AWS services consuming the output. AWS IoT also provides various options for secure communication between devices and the AWS IoT platform. Devices connect using your choice of identity through one of three options: digital (X.509) certificates, AWS authentication through user names and passwords, or by using the device’s identity provider or third-party providers like Google or Facebook through Amazon Cognito. When a device is authenticated, AWS IoT handles authorization through policies, which let you execute device operations (connect, publish, subscribe, receive) based on the permissions you define. Once authorized, you can perform the specific operations. This process completes device communication with the AWS IoT platform. As part of your IoT app, you will probably invoke other AWS services, like persisting the device data from an MQTT topic to Amazon DynamoDB or processing large data streams in real time through Amazon Kinesis. Amazon Kinesis provides real-time data processing, enabling apps to capture continuous streams of data from devices and other sources, analyzing them at runtime to generate real-time dashboards or trigger required action. To invoke an Amazon Kinesis stream instance (or any other AWS service), you must define a policy in AWS Identity and Access Management, which the rule instance uses to allow your AWS IoT instance to access the Amazon Kinesis stream instance securely. This integration ensures an end-to-end, secure connectivity between devices and the AWS IoT platform and from the AWS IoT platform to the rest of your AWS services.
Communication Strategy
The AWS* IoT platform supports MQTT, WebSocket, and HTTP. All communication between Intel devices (or any IoT device) and the AWS IoT platform must happen over the supported protocol.
MQTT is a lightweight message-oriented middleware based on the publish–subscribe model. The protocol is designed to be used for machine-to-machine communication that involves a 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
The WebSocket protocol supports a persistent connection between a client and the server over a single TCP connection. WebSocket facilitates near-real-time communication and data transfer to and from the server without the client or server polling for data updates and transmitting relevant updates without an explicit request between the client and the server. AWS IoT supports WebSocket over MQTT.
The AWS IoT Device SDK simplifies the process of connecting devices securely to the AWS IoT platform over MQTT, WebSocket, and HTTP. The software development kit (SDK) currently supports the C SDK for Linux*, libraries for the Arduino* platform, and Node.js* libraries. Read more about the AWS IoT Device SDK.
Figure 2 illustrates how Intel IoT devices can communicate with the AWS IoT platform.
Connecting the Intel® Edison Board to AWS IoT
To connect Intel® Edison boards to the AWS* IoT platform, you have a choice of C, Arduino*, or the JavaScript* library that the AWS IoT Device SDK provides. 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++, or the Arduino IDE to program the Intel® Edison board with Arduino. You can then import the required AWS IoT device SDK library into your code to connect to the AWS IoT platform and send data (that is, sensor data) to the AWS IoT platform.
To interact with sensors and actuators on device boards, Intel provides the libmraa library. This library provides an abstraction layer on top of the 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 the AWS IoT platform by MQTT (or WebSocket) over the supported network. You would typically convert the data into a format like JSON and send it over MQTT (or WebSocket) using the AWS IoT Device SDK library. If the device has the capability, it could connect directly to the Internet and to the AWS IoT platform over Wi-Fi or an Ethernet connection or to an Intel Gateway that connects to the AWS IoT platform. Typically, the data would be read after every X intervals and published to the required topic in the AWS IoT platform.
To connect to the AWS IoT platform, you must register the devices in a registry, create certificates, assign policies, and use the relevant SDKs. The following high-level steps are applicable for registering any class of device (for example, an Intel® Edison board, an Intel® Curie™ module, gateways) with the AWS IoT platform:
Create a device in the Thing Registry.
Create certificates and policies for secure communication.
Attach a certificate to the device.
Generate SDKs.
For these steps, you can use the AWS Management Console or AWS command-line interface commands. For detailed instructions on how to register devices, see Create a Device in the Thing Registry.
Note: To start connecting Intel IoT devices to the AWS IoT platform, you can also buy the Intel® Edison Board and Grove* Indoor Environment Kit, Powered by AWS, and start building cloud-connected projects quickly.
Connecting the Intel® Curie™ Compute Module to the AWS* IoT Platform
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 a sketch in Arduino) that reads the values of your sensors.
The sensor data is then transmitted to the AWS*IoT platform over 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 that support 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 the Intel gateway then connecting to the AWS 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. 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 at https://software.intel.com/en-us/iot/hardware/curie.
Connecting an Intel Gateway to the AWS* IoT Platform
Intel® IoT Gateway Technology is primarily required when devices are unable to connect directly to the AWS* IoT platform 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 the AWS 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 (such as smart building solutions), which typically employ protocols like ZigBee* or Z-Wave*. Employing an Intel Gateway device 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 the AWS IoT platform, you have your choice of C, Python*, JavaScript* libraries, which the AWS IoT Device SDK provides. The steps required to connect an Intel Gateway device are similar to the steps for connecting an Intel® Edison board to the AWS IoT platform.
Building IoT Apps with the AWS* IoT Platform and AWS Services
When the device data is available to the AWS* good IoT platform, you can start visualizing it. Typically, other AWS services would consume the data for further processing, so you start by creating rules with the Rules Engine service that route incoming data to one or multiple AWS services for processing. You can create multiple rules—for instance, one rule can route the message to an Amazon Kinesis stream instance for real-time processing, while another rule could directly insert the incoming data into Amazon DynamoDB tables for historical and offline analysis.
Multiple applications can receive the Amazon Kinesis data streams and work in parallel. The data from the Amazon Kinesis stream instance can be emitted to AWS Lambda, a compute service that provides the ability to run your custom code in an AWS infrastructure. You can add your custom code based on your IoT app. For example, you can invoke the Amazon Machine Learning service to predict an outcome, execute your own proprietary code, or send notifications to mobile devices using the Amazon Push Notification Service.
Summary
This article showed you how to connect Intel IoT devices to the AWS* IoT platform. When your data is made available to the AWS IoT platform, you can consume it and rapidly build IoT apps by composing corresponding AWS services to realize your IoT use case.