Developing Applications for the Intel EdisonFollow article
A walk through some of the different ways you can program the feature packed platform.
Intel IoT Developer Kit
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.
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.
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
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.
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.
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