Codebender - coding for Arduino in the cloud
by D.J.Walker-Morgan
The Arduino has come to define the hands-on microcontroller, for education and for practical applications. But the associated software tools are very much tied to the traditional desktop. Codebender is hoping to change that by taking Arduino development into the cloud while keeping it open source.
Codebender is a web based development environment for Arduino which offers a simple syntax highlighting editor, compiler and tools to get the compiled code onto an Arduino. A user can create any number of projects, though currently projects are limited to a single file, and if wanted, seed them with one of a number of existing Arduino projects or libraries.
One of the team working on Codebender is Vasilis Georgitzikis and The H talked to him about where Codebender currently was, how it's been implemented and where it's going. The project recently opened a closed beta running on Amazon Web Services. The closed beta was to "kill two birds with one stone", said Georgitzikis. "We want to look for bugs and make the system 100% stable before opening for the public, but we also want to reward the people who support us through Indiegogo". The codebender team have been raising funds on Indiegogo and their campaign recently passed its modest $5,000 goal offering early funders exclusive access to the trial run.
"The plan is to open for everyone in a couple of months and to keep working on features as we get the time... or if we get someone interested in a specific feature and willing to pay", he added. The $5,000 should cover operating the service for the first year at least. Crowd-funding isn't the end game of the financing plan for Codebender though; "At the moment we all have jobs, and we just felt like giving to the community", said Georgitzikis. "We'll provide this awesome service we build from the good of our hearts. Right know we're talking with some people and who knows, maybe we'll create a business model to be able to work full time on."
The open source code, available from the project's GitHub repository, is built around the Symfony 2 PHP framework with MongoDB providing the document/project storage and MySQL providing the user and settings storage. PHP Fog is used to then make the application suitable for cloud hosting. For a C compiler, the Codebender developers have gone for Clang, part of the LLVM project, which has better syntax analysis for code and more accurate error reporting; especially useful when your software may be assisting a beginner with their first code.
The core of the IDE, the editor, is based on ACE, the successor to Mozilla's Bespin project. The ACE editor offers automated indentation, syntax highlighting, parentheses matching, auto-completion, keyword highlighting and even comes with bindings for Vi and EMACS. To simplify the development process further, Codebender has a range of built-in libraries including the Adafruit LCD library, XBee and XBeeRadio, Webduino web server and others. By building in the libraries, all a user needs to do is include them in their Arduino sketch, reducing the time spent fiddling with the development environment and increasing the time spent writing and discovering what's possible with the Arduino.
The H spent some time writing code with Codebender and deploying it onto one of the house Arduinos and can report that the environment is comfortable and functional. Georgitzikis told us that they were "constantly talking of adding features but we think we are a good IDE right now. We support most of the Arduino IDE's features and we have a lot of great new ones." He estimated that by the end of the year they would "probably be proud of codebender as an IDE", as the only important thing it lacks is autocompletion.
One question that comes up is how does compiled code get from the cloud IDE into the serial-over-USB interface of the Arduino. The possibly surprising answer is a Java applet, designed to be embedded into Codebender's editor pages. The applet can request sufficient permission to get access to the virtualised serial drivers and upload code to the Arduino board. The applet also gives the user a serial console to track output from the Arduino. In the future, the developers want to look at the emerging JavaScript APIs for serial port access, but for now the Java applet will be the main way to move code from the cloud to the chip.
But this is not the only way to load code onto the device from Codebender. If the Arduino has an Ethernet shield or is already Ethernet enabled, it can be configured to pull the code from a TFTP server using a specially created, open source, TFTP bootloader. This has the advantage of allowing remote, in-place updating for hard to reach Arduinos. With new generations of Arduino devices arriving with integrated Ethernet or even Wi-fi, the possibility of an entire network of connected, auto-updating embeddable microcontrollers becomes a real possibility, not just for commercial manufacturers, but for small-scale makers.
It is possibilities like that that motivate the Codebender developers. They hope to open up the Arduino community to easier code sharing through the cloud, of web based collaboration and of shared tools. Talking with Georgitzikis, it was clear that they were open to ideas and already had plenty of their own. There's also the possibility with Codebender of creating specific tools for education which, thanks to being web based, could be accessed by any school no matter what hardware they have. Right now though, Georgitzikis and the rest of the Codebender team are working through the last bugs before rolling out the public version of what could well be the quickest way to get up and running with Arduino development to date.