Skip to main content

title

The open source operating system for the IoT on the new TI SensorTag

TI's second generation SensorTag is crammed full of features and boasts no less than 10 sensors, together with a capable CC2650 2.4GHz multi-standard wireless MCU at its heart, making it a powerful platform for prototyping IoT applications. There is no shortage of options when it comes to developing firmware for the SensorTag either, and in this post we'll take a look at the equally featured packed open source O/S for networked memory-constrained systems, Contiki.

Low power, multi-tasking and 6LoWPAN support

title

Cooja Contiki network simulation with 41 nodes. Source: wikimedia.org, CC BY-SA 3.0.

Contiki is designed from the outset for devices that are constrained in terms of memory, power supply, processing power and communication bandwidth. With support for microcontrollers including ARM and AVR devices from Atmel, NXP LPC2103 (ARM), dsPIC and PIC32 from Microchip, and numerous devices from Texas Instruments, including of course the CC2650.

Support is provided by Contiki for IPv4, IPv6 and also Rime, a hierarchical set of custom lightweight networking protocols, that range from anonymous broadcasting to mesh network routing and are designed specifically for low power wireless networks.

The IPv6 stack notably includes support for 6LoWPAN, which extends the features and scaling of IPv6 to low power and potentially lossy IEEE802.15.4 wireless networks. This is particularly interesting as it provides the infrastructure for creating device networks which are based on open standards, built for the future and with IPv4 interoperability via network address translation.

Contiki manages to fit all of this, along with a multitasking kernel, into about 10 kilobytes of RAM. Other optional features include pre-emptive multithreading, a web server, windowing system and even a web browser (using remote display over VNC).

A simulator called COOJA that has been designed specifically for wireless sensor networks is also available, which actually compiles and executes a Contiki system for each node in the network.

CC26xx Contiki examples

title

Source: ti.com, CC BY-SA 3.0.

TI provide three Contiki examples for use with the CC2650 SensorTag, which demonstrate its basic capabilities, mesh networking and a very low power consumption mode.

The cc26xx-demo showcases basic Contiki operation. Sensors and buttons are read and data output to the serial port, and Blueooth Low Energy (BLE) beacon is started and can be picked up by e.g. a suitable smartphone. Other suitably configured nodes can also be pinged via IPv6.

title

Source: ti.com, CC BY-SA 3.0.

In order to use the cc26xx-web-demo it's necessary to set up an edge router, with an example configuration provided that uses a BeagleBone Black and USB connected sub-1GHz or 2.4GHz RF interface. SensorTag mesh nodes provide a web server that is used to display sensor readings and to configure an MQTT client, which is then able to publish messages to an MQTT broker either locally or, for example, to the IBM Bluemix cloud service. A CoAP server is also provided to set and get resources, along with a network-based UART and once again a BLE beacon.

title

Viewing CoAP resources with the Copper add-on for Firefox. Source: ti.com, CC BY-SA 3.0.

The final example, very-sleepy-demo, starts in normal mode and for a predetermined period of time the SensorTag is accessible and can be configured via CoAP. It then switches into very sleepy mode and becomes mostly unreachable, waking only to perform network maintenance tasks.

Sources and toolchain

The Contiki source code can be found on GitHub and this includes the cc26xx examples.

A GCC ARM embedded toolchain is required in order to build applications, which is available in some Linux distros via the package repositories, whereas in others one may need to be installed from a tarball or perhaps built from source. With either of the latter it will probably be necessary to also set your path, so that the executables are found when invoked from project makefiles.

Alternatively, Instant Contiki may be used, which is an Ubuntu virtual machine with all the required software pre-installed and that simply requires VMWare player to use.

Building and flashing

title

With the sources downloaded, a toolchain installed and in your path, building the examples is trivial and simply a matter of running make! These can then be uploaded to the SensorTag via the Debug DevPack and the SmartRF Flash Programmer 2.0 (Windows) or CCS Uniflash (Windows/Linux).

Conclusion

Contiki provides a feature rich platform for building scalable IoT applications and TI have clearly put quite a bit of effort into supporting it on the new SensorTag. Furthermore, it's great to see that this support has been pushed “upstream” and into the main Contiki development repository, rather than residing in a TI-specific version located elsewhere.

Andrew Back

Top image: 6LoWPAN Mesh. Source: ti.com, CC BY-SA 3.0.

BUY A SensorTag

Open source (hardware and software!) advocate, Treasurer and Director of the Free and Open Source Silicon Foundation, organiser of Wuthering Bytes technology festival and founder of the Open Source Hardware User Group.