Contiki: An operating system for the 'Internet of Things'

The 'Internet of Things' (IoT) is a phrase generally considered to have been coined by Kevin Ashton in 1999. Ashton, who is now general manager of Belkin, came up with the phrase while working at Proctor Gamble. In his words it combined quot;the new idea of RFID in Pamp;G's supply chainquot; with the "then-red-hot topic of the Internet".

The term refers to linking the Internet to physical objects: Equipping objects, such as household appliances, with networking capabilities, allowing mutual interaction between them and greater monitoring and control over them by end users.

How Haiku is building a better BeOS
What's your idea worth? Building a social knowledge market with Barter
AmigaOS 4 developer interview: Why it endures and what the future holds
Syllable OS: Creating a better desktop operating system
Open Source Spotlight - OpenStack: Building a more open Cloud

"Ultimately, the Internet of Things is about making the simple things in life a little simpler," Adam Dunkels says. Dunkels is the creator of Contiki: an open source operating system designed to be used for the Internet of Things.

"For example, when waking up a on a summer day, wouldn’t it be nice to have an app that tells you what beach is sunniest?" Dunkels says. "The Internet of Things allows us to build such apps: apps that make the real world a little more like the Internet.

"The Internet of Things builds on a range of technologies: Low-power radios, routing protocols, sleek software. One key enabler has been the standardisation the Internet Protocol to cover new low-power wireless devices.

"This allows items, environments, places, and devices to be directly connected to the Internet and exchange information. Both obtaining information from the Internet, for example to better control heating and lighting, and pushing information to the Internet; for example providing information of where people are moving around in a city."

Dunkels believes that making the Internet of Things a reality on a large scale requires making it easier to build Internet-connected embedded systems, which is where Coniki comes in. "Contiki has worked in this direction, but it hasn’t come far enough," he says

The operating system has been built to let battery-operated, low-power systems connect to the Internet. The project began in 2003 as an experiment by Dunkels, "connecting various interesting things to the Internet". Contiki built on the uIP project, which Dunkels says was the world's smallest IP stack at the time.

"In 2002, uIP had been used to Internet-connect the world’s first Lego brick and was also widely used in embedded systems," he says.

"Contiki added an operating system layer on top of uIP, which made it possible to connect multiple applications to the Internet simultaneously."

When the project started, it made headlines by enabling a range of underpowered, dated devices connect to the Internet. The examples cited by Dunkels include the Apple II (released in 1977), the Commodore 64, and even Nintendo's handheld Gameboy console.

In 2008, networking vendor Cisco contributed code to add IPv6 support to the OS, making it the first IPv6 certified system for the Internet of Things. Other hardware vendors have also contributed to the system, helping make sure their devices can work with Contiki.

Despite its emphasis on being a super-lightweight embedded operating system, Dunkels is a "firm proponent" of not optimising code to the nth degree. "The fact that we do not need to optimise code these days makes us so much more productive than we used to be," he says.

"Sure, there is a bit of a lost art in that we don’t need to bleed every last bit out of every data structure and every last cycle out of every algorithm any more. But much of this art wasn’t that useful anyway.

"One of the biggest challenges in developing Contiki is finding the right balance between optimisation, simplicity, and resource-efficiency. It is all too easy to fall into the traps of premature optimisation and sub-optimisation."

Under the hood, however, Contiki still has some innovative features to help maintain its low overhead. For example, the system uses "protothreads"; a concept developed by Dunkels with the aid of Oliver Schmidt.

Page Break

Dunkels describes protothreads as "a programming abstraction that allow programs to be written as if they were threaded, but without the memory overhead of multiple thread stacks".

"All protothreads run on the same stack, while retaining linear code flow," he explains.

"This allows programs to use blocking waits, without having to manually be turned into state machines. The trade-off is that programs must block only at the top level, but this is enough for the kind of programs we find in IoT devices that typically do only a set of relatively simple tasks."


Contiki can now be found in what Dunkels describes as "typical types" of IoT systems, including smart grids, smart buildings and homes, and smart streetlights.

"One recent cool application that came to our attention was a wireless radioactive radiation detector by D-Tect systems that uses Contiki to allow the detectors to form self-healing wireless networks to transport radiation readings," he says.

Perhaps the most unusual use so far has been Oxford University badger tracking system.

Dunkels recently launched a new company, Thingsquare, which aims to make building applications for the Internet of Things "dramatically" easier.

"IoT applications have traditionally required deep expertise in electronics design, embedded systems software, low-power wireless communication, networking protocols, Internet server software, and smartphone app development, making them way too difficult to develop for most people," Dunkels says.

"We aim to change this by making IoT apps as easy to build as smartphone or Web apps. Because, let’s face it, there are a lot more people that can develop software for Android or node.js than for Contiki."

Thingsquare is developing to systems to make creating IoT applications easier. The first is Thingsqure Mist: A wireless, self-healing mesh networking system for devices running Contiki. The second is a cloud service called Thingsqure Haven. "Mist devices can connect to the Thingsquare Haven cloud service to provide an API for app developers and well as for integration in enterprise IT systems," Dunkels says.

"To make Haven secure to use over the Internet, we provide a VPN tunnel for Mist devices. Haven is a subscription service, so users need only pay for what they really need."

Contiki's future

In July, version 2.6 of Contiki was released, adding networking improvements and new features including the lightweight Antelope database manager and a JSON library. The project's developers are currently in the process of developing a roadmap for version 3.0.

"While many of the essential underlying features are in place, such as the IP stack, routing, memory allocation, and so forth, it still is way too difficult to port Contiki to new platforms and to develop software for Contiki," Dunkels says.

One of the priorities is to create better APIs to make development easier and simplify the process of porting the OS to new platforms.

Dunkels has also been looking at making it easier for people to contribute to the project by adopting a new development model based on a patch review system.

"We’re still working out the details of this, but the overall idea is to both speed up inclusion of outside contributions to Contiki and to increase the quality of patches by providing a set of clear mechanisms for contributing them and by making reviewing easy."

Dunkels believes that the Internet of Things will ultimately have a profound impact on people's lives. "I think it will be akin to how computers, the Internet, and smartphones have improved our lives already, which really is a tremendous change if you stop and think about it," he says.

"We’ve come to take for granted that we have instant access to information today. Tomorrow, the Internet of Things will mean that we will have instant access to not just information, but — literally — everything around us, just as we have access to information on the Internet today."

Rohan Pearce is the editor of Techworld Australia and Computerworld Australia. Contact him at rohan_pearce at

Follow Rohan on Twitter: @rohan_p


Copyright © 2012 IDG Communications, Inc.

Shop Tech Products at Amazon