Introduction to Contiki OS

Introduction to Contiki OS

To install Contiki: Refer this post :

To Refer the Characteristics and comparison of Various OS, refer this Slides:

Operating System fo IoT from T S PRADEEP KUMAR
How to use Contiki OS for Sensor Simulation - A Detailed video is enclosed herewith.
It tells about
Oracle Virtual Box
How to create a Sensor mote using Contiki
How to write a new App in contiki
What are the different windows that categorise? and lot more. Refer this video

T S Pradeep Kumar

RIOT OS (An Operating System for IoT)


The Internet of Things (IoT) is used with heterogeneous devices. They range from 8 bit to 32 bit microcontrollers from different manufacturers. Traditional Operating system (OS) or the conventional embedded OS may not suit the requirements that these tiny devices demand (low power, small in size and low memory foot print). RIOT Operating system is a free and open source arachtiecture which is friendly to IoT applications and proved to be a perfect OS for IoT Systems.
It started in the year 2008 as an Operating system for Wireless Sensor nodes, later the OS is fine tuned for IOT systems.

Features of RIOT

The OS is actively developed and maintained.
  • There are no new programming environments, C or C++ can be used directly with existing tools like gcc, gdb, etc.
  • Less hardware dependent code
  • Supports 8,16 ad 32 bit microcontroller platforms
  • Energy efficieny is maintained
  • less interrupt latency, so real time capability is ensured
  • multi threading is enabled
  • Supports the entire Network Stack of IoT (802.15.4 Zigbee, 6LoWPAN, ICMP6, Ipv6,RPL, CoAP, etc)
  • Both static and dynamic memory allocation
  • POSIX complaint (Partial)
  • All output can be seen the in terminal if hardware is not available, however there is a visualization tool called RIOT-TV is provided 
  • MSP430 
  • ARM7 
  • Cortex-M0, M3 ,M4
  • x86, etc
  • Radio receivers
  • Environmental sensors like humidity, temperature, pressure, alcohol gas sensors
  • accelerometer
  • gyroscopes
  • ultrasonic sensors, light and servo motor

Contiki OS
Tiny OS
Minimum RAM and ROM needed
C and C++ Support
No support (nesc)
Full support
Multi threading
No (protothreads are used here)
Real Time
  • msp 430 GCC compiler 
  • msp 430 libraries
  • avr utils,
  • arm based gcc 
  • gcc multilibrary
  • etc

Architecture, Board and Driver Support

It supports various architecture like
and it supports the native port, where one can simulate the output within the OS it was running. So RIOT is supported in Linux as well as OS X.
There are in built drivers for the following sensors (without a need of hardware, these sensors can be modeled in native mode also)
Most of the sensor boards have support from this OS like TelosB, ST Microcontroller sensor boards, Zolertia, MSP 430 boards,Aruduino sensors, Atmel, and the list is so huge.
It also support virtualization that the code and application can run as a simple unix process. It also uses wireshark for packet sniffing.

Comparison with Contiki OS and Tiny OS

There are other two OS called Contiki OS (Already featured in OSFY) and Tiny OS which are suitable for IoT applications. But RIOT takes an upper hand in terms of memory usage and support.
The following table shows the comparision between these OS
Table 1: Comparison of various OS for IoT
Figure 1 and Figure 2 represents the block and Network stack diagram of IoT. Except for RPL, all the modules have the support from RIOT OS (for RPL alone, there is a partial support from RIOT)
Network Stack for IoT
Network Stack for IoT

Component of IoT
Component of IoT

Installation of RIOT in LinuxOS Used for installing : Linux Mint 17.2 and Ubuntu 14.04.2Architecture used: 64 bit OSInstalling RIOT needs lot of packages that are prerequisites like
Assume if you have installed just now, follow the steps to install

pradeepkumar $] sudo apt-get update
pradeepkumar $] sudo apt-get install libc6-dev-i386 build-essential binutils-msp430 gcc-msp430 msp430-libc libncurses5-dev openjdk-7-jre openjdk-7-jdk avrdude avr-libc gcc-avr gdb-avr binutils-avr mspdebug msp430mcu autoconf automake libxmu-dev gcc-arm-none-eabi openocd git bridge-utils gcc-multilib socket
The OS can be downloaded as a zip file from github ( , else you can clone it using the following command
pradeepkumar $] git clone

The folder RIOT/ or RIOT-Master/ contains various subfolders
->boards  (This folder has all the drivers for the boards that are supported by the OS)
->cpu (this folder contains the architecture supported by RIOT)
  ->cores  (Core of the OS like kernel, modules, etc)
->doc (Documentation)
->examples (some examples like hello word, border router, Ipv6 formation, etc)
->drivers (drivers for all the sensors)
Simple Example
These type of Operating systems can be learnt only through the examples given within the source code of the application. This OS has some examples in the examples/ folder and one can go through the source code and run it using the following method. There are more examples available in the github of RIOT (
If sufficient board or hardware is not available, then the code can be run in the terminal itself (native mode)
To run the hello-world example from the examples folder

pradeepkumar $] cd RIOT-Master/examples/hello-world
pradeepkumar $] make flash
pradeepkumar $] make term 
Running a hello-world example
Running a hello-world example

hello world application run in the terminal
hello world application run in the terminal

RIOT native interrupts/signals initialized.
RIOT native board initialized.
RIOT native hardware initialization complete.
main(): This is RIOT! (Version: UNKNOWN (builddir: /home/pradeepkumar/RIOT-master))
Hello World!You are running RIOT on a(n) native board.
This board features a(n) native MCU.
Press Ctl+C to quit the application
make flash will compile and show the text and data size occupied by the memory. Since this application is run under native mode, the output can be viewed using make term command.
Networking Applcation in RIOT
There are few number of applications avaiable in RIOT. One such application is a socket application which works with the POSIX API with UDP as the protocol. All the relevant source codes are avaialble in the directory itself
pradeepkumar $ ] cd RIOT-Master/examples/posix-socket/
pradeepkumar $ ] make flash
pradeepkumar $ ] sudo make term
output of the above command
/home/pradeepkumar/RIOT-master/examples/posix_sockets/bin/native/posix_sockets.elf tap0
RIOT native interrupts/signals initialized.
RIOT native board initialized.
RIOT native hardware initialization complete.
main(): This is RIOT! (Version: UNKNOWN (builddir: /home/pradeepkumar/RIOT-master))
RIOT socket example application
All up, running the shell now
> help

posix in riot
POSIX Application

udp                  send data over UDP and listen on UDP ports
reboot              Reboot the node
ps                   Prints information about running threads.
random_init          initializes the PRNG
random_get          returns 32 bit of pseudo randomness;
ifconfig             Configure network interfaces
txtsnd               send raw data
ncache              manage neighbor cache by hand
routers              IPv6 default router list
Figure 5 shows the above configuration: Routers can be configured, txt messages can be sent, running processes details can be found out, etc can be done using the application

There are only limited number of Operating systems available for the IoT sensors and among these OS, RIOT really has a well documented API with huge support for most of the boards, architecture and sensors. The main advantage being, RIOT is actively developed and maintained, there is a incremental version every month.  Students and electronic hobby enthusiasts are using arduino and Raspberry Pi for their IoT applications these days, RIOT really help these boards and sensors to achieve low memory footprint and low energy efficiency without any compromise on the performance of the IoT Systems.

NB: This article is published in the "Open Source for You Magazine" February 2016 Edition.

Popular posts from this blog

AWK Scripts for NS2 to process data from Trace Files


ns2 installation in Ubuntu 14.04