Skip to main content
Till KTH:s startsida Till KTH:s startsida

* Contiki Minimal Router for IoT

Overview

The aim of this project is to implement an IPv6 router for IoT applications, on a resource-constrained embedded platform, in terms of CPU and Memory. We aim for a minimal router platform that  will be able to run at 32Mhz CPU clock, and use less than 32kB of RAM in total.

Motivation

Various IoT gateway solutions, for inter-connecting an IPv6 6LoWPAN with the Internet, have been proposed, implemented and demonstrated. Most of the approaches are based on expensive, complex, and energy-intensive hardware, and a  resource-hungry Linux image, on which a "Native 6LoWPAN Border Router" runs as an application.

Often, 802.15.4 connectivity is provided using an external MCU with a 802.15.4 RF module, interfaced with the Border Router using Serial or SPI connections and SLIP stack. SLIP/UART solutions are particularly inefficient, restricting the gateway traffic throughput to relatively low rates.

A more promising solution is an embedded gateway with multiple physical interfaces that needs no additional H/W and Software. Although such solutions exist, they are

  1. not general-purpose, i.e. limited to the particular physical network connectivity (e.g. Ethernet)
  2. providing limited network connectivity (e.g. NAT64 solutions for the IPv6 6LoWPAN network, no IP connectivity from the "outside" world) services
  3. not easily extendable, or dynamically configurable, depending on the network environment

A general-purpose IoT router

Our aim is to design a general-purpose IoT embedded router that overcomes the above limitations. In particular, our design provides the following functionality:

  1. Embedded router on a low-power MCU, for optimal energy performance
  2. Flexible, configurable management of the available physical interfaces (Ethernet, WiFi, 6LowPAN), with independent mode (Router, or Node) at each interface
  3. Fully IPv6 forwarding engine among the available interfaces
  4. IPv6 IN & OUT access to the 6LoWPAN sub-nets
  5. NAT64 services to the 6LoWPAN sub-nets, for talking to the IPv4 Internet

Contiki Router

Contiki OS is chosen as the operating system for the embedded router. Contiki OS is lightweight, energy-efficient, and has a rich IP stack that already supports lots of the desired features. It additionally includes libraries for most upper-layer networking features we need for network management:

  1. mDNS implementation for zero-configuration and host-name resolution in the IPv6 network
  2. CoAP server for network monitor and dynamic configuration
  3. HTTP server for content distribution

The outcome of this project is a fully-functional Contiki Router, deployed on the following IoT test-bed:

network_topology.png

[A higher resolution Figure of the topology can be downloaded here].

Technical Challenges that resulted in significant Contiki IPv6 stack enhancements

The following features were implemented as Contiki Network Stack extensions:

1. Extended 6LoWPAN engine for multiple de-fragmentation of frame streams

2. Efficient Route Aggregation in RPL networks, to increase solution scalability in dense 6LowPAN networks.

3. A complete multi-interface IPv6 network stack for Contiki as well as an optimized forwarding engine among the existing network interfaces

4. A minimal RIP implementation for talking to other IPv6 routers

5. Multi-radio module support for running physically isolated RPL instances at the same time in different channels.

Inter-domain routing with RIP

RIPng has been selected for its simplicity, as it only sends out two types of messages, requests and responses, where routers publish their complete routing tables. 

Contiki network stack implements RIP over UDP, using the socket engine. A Contiki Process for the RIP state machine was implemented, for periodic multicast of gratuitous RIP responses.

The RA structure of ND6 was, additionally, updated so the Contiki Router can publish Routing Options in RAs sent out to the connected hosts.

The above structure is shown in the following Figure [details here]

Detailed RIP/ND6

Network Stack for the Contiki Router

The network stack is fully compatible with the default NETSTACK/UIP stack of Contiki OS.

Extensions span through the whole top-down network stack, including low-level drivers for external peripherals, NETSTACK for link-layer stack components and an expansion for the Contiki UIP stack that has a multi-interface support (other than FALLBACK), and a related forwarding engine.

A higher resolution diagram for the proposed network stack can be downloaded here.

Stack

Test-bed Design

The Contiki Router is implemented on a Cortex-M3 platform. The Arduino Due has been chosen as the development board. 

ArduinoDue_Front_450px.jpg

Arduino Due offers a 512K of fash for program loading, and 96K of RAM, that is sufficient for the Contiki Router.

Communication

Ethernet connectivity is provided with a Microchip ENC424J600 module, connected to the ARduino over SPI.

ethernet_microchip.jpg  xbee.jpgfritz.JPG

WiFi connectivity is provided with a Fritz! 802.11n dongle connected to the Arduino over USB.

6LoWPAN connectivity is provided using DiGi XBEE 802.15.4 modules, connected over USART to the Arduino board.

Evaluation

We use Copper, a popular CoAP client plugin for Firefox, to talk to the Contiki Router and the RPL wireless nodes. Our monitoring infrastructure consists of a set of CoAP resources, that describe the status of the router, regarding:

 - IPv6 neighbors, routes and prefixes

 - Driver statistics

 - General information

copprer_node_stats.png

copper_router.png

Software sources

The project is hosted on Github. The complete software implementation will be available under BSD license shortly.