Categories
Eclipse IoT

Remote management of an ARM mbed device using LwM2M, Wakaama & Leshan

One of the great strengths of LightweightM2M (LwM2M) is to be… ahem… lightweight! The fact that it relies on CoAP for the communication, and that all the standard resources are meant to be very concise really helps making very small implementations that can fit in constrained devices.

In the video below, you can see how Eclipse Wakaama (a C implementation of LwM2M) has been ported to an mbed NXP LPC1768 – a device with just 32KB of RAM! – and is controlled from Eclipse Leshan, a LwM2M server in Java.

What I really like in this video is that it shows how simple yet powerful LwM2M actually is, and how efficiently you can fit advanced features like firmware upgrade in very constrained devices.

View the video on YouTube

Categories
Eclipse IoT

Bridging IoTivity and Eclipse SmartHome

There are several ongoing initiatives that aim at standardizing protocols and interfaces in order to enable a truly interoperable Internet of Things.
On the protocol front, I would certainly argue that the technology is already there and over the last decade standards organizations like OASIS, IETF or the Bluetooth SIG have done a lot to provide clear specifications for, respectively, MQTT, CoAP, or Bluetooth Smart. Not only are these protocols mature, but they really are optimized for the constrained networks that make IoT. And of course, there is an always growing ecosystem of open-source implementations.

What is interesting to see though, is the work being done by the likes of the Allseen Alliance (with Alljoyn) and the Open Interconnect Consortium (with Iotivity) when it comes to:

  • Advertisement/Discovery: while the aforementioned protocols provide ways to do one-to-many communications, this isn’t quite enough if there is no agreed upon methodology for devices and applications to make themselves known to the world,
  • Interoperability: protocols like MQTT or CoAP provide you with what is more or less a simple bit pipe, that allow you to connect things to each other, while certainly not guaranteeing that they will understand each other. Implementing IoT communications is not only about making the data flow, but also, and more importantly, making sure the associated metadata (“what is this temperature’s unit?”, “oh, and by the way is this really a temperature?”) is understood by all the parties involved,
  • Provisioning: it is important to be able to provision a brand-new device on an existing IoT network, and to be able to associate all the required security credentials that will make it able to speak with its peers. Security at the transport layer is one thing, having access to a flexible model for configuring secured communication channels is another, that initiatives like LwM2M or IoTivity are trying to address.

While it is hard to tell what will become *the* standard for IoT between AllJoyn, OIC, now Google with Weave – and certainly many others – it is however interesting to start evaluating the pros and cons of all these solutions. Interesting fact: since most of these initiatives are embracing existing protocols like CoAP or MQTT, it’s actually pretty easy to start coupling them to the Eclipse IoT technology.

In the video below, you will see how you can interact with IoTivity-compatible devices from Eclipse Smarthome, thanks to a dedicated binding1 which you can find here.

The videos goes through the following steps:

  • Introduction to IoTivity
  • 1:28 – Setting up SmartHome with the IoTivity binding
  • 3:11 – Discover an IoTivity “thing”
  • 6:16 – Manually configure a Kinoma Create exposed as an IoTivity “thing”

1. Please note that this is absolutely not production-ready 🙂 The OIC standard isn’t publicly available so this implementation is only covering basic use cases featured in the IoTivity examples. Also, this binding uses a slightly patched version of Californium to allow for multicast CoAP communications.

Categories
Eclipse IoT Non classé

Running Eclipse Mosquitto on Snappy Ubuntu Core

I’ve recently been playing around with Snappy Ubuntu Core, and I thought it would be a nice exercise to try and package Mosquitto as a so-called “Snap”.

This blog post will give you a quick introduction to Snappy, and what it means to have a technology like Mosquitto available as a snap package.

Snappy Ubuntu Core

snappy

Ubuntu Core is a minimal Ubuntu distribution, that doesn’t come with the classical, APT-based, package manager.
Ubuntu Core is targeting cloud & IoT environments, therefore it is using an approach where the applications or services that one installs in a given distro, are self-contained “snaps”, that are completely isolated from the rest of the environment. If a snap depends on a shared library, this library will be bundled with the snap. If a snap needs to be granted rights beyond the scope of their default sandboxed container, it will be specified in the snap metadata. And so on.

Why does it matter for the Internet of Things?

Being able to transactionally update a system definitely makes sense for cloud environments, but it is also key for Internet of Things solutions. Even more so if you take into account how easy it is to fire up a new EC2 machine for a system you just crashed, vs. actually going on the field to troubleshoot an IoT gateway that went off the network after a failed update…

Furthermore, IoT gateways today are operating a very limited set of services, since there’s no clean and safe way to really turn them into extensible platforms, where any partner involved in developing a given solution would be able to run its own bits, in dedicated sandboxes. Application frameworks like Kura certainly enable such things at the application level, but we need solutions like Ubuntu Core for anything closer to the system.

Mosquitto on Snappy Ubuntu Core

If you have ever played with MQTT, there’s a good chance that you have used Eclipse Mosquitto as your broker. It is a very customizable, feature-packed, broker that has recently added support for MQTT over WebSockets. Mosquitto is available in source form, but it is also distributed in binary form and as a ready-to-use package in many Linux distros.

The Mosquitto Snappy package contains a WebSockets-ready version of Mosquitto 1.4.2 that can run on x64 or ARM architectures. Therefore, you are literally 2 minutes away from having an up-and-running Mosquitto broker on Microsoft Azure, Amazon EC2, or Google Compute Engine. Since Ubuntu Core is also available for the Raspberry Pi and the BeagleBone Black, you can install Mosquitto on those platform as well.

If you want to try it yourself on EC2, for example, you can follow this tutorial to bootstrap your Ubuntu Core image. Once you have a shell access to your Core server, simply run sudo snappy install mosquitto.kartben, and Mosquitto will be automatically downloaded from the Ubuntu Software Store, and installed. WebSockets are enabled on port 8080 and as a matter of fact, I have also packaged a few extra resources with the broker to help you get started: if you open http://{myubuntucoreIP}:8080 in your browser, you will be granted with a web page that helps making sure you use the right connection settings, and also with a live visualization of your topics’ activity.

screenshot