Skip to main content

RIOT OS (An Operating System for IoT)


Introduction

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

Features
Contiki OS
Tiny OS
RIOT OS
Minimum RAM and ROM needed
<2kb,
<30kb
<1kb
<4kb
~1.5kb
`5kb
C and C++ Support
Partial
No support (nesc)
Full support
Multi threading
No (protothreads are used here)
No
Yes
Real Time
No
No
Yes
  • 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 (https://github.com/RIOT-OS/RIOT/archive/master.zip) , else you can clone it using the following command
pradeepkumar $] git clone https://github.com/RIOT-OS/RIOT.git

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)
etc
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 (https://github.com/RIOT-OS)
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

-----OUTPUT-----
/home/pradeepkumar/RIOT-master/examples/hello-world/bin/native/hello-world.elf
RIOT native interrupts/signals initialized.
LED_GREEN_OFF
LED_RED_ON
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
--------------------------CODE-----------------------------------
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
----------------------------------CODE--------------------------------------
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.
LED_GREEN_OFF
LED_RED_ON
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

Command
---------------------------------------
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
--------------------------CODE----------------------------

Conclusion
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.

Comments

Popular posts from this blog

Installing ns3 in Ubuntu 22.04 | Complete Instructions

In this post, we are going to see how to install ns-3.36.1 in Ubuntu 22.04. You can follow the video for complete details Tools used in this simulation: NS3 version ns-3.36.1  OS Used: Ubuntu 22.04 LTS Installation of NS3 (ns-3.36.1) There are some changes in the ns3 installation procedure and the dependencies. So open a terminal and issue the following commands Step 1:  Prerequisites $ sudo apt update In the following packages, all the required dependencies are taken care and you can install all these packages for the complete use of ns3. $ sudo apt install g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev  libxml2 libxml2-dev libc6-dev libc6-dev-i386 libclang-dev llvm-

Installation of NS2 (ns-2.35) in Ubuntu 20.04

Installation of NS2 (ns-2.35) in Ubuntu 20.04 LTS Step 1: Install the basic libraries like      $] sudo apt install build-essential autoconf automake libxmu-dev Step 2: install gcc-4.8 and g++-4.8 open the file using sudo mode $] sudo nano /etc/apt/sources.list Include the following line deb http://in.archive.ubuntu.com/ubuntu bionic main universe $] sudo apt update $] sudo apt install gcc-4.8 g++-4.8 Step 3:  Unzip the ns2 packages to home folder $] tar zxvf ns-allinone-2.35.tar.gz $] cd ns-allinone-2.35/ns-2.35 Modify the following make files. ~ns-2.35/Makefile.in Change @CC@ to gcc-4.8 change @CXX@ to g++-4.8 ~nam-1.15/Makefile.in ~xgraph-12.2/Makefile.in ~otcl-1.14/Makefile.in Change in all places  @CC@ to gcc-4.8 @CPP@ or @CXX@ to g++-4.8 open the file: ~ns-2.35/linkstate/ls.h Change at the Line no 137  void eraseAll() { erase(baseMap::begin(), baseMap::end()); } to This void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); } All changes made Step 4: Open a new termi

Installation of NS2 in Ubuntu 22.04 | NS2 Tutorial 2

NS-2.35 installation in Ubuntu 22.04 This post shows how to install ns-2.35 in Ubuntu 22.04 Operating System Since ns-2.35 is too old, it needs the following packages gcc-4.8 g++-4.8 gawk and some more libraries Follow the video for more instructions So, here are the steps to install this software: To download and extract the ns2 software Download the software from the following link http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download Extract it to home folder and in my case its /home/pradeepkumar (I recommend to install it under your home folder) $ tar zxvf ns-allinone-2.35.tar.gz or Right click over the file and click extract here and select the home folder. $ sudo apt update $ sudo apt install build-essential autoconf automake libxmu-dev gawk To install gcc-4.8 and g++-4.8 $ sudo gedit /etc/apt/sources.list make an entry in the above file deb http://in.archive.ubuntu.com/ubuntu/ bionic main universe $ sudo apt update Since, it&#