28 msdn magazine
Machine-to-machine (M2M) computing is fast becoming a
technology that all developers and architects need to embrace.
Numerous studies suggest a coming world of tens of billions of
devices (a half-dozen for every human on earth) by 2020 (bit.ly/M2qBII).
One reason this is happening is because it has never been easier for
garage tinkerers and hobbyists to prototype a consumer or com-
mercial device for later manufacture and sale. Getting started with
both the hardware and soft ware is incredibly inexpensive. For less
than $100, you can order an Arduino or a Raspberry PI.
But you do get what you pay for and these devices—especially
the Arduino—represent the low end of the device-capability spec-
trum. With 32KB of Flash storage and 4KB of RAM, they lack the
power to run anything but the simplest aspects of a Web stack.
Th e Arduino is an open source microcontroller fi tted with a small
chip, memory and storage. The software consists of a standard
programming-language compiler and a boot loader that executes
on the microcontroller. You can add expansion boards that plug
into the device, hooking up motor controls, GPS, Ethernet, an LCD
display, sensors, actuators and more. Pay a little more money and
you can get the more powerful Raspberry PI, which comes with a
version of the GNU/Linux OS and 256KB of RAM.
These devices rarely have value unless they’re connected to
something else, perhaps a cloud back end that receives data and
sends commands. But connecting to, communicating with and
managing these devices from an application running in the cloud
presents some special challenges. The sheer number of devices,
as well as their limited battery life and bandwidth, forces a cloud
developer to carefully consider all options.
In this article, we’ll take a look at how developers are trying to
overcome the key challenges of addressability, bandwidth and
security. We will debunk the myth that IPv6 and virtual private
networks (VPNs) are simple, effi cient, and secure, and will pro-
pose that the Windows Azure Service Bus is the perfect product to
elegantly overcome these challenges. To drive home some of the
concepts, we’ll present four patterns you can use on your client
device when communicating with the cloud back end. Finally,
we’ll present a brief introduction to Service Bus support for the
Advanced Message Queuing Protocol (AMQP) 1.0—an interop-
erable and effi cient protocol for device-to-cloud communication.
For many years, secure connectivity meant using TCP/IP with
IPv4, combined with VPNs. Th is worked reasonably well, but is
now showing signs of age. For starters, it’s diffi cult to get a unique
IP address out on the public Internet to use with a device—we’ve
pretty much run out of IP addresses. Diehard fans of this approach
promise that IPv6 will come to the rescue. The conventional
wisdom is that if you give the device a unique IP address, all your
diffi cult problems are solved. Unfortunately, this solves only a small
part of the overall problem. Giving each device its own unique IP
address is defi nitely not the silver bullet many had hoped.
Just to be clear, IPv6 and VPNs are fraught with problems in a
crowded, connected-device world. Bandwidth, in particular, is a
challenge. Chatty connectivity between device and network can
lead to excessive traffi c. Moreover, using typical HTTP request/
response approaches for all messaging drains battery life on many
devices. Perhaps most important is that security can’t be guaranteed.
VPNs are defi nitely insecure in some scenarios. Before presenting
a solution, let’s dive a little deeper and explore these problems.
Devices that create excessive network traffi c communicating with the
cloud back end are problematic. Bandwidth costs money, potentially a
The Windows Azure Service Bus
and the Internet of Things
WINDOWS AZURE INSIDER
BRUNO TERKALY AND
RICARDO VILLALOBOS
BUILD A FREE DEV/TEST SANDBOX IN THE CLOUD
MSDN subscribers can quickly spin up a dev/test environment on
Windows Azure at no cost. Get up to $150 in credits each month!
aka.ms/msdnmag
Figure 1 Arduino Sprinkler System Reference Architecture
Sprinkler Valve
National
Weather
Service
Home Network
Windows
Azure
HTTP
Mobile
Services
Data/State
Blob
NoSQL
Database
Worker
Role
Linux Virtual
Machine Python
Admin
Web Role
Service
Bus
Arduino
Sprinkler
Controller