How to connect apps to Internet of Things (IoT) devices in the cloud

With the Internet of Things (IoT) market projected to reach 7.1 trillion dollars by 2020 according to IDC, it's no surprise that many businesses are anxious to develop applications that support these devices. IoT is driving a new area of the market, namely IoT application development. But exploiting IoT device interfaces to integrate your applications with those devices can be tricky, and knowing how to get the most value from IoT devices can be even trickier.

The IoT encompasses a wide range of devices, from the Nest smart thermostat, to the Fitbit, to industrial robots that assemble cars. Indeed, on the factory floor, smart devices capable of machine-to-machine (M2M) communications were already a huge market before someone put the IoT label on it.

While there isn't much difference in how you develop the application itself, supporting IoT devices does require that software engineers become proficient with device-level application programming interfaces (APIs). IoT integration is all about APIs, the logical connectors that allow applications to communicate with each manufacturer's IoT devices. APIs expose data that enables those devices to transmit data to your applications, acting as a data interface. Or, they can allow your application to control the device and serve as a function interface.

While device manufacturers are taking steps to ensure that their APIs are well defined, developers must learn how to use IoT device interfaces effectively. Fortunately, third-party providers are also producing tools that make using each IoT device manufacturer's APIs easier for developers.

Learning by example: The Nest API

Here's an example of how to get started. Let's say you want to communicate with a Nest smart home thermostat. The Nest is Wi-Fi enabled and remotely controllable using a mobile app or by browsing to your account on the Nest website.

While Nest has built applications that can communicate with its own smart thermostats, smoke detectors, and other products, it also offers an API that your applications can use to communicate with Nest devices. Get in-depth knowledge by taking IoT Training. This also means that you can build and sell applications that can receive and exploit Nest data.

Data within the Nest API is built on the notion of devices in structures. With this API, all data is addressable by way of a URL that Nest calls the "data location." Each data location can store strings, numbers, and Booleans.

You can use the Nest API to sync data from data locations at multiple levels in the hierarchy. Nest cites these examples:

  • An entire structure, including all devices
  • A single device in a structure
  • A group of data values (current and ambient temperature)
  • A single data value (battery health state)

Of course, you don't want unauthorized access to your thermostat or smoke detector data, so Nest requires that you have permission to access the data.

While there are some great API and code examples out there, I find Nick Branstein's Nest API code examples to be the easiest to understand. For example, here's the code for reading all the settings from a Nest thermostat:

function getNestData() {

var accessToken = $.cookie('nestAccessToken');

ar ref = new Firebase('wss://developer-api.nest.com');

ref.auth(accessToken);

ref.on('value', function (snapshot) {

console.log(snapshot.val());

});

As you can see, there's not much to it. You use the device as a data source, and then you can use the data for any purpose, including predictive analytics, machine learning, or simple interactions with other applications. In fact, according to EDC's Internet of Things Study 2015, 79 percent of IoT application developers spend at least 25 percent of their time with analytics or databases, while 42 percent work on big data or advanced analytics projects.

But Nest is just one example. There are thousands of devices out there that use similar APIs to access data or control IoT devices. Unfortunately, while some are well defined and designed, for others (mostly older devices) you'll have to write your own API to abstract data from primitive device interfaces.

The good news is that a set of approaches and best practices are emerging around the use and development of IoT device APIs. Already, most devices out there have either open APIs, or APIs that the manufacturer uses internally. It's no surprise, then, that developers who know how to design or leverage device APIs are in high demand.

The data interface

With so many IoT devices out there, many organizations are focused on gathering data from all connected devices. Data interfaces are key and can be used for such things as:

  • Determining data patterns that may require fixes or maintenance. For example, data generated by jet engines can be analyzed to determine whether an engine needs attention ahead of regular maintenance.
  • Data produced by drones that are programmed to orbit agricultural fields to determine the effectiveness of irrigation
  • Data produced by a health activity tracker may indicate that the wearer is in danger of suffering from heatstroke or heart attack. Activity trackers are also being used as tools physicians can use to track higher-risk patients between exams.

While the types of data accessed on devices vary greatly, common uses include placing that data within big data systems for data analytics processes to analyze the data in real time or near real time.

Data science is joined at the hip with IoT. Pulling the data off devices is becoming easier, and offline analysis of the data is where innovation is occurring. For example, healthcare providers might analyze health telemetry data to gather information from patients, look for patterns that the patient might change to improve wellness, or diagnose diseases earlier.

Please sign in to leave a comment.