RAD – Ideas For Dozens http://urbanhonking.com/ideasfordozens Wed, 30 Mar 2016 22:39:34 +0000 en-US hourly 1 RailsConf 2008 Lightning Talk Summaries http://urbanhonking.com/ideasfordozens/2008/06/01/railsconf_2008_lightning_talks/ http://urbanhonking.com/ideasfordozens/2008/06/01/railsconf_2008_lightning_talks/#respond Sun, 01 Jun 2008 17:32:40 +0000 http://urbanhonking.com/ideasfordozens/2008/06/01/railsconf_2008_lightning_talks/ Continue reading ]]>
photo by James Duncan Davidson

A few months back Chad Fowler asked me to coordinate the lightning talks for this year’s RailsConf. It turned out to be a rolicking good time! We had 36 speakers in three sessions over three days — more than half the number of official talks! Topics ranged from announcements of new plugins (man, there are a lot of these suckers out there!) to demos of cool sites (Shared Copy certainly blew some minds) to rants and harangues (Ryan Davis never disappoints in this regard).

Below, I’ve attempted to summarize each of the talks and provide appropriate links where I could find them. The results are based on my sketchy notes while keeping time (and preparing my own talk) and so are definitely less than definitive. If you spoke and I got some of your details wrong, drop me a comment and I’ll make corrections. If any speakers want to send me links to their slides, I can add those as well.

Thanks to everyone who participated — audience and speakers alike — and thanks to the RailsConf orgnaizers for letting me put this together.

Friday

Saturday

Sunday

Tagged: , , , , ,

]]>
http://urbanhonking.com/ideasfordozens/2008/06/01/railsconf_2008_lightning_talks/feed/ 0
RAD 0.2.2 Released: Arduino 0011 Support http://urbanhonking.com/ideasfordozens/2008/04/29/rad_022_released_arduino_0011/ http://urbanhonking.com/ideasfordozens/2008/04/29/rad_022_released_arduino_0011/#respond Tue, 29 Apr 2008 13:15:41 +0000 http://urbanhonking.com/ideasfordozens/2008/04/29/rad_022_released_arduino_0011/ Continue reading ]]> On sunday night, I released version 0.2.2 of the Ruby Arduino Development gem. The main focus of this update is compatibility with version 0011 of the Arduino software tools (follow that link for the release notes). While 0010 may still work with this new version of RAD, 0011 is now the default and upgrading is highly encourages. Download it here: Arduino 0011

.

This release also includes a patch to fix a problem with type-compatibility between RAD’s var system and some Arduino function return values courtesy of David Michael. David also gave what looks like a great talk about RAD at NYC.rb: Ruby Meets Worlds, which includes a really nice example of using the observer pattern to communicate with an Arduino over a serial port that portends really well for one of the exciting things we’ve been talking about on the RAD Google Group: an interactive serial console.

Tagged: , , , , , ,

]]>
http://urbanhonking.com/ideasfordozens/2008/04/29/rad_022_released_arduino_0011/feed/ 0
RAD 0.2.1 Announcement and Dorkbotpdx 0x01 demo http://urbanhonking.com/ideasfordozens/2008/04/07/rad_021_announcement_and_dorkb/ http://urbanhonking.com/ideasfordozens/2008/04/07/rad_021_announcement_and_dorkb/#respond Mon, 07 Apr 2008 13:33:00 +0000 http://urbanhonking.com/ideasfordozens/2008/04/07/rad_021_announcement_and_dorkb/ Continue reading ]]> It’s been an active few weeks in the world of RAD! First off, RAD 0.2.1 was released last week which includes a bunch of small features and bug-fixes:

The documentation and examples should be lots of help for those of you are just getting started. If you’ve got successful sketches, send them to me and I’ll add them!

I setup a Ruby Arduino Development Google Group for discussion amongst the growing group of contributors and users of the project. We’ve already got some fun stuff brewing there including someone working on a serial console, so drop by if you’ve got questions or want to participate.

Also, big thanks to Brian Riley of Really Bare Bones Arduino supplier Wulfden.org. His patch here for SWSerLCDpa support hopefully marks the start of a great collaboration to get a bunch of important Arduino libraries ported to RAD including OneWire and I2C. Plus, he sent me a totally awesome data logging kit to play with!
Wulfden Arduino Kit Unboxing: data logging kit

Last, but definitely not least, I presented about RAD at Dorkbotpdx 0x01 last week. I was fortunate enough to be in the good company of Ward Cunningham (who gave an amazing talk about his biologically-inspired Cybords project) and many others. Jared from Dorkbotpdx shot video of the event which is now online. I did two demos, the basic blinky-LED hello world and a more advanced assembler sketch that drove a 7-segment LED and serial output (my segment starts at about 4:46):

Watch the rest of the videos from the event here: Dorkbotpdx 0x01 on Vimeo.

Tagged: , , , , , , , , ,

]]>
http://urbanhonking.com/ideasfordozens/2008/04/07/rad_021_announcement_and_dorkb/feed/ 0
Announcing RAD 0.2: Software Serial Support, Inline Assembler, and More! http://urbanhonking.com/ideasfordozens/2008/03/16/announcing_rad_02_software_ser/ http://urbanhonking.com/ideasfordozens/2008/03/16/announcing_rad_02_software_ser/#respond Sun, 16 Mar 2008 15:51:10 +0000 http://urbanhonking.com/ideasfordozens/2008/03/16/announcing_rad_02_software_ser/ Continue reading ]]> I’m proud to announce a new release of the Ruby Arduino Development gem (RAD)! This release brings two major new features (software serial serial support and inline assembler), a major revamping of the hardware serial library, and a raft of other small features and bug fixes. I’ve got lots of details below, but first I wanted to thank Scott Windsor who contributed the software serial support as well as all the other people who wrote in with bug reports, ideas, and comments, and of course all the members of the RAD core team. It’s exciting to see RAD starting to support physical computing scenarios I’ve never had the hardware to work with myself.

Inline Assembler

I’m starting with this new feature not because it’s necessarily the most import or most broadly useful, but just because I think it’s the sexiest (which probably says something sick about me, but there you go)! RAD now offers a class method to all sub-classes of ArduinoSketch for writing routines in assembly language. You give the method three arguments: the name of the routine, its signature, and the assembly code you’d like to consitute its body. Here’s an example script showing the method in action:

class AssemblerTest < ArduinoSketch
serial_begin
def loop
serial_println product(10,4)
end
assembler( :product, "int product(int a, int b);",
<<-CODE
product:
mov r18,r24 ; move a to another register
ldi r24,0 ; clear running sum, used to coalesce product
ldi r25,0 ; sum = 0
.loop:
tst r18 ; is a = 0? if so, we're done
breq .end
mov r19,r18 ; copy a
andi r19,1 ; is a % 2 == 0
breq .skip
add r24,r22 ; add b to sum
adc r25,r23
.skip:
lsr r18 ; divide a by 2
clc
rol r22 ; multiply b by 2
rol r23
rjmp .loop
.end:
ret
.size product, .-product
CODE
)
end

As you can see, the body of the assembly code is simply passed as a string to the ‘assembler’ method. In this case, all I’m doing is implementing multiplication of two integers. RAD takes your assembly code, adds some architecture-specific headers and other boilerplate, writes it to a source file, and makes sure that the compiler knows to compile it into object code and link it into your project during the build process.

I’m an asm newbie and I found that the hardest part of getting started learning the stuff was bootstrapping an environment where you could actually run your code and see the results. Hopefully this addition to RAD will smooth that process for people in a similar situation. Now all you’ve got to do is put your assembly code in an ArduinoSketch model like the one above, upload it to your Arduino, and read the board’s serial output (for example by attaching to it with screen). You can be writing (and debugging) your first assembler routines in seconds.

It’s worth noting that this feature wouldn’t have been possible without Reed College math professor Jim Fix teaching me the basics of AVR assembler and the avr-gcc build process. Thanks, Jim!

Software Serial Support

This feature came in as a patch from Scott Windsor. Scott was working on hooking up his Boarduino (an Arduino-compatible clone from Lady Ada) to a GPS module and a Serial LCD both of which require serial connections. Thankfully, Arduino provides a SoftwareSerial library for doing serial connection on any of the board’s digital i/o pins. Scott’s patch gives you really convenient access to this functionality, thusly:

class MySketch < ArduinoSketch
output_pin 13, :as => :led
software_serial 6, 7, :as => :gps
serial_begin
def loop
digitalWrite(led, true)
serial_print(gps.read)
end
end

As you can see, he configures ports 6 and 7 as a software seria connetion called “gps” and then he simply says “gps.read” to read the data his device is sending over that connection. Scott also implemented “print” and “println” methods for outputting to serial-connected devices such as his LCD, which work in the same way.

I was especially psyched to see this patch since I haven’t gotten to work with any devices that communicate over software serial yet, which had meant that I couldn’t really test and add this functionality myself. I’m planning to get my hands on some of that soon and so I’m excited to play with the clean simple API Scott’s provided here.

Fixed Hardware Serial Support

In previous releases of RAD, hardware serial support had been, uh, perfunctory. The trouble stemmed from the wide variety of functionality hidden behind Arduino’s elegant serial API. Serial.read(), Serial.print(), and their brethren do subtle things to act correctly when called with different arguments, from integers to individual characters to full strings (or arrays of characters, as C would have it). The result was that RAD’s versions of these methods would sometimes do strange things like returning ASCII-value integers when sent characters. That should no longer be happening. For example if your run the following sketch:

class SlowTypewriter < ArduinoSketch
serial_begin
def loop
serial_print serial_read
end
end

and attach to the serial output with screen, you’ll see the characters you type successfully roundtripping to the Arduino and coming back with their encoding preserved. It’s the world’s slowest typewriter!

A Panoply of Small Features, Tweaks and Bug Fixes

Including, but not limited to:

  • Made ‘rake make:upload’ default to skipping the prompt for reseting the board. The older NG boards that require the reset are getting rare and I recently modded mine to no longer require it. The reset is still available as an option by editing the “physical_reset” option in config/hardware.yml.
  • Added support for HIGH/LOW and ON/OFF constants. This is a nice feature of the Arduino API that I hadn’t been able to sneak throug the RubyToC translation stage until now.
  • Support for variables that are not local to the loop method. It’s a common desire to be able to initialize variables outside of the loop method of a sketch so that they will not be constantly re-initialized with each run, for example to define environmental constants or initialize counters. Since RAD replaces the Arduino setup functions and global declarations with ArduinoSketch class methods (such as output_pin), this wasn’t previously possible. As of this release, you can use the ‘vars’ method to initialize variables in this scope thusly:

    class VarTest < ArduinoSketch
    vars :a => :int, :b => 7, :c => "hello"
    def loop
    a = 1
    serial_print a
    serial_print b
    serial_println c
    end
    end

    This will produce output like:

    17hello
    17hello
    17hello
    17hello
    [...]
    

    As you can see, the vars method takes a hash where each key is the name of the variable you’d like to initialize and the value and be either a type (rendered as a symbol, i.e. “:int”), or an actual value if you want the var to be initialized to something (i.e. “hello”).

  • Changed default Arduino location to be /Applications/arduino-00010, which seems to be where most people (now including me) have it.
  • Plus too many small bug fixes to list here!

What’s Next?

There’s all kinds of things big and small on the immediate roadmap for RAD. There’s the administrative: putting the RAD source on Git Hub, adding sorely needed documentation to the core ArduinoSketch methods, organizing an email list for the growing group of people wanting to be kept up-to-date on the project, etc. There’s the lofty: I’ve got the beginnings of a plan for putting building a testing and simulation framework on top of RAD that would let you run your sketch against a software version of the Arduino hardware while developing (with a visualization/interactive app built on Shoes!), etc.

And then there’s your contribution: send me your patches and RAD can become whatever your want it to! As always, if you’ve got any questions, ideas for contributions, or run into any troubles running RAD, feel free to email me: greg [dot] borenstein [at] gmail [dot] com or comment here; I’d especially love to see/hear what projects people are building with RAD. Happy hacking!

Tagged: , , , , , , , , ,

]]>
http://urbanhonking.com/ideasfordozens/2008/03/16/announcing_rad_02_software_ser/feed/ 0
RAD demo videos online http://urbanhonking.com/ideasfordozens/2007/08/02/rad_demo_videos_online/ http://urbanhonking.com/ideasfordozens/2007/08/02/rad_demo_videos_online/#respond Thu, 02 Aug 2007 23:22:35 +0000 http://urbanhonking.com/ideasfordozens/2007/08/02/rad_demo_videos_online/ Continue reading ]]> During my recent presentation of RAD at FOSCON, I did two demos: I wrote a ‘hello world’ light-blinking sketch live and I showed and explained a sketch for communicating with the Arduino over serial communication in order to wave a flag. During the demos, I had setup my screen so the audience could see my code samples, my command line, and a webcam pointed at the Arduino and its peripherals.

While these demos don’t translate that well into normal slides, they were the heart of my presentation. After a little bit of searching, I came across Snapz Pro, a great little Mac utility for making screencasts. With Snapz Pro and only a couple of dozen rehearsals, I was able to create two short videos that pretty much reproduce the content of my demos. And I’ve put them online so you can take a look even if you weren’t lucky enough to be at Holocene last week:

RAD Demo #1: Ruby Arduino Development Hello World

RAD Demo #2: Ruby Arduino Development Serial Communication

(Bonus points if you recognize the logo on the flag in the second video…)

I’ve inserted both of these into the online version of the slide deck so they’ll preserved for future generations.

If these videos pique your interest, check out RAD’s Rubyforge homepage for more info or to offer your help!

Tagged: , , , , , , ,

]]>
http://urbanhonking.com/ideasfordozens/2007/08/02/rad_demo_videos_online/feed/ 0
FOSCON RAD slides http://urbanhonking.com/ideasfordozens/2007/07/25/foscon_rad_slides/ http://urbanhonking.com/ideasfordozens/2007/07/25/foscon_rad_slides/#respond Wed, 25 Jul 2007 11:22:16 +0000 http://urbanhonking.com/ideasfordozens/2007/07/25/foscon_rad_slides/ Continue reading ]]>

FOSCON III was a blast last night. There were lots of talks about subjects as diverse as generating midi and controlling Lego Mindstorms robots with Ruby. Plus, there was the most pizza I’ve ever seen in one place! Thanks a lot to Thomas Lockney and all the organizers for putting it on.

Here are the slides from my presentation: RAD: Physical Computing with Ruby. I’m planning on supplementing them with some video of the demos as well as a few additional slides to fill in the holes that appear without the audio. Also, I’m working on getting video of the talk from the Box Populi folks who were shooting last night and I’ll post that as soon as I’ve got it.

Tagged: , , , , , ,

]]>
http://urbanhonking.com/ideasfordozens/2007/07/25/foscon_rad_slides/feed/ 0
RAD: The first step towards Ruby on Robots http://urbanhonking.com/ideasfordozens/2007/07/23/rad_the_first_step_towards_rub/ http://urbanhonking.com/ideasfordozens/2007/07/23/rad_the_first_step_towards_rub/#respond Mon, 23 Jul 2007 16:06:14 +0000 http://urbanhonking.com/ideasfordozens/2007/07/23/rad_the_first_step_towards_rub/ Continue reading ]]> Note: I’ll be presenting RAD at FOSCON this coming Tuesday at 7:30pm at Holocene in Portland, Oregon!

About a year ago, I started learning microcontroller programming. Microcontrollers are the tiny computers that act as the brains of electronic devices: they run your alarm clock, your Wiimote, your cockroach controlled mobile robot. I’d gotten interested in them after becoming a fan of the the cinematic miniatures of Jennifer and Kevin McCoy and other similar work conducted at NYU’s Interactive Telecommunications Program.

I acquired an Arduino, an integrated open source hardware and software system that provides everything you need from the microcontroller itself to the connectors for plugging in electronic circuits to the code libraries for accessing the chip’s capabilities. I gathered a group of similar-minded friends and we started doing some experimenting. We built a working prototype of a a Simon-style pattern matching game, we played with motors, and, eventually, I had an idea.

My idea was: why was I wrestling with ugly and low level C/C++ code, when I spent my days writing with the beautiful and near-infinitely flexible Ruby? Why couldn’t programming Arduino be as beautiful as programming Rails? Why couldn’t ‘hello world’, which was 10 lines of “void”, “int”, and curly braces look like this instead:

class MySketch :led
def loop
blink led, 500
end
end

And further, why couldn’t I have all the developer tools I’d grown used to in Rails? Where was the testing, the platform independence, the metaprogramming?

So, I set out to do something about it: I started working on a system for programming Arduino in Ruby. And, today, I’m proud to announce the first release of the resulting project: RAD: Ruby Arduino Development. RAD converts Ruby scripts (like the one above) written using a set of Rails-like conventions and helpers into C/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.

Start by downloading the Arduino software tools. Then, you can install RAD in the usual way:


$ sudo gem install rad

RAD depends on Ruby2C, which seems immune to the normal gem requirement techniques, so, if you don’t already have it, you’ll need to install that as well:
$ sudo gem install Ruby2C

Once, you’ve got in installed, you create your new Arduino sketch just like you would a new Rails project:

$ rad my_sketch

That’ll generate a new directory containing a blank ArduinoSketch file, a config directory with files for telling RAD about the relevant hardware and software constants (the location in which you installed the Arduino software tools and the path to your serial port), and a vendor directory with all of the RAD helper code. Next, make sure that the Arduino software tools are in your path:

export PATH=<path to arduino install root>/tools/avr/bin:$PATH

Now, you’re ready to write code. To start with you could emulate my example above. It’s the classic ‘hello world’ script for microcontrollers: it flashes a single LED twice a second.

RAD provides class methods for setting up your Arduino: output_pin and input_pin which take an integer representing a pin number between 1 and 14 and an optional :as argument which lets your refer to that pin through a method named after the given symbol. There are also equivalent methods for setting up multiple pins at once (output_pins and input_pins) each of which take an array of integers. In my example code, you can see I’m setting up pin 7 as an output pin and creating a method for referring to it as “led”

The other main element of your ArduinoSketch will be the “loop” method. That’s where you write the code you want the Arduino to actually run repeatedly on the microcontroller. The example I’ve got here is pretty straight forward. It tells the Arduino to turn the LED on, to wait 500ms, to turn the LED off, and then to wait 500ms (blink is just a built in RAD-macro for the digitalWrite and delay commands in the Arduino library). Repeat that over and over and you’ve got a blinking LED.

Obviously, to make this work you’ve got to have the corresponding circuit actually hooked up to your Arduino. In this case, that would be a 220ohm resistor and an LED connected in series between the the Arduino board’s pin 7 and its ground pin. (If you don’t have a resistor or LED handy, you could test this out with pin 13, which is connected to the built-in test light that comes with the Arduino, just change the output_pin number above.)

Once you’ve got your circuit wired up, your configuration complete, and your Ruby code written, run:
$ rake make:upload
This will:

  • generate the correct Arduino C/C++ code from your sketch
  • dynamically prepare a localized version of the default Arduino makefile
  • compile your script
  • prompt you to hit the reset button on your Arduino
  • upload your compiled binary onto your Arduino

If everything goes smoothly, a wave of hex output will flow from your terminal, the yellow lights on the Arduino will flicker, and, after a second or two, your LED will start blinking! Now, all you’ve got to do to iterate on your script is write changes, save them, and run the rake command again.

With the exception of the still-experimental Serial interface, most of the Arduino software API should be working correctly at this point. Documentation for the Ruby versions of the methods is forthcoming, but it is mostly what you’d expect: methods with identical names and arguments to their Arduino counterparts with the exception of using ‘true’ and ‘false’ for HIGH and LOW (RAD uses Ruby2C to translate your ‘loop’ method into C).

As mentioned above, full compatibility with the Arduino API is just the beginning for RAD. The long term goal for RAD is to provide developer tools like testing, an interactive console for communicating with the Arduino over serial, metaprogramming facilities, and, eventually, even platform independence, i.e. the option to transform your Ruby code to work with other non-Arduino PIC and AVR microcontroller platforms.

In order to accomplish any of these lofty goals, many discipline-crossing skills will be required. So, I need your help! 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? If so, and you’re interested in getting involved with the glamorous world of microcontroller metaprogramming, get in touch. You can visit the RAD homepage on Rubyforge for svn access and email me with questions, suggestions, comments, criticism, and patches.

Tagged: , , , , , , ,

]]>
http://urbanhonking.com/ideasfordozens/2007/07/23/rad_the_first_step_towards_rub/feed/ 0