(Arduino Serial Ruby on YouTube)
For the last month or so, Brett and Marcus from Tables Turned and I have been meeting weekly to teach ourselves Physical Computing, the use of micro-controllers like those found in cell phones and Roombas to build all kinds of interactive projects, from multimedia installations to scientific equipment.
We're using Arduino, a cheap and simple micro-controller chip and programming framework that's great for beginners. Between the three of us, we've got lots of ambitious projects we'd like to build, from immersive sound installations to wifi-enabled street walking robots, but in order to learn the basics, we're starting with a pretty simple project: building our own version of the children's toy Simon. If you're interested, you can follow our progress on the ComputerKraft wiki.
The two videos I've posted here show some early experiments we tried out while learning the ropes. The one below is amongst the first things we ever tried: reading the analog input from a knob and using its position to light up a changing number of LEDs.
The video at the top is from this week and I'm pretty proud of it. It shows a Ruby program running on my computer that reads input from a user and then lights up a different LED depending on what number it receives. This doesn't sound too impressive; after all, it's just another 'hello world'. But the elements involved are really exciting to me. With them in place, pretty much anything you can do in Ruby scripts, Arduino can know about -- reading RSS feeds, looking for files, user input, etc. Plus, from here, it doesn't take much more to get the interaction to flow both ways: when Arduino does something or senses something, it can get sent off to a Ruby program and from thence to files, the web etc.
If you're curious to know more about the technical details, you can check out the Ruby/serial demo page on the ComputerKraft wiki. It's got both the Ruby and C source code as well as an explanation of the hardware and links for downloading the ruby/serialport library (which does, in fact, work on OS X even though their documentation gives you little confidence that it would). Or, if Ruby's not your thing, you can check out Todbot's C code for doing this manually from the command line to accomplish something similar.
Tagged: arduino, ruby, serial, physical+computing, microcontroller, computerkraft