First Steps with Contiki OS: Why Contiki OS?

What is Contiki OS and why would you probably care?

First Steps with Contiki OS: Why Contiki OS?

Sometime ago I build an actor to replace my dumb Junkers room thermostat with something even dumber, but controllable so my smart home system can device how much should be generated. Long story, I created a prototype based on an Arduino and the prototyping shield and hooked it up via USB and it worked fine. But this USB cable was annoying me. Since I can power this device over the wires from the old thermostat (called a “1–2–4”-bus and it gives you 24V) it should be completely wireless.

So I started looking around at wireless technologies to use with an Arduino in a smart home environment. I found projects based on some transceivers by Nordic Semiconductor or the infamous RFM12B. I also found projects where people build slave devices for existing smart home rf technologies like Homematic or Z-Wave. But implementing a custom rf protocol didn’t seem like a smart idea. Using an existing home automation rf protocol could seem like an smart idea from the outside, but once you gain intimate knowledge of such protocols you will think otherwise. So I started to ask myself what do I expect from a good home automation centric rf protocol?

  • openness
  • security
  • reliability
  • meshing
  • low power requirements
  • low processing requirements (should run on microprocessors)

Protocols like FS20 are neither secure nor reliable or anything else except that they use very little power. Homematic is more reliable, a little bit more secure but can’t do meshing and just doesn’t look nice on the protocol level. Since I work a lot with it, I looked closer at Z-Wave since it an do meshing. But the meshing implementation of Z-Wave doesn’t seem very well engineered and it uses a lot more power (meshing routers can’t be battery operated for example). Also Z-Wave is not open (you have to be an alliance member) and even the documentation for alliance members is unreliable at best.

In the end I remembered a technology called 6loWPAN. This acronym stand for “IPv6 over low powered Wireless Personal Area Networks”. It works on 2,4 GHz (or 868 MHz/915Mhz depending on your geographical region) and allows you to do meshing, it should reliable enough since it is using IPv6 and is completely open since it is a common standard. In the end this will enable to talk to your sensors and actors like they are just on your normal network!

When searching for 6loWPAN stacks for embedded devices you will quickly stumble upon Contiki OS. Don’t be fooled by the “OS” in the title, while this can actually classify as an operating system in the strict sense it only needs a few kB of ROM and about 10kB of RAM. Rather than developing a custom (and most probably really shitty) rf protocol Contiki OS enables me to use 6loWPAN on embedded devices like ATMEL microprocessors

But before you break out in frantic cries of joy, there are also some downsides. Currently Contiki OS doesn’t have security on the network layer implemented. You can use TLS (or DTLS) for your protocols but you should be aware that currently the MAC layer is not enrypted. The other downside is simply that you won’t that much information around Contiki OS in the net. There is some documentation and some pages from universities using Contiki OS in their studies, but either these are outdated or sometimes are lacking basic information on how to get up and running with Contiki OS.

So with the next blog posts I will shed a light on how I will get Contiki OS running. As a hardware platform I choose the deRFmega128 modules from dresden elektronik. The modules are reasonibly priced and use the atmega128rfa1 microcontroller with integrated 2,4 GHz transceiver from ATMEL which already supported by Contiki OS (or so they claim, I will see once the hardware arrives). As connection to my home automation system I choose the RZUSB Stick from the Atmel 802.15.4 evaluation kit. You can get it for around 40€ from farnell and together with Contiki OS it should be possible to create an USB based border router which recognized as an USB modem by the operating system. Until the hardware arrives I will try to get Contiki OS compiled for these 2 systems with a meaningful configuration.

Wed Mar 11, 2015