The Internet of Things

by Simon Bisson

The coming revolution will transform our world. Simon Bisson introduces a major new series.

HardCopy Issue: 66 | Published: June 1, 2015

There’s a revolution going on and it’s changing the way we think about computing. The Internet of Things promises to add billions of computers and devices to the Internet over the next few years. Whether you call it Machine-to-Machine, Connected Home, Smart Cars, The Internet of Sensors, The Internet of Everything, or whatever, it’s a massive change that’s likely to become something bigger than the marketing-driven hype. That’s because it’s building on some of the most important computer science work of the last 30 years, and most importantly, because it’s being driven by makers and hackers who are solving real problems with a new generation of tools.

The roots of the Internet of Things (IoT) go back to the early days of personal computing, and to the work of ubiquitous computing pioneers like Mark Wieser at Xerox PARC. It wasn’t a big jump to go from a computer on every desk to a computer in every pocket to a computer in everything, to the extent that the computer disappears, enveloping the world in a sea of ambient computation. As Microsoft CEO Satya Nadella puts it, it’s a world of “ubiquitous computing and ambient intelligence.”

It’s a big vision, but one that’s driving much of what we’re seeing in the development world today, from new languages and design patterns, to Platform-as-a-Service clouds. Our IDEs now stretch from screen-less, UI-less devices, all the way up to those cloud platforms, letting us create and build projects that span the whole of the Internet of Things. Then there are the so-called ‘maker boards’: low-cost, low-power prototyping boards that give you the electronics you need to connect those Things to the Internet.

One such project comes from a well-known logistics company that has a division specialising in urgent perishable goods, such as experimental drugs. These are carried in refrigerated trucks, and if there’s a change in temperature they can be ruined. That’s a big problem if a single dose can cost many thousands of pounds. The company fitted an array of sensors with cellular modems to every truck, delivering readings to a machine learning system. Over a period of a few months the system became able to detect possible failure states before they occurred, and automatically reroute trucks to repair depots or to meet other trucks for a transfer, depending on the urgency of the delivery and the predicted failure mode of the refrigeration system.

At a major Californian university, all new buildings have devices embedded in every wall, simple un-powered strain gauges that transmit readings when energised by a radio signal. After an earthquake civil engineers walk the halls, capturing stress data from the sensors and so allowing a quick assessment of building safety. Instead of weeks of work to manually determine safety, a building can be back in action in hours or days.

Then there are aircraft engines. The huge turbines under the wings of a Boeing 777 collect data as the aircraft flies, dumping it back to the engine maintenance crew on landing, so that critical tasks can be handled quickly and efficiently, reducing delays and helping schedule a maintenance programme that can keep engines running for longer and for a greater portion of an airframe life.

There’s an old adage: you can’t control something you can’t measure. What the Internet of Things is about is adding measurements and control systems to the world around us. These might be smart fire alarms, intelligent electricity meters, personal fitness monitors, or anything else you can imagine. What they’re doing is giving us a whole new set of endpoints that can transmit data to our applications, letting us build feedback loops that can be adjusting boiler temperatures in a central heating system, unlocking doors as we walk up to them, or sending out replacement buses and planes.


Maker boards

Perhaps the most popular route into the Internet of Things is through Arduino, a low cost single board computer built around ARM micro-controllers, with plenty of I/O ports to allow anyone to build prototype sensors and actuators, and small enough to fit in the palm of your hand. The heart of Arduino’s success is the concept of the shield, a pluggable circuit board that can contain sensors or other hardware, such as a Wi-Fi or cellular chipset. Some shields are designed to be extensible, built around breadboards or simple soldering pads where you can add your own components.

RCarduino by the LA Robotics Club

The RCarduino: an Arduino strapped to a model car chassis by the LA Robotics Club.

Arduino works with a wide selection of development environments and tools, but is perhaps best known for the combination of the Processing IDE and the Wiring language that make it easy to quickly build event-driven applications. Wiring is a C/C++ library and it’s found its way into other platforms too, including Intel’s Arduino-compatible Galileo board which is being used as a test-bed for the first iteration of Microsoft’s Windows for Devices.

A common I/O port design and its plug-in shields have helped create an ecosystem of component providers, kit builders and device manufacturers giving all you need to build an Arduino board into your own IoT projects. You don’t even need to be a full-time developer: a while back we met a winemaker in Northern California who is using homebuilt Arduino devices to instrument the winemaking process, from battery-powered sensors in fields to arrays of temperature monitors in a fermentation vat.

Arduino’s success has inspired other prototype boards and devices, such as the Wi-Fi based Electric Imp that can be used to add low-powered connectivity, or Spark Labs’ Electron cellular board for remote sensors. There are also Arduino-compatible boards based on other programming models, like the Netduino which uses Microsoft’s open source .NET Compact Framework.

Like Arduino, many of these prototyping boards are simple microcontrollers. There’s no operating system and no storage: just a set of firmware and enough memory to load and run a single program. But that’s good enough for most IoT applications where firmware-based devices can be flashed once and left running for years. All you need to do is hook them up to a power source.

That said, there is also a need for more complex devices: small computers that can be part of an IoT deployment, perhaps managing a fleet of sensors or handling more complex tasks. An Arduino might not have the horsepower to recognise a cat trying to come in through a locked cat flap, but a low cost single board computer with a full ARM or Intel Quark SoC (System-on-a-Chip) could do the job nicely.

Perhaps the most popular in the UK is the Raspberry Pi. Riding on a wave of BBC Micro nostalgia with its model A and B versions, the Pi is an ARM SoC-based single board computer. Unlike the Arduino, it is able to run a full OS and drive an HDMI display, as well as handling USB peripherals. The Raspberry Pi offers many similar features to Arduino devices, with plenty of analogue and digital I/O, and is the size of a credit card.

Like Arduino, the Raspberry Pi has become an IoT flagship, at the heart of many different prototyping kits and tutorials. It’s also been used as the basis for low-cost educational computers, like the Fuze. Packaged in a strong case the Fuze hides a Pi underneath a full sized keyboard, with a header board dropping from the Pi’s IO ports onto a pluggable breadboard – together with a kit of wires, components, sensor and LEDs, ready to get users started building their first IoT apps. An OS and tutorial software help speed things up.

The Pi has its own equivalent of the Arduino Shield, in the shape of HATs (Hardware Attached on Top). These add extra hardware to the underlying Pi and conform to a specification that allows the Pi to identify the hardware it’s using and install the appropriate drivers.

Intel Edison single-board computer

The Intel Edison single-board computer is the size of an SD memory card.

Similarly Intel’s Galileo and Edison devices are based on its Quark processor with Arduino-compatible ports and support for Wiring-based applications, but like the Raspberry Pi you get a choice of operating systems, including IoT-focused releases of Linux. Other boards, such as Imagination’s MIPS-based Creator CI20, offer other operating system options including Android.

Microsoft is prototyping a version of Windows for IoT devices and has shipped a cut down version of Windows 8 for Intel’s Galileo boards. A Windows 10 build for Raspberry Pi 2 devices is due Summer 2015 and will give Windows developers the tools they need to deliver Universal apps to IoT controllers.


Developer tools

Building an IoT application is much like building any other piece of code. While you have to be aware of the limited capabilities of much IoT hardware – and of memory and CPU constraints – you’re going to be using the same IDEs and development tools, or at least tooling that’s very similar.

A good example of how IoT development works is the way in which Microsoft has been adding support for Windows for Devices to Visual Studio. With the current build, installing the Windows for Devices SDK adds new project types to Visual Studio. You can then write Wiring code in a C++ wrapper, and use Visual Studio’s remote deployment tools to deliver the app over an Ethernet connection to an Intel Galileo board.

The Intel angle

Intel’s involvement in the Internet of Things is wide ranging, from the Xeon multi-core processors that power much of the cloud, to the tiny Quark SoC (System-on-a-Chip) devices that are designed to sit within the ‘Things’ at the edge.

The Quark is a single core 32-bit processor that supports the x86 instruction set together with a number of interfaces, including PCI Express, Ethernet and USB 2.0, in as small a package as possible. It is accompanied by three ‘maker’ boards. The Galileo, now on its second generation, conforms to the Arduino specification and comes with 256MB of memory and a range of connectors on a board measuring 107 by 71mm. The Edison is also Arduino compatible but considerably smaller at just 36 by 25mm, with support for both Bluetooth and Wi-Fi. The smallest of all is the Curie which will be released later in the year and includes a Quark processor together with 384kB of Flash memory, Bluetooth LE and a movement detector in something the size of a fingernail.

As James Reinders of Intel Software explained at the recent iStep conference, Quark’s priority is extremely low power consumption, while still providing a useful performance: “You’re talking about devices that you want to run on very small batteries for a very long time, while still being able to talk to the outside world. One of the secrets is to keep as much turned off as you can, leaving just a small piece active so as to know when the rest of the chip needs to be powered up.”

There’s also the problem of powering such devices. Reinders continued: “It’s obvious devices like the Curie don’t want you plugging in a cable, which is why you see Intel so excited about wireless power. If you’ve got something the size of a button, then throwing it in a tray to recharge is much better than trying to figure out how to plug in a cable that’ll probably break the device if you put it in wrong.”

Intel has long been at the forefront when it comes to parallel computing, and as Reinders points out, “The Internet of Things is another place where computer engineers need to be aware of parallelism and the issues of concurrency that arise when you distribute your problem. I’ve got little robots doing something here; I’ve got cloud computing doing face recognition and looking up databases there: it’s an amazing application of parallel computing.”

For example, one solution to the problem of security is to have low-power devices talking through something like Bluetooth LE to local hubs that decide who gets Internet access. Such a hub could also perform some initial processing on the raw data: “That would lower the complexity of the devices, and if you can trust that you are always in touch, then the hub can just tell you when something changes, or when something bad happens.”
As a representative of Intel Software, Reinders sees compatibility as a major selling point: “It’s really cool to see our tools being used for more than we imagined when we started producing our compilers and libraries and so forth. They were always for workstations and desktops but now it’s up to supercomputers and down to Quarks. It’s good to see that commonality because people who have been using our tools for years can get involved in the Internet of Things and the tools are familiar, and the x86 is familiar, and that’s a big boost for innovation.”

You can read the full transcript here.

Once the app has been deployed you can use Visual Studio’s remote debugging tools, using breakpoints to expose variables and single step through your code. Wiring makes it easy to address I/O ports and read analogue or digital values, and it also lets you trigger outputs. We were able to write an app that reads values from a temperature sensor on a shield and then flashes an LED at a proportional rate using just a few lines of code. You can get a feel for how device development and cloud services come together using the Microsoft Open Technologies Connect The Dots project, which provides framework code for working with Azure cloud services, and design patterns for working with sensor data.

Microsoft’s Windows 10 IoT implementation is likely to work similarly, but with support for Universal apps written using .NET languages and with the option of providing a basic UI on devices which support screens, such as the Raspberry Pi. Arduino support is also promised, though Microsoft has yet to detail how apps will run on Arduino firmware and how Visual Studio will work with devices that only have firmware. Alternatively you can write apps that work with Microsoft’s wearable sensor platform Band, reading sensors over a Bluetooth connection and taking triggers from the device’s buttons.

Other development platforms are offering different approaches to cross-platform IoT development. Embarcadero’s recently released RAD Studio XE8 supports Android Wear and Apple Watch, with tools for working with Bluetooth LE beacons and for designing smartwatch UIs. Xamarin’s C# and F# cross-platform tools also offer wide-ranging support.

With the Internet of Things building on a maker foundation, there’s a lot of open source tooling, starting with Arduino’s Processing IDE. Node.js is an important element of many IoT solutions, giving you a simple, scalable actor that can be used as a switching element to handle messages from IoT endpoints, marshalling data to cloud services. A quick way of getting started with Node.js is IBM Research’s Node-Red, which takes a visual approach to managing information from devices.

Running inside a browser, Node-Red lets you draw your IoT application, dropping controls on screen and adding JavaScript code to customise controls. There’s a library of connections to various common devices, with links to cloud services and databases. There’s even a build of Node-Red that’ll run on a Raspberry Pi, giving you the option of building your IoT applications directly on an IoT device.


Connecting the IoT

Connectivity is of course key. While most devices use IP-based connections, there are other protocols that can be used in home automation and industrial hardware. One option, ZigBee, is designed to work with low power radios and includes tools for building them into a mesh network, making it possible to transmit data from device to device until it reaches a hub. It’s relatively slow but works well for home automation, handling temperature and humidity sensors and simple switches.

Bluetooth LE (Low Energy) is increasingly popular for short-range connections between smart devices and hubs. As it’s the heart of the Bluetooth Beacon specification, it’s commonly used for linking fitness trackers to phones and to support device tracking hardware. There’s support for it in Windows, as well as in most mobile operating systems.

A relative newcomer is AllJoyn, a higher level protocol that lets devices advertise their capabilities, so simplifying connection to software and other devices. It’s already supported in various connected home devices, and is an open software framework which means it is supported by a wide variety of operating systems. Microsoft is making AllJoyn a key component of Windows 10 and is shipping an AllJoyn agent in the Windows 10 Mobile Technical Preview.


In the cloud

The cloud is a key part of the Internet of Things. With many millions of devices connected to networks, we’re going to need systems that can scale effectively. Microsoft has been focusing a lot of its IoT work on Azure, with its Azure IoT Suite. Based on the Intelligent Systems Service preview, this is a mix of tools designed to help capture and manage information from devices, especially from sensors. Full details of the service are still to be announced but the focus is around Azure Event Hubs, Stream Analytics and Machine Learning.

Event hubs are a key technology, designed to work with millions of telemetry events a second. You may not be planning to deliver information at that volume but if you’re instrumenting complex equipment then you’re likely to find that you’re generating more data than you expect. Event hubs handle secure connections, as well as throttling signals from devices and buffering data before sending it on to a real-time analytics service, or to a storage service for later analysis. Azure’s Stream Analytics is an example of a real-time analytics service, able to compare data with historic information, as well triggering alerts for known error conditions. And you don’t need to learn new skills as queries are managed using a SQL-like language.

Azure Stream Analytics

Microsoft Azure Stream Analytics provides cloud services for analysing the real-time data that is streaming back to your application from IoT devices.

But it’s Azure Machine Learning that really drives the IoT platform, letting you train machine learning systems and pick and choose algorithms – as well as add your own code. Building an IoT service around Platform-as-a-Service makes a lot of sense as you don’t have to design your own scaling algorithms, which you’d have to do with Node.js.

Microsoft’s aren’t the only cloud services around. You can also use tools like Amazon’s Lambda service to trigger actions based on information from devices and services. While it’s not a platform for dealing with dense streams of data, it’s easy to see how it can be used to work with another class of sensor. Take Netgear’s Arlo security cameras, or Google’s Nest smoke alarms for example. These are quiescent most of the time, only needing access to cloud services when triggered. Arlo’s motion sensors can instigate a cloud upload of a video snippet, while Nest sends alerts to your smart devices. This is where Lambda would come in, firing up the code to handle that upload or alert as soon as the event triggers. You’re not running apps all the time, just when they’re triggered, so saving you money.

Other cloud options include Arrayent’s Connect, which links devices to UIs, so you don’t need to write controller tools. If you’re a sump pump manufacturer, you don’t want to be writing iPhone apps, you want to be building better pumps. Arrayent’s tools allow you to concentrate on linking your device to the cloud, allowing third parties to integrate your devices with their control systems, or letting you quickly build and deploy a UI.


Putting it all together

So what does tomorrow look like? A recent presentation by Microsoft’s Scott Guthrie at an Azure User Group event in London shows how you can start to bring all these pieces together to build your own IoT apps. It’s probably a coincidence that his demonstration mirrored that logistics company’s truck refrigeration monitoring system using just a few lines of a code and a collection of cloud services.

Taking an off-the-shelf humidity sensor, Guthrie connected it to a PC and with a few lines of C# code had it delivering a stream of JSON-encoded data to an Azure Event Hub. This delivered the data to two separate services, namely Stream Analytics and Azure Machine Learning. Stream Analytics processed and stored the data for display in a Power BI dashboard. Meanwhile the Machine Learning system was able to identify out-of-band readings using a standard set of rules to predict future states based on past and present readings, triggering alerts when Guthrie deliberately breathed into the sensor.

Using off-the-shelf BI tools to display real-time data makes a lot of sense: they’re designed to be human readable, as well as easy to reconfigure. We’re not going to be sitting there watching real-time data as it streams off millions of sensors: that’s what machine learning systems are for.
Instead we’re going to want to explore the data we get, asking questions in order to get insights that machine learning systems may not be delivering.

It’s worth looking at the lessons of the massive IoT sensor systems already in use; the Formula 1 teams, the jet engines, the container ships and the America’s Cup yachts. They’re all pushing the envelope of modern computing, using sensors to generate the vast amounts of data they need to gain useful insights into the way their tools, services and businesses are actually working.

The Internet of Things promises much, but we’re still in the early days. That means there’s lots of work to be done, and lots of opportunities. But with tools and technologies coming together, and support from cloud platforms and operating systems, we’re going to see an explosion in IoT development over the next few years. If you want to get a feel for it, pick a Raspberry Pi or an Arduino and start building that piece of automation you’ve always wanted. You won’t regret it.