6LoWPAN part 2 – Building Contiki on Windows

Getting started

Following on from my previous post about wanting to experiment with 6LoWPAN and Contiki, I suppose I’d better do something. First things first. I needed to download Contiki and get it building. I’ve got a few options.

A Linux VM

The official guide pointed me towards using a pre-configured “Instant Contiki” Ubuntu VM and that certainly works. I needed to install and setup VMWare but that wasn’t too bad. It’s probably time I played around with Linux a bit more, so I also installed Linux Mint (easier for newbies) in a VM too.

Cygwin

There was also a guide on Sun May Sky about using Cygwin on Windows. I’m sure this works as described and I was about to give it a try, but then I though “Cygwin? Isn’t that a little outdated for Windows 10?”

Bash on Ubuntu on Windows

ubutntu-on-windows-10-logo-bannerWhen I first wrote this guide, the version of Windows was the 1607 “Anniversary Update” and the Bash shell was available but as a slightly hidden developer-only feature. I’ve updated it for the latest (at time of update) Windows 1709 “Creator’s Update”. To get things working in 1709 just install Ubuntu from the Windows store and type “ubuntu” to run.

The only thing worth mentioning is that your C drive will appear as /mnt/c rather than Cygwin’s /cygdrive/c.

YaKai Chen’s Cygwin guide mentioned installing the ARM GNU Compiler toolchain and adding the installation folder to the path. The default Windows installation path with spaces and (x86) is awkward to use in Linux and it turns out it isn’t even necessary.
I went to build a Contiki component with a make command and was told that it wasn’t installed. “sudo apt-get install make” solved that.

build-error-1-armYou’ll notice the make failed with arm-none-eabi-gcc not found, so I tried just entering arm-none-eabi-gcc. A very helpful prompt told me that apt-get install gcc-arm-none-eabi might solve my woes. And it did.

build-error-2-srecordTime to try that make again… OK, this time srec_cat was the missing culprit, but just typing srec_cat told me what needed to be installed. Simply apt-get install srecord and I was ready for attempt #3… and success.

build-error-3-successThat seemed easy! Don’t tell anyone, but I might get to like this new Bash shell. Now to get something meaningful working…

Advertisements

6LowPAN (part 1) – discovering sub 1GHz mesh networking

What?

So, party inspired by my not particularly successful Tado teardown I’ve decided to play around with 6LowPAN. “What’s 6LowPAN?” you may ask. Well, it IPv6 networking over Low power Wireless Personal Area Networks. That’s what Tado uses to communicate between its components and I thought I might re-purpose their gateway for this. Unfortunately it uses a slightly out of data Stellaris microcontroller and getting this working was awkward. I got bored with it.

6lowpan_mesh

Why?

The ultimate goal would be to have drop-in smart light switches that link up in a mesh and can be controlled remotely home-automation style. Ideally I’d like something that:

  • can report its status back (unlike some commercial offerings)
  • is battery powered so that there’s no need for a neutral connection in the switch
  • doesn’t leech power through the load – that’s cheating and won’t work well with LED lighting
  • can operate as a separate manual switch in case the network is down

How far will I get with this? Who knows. Let’s see.

How?

6LoWPAN can sometimes be over a 2.4GHz network (like Zigbee) but I’m going to go with Sub-1GHz for better range through walls and hopefully as far as my garden office / workshop. TI do a nice range of Sub-1GHz ARm microcontrollers. I got myself some CC1310 launchpads and a CC1350 launchpad too for good measure.

As far as software goes, it looks like Contiki is a good place to start. It’s a RTOS designed exactly for 6LoWPAN. It looks pretty good, but despite the best efforts of the creators I must admit it doesn’t seem easy to get started with. There is some helpful stuff over at Sun May Sky which I believe is maintained by YiKai Chen who you’ll also find helping out over on the TI E2E Community.

Getting started

First things first. I needed to download Contiki and get it building. The official guide pointed me towards using a pre-configured “Instant Contiki” Ubuntu VM and that certainly works. There was also a guide on Sun May Sky about using Cygwin on Windows. I had some minor trouble with that so thought I’d try out the new Ubuntu bash shell that’s (a hidden) part of the latest Windows 10 builds. That seemed to work well, so I thought I’d add my own guide.