BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage Interviews Interview with Benjamin Cabé on the Eclipse M2M projects

Interview with Benjamin Cabé on the Eclipse M2M projects

Bookmarks
   

1. I’m here with Benjamin Cabé at EclipseCon 2013 and Ben is the chairman of the M2M Working Group and project lead of Mihini and Koneki, if I pronounced those correctly. So, perhaps you can start off by explaining to our viewers what M2M actually stands for and what the M2M Working Group is doing at Eclipse?

M2M is machine to machine so this is basically, if you go to Wikipedia what you will learn is that it’s connecting machines to each other, M2M generic term for all the technology enabling the connection of machins and to have them talk to each other, so for that you need special communication protocols, you need frameworks, you need tools. This is basically this ecosystem and machine to machine is a new term but still the technology has been around for a while, connected cars, connected houses, this is already happening. The initiative at Eclipse, we started that at the end of 2011 and the idea is that M2M as I said is starting to become more and more popular because there are so many objects that are now connected, the pacemaker of your grandmother, analysts say that by 2020 there will be tens of billions of objects communicating each other, but still today what we see on the market is that there are still so many proprietary stacks for doing machine to machine, proprietary communication protocols, proprietary SDKs, tools, so if we are to reach billions of devices by 2020 we need open source. So that’s why we created at Eclipse, this Industry Working Group, to work together in an open mode with the industry to come up with open standards and open source implementations of the technology we need to address the M2M problems.

   

2. What’s the Internet of Things, the IOT?

To me, this is pretty close but eventually if M2M is done right then we’ve achieved the Internet of Things all these objects. It’s just like the web, you can browse them, discover what data they have, what do they have to tell you and actually M2M is enabling the Internet of Things, once you have all the technology, all the ways to communicate between all the devices efficiently, then eventually you’ve build a web of things. Yes, both terms are pretty similar.

Alex: I guess with the Internet of Things or with machines that’s going on, a lot of the times people saw machines as something that you would tell them what to do and they would do something, turn the lights on, turn the lights off and so on. We’re seeing a lot more of devices being able to report on their current environment or sensors to be able to report back as well.

Yes. That is really the idea, you have these objects and you want them to report if we talk about temperature sensors, then yes of course, you are going to be interested in is the value of the temperature, but then this temperature sensor is probably getting internet connectivity via some router somewhere or it has a wireless modem built in maybe and then the status of this very modem you are interested in it as well, so you need to be able to monitor the sensor, to monitor the communicating devices and the other way around you need to control them, you need to turn the light on or off, as you said, to upgrade if you talk about the modem, again you may need to upgrade the modem over the air, you need back and forth communication and you need this to be secure and efficient because you do wireless. These are the challenges basically in the future.

   

3. You mentioned about getting together at Eclipse and providing open source projects, can you tell us a little bit about the M2M projects that are currently at Eclipse?

The three pillars basically of the M2M initiative at Eclipse, we think what is important for M2M solutions to be more popular and easier to develop, we think we need good tooling and historically you probably know that Eclipse has been an IDE. So we started by creating a project called Eclipse Koneki which delivers Eclipse plug-ins basically for helping M2M developers write the code of their embedded applications, so this is Koneki and it’s about the tools. Then comes the embedded framework, when you are doing M2M you have as I said embedded sensors, embedded wireless modems and you need to put some logic in them, you need to be able to program them, and for that you need a runtime technology and this is Eclipse Mihini, this is the project that was created the most recently under the umbrella of this working group. And then you develop applications on frameworks and then they need to communicate with the internet right so for that we deliver open source implementations of M2M communication protocols, they are meant to be efficient, they are meant to be secured and this is the Eclipse Paho project. These are all words from the Maori language, by the way, so sometimes they are hard to pronounce, many h’s and stuff.

   

4. You know what the translations are for them?

For Mihini, this is machine, Koneki is pretty much just like it sounds, it’s connecting, and Paho is communicating. So this is all in the same area, I guess.

   

5. Why was Lua chosen as the scripting language for the development tool and the runtime platform?

When you do machine to machine you have usually constrained devices, you talk about sensors, about wireless CPUs, a few megabytes of RAM, a few megabytes of flash, so you need a runtime that is really small but still allows you to have good performances and that is easy to program, the Lua programming language is actually a language that’s invented in 1993 with this exact need in mind, of being small, easy to learn, easy to interface with C as well, because when you do embedded usually you have legacy code that you want maybe to reuse. We thought that it would be a good idea to have not only a runtime easy to embed but since Lua is a scripting language then it’s also easy for people to learn how to program, basically when they program an M2M application using Eclipse Mihini and the Eclipse M2M technologies, they just script their M2M gateway, they take data out of sensors and in just a few lines of code they take this data, consolidate the data, maybe do some computing of averages and stuff and then report the data back to a server by simply scripting, no cross compilation, no C nightmare with memory management and stuff. That’s the main reason.

   

6. For people who haven’t come across Lua before, how would it compare with JavaScript in terms of its syntax or how you would use it, dynamically typed or static typed and so on?

It’s a dynamically typed language and to some extent it’s similar to JavaScript or to Ruby, the syntax is really easy to learn, in a couple of hours you can be Lua fluent and that’s really also why some many people actually embed Lua in their own runtimes, like Adobe, Blizzard with World of Warcraft they are all embedding Lua interpreter virtual machines so the users of these technologies can actually script their photo processing scripts or script the UI of the video game, it’s really easy.

   

7. And presumably Lua is both easy to embed and also license friendly, permissible to be able to do those things?

Absolutely. Lua is licensed under the MIT license and this is also a reason why we took it. For example, we are looking now at supporting Java inside our embedded framework, but it’s going to be more difficult in terms of licensing, getting a good Java implementation on an embedded device, it’s not as easy as getting just a VM, which is really meant to be embedded right from the beginning.

   

8. Now, you had a tutorial at EclipseCon that connected Raspberry Pi and Arduino together. For those who don’t know, can you explain a little bit about what a Raspberry Pi is, what an Arduino is and why you would need to have both of them talking to each other instead of perhaps just using one of them?

Yes, absolutely. So we had a tutorial on Monday where we wanted to show that the technology we are developing at Eclipse is running on open source hardware, so both Raspberry Pi and Arduino are open platforms for prototyping, this is really what they are meant for. The Arduino is actually, maybe you guys are familiar with it, this little device which is actually a micro-controller which comes with a very simple C based language for programming general purpose inputs and outputs, you can control LEDs, relays, you can read values out of temperature sensors and it’s really easy to program and also it’s really meant for prototyping in that if you do something wrong, it’s really unlikely that you will fry the board, it’s really for kids, teenagers, makers of all kinds. So we used this device as part of the tutorial for wiring a few sensors on it and then what we wanted to do is use this guy, which is the Raspberry Pi, it’s basically a full-fledged computer, it’s just that it’s small, it’s a Linux capable computer that we use for running Mihini, so we have this embedded runtime that allows to program into applications and what we need is just to have these two guys communicate over serial communication so as on the Arduino we can easily plug the sensors without being afraid of doing something wrong with the electronics, we can just plug the sensors. And then on the Raspberry Pi we use serial communication, this serial communication API is in Mihini, to read the data out of the sensors that are connected to the Arduino and then in Lua code consolidate this data and report the data back to a server and that’s the idea. And the reason, back to your question, why we use the Arduino for wiring the sensors instead of using actually the inputs and outputs of this system here, it’s just that I don’t want to fry this guy here, it’s more fragile. Also, the reason why we have this approach where we have the sensors on one end and the M2M gateway on the other is that this is what happens in the real world, you have sensors that are already spread out in the factory or in your building and are just here, and are already accessible using a specific protocol and what you want to do when doing M2M is bridge them to the internet, so you use a Raspberry Pi, you use whatever Linux gateway, whatever embedded gateway for reading the data out of the sensors and reporting that back to the server. So, that is what we were replicating during the tutorial.

   

9. What is the difference in programming the two devices in terms of how you actually achieve it? You mentioned that the Arduino has a C based syntax, but does that actually get on to the device?

So, the Arduino comes with a very user friendly IDE, which is readable on the arduino.cc website, I guess, which is really easy to master, comes with lots of examples and so you write this C code which is actually the firmware, the binary code, that you will directly flash into the micro-controller using USB communication. You just have to write a few lines of C code and deploy that on the micro-controller. But then this is just a micro-controller, you don’t have a file system, you don’t have what Linux would bring you, whereas when you use the Raspberry Pi, this is a PC, when you receive your Raspberry Pi you get an SD card and you flash a Linux distribution inside the SD card and then you start using it just like you would use a PC, so this is a Debian distribution by default by the way, so you will use the package manager to install Python and then if your language of choice is Python you can use Python for programming the Raspberry Pi but if you want to use Java you can do that as well, install OpenJDK and stuff, and if you want to use Mihini, then you install the Mihini runtime that you get from the Eclipse Mihini project and by using the Koneki development tools you can easily connect to the Raspberry Pi and deploy your script remotely, debug them over the air and you get basically a complete IDE for doing M2M on that kind of platform.

Alex: So, the Arduino you are using to hook up to sensors and then in essence materialize that data via a serial cable to the Raspberry Pi and the Raspberry Pi is then doing if you like the heavy lifting or transporting of that data and sending it elsewhere.

And getting you the internet connectivity as well. Again, this is just a micro-controller, so getting this guy connected to the internet would probably be feasible, but complex, you can have extensions, Ethernet extensions, but you then need to have a TCP/IP stack inside the micro-controller, and maybe you don’t have room, you will be able to do TCP but not SSL if you need security, you need a fully capable computer or at least have a decent enough stack for doing M2M and this is what the Raspberry Pi provides you with, if you also want to use Mihini for having network connectivity management, like by default you would use the Ethernet connection of the Raspberry Pi, but if for some reason the Ethernet connection is down, then you will fall back on 3G connection if you have a 3G modem connected to the Raspberry Pi, and Mihini can take care of this network management for you.

   

10. What kind of sensors can you plug into an Arduino, what kind of projects have you used the Arduino for?

So many sensors that you can hook to the Arduino; again if you look at the website at what the community is coming up with, you can control coffee machines, we have in the Eclipse M2M community the guy who invented MQTT, of which we’ll talk about probably in a few minutes, at his house he’s monitoring even his mouse trap using Arduino, you can plug pretty much everything you want, you can plug also display devices, LCDs and pretty much anything you can imagine.

   

11. Can you hook it up to motors or use it to investigate robotics?

In the tutorial what we are replicating even though we didn’t have all the hardware for doing that, we were replicating a use case where you monitor a greenhouse, so you want to monitor the humidity, the temperature, the luminosity, and then the other way around you want to be able to control your greenhouse, so for that we hooked up to the Arduino a servo motor to be able to open the roof of the greenhouse, so you can definitely also drive motors and create robots and whatever.

   

12. You mentioned MQTT. Can you explain what the acronym stands for and what it’s used for?

MQTT stands for Message Queue Telemetry Transport and this is a protocol that was co-invented by IBM and Eurotech back in the late 90s for doing sensors monitoring and sensors data reporting, so this is a messaging protocol based on publish/subscribe mechanism basically which is on top of TCP, very lightweight and it’s meant for publishing and broadcasting data coming and flowing from sensors and MQTT is currently being developed as part of the Eclipse Paho project, you have reference implementations for the protocol as part of Eclipse Paho.

   

13. And is MQTT specific to a particular programming language?

I think MQTT comes with implementations for almost 50 languages so the specification is very simple, it’s just a messaging protocol and there are implementations in Python, in Java, in Ruby, both client side and server side as well.

Alex: And presumably the specification lists out the binary layer on the wire, so that other languages can be added in the future as well and you can have interoperation between languages.

Yes, absolutely. But also, what the Working Group is currently looking at as well is that MQTT is like I said messaging protocol, as you said, binary speaking the transport layer is specified but it’s up to the user to put what he or she wants inside the payload of the messages and what we see more and more in M2M is that being payload agnostic on the long run is not going to work, because if you want to enable the Internet of Things then when you have a sensor communicating with the internet you need to know what is the data that it reports, is it a string, is it an integer, even if it’s an integer is it a temperature, is it a luminosity, so we are investing in the M2M Industry Working Group, in the Paho project at adding new protocols or extending Paho so as we can bring more logic inside the protocols we use, so as we can keep the bandwidth efficiency, which is very important when you do wireless, but also to bring more meaning inside the M2M packets. So this is what we have on our plate for the communication protocols.

   

14. You mentioned about the efficiency of the wireless there, why doesn’t everyone just use Wi-Fi on these devices and not worry about the data they send?

Because for example, remember we talked about billions of devices, you have this house up on the hill that has a solar panel producing electricity for the house and you want to be able to monitor remotely whether the solar panel is working correctly, then it’s very unlikely that you will be able to use Wi-Fi for that, you will probably use 3G, LTE, 2G or SMS based communication maybe and you will want to report once an hour, once a day the status of the device, you want to be able to contact the device, to reboot it remotely maybe, this will be done using a wireless 3G-like communication and bandwidth costs money, right? If you want to be able to save money when you control these devices, then the protocol needs to take care of that

Alex: I guess with solar panels they are producing their own electricity, but if you’ve got devices as small as these ones presumably they can be powered by batteries as well.

Yes, absolutely. Actually even the Raspberry Pi can be battery powered.

   

15. Ok. So, finally, what’s the future plans for the M2M project in the Working Group and Eclipse and when do you see the first releases of these projects being released as a 1.0 version rather than incubator projects?

That’s right, we still have incubator projects. The Koneki project has had two releases already, 0.8 and 0.9, providing tools for Lua developers and then what we would like to come up with is actually having a one stop shop for M2M developers, as you said a 1.0 release where you can pretty much download you can get Eclipse for Java development, Eclipse for C development, what we would like to come up with is an Eclipse distribution for M2M developers that comes with all the tools for doing Lua development, all the tooling for monitoring your MQTT packets or monitoring your M2M communications, and the idea would be in the next months to really agree on what we want to do and the 1.0 release is on the plate for 2014, so that’s converging these three projects. Maybe we will also have new projects joining, like I said for today we have Lua support in the embedded framework, but we would like to enable embedded development for more than just the Lua programming language, what if you want to use Java, what if you want to use Python, so maybe further down the road we will have other people joining us and enhancing and enriching the framework with new language bindings, so that’s one approach. What we would also like to work on is really build a community of developers, this is what the Eclipse ecosystem is good at, right? Having a vivid community of developers so we have this tutorial we’ve done earlier at EclipseCon and we will be sharing all the information for people to replicate it and what we would like to do is just like this guy I mentioned who connected his house and his mouse trap using Arduinos, what if you would be using Mihini, you’d have even more features in terms of data reporting etc., so that’s what we would like having more and more people come hack with us, coming from the maker community and so as on the long run the industry starts also adopting what will eventually become kind of a de facto standard

Alex: Benjamin Cabé, thank you very much.

Welcome.

May 23, 2013

BT