All posts tagged: contiki

Contiki is a lightweight, multitasking operating system aimed primarily at memory-constrained embedded systems, wireless sensor networks, low-power networked embedded devices and the general “Internet of Things”. Contiki is resource efficient, highly portable, and it is free, open-source software.

Although Contiki is free software and its underlying source code is freely downloadable, some commercial companies such as ThingSquare provide professionally supported solutions for the deployment of Contiki-based Internet-of-Things applications and products in the commercial sector, just as is the case with the Linux ecosystem.

Designed to run on embedded hardware platforms that are severely constrained in terms of memory, processing power and communication bandwidth, Contiki still offers a multitasking kernel and a built-in TCP/IP stack, and a real-world Contiki deployment can be run on an 8-bit microcontroller, for example, with only about 10 kilobytes of RAM, 30 kilobytes of flash, a clock on the order of 10 MHz and a power budget on the order of 10 milliwatts.

Thanks to these low system requirements, Contiki has been or is being ported to many common microcontroller platforms – such as Atmel AVR, Microchip dsPIC and PIC32, TI’s MSP430 low-power microcontrollers, and ARM-based systems such as the TI CC2538.


Networking is easy with Contiki, as it provides three lightweight, memory efficient networking stacks – the uIP TCP/IP IPv4 stack, the uIPv6 stack, providing support for IPv6 networking, and the Rime stack, which is a set of custom lightweight networking protocols designed specifically for low-power wireless sensor networks.

The IPv6 stack also contains the RPL routing protocol for increased tolerance of packet loss in low-power IPv6 radio networks and the 6LoWPAN header compression and adaptation layer for IEEE 802.15.4 radio networks. Contiki is particularly well suited to use with microcontroller systems-on-chip incorporating an IEEE 802.15.4 radio transceiver on board, such as the Atmel ATmega128RFA1 family or the Texas Instruments CC2538.

Such hardware platforms, combined with Contiki, provide highly integrated, cost-efficient, power-efficient single-chip wireless sensor network or Internet-of-Things platforms with wireless IPv6 802.15.4/6LoWPAN networking support on board, allowing IPv6 internet connectivity to be routed right down to the wireless, power efficient end nodes of an Internet-of-Things network.

The Rime stack is an alternative network stack that is intended to be used in applications where the overhead of the IPv4 or IPv6 stacks is prohibitive. The Rime stack provides a set of communication primitives intended for very lightweight applications in low-power embedded wireless networks, which by default include single-hop unicast, multi-hop unicast, network flooding and address-free data collection.

These primitives can be used on their own or combined to form more complex protocols and mechanisms whilst still maintaining the most lightweight mechanism possible to perform the networking task required.

Contiki also provides a set of mechanisms for reducing the power consumption of the system on which it runs, including the ContikiMAC radio duty cycling protocol for improving power efficiency in radio-networked platforms, keeping the radio powered down or running in a low-power mode for as much time as possible while still being able to receive and relay network messages.

These mechanisms enable powerful Contiki-based solutions in severely power-constrained environments such as battery-operated wireless sensor network devices that are expected to operate unattended for long periods of time without battery maintenance or replacement.

To run efficiently on memory-constrained systems, the Contiki programming model is based on protothreads, which are thread-like memory-efficient programming abstractions that share features of both multi-threading and event-driven programming to attain a low memory overhead.

The kernel invokes the protothread of a process in response to an internal or external event. Examples of internal events are timers that fire or messages being posted from other processes, whilst examples of external events could include external interrupts that are triggered by external sensor inputs, or radio-triggered interrupts created by incoming packets on the wireless network.

These protothreads are cooperatively scheduled, meaning that a Contiki process must always explicitly yield control back to the kernel at regular intervals. Processes may use a special protothread construct to block waiting for events while yielding control to the kernel between each event invocation.

Contiki supports per-process optional pre-emptive multi-threading, interprocess communication using message passing through events and an optional GUI subsystem with either direct graphic support for locally connected terminals or networked virtual displays via VNC or Telnet. However, the use of a graphical user interface does increase memory requirements a little, from a minimum of 10 kilobytes of RAM up to a minimum of about 30 kilobytes of RAM.

The Contiki system includes a network simulator called Cooja. The Cooja Contiki Network Simulator simulates networks of nodes running Contiki which may belong to one of three classes – emulated nodes, where the entire hardware of each node is emulated, Cooja nodes, where the Contiki code for the node is compiled for and executed on the simulation host, or Java nodes, where the behaviour of the node must be reimplemented as a Java class.

A single Cooja simulation may contain many nodes from a mixture of any or all of the three classes. Emulated nodes can also be used to include non-Contiki nodes in a simulated network environment. Cooja can also be used to simulate real-world physical effects in large wireless mesh networks, such as packet loss and network degradation in RF networks.

With the combination of low-powered embedded wireless hardware, Contiki and the tools included – you have the foundation for a scalable, efficient and contemporary Internet-of-things.

To get started with your own ideas and Contiki, or to explore other options to solve your problems – join us for an obligation-free and confidential discussion about your ideas and how we can help bring them to life – click here to contact us, or telephone 1800 810 124.

LX is an award-winning electronics design company based in Sydney, Australia. LX services include full turnkey design, electronics, hardware, software and firmware design. LX specialises in embedded systems and wireless technologies design.

Published by LX Pty Ltd for itself and the LX Group of companies, including LX Design House, LX Solutions and LX Consulting, LX Innovations.

Muhammad AwaisContiki – the low-power IoT Operating System