Thursday, December 26, 2024

Contiki For Converting Embedded Into The IoT

- Advertisement -

We are in an era of rapidly-developing electronics of embedded systems, efficient processors, the Internet of Things (IoT) and miniature chips. To aid with one’s design process in this fast-paced scenario, here is an operating system (OS) that is specially designed to connect tiny, low-cost and low-power microcontrollers (MCUs) to the Internet—Contiki.

Contiki has been developed with an aim to connect embedded system designs to the Internet. The OS is customised to enable fast and easy development and inter-operate with most readily-available MCUs. The design is optimised for low-power applications, what with minimal power consumption being the driving factor behind most IoT applications today. This article tries to have a look at what Contiki offers for the IoT and for easy development.

Ease through the protocol maze

It is well-known that working with any IoT product demands adhering to stringent norms and protocols. While the idea of implementing these from scratch demands a lot of work and re-work from the developing team, it is a relatively smooth sail once the base is set. Contiki is modelled over Internet Protocol (IP) suite and offers support to the standard User Datagram Protocol (UDP), Transmission Control Protocol (TCP) and Hypertext Transfer Protocol (HTTP).

- Advertisement -

fig-1

box-1

For simple applications like alerting your friend or for applications where bandwidth is premium, it might be wise to shy away from elaborate or complex designs. For such situations, Contiki comes up with Rime, a tailored wireless networking stack that can extend to operations like address-free multi-hop. Rime stack works by offering a default set of communication primitives for low-power wireless systems, which can be executed on their own or combined with complex ones.

A low-power focus. With IoT designs focussing on reducing power consumption to bare-minimal levels, this OS lets one work easily with new-age, low-power protocol standards. The recently-standardised Internet Engineering Task Force (IETF) protocols for low-power IPv6 networking, including IPv6 over Low-power Wireless Personal Area Network (6LoWPAN) adaptation layer, Routing Protocol for Low-power (RPL) IPv6 multi-hop routing protocol and Constrained Application Protocol (CoAP) RESTful application-layer protocol, are also supported.

To further build optimised designs, this OS lets one calculate the power consumption of the system and figure out the power-loss graph. Relay nodes in the wireless network, which simply transmit information from one node to the next, are monitored by ContikiMAC radio duty cycling mechanism that wakes these up when duty calls. The developers fondly call these relay nodes as sleepy routers.

Beat the memory hassle

The biggest problem as one moves into smaller and smaller devices is fitting the required amount of memory into the device. Managing access between the available locations is not easy either. This entire process seems to be made a lot easier with Contiki, owing to its efficient memory-handling mechanism.
Requiring less than 10kB random-access memory (RAM) and 30kB read-only memory (ROM), there are specific instructions for block allocations, and it also uses a mixture of event-driven and multi-threaded programming mechanisms. This concept, called protothreads, allows saving memory, while providing a neat code-control flow. The kernel, when triggered by signals like internal timers or external sensors, invokes the protothread.

As refreshing as coffee. One might wonder how coffee comes into the picture in an article about an OS. Well, that is what the developers call their lightweight flash file system! Just like a cup of coffee to ease tension, Coffee lets application programs seamlessly access external flash memory, without having to worry about either clearing flash before use or flash wear-levelling.

box-2

Providing advanced capabilities

The environment of Contiki is built to assist designers develop the perfect code. The basics are simple with coding in standard C language. Cooja Network Simulator, the simulation environment for Contiki, lets the designer visualise a large-scale network operation or even emulate it on hardware. A dynamic module-loading feature allows one to modify designs even during run-time, easing the debug process.
In addition to features like multi-threading and protothreads, Contiki allows for multi-tasking and inter-process communication using messages passing through events. The user can also choose to work with a graphical user interface via direct graphic support or networked remote display with virtual network computing. The OS also claims to support the world’s smallest Web browser.

As Wikipedia puts it, “Contiki is an OS for networked, memory-constrained systems with a focus on low-power wireless IoT devices.” Specifications of a typical Contiki system are a few kilobytes of memory, milli-watt power consumption, processing speed in the order of megahertz and a bandwidth the order of about hundreds of kilobytes. With such features and specifications, the OS seems to promise substantial work in the coming years.


Priya Ravindran is a freelance writer with EFY

Simulating with Cooja

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Electronics News

Truly Innovative Electronics

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics