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 ns-3.34 in Ubuntu 20.04

This post shows how to install ns 3.34 in Ubuntu 20.04 LTS Prerequisites: Fresh installation of Ubuntu Version 20.04 LTS  ns3.34 can be downloaded from here Follow the video link for complete step by step instructions on the installation.  This version fixes the compilation issues of vanet-routing-compare.cc (bug in ns3.33)  Issue the following commands after opening a terminal  $ sudo apt update $ sudo apt install g++ python3 python3-dev python-dev pkg-config sqlite3 python3-setuptools git qt5-default 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 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev tcpdump wireshark libxml2 libxml2-dev Unzip or untar the ns-allinone-3.34.tar.bz2 in the home folder (in my case its /home/pradeepkumar) $ cd ns-allinone-3.34/ $ ./build.py --enable-examples --enable-tests  Once the installation is completed, you may get an output show

Installation of ns3 in Windows 10 and Windows 11 OS using WSL (Windows Subsystem for Linux)

This post shows how to install ns-3.33 in Windows 10 through WSL (Windows Subsystem for Linux) This posts works for Windows 11 also (I have tested it on a Windows 11 ISO and it works the Same way as mentioned in the following post.) This post will work for ns-3.3x version. Prerequisites : Install Windows Subsystem for Linux with GUI: Please refer the following video  System Information: OS used: Windows 10 and WSL (Ubuntu 20.04) GUI: XServer for Windows NS3 Version: ns-3.33 See the following complete video on how to install ns3 in Windows 10 Step 0 : Open XLaunch Step 1 :  Open WSL using PowerShell and open it as Administrator Command:/  wsl $ xfce4-session The GUI of Ubuntu Opens within Windows 10 OS. Step 2 : Download ns3 from nsnam.org website through Mozilla Firefox browser Step 3: Open a Terminal  $ sudo apt update $ sudo apt install build-essential autoconf automake libxmu-dev python3-pygraphviz cvs mercurial bzr git cmake p7zip-full python3-matplotlib python-tk python3-dev qt5-q

Installing NS-3.32 in Ubuntu 20.04

This is about installing ns version 3.32 in Ubuntu 20.04 LTS. #ns3 #ns3 .32 #networksimulation The commands used in the video are given here. $] sudo apt update $] sudo apt install build-essential autoconf automake libxmu-dev python3-pygraphviz cvs mercurial bzr git cmake p7zip-full python3-matplotlib python-tk python3-dev qt5-qmake qt5-default gnuplot-x11 wireshark Download the ns-allinone-3.32.tar.bz2 package from nsnam.org and copy it to /home/ folder See the full video for detailed instructions Extract it either in GUI or using command $] tar jxvf ns-allinone-3.32.tar.bz2 $] cd ns-allinone-3.32/ $] ./build.py --enable-examples --enable-tests The above command will take some time to install all the packages  You can see the output as shown below ns3 To check whether ns3 installed successfully, use the following commands. $] cd ns-3.32/ $] ./waf --run hello-simulator You should get the output as Hello Simulator $] ./waf --run first This is the example from the ns-3.32/exa