Behold the Crystal Monster

The Crystal Monster is an art piece created by Beverly Tang and Tod E. Kurt (me). It’s on display in the Continental Gallery on 4th & Spring St in downtown Los Angeles. The shape and structure of the Crystal Monster are Beverly’s design. I created the lighting and the electronics. It’s made from over 400 sheets of laser-cut acrylic, more that 240 feet of LED tape (>2200 RGB LEDs!), and around 500 steel rods and other steel hardware. It’s approximately 12 feet long and 10 feet wide and hovers 10 feet above your head. It’s got an Arduino brain and 18 BlinkM MaxMs (one per segment) to let it flutter color patterns up and down its length.

A little movie showing it in action:

Crystal Monster at Art Walk Downtown July 2009

Go to Beverly’s site for high-quality photos of the Crystal Monster. Check out her other work, she’s an amazing artist.

Some of my photos (or click to go to Flickr set):

crystal monster eating
crystal monster profile
Crystal Monster at Art Walk Downtown July 2009
Crystal Monster at Art Walk Downtown July 2009

It was first installed at the Ball-Nogues studio in Downtown Los Angeles as part of their participation in Downtown L.A. Art Walk, and lived there for a few months.
Crystal Monster: final assembly!

Then it moved to its mostly-permanent location at the Continental Gallery at 4th & Spring in Downtown Los Angeles.
Crystal Monster in its new home

It’s right on the corner, so you can really see it just from walking by on the street.

Crystal Monster from the street

The electronics consist of 18 BlinkM MaxMs driven by a single Arduino, all powered by an ATX power supply. The Arduino has an IR remote control receiver so the Monster’s behavior can be controlled from afar.

crystal monster control box

Using MaxM with flexible RGB tape

A single BlinkM MaxM can easily drive a 5 meter (16 ft) roll of the flexible RGB SMD LED tape that’s used for architectural lighting. Each roll contains 150 RGB LEDs.

maxm rgb led tape

Each LED in the tape is a SMD RGB "5050" LED, capable of putting out about 6000mcd. The spacing between LEDs is 3.3cm (~1.25").

Every 3 LEDs is a cut mark with solder tabs so you can cut or join pieces of tape.

Max current for a 5m roll is about 1.9 Amps. I did a quick test of MaxM driving three rolls at about 6A and it seemed fine.

This stuff is really cool. I’ve been buying it from this really great seller on ebay named "sunnytech".

Here’s what you can do with it. Each of the 15 sections contains between 1 and 3 rolls of the tape.

crystal monster profile

Multiple BlinkM MaxM Blasters on one Master

BlinkM MaxMs will be back in stock soon. Over on our GetSatisfaction area, there’s a question on how to use multiple BlinkM MaxM “Blaster” LED boards with one MaxM “Master” driver board. It’s possible and only just a little tricky. The Blaster board is powered by the 5V voltage regulator built-in to the Master board. That regulator is designed to power just one Master and one Blaster. If you try to drive multiple Blasters with it, it might work, but we don’t recommended it and could blow up your Master board.

Instead, it’s better to drive the MaxM with an external 5VDC power supply. This isn’t officially within the operating range of input voltage for the Master, but for this application it’s okay. To drive multiple Blasters, you then run that external 5VDC supply, available from the “V+” socket to the “5V” pin of each Blaster. And do not connect the Master’s “5V” to anything. Here’s a wiring diagram (click to enlarge):

maxm_multi_blasters

Continue reading “Multiple BlinkM MaxM Blasters on one Master”

BlinkM & Arduino 3D models

Here’s a really quick 3D model of BlinkM, if anyone needs it. It’s accurate to ~0.1mm.

blinkm.skp — BlinkM SketchUp model
rgb_led_piranha.skp — Piranha RGB LED SketchUp model

And here it is plugged into the awesomely done Arduino Diecimila model by Jon-Paul from the Google 3D Warehouse.

SketchUp is pretty great, but I found a problem with it if you’re trying to make accurate to-scale electronic parts: it won’t create surfaces with an area of <1mm. Took me a while to figure that out. The solution is to make a 10x or 100x size version and then do a scale by 0.1 or 0.01 when you’re done.

Spinning Knobs: Custom Rotary Encoders

For this project, I wanted a device that wasn’t an absolute mapping of position to color amount. I didn’t want a strict teaching device, but more of a fun color exploratory toy, able to be spun like mad by kids.

Rotary encoders are used to measure rotational amount and direction. You can find them in “infinite rotation” knobs, computer mice, robots, and lots of other things. They’re a good solution for user interface input devices when you want to make relative adjustments to a value, rather than absolute positioning (where a pot would work well). Wikipedia’s “rotary encoder” entry is a pretty good explanation of the various types of encoders. Wikipedia mentions absolute positioning encoders, a much rarer and more expensive type. Most all rotary encoders you’ll encounter are the relative positioning type. There are two main classes of relative rotary encoder implementations: mechanical and optical. Both make electrical signals when the encoder is rotated. Mechanical uses tiny electrical wipers to produce them. An optical encoder uses an optical interrupter, consisting of a light beam and light sensor.

I experimented with mechanical encoders but they had a lot of friction and their pulses-per-revolution were fairly low (12-24). I wanted a low-friction, high-resolution encoder. For low-friction this meant an optical encoder, and for high-resolution this meant a large encoder disk (since I was using fairly large optical interrupters).

To sense the slots in the disk, standard H21A1 optical interrupters are used. These optical interrupters are simply an IR LED (”emitter”) and an IR phototransistor (”detector”) in a single package, pointing at each other. Breaking or unbreaking the beam creates a signal you can measure. If you hook them up, you can see the IR LED using a digital camera:


You can see the “E” and “D” markings for “emitter” and “detector” above.

A single interrupter can measure speed of rotation by counting pulses. It can’t measure direction of rotation. But by using two interrupters and “quadrature encoding” (two output signals offset by 90º), you can measure both. The spacing between the slots, the spacing between the interrupters, and the aperture width of the LED emitter are interrelated in order to get proper quadrature output. Hopefully I’ll have a subsequent blog post describing this in more detail. :) To decode quadrature encoding, pick one of the two signals (call them “A” and “B”): when A goes HIGH, measure B. The value of B gives the direction of rotation. By counting the number of times A goes HIGH, you know how much rotation is happening. In the diagram below, follow the two signals as rotation happens either clockwise (to the right in the diagram) or counterclockwise (to the left)

Building the Knobs

The knobs are constructed out of PVC drainage caps, laser cut acrylic for hubs & diffusers, rollerblade bearings to give a smooth spin, 5/16″ bolts to act as axles, hot glue to put it all together, and a plywood base. The black, slightly rubbery texture was from the spray-on form of PlastiDip.

My good friend Ben Franco helped prototype many iterations of the physical design of the knobs, until we came upon the final result. He was the one who recognized that the diameter of 5/16″ nuts was just perfect enough to grasp the inner ring of a rollerblade bearing. So a 5/16″ bolt through the center of the bearing becomes the axle and the outer ring of the bearing can be attached to a stationary base, giving a smoothly spinning knob.

Rotary encoder Arduino code

When reading rotary encoders, it’s useful to think of the two signals coming out of it as a “clock” and a “data” signal. It doesn’t matter which one you treat as which, as it’s the interrelationship between the two that matters. Usually you’d use interrupts to handle reading encoders because it makes it very simple: on interrupt of the “clock” signal, read the “data” signal, and its value gives you the rotation direction. On Arduino we’ve only got one interrupt and three knobs, so polling is easier. I started with the a really good Arduino playground rotary encoder polling example and then went from there.

The relevant parts of the BlinkMCylon code for dealing with rotary encoders is below. It’s almost encapsulated enough to be a library. The “knobs” data structure contains a list of “knob” data structures, which in turn is just a holder for which pins the knob is connected to, what the last value was of that knob’s clock pin, and its current rotation value.

The “knobs_init()” function sets up the pins correctly, and by calling “knobs_poll()” as fast as possible, you can read many knobs fairly accurately.

typedef struct _knob {
    uint8_t clkpin; uint8_t datpin; uint8_t clklast; uint8_t val;
} knob;
knob knobs[num_knobs] = {
    { 2,3, 0, 0},    // first knob on pins 2 & 3
    { 4,5, 0, 0},    // second knob on pins 4 & 5
    { 6,7, 0, 0},    // third knob on pins 6 & 7
};

static void knobs_init(void)
{
    for( int i=0; i<num_knobs ; i++ ) {
        pinMode( knobs[i].clkpin, INPUT );
        pinMode( knobs[i].datpin, INPUT );
        // turn on internal pullup resistors so we don't need external ones
	digitalWrite( knobs[i].clkpin, HIGH);
        digitalWrite( knobs[i].datpin, HIGH);
    }
}

// this function must be called as quickly and as regularly as possible
static void knobs_poll(void)
{
    byte c,d;  // holder for readings
    for( byte i=0; i<num_knobs; i++ ) {
	knob k = knobs[i];           // get a knob
	c = digitalRead( k.clkpin ); // read its pins
	d = digitalRead( k.datpin );
	if( c != k.clklast  ) {      // look for clk line transition
            d = c^d;                   // xor gives us direction
	    if( d ) k.val++;           // non-zero means clockwise rotation
	    else k.val--;              // zero means counter-clockwise rotation
	    k.clklast = c;             // save the clk pin's state
            knobs[i] = k;              // save our changes
	}
    }
}

Resources & Links

Other info:

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”