Skip to main content

Developing Applications for the Intel Edison

A walk through some of the different ways you can program the feature packed platform.

In a previous post I covered in brief how the Intel Edison can be programmed via the Arduino IDE, with other options including writing JavaScript and native C/C++ applications. This post explores those options in a little more detail and takes a look at the Intel strategy for peripheral device support.

Intel IoT Developer Kit

title

The Intel IoT Developer Kit is based upon the popular open source Eclipse IDE, and is bundled with C and C++ examples for the classic hello world, and LED blink — the hardware hello world.

C and C++ examples are also included for sending data to the Intel IoT Analytics cloud via the IoT Kit Agent, software which also runs locally on the Edison. This service allows for the collection, storage and analysis of sensor data, with the ability to configure alerts. Intel state this as being provided free for “limited non-commercial use”, so it may not be suitable for all applications.

There are also C++ examples for reading an analogue input, and driving an I2C LCD and a buzzer.

title

The IDE provides a Remote System Explorer view where the IP address and login details for a connected board are entered. Once configured this allows for remote execution and debugging of programs from within the IDE, with both Edison and Galileo boards being supported.

Application portability is provided courtesy of the MRAA library, which offers a consistent API across different hardware for GPIO, UARTs and buses such as I2C and SPI, performing board detection at runtime. In addition to Edison and Galileo, the library also includes support for the Minnowboard and Raspberry Pi Model B.

The UPM libraries then build upon MRAA to provide APIs for sensors and actuators. At the time of writing this includes numerous temperature, pressure, gas, light and magnetometer sensors, along with various displays, LED controllers and servos. A guide to writing new modules is also provided, along with an Arduino library porting example, and Intel invite third party contributions to UPM.

Arduino compatibility

title

The Intel variant of the Arduino IDE has the same familiar look and feel as the classic version, and all the basic example sketches are there along with a healthy selection of libraries. However, it's important to note that sketches compile down to a binary that then executes on Edison as a Linux process. There is no microcontroller. This is not a real-time system.

What does this mean? Well, sketches that use AVR-specific features will obviously need to be modified, and some may not even work at all. A good example of where issues may be encountered is sketches that toggle pins to drive wireless and infrared etc. links and bit-banged I/O. These typically disable processor interrupts by calling cli() or nointerrupts() before doing the timing critical toggling of pins, and then re-enable them immediately afterwards with sei() or interrupts().

In testing, Arduino AVR code that used cli() and sei() would compile after these function calls were removed. However, as one might predict, it was then found that the timing of data being sent over a wireless link was out and the receiver simply discarded it. Which is hardly surprising when you consider that Linux probably serviced plenty of interrupts during the transmission period.

That said, it may be that a trick was missed and that there is some soft real-time capability that can be used. Failing which, an update to the Edison software is planned which will enable the onboard independent Intel Quark core, and one can only hope that when this happens it will become possible to target Arduino applications to it, instead of a Linux process on the main Atom processor.

Bridging two worlds

Reusing existing Arduino code and then integrating it with applications running under the Linux system — where there are greater resources and many more tools available — seemed like an obvious thing to want to do. As such, I had hoped that there would be a simple facility whereby data could be exchanged between a sketch and some other Linux application.

However, it turns out that while this is possible, it requires a fair amount of setup, with memory mapped interprocess communication (IPC) and mutexes for synchronisation. Although this situation may easily change and it presumably wouldn't take a competent programmer very long at all to come up with Arduino and Linux (C, C++ and/or Python etc.) libraries that greatly simplify this.

Intel XDK IoT Edition

title

The Intel XDK IoT Edition allows applications to be developed in JavaScript, via the increasingly popular node.js runtime environment, and provides templates for things such as digital read/write, analogue read and — of course — LED blink!

The XDK also provides support for creating mobile applications that are built using HTML, CSS and JavaScript, via the Apache Cordova set of device APIs.

title

The two sides to XDK development neatly complementing each other, enabling both IoT device behaviour and companion mobile app logic to be defined using the same language and IDE.

As with the IoT Developer Kit, the MRAA and UPM libraries are used for compatibility across IoT devices.

Conclusion

With three official SDKs — four if you count building native applications via Yocto! — it can be a little confusing when you first start exploring the available options for developing for Edison. A matter that is not helped by the similar naming of the Intel IoT Developer Kit and Intel XDK IoT Edition. However, once you familiarise yourself with the differences and understand what each of these development environments brings, it all makes perfect sense and there should be options to suit most tastes and needs.

Despite the present limitations of Arduino development on Edison, it's still an incredibly useful tool, if for no other reason than in providing a gentle on-ramp for the platform. Which is not to say that it won't also be improved upon in due course.

Andrew Back

Intel Edison Module - is available from RS Components

Intel Edison Development Kit - is available from RS Components

Intel Edison Breakout Kit - is available from RS Components

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.
DesignSpark Electrical Logolinkedin