A practical Internet of Things
By Andrew Back
In the Internet of Things, physical objects will gather data and pass it into information networks and will consume data from those same networks. That mass of new information and its automated creation and consumption will change everything. Andrew Back looks at the practical aspects of this change and shows how you can build a point of the future with an Arduino-compatible Nanode and the Cosm web service.
In 25 years the internet has grown from connecting around a thousand fixed computers to linking billions of people through PCs and mobile devices. By 2010 it was estimated that total internet traffic had exceeded 20 million terabytes/month. Yet impressive as these figures are, computing devices remain largely dependent upon people for their operation, and almost all internet traffic is data that has been created or captured by humans and is destined for human consumption.
The Internet of Things (IoT) is set to change this and will bring about a world in which physical objects create and consume data without our intervention. Uniquely identifiable objects – from food packaging with an RFID tag to a car that is equipped with wireless-enabled sensors – will provide real-time inputs to complex networked applications. Software agents will be consuming data, processing it on our behalf and controlling outputs in the physical world.
The uses for this technology are incredibly wide-ranging and the implications profound. For example, it will lead to vastly increased manufacturing efficiency and waste reduction as products are tracked throughout their entire life cycle. New business models will be made possible as physical things become part of dynamic information infrastructures, and the pricing for services can be finely tuned based on access to real-time data. Ambient sensors and controls will be used in the homes of the elderly to give them increased independence. And global networks of citizen sensors will deliver hyperlocal open data, providing a platform for potentially world-changing applications.
With the IoT come certain technological challenges, but in the main these are concerned with more advanced features such as auto-configuration and discovery of smart objects, and using artificial intelligence (AI) to build autonomous systems. Most of the fundamental building blocks required are reasonably simple and have been around for quite some time: web APIs, publish/subscribe messaging, RFID, low power wireless networking and home automation, among others.
"The ever-decreasing cost and increasing capability of connected devices is enabling new applications across a wide range of sectors. From here on, progress towards the Internet of Everything and Everyone can only accelerate."
– Paul Tanner, Principle at Virtual Technologies, a company developing tools for the IoT.
As with all technology that will benefit greatly from vendor interoperability and integration with other systems, standards have a vital role to play. In recognition of this, the European Commission has invested almost 12 million euros in an IoT architecture research project, while the UK's Technology Strategy Board has made a smaller investment in early work on IoT convergence. Not ones to miss out on a standardisation opportunity, the behemoth that is the International Telecommunications Union has its own IoT Global Standards Initiative. Meanwhile, less grand but much more pragmatic efforts can be seen from the likes of the Eclipse Foundation, whose Paho project provides open source implementations of machine-to-machine (M2M) messaging protocols.
Neither deep pockets nor specialist skills are required in order to start experimenting with the Internet of Things, and next we'll take a look at how this can be done with hardware costing less than £30 in total and by making use of the free Cosm web service (formerly known as Pachube).
The Network Applications Node
The Network Applications Node, or Nanode for short, is a low cost internet-connected alternative to Arduino, which is compatible with most Arduino shields and is able to make use of the same easy-to-use IDE and software libraries. It also supports on-board optional extras in the form of 868MHz/433MHz wireless, a real-time clock, and microSD for local data storage.
The Nanode can be combined with any type of sensor, including those for light, power consumption, oxygen and radiation levels, and is capable of controlling directly-attached outputs, or remote ones such as a wireless-controlled light switch. In this example we'll connect a DS18B20 1-Wire digital thermometer which can measure from -55 oC to 125oC. Other variants in the DS18x20 family could be used, such as the DS18S20 which provides slightly lower resolution.
1-Wire is a low-speed communications bus that is used for devices such as voltage, current and temperature sensors. The name is a little misleading in that it actually requires two wires: one for data and one for ground. When not actually sending data, a 1-Wire device takes its power from the data line and stores this in a small capacitor.
As luck would have it, an Arduino library is available for 1-Wire, with another that builds on this to add support for temperature sensors from Dallas Semiconductor (now a subsidiary of Maxim). Our code, or "Arduino sketch", needs to start by including these libraries along with a library called EtherShield that will provide us with a basic TCP/IP stack.
With these libraries included we now define which Nanode pin will be used for the 1-Wire bus.
#define ONE_WIRE_BUS 4
Then we configure the 1-Wire bus, and the Dallas Temperature library to use it:
In the setup() section of our code we set the temperature sensor resolution to 12-bit:
And in the main
loop() we are then able to poll the sensor and store the temperature reading in the
DS1820Temp = sensors.getTempC(DS1820Thermometer);
We now have a small computer with an attached sensor. The next step is to plug it into the IoT.