Get Version


Sponsored by:

The Shoppe at Wulfden

Totally Open Arduino-Compatible Hardware


→ ‘Ruby Arduino Development’


RAD is a framework for programming the Arduino physcial computing platform using Ruby. RAD converts Ruby scripts written using a set of Rails-like conventions and helpers into C source code which can be compiled and run on the Arduino microcontroller. It also provides a set of Rake tasks for automating the compilation and upload process.

Demo: 'Hello World'

Here's a basic demo of RAD in action. In this movie, we'll write, compile, and upload the universal physical computing 'Hello World': a single flashing LED.

Note: This movie was made using an old version of the Arduino board which required a hardware reset before being able to accept a new sketch. More recent versions of the board don't have this requirement and hence as of version 0.2.0, RAD no longer prompts for reset when running 'rake make:upload' (thought the option is still available for older boards.)


While duplicating the functionality of the well-designed Arduino software interface in Ruby may seem like an odd or redundant goal, RAD has further ambitions! Bootstrapping the ability to write microcontroller code in a high level dynamic language like Ruby could greatly ease the creation of all the luxurious development aids the users of such a language have come to expect: developer testing, platform independence, easy metaprogramming, etc.


$ sudo gem install rad

You’ll also need to have the Arduino environment installed, which you can get from the Arduino website. RAD currently requires Arduino 0011, but we try to keep it up-to-date with new Arduino releases.

The Basics

$ rad my_sketch

This command will create a new RAD project directory (my_sketch/) inside of the current directory that contains a blank script in which you can write your own RAD code, as well as a full install of the RAD support infrastructure (in vendor/). A sample ‘hello world’ script in RAD will look like this:

class MySketch < ArduinoSketch
  output_pin 7, :as => :led
  def loop
    blink led, 500

Once your code is written, your relevant local configuration properly setup in config/hardware.rb and config/software.rb, and an Arduino with the corresponding circuit (a 220ohm resistor and an LED wired in series between Arduino pin 7 and ground) is connected to your computer via serial, run:

$ rake make:upload

This will:

Documentation and The Arduino API

Most of the Arduino software API should be working correctly at this point. Documentation for RAD's version of things and details about usage of the wider Arduino API are available in the RAD rDocs.

Demo: Serial Communication

To demonstrate some of the more advanced features of RAD, here's a movie showing how to program the Arduino to listen to serial communication from a computer.

Note: The same comment from above applies here about the hardware reset. Also, extra points are available if you recognize the logo on the flag in the video.

For more examples of RAD in action, see the RAD example directory.

RAD Needs You!

All the many discipline-crossing skills required for a project like RAD make for lots of opportunities to help out: Have you written lots of sketches exploring the obscure depths of the Arduino library? Do you run the Arduino development tool chain on an obscure (i.e., non-OS X) platform? Do you develop for other AVR or PIC microcontrollers? Are you a C/C++ ninja? Or even C/C++ competent?

There’s lots to do.

If you’re looking for a place to dive in and don’t know quite where, email the RAD Google Group; we're friendly! If you want to start by taking a look at the code, check out RAD on GitHub:


This code is free to use under the terms of the GPL 2.0 license, just like the Arduino software library itself.


Comments, questions, heckles, attacks, praises, and, (most especially) patches and contributions are welcome! Send email to the RAD mailing list.


Greg Borenstein is RAD's original author and main maintainer with significant contributions from Ben Bleything and Brian Riley, patches from Scott Windsor and David Michael, and the support of the the Ruby Arduino Development Google Group.

Dr Nic, 18th November 2007
Theme extended from Paul Battley