Embedded development has always been a bit of a mystery to me, with all of the low-level code work and the limited functionality of the tools. But I may start exploring the world of embedded development because I'm intrigued by IBM's Mote Runner SDK. Here's what I've learned about Mote Runner, including what it is and how developers can start programming with it.
What is Mote Runner?
Mote Runner is an SDK that allows applications to interact with "Motes." The Motes are sensors that can detect a variety of things (such as temperature, humidity, sound, motion, and acceleration) and report their reading via wireless networks. You write code against the Mote Runner SDK in Java or C# in the Eclipse environment, and the code gets turned into Mote Runner bytecode by the compiler to be deployed to the Motes.
What you need to get started
On the hardware side of things, the Motes are pretty compact and contain everything they need to run, including the wireless transmitter. The wireless networking is pretty robust, and the manufacturer claims that it has been able to transmit up to 500 meters (with line-of-sight) without needing a signal boost.
In addition, the Motes create a mesh network that can extend as far as needed by adding new Motes to the deployment. You will need a gateway to connect your PC to the Mote network. You can also connect the Motes directly to a computer using a serial connector, a USB, and other connections. Either way, you will need to be connected to the Motes in order to deploy your code to them.
The Motes have a connector for the sensor boards, so you can mix-and-match your components as needed. The Motes can be powered either by a pair of AA batteries or through a standard Molex adapter (in case they are part of a larger component with its own power supply).
You will also need to flash a replacement firmware onto the Motes before they will work with Mote Runner.
What you need installed
You need to have Eclipse installed and JRE/JDK 6. Then you can install the Mote Runner SDK (which is currently in beta); this installs an Eclipse plugin that allows you to start programming for Mote Runner.
In addition to the APIs that you would expect and the documentation, it also provides a Mote simulator so that you do not need to actually work with Mote hardware to start programming.
If you plan on working in C#, you will either need to have the .NET Framework installed or have Mono installed (on Linux, Mac, etc.). When I tried to get the Mote Runner SDK installed on my Windows 7 machine, the experience was definitely beta quality on the "fit and finish," but I followed the instructions without any issues.
Reading through the documentation (which is surprisingly good considering the stage of development it is in), I learned that the basic programming model is that your application will need to create a timer and, when the timer fires, that is when you read your data and take the appropriate actions. There is no interface to implement that will be called by the system. The alternative to a timer would be an endless loop, but that would drain the batteries pretty quickly. It feels like there is an art to selecting the right timer delay to get the minimum resolution that your application requires to maximize battery life. There is a standard command to read sensor data, and you provide it with the sensor type, a sensor offset (in case there are multiple sensors of the same type), a byte array for the data, and a read offset and length. How you interpret the read data is determined by the sensor.
Something else I read in the documentation is that your Java or C# is not being run on the JDK or .NET CLR (or even the Mono CLR) that you may be used to. As a result of the Mote Runner system using a customer bytecode environment, some of the things that you may be used to are not there or are changed. For example, there is no 64-bit math, and longs are implemented as 32-bits, and ints are 16 bits. There is also no reflection, threading, and more. You will want to take a look at the documentation for details.
After reading the Mote Runner documentation for about 20 minutes, I was ready to write a simple application. (This doesn't include the time I spent with the sensor instructions to interpret the results.)
Unfortunately, I am not knowledgeable enough about embedded development to compare Mote Runner to other systems, but I think Mote Runner makes this kind of development easy enough for the hobbyist/enthusiast and provides the tools needed for the professional.Check out the related gallery: IBM launches Mote Runner for sensors.
J.JaDisclosure of Justin's industry affiliations: Justin James has a contract with Spiceworks to write product buying guides; he has a contract with OpenAmplify, which is owned by Hapax, to write a series of blogs, tutorials, and articles; and he has a contract with OutSystems to write articles, sample code, etc.
———————————————————————————————————————————-Get weekly development tips in your inbox Keep your developer skills sharp by signing up for TechRepublic's free Web Developer newsletter, delivered each Tuesday. Automatically subscribe today!
Justin James is an OutSystems MVP, architect, and developer with expertise in SaaS applications and enterprise applications.