Hacking USB HID for Easy Tethered Ubicomp

At this years Sketching in Hardware conference, I gave a talk on the general approach I used to create LinkM, ThingM’s USB-to-I2C adapter for programming and controlling BlinkMs. I called it “Hacking USB HID for Easy Tethered Ubicomp” (4.8MB PDF) to give it a form that fit within some of the larger issues I’ve been dealing with in creating easily usable ubiquitous computing devices.

USB has many different (and confusing) aspects to it. I’ve long advocated the creation of a set of libraries and patterns to make “driverless” USB a reality. A sort of training wheels for USB. At the time I called this USB on Rails”, poking fun at RoR.

To me the key to this ease-of-use was the HID class in USB. No driver is needed when plugging in something like a mouse or keyboard. Other built-in device class drivers include CDC (modems), Mass storage, audio (headset), and video (webcam).

While researching HID, trying to make LinkM a “USB on Rails” project, I found that the biggest hurdle was a consistent host-side USB API that would let one write one set of code that could easily be ported to Mac OS X, Windows, and Linux. Libusb works well enough for Unix-like OSes like Linux and Mac OS X, but the Windows variant libusb-win32 required a driver install. So I put HID away.

For many months I investigated using CDC instead of HID because it maps down to a serial port on modern operating systems. Unfortunately, CDC has two main problems. For the “serial port emulation” mode, mapping to serial port semantics is problematic for a USB device that can be removed at will. If a device is removed while it is still “connected”, the OS and application can get confused or crash. Also, the CDC driver implementation seems brittle on Mac OS X. Some CDC devices can work fine, others wouldn’t. I can see now why FTDI and similar vendors use a custom driver for their USB-to-serial chips.

When looking back into HID after the frustration with CDC, I discovered that V-USB, the software-only USB firmware stack for AVR microcontrollers, had two interesting HID-based projects in them with a cross-platform host-side library for talking HID. The first was BootloadHID, a HID-based bootloader, and the second was “hid-data”, one of the examples. And there was a nice discussion of the platform differences on the V-USB wiki.

With that, I took both of those projects, generalized them slightly, then specialized them for LinkM and made them the core of the LinkM project. You can view the resulting source at the LinkM Googlecode project.

ThingM at Maker Faire 2010

My company ThingM had an official presence at Maker Faire this year. We were showing off the BlinkM line, including the new BlinkM MinM and the LinkM USB BlinkM controller. It was a lot of fun. And packed!

ThingM at Maker Faire 2010
(click any photo to go to larger version on Flickr)

We were in the Maker Shed building, right underneath the Arduino banner, so we got lots of awesome questions about Arduino. The most common: “So I just picked up this thing that says ‘works with Arduino’…well, what *is* Arduino?” It was so great to see so many people interested in building their own gizmos.

ThingM at Maker Faire 2010 ThingM at Maker Faire 2010

By far the most fun demo we had was TwitM, the Twitter-controlled BlinkM. Using LinkM, a couple BlinkMs, and a Processing sketch, I had it so anyone who tweeted anything with the keyword “makerfaire” made one BlinkM flash. If you tweeted “blinkm colorname”, where colorname was any color in the X11 color names or a hex color code RRGGBB, the other BlinkM would turn that color. Because of the streaming Twitter API, these changes happened instantly; it was really something to see.

ThingM at Maker Faire 2010 ThingM at Maker Faire 2010

Kim and Mike made up some really nice “walltext” describing the various demos we had up.

ThingM at Maker Faire 2010 ThingM at Maker Faire 2010

A big hit was MaxM controlling RGB LED flexible circuit tape, using the same techniques I used for the Crystal Monster.

ThingM at Maker Faire 2010 ThingM at Maker Faire 2010

This was about regular busy at the Faire. There were many times when it got way more packed.

Get on the BlinkM Bus with a BlinkM Cylon

BlinkMs are a lot of fun by themselves, but they’re also little network devices, each having its own address on an I2C network. Here’s where I think BlinkM can really shine since it makes controlling multiple RGB LEDs pretty easy. For Maker Faire, I wanted to show off this facet by having a single Arduino control a dozen or so BlinkMs on a single I2C bus. The result is shown in the little video below.

Read on for how this was put together.

Continue reading “Get on the BlinkM Bus with a BlinkM Cylon”

ThingM & BlinkM at Maker Faire!

ThingM (Mike and me and some friends) will be at Maker Faire Bay Area 2008 this weekend. Come by and visit us!

Our bench will be about “Experiments with Smart LEDs”. Basically we’re showing off BlinkM, the projects that led up to BlinkM, like my experiments with Smart LEDs, some future products we’re working on, and some fun projects using these gizmos.

Here’s some photos of some of the projects as they were being built:



And lots of the projects will be using various types of Arduino, if you’re into that sort of thing.

“WiiChuck” Wii Nunchuck Adapter Available

Want to hook up a Wii Nunchuck to an Arduino but don’t want to cut up the cord on your Nunchuck? Yeah me too. So I made some of these:

wiichuck_adapter1.jpg

wiichuck_adapter2.jpg

It’s a small PCB that adapts the Wii Nunchuck connector to standard 4-pin header. I call it the “wiichuck adapter”. It plugs directly into the Arduino, no wiring necessary. You can get one too for $4.

Available from the following wonderful shops:
FunGizmos.com. FREE DOMESTIC SHIPPING. International shipping for $1 more.
Little Bird Electronics (Australia)
SparkFun. Ships domestic & internationally. Be sure to order header pins too!
– and just about any SparkFun distributor

Continue reading ““WiiChuck” Wii Nunchuck Adapter Available”