Parts: ShiftBrite RGB LED Module (A6281)

shiftbriteii

Macetech’s ShiftBrite is a high-power RGB LED coupled with an Allegro A6281 backpack. The A6281 uses three 10bit pulse-width modulators to mix millions of colors using the red, green, and blue elements in the RGB LED. Multiple modules can be chained together for bigger projects, like the ShiftBrite table.

Below the break we demonstrate a ShiftBrite module using the Bus Pirate. For a limited time you can get your own Bus Pirate, fully assembled and shipped worldwide, for only $30.

shiftbrite-over

ShiftBrite RGB LED module (Macetech, $4.99). ShiftBrite datasheet and example code, Allegro A6281 datasheet (PDF).

The ShiftBrite module is a complete A6281 development board. It doesn’t require any extra parts, just a 5-9volt supply.

The A6281 is one of the most complete RGB LED driver ICs, but it’s only made in a tiny QFN package. The ShiftBrite is a good way to try the A6281 without soldering a small chip.

A6281-connect.470

A bunch of A6281 modules can be chained together. Each module repeats all of the serial input signals on separate output pins, so the A6281 will work over long cable runs.

Bus Pirate ShiftBrite
MOSI DI
CLK CI
CS LI
AUX EI
5volts V+
Vpullup V+
GND GND

We used our Bus Pirate universal serial interface to demonstrate the ShiftBrite, but the command sequences will be the same for any microcontroller. We connected the Bus Pirate to the ShiftBrite as shown in the table above.

We setup the Bus Pirate for raw3wire mode (M, 8), and chose open drain outputs (Hi-Z) so we can interface the ShiftBrite at 5volts. The Bus Pirate can’t output 5volts directly, so we enabled the bus pull-up resistors (menu ‘p’ in v2) and attached the pull-up resistor voltage input pin to the 5volt supply. Finally, we enabled the on-board power supply (capital ‘W’).

Interfacing

The LED driver output is only active when the enable pin (EI) is held low.

RAW3WIRE>A <– capital ‘A’, EI pin high, output disabled
AUX HIGH
RAW3WIRE>a <– small ‘a’, EI pin low, output active
AUX LOW
RAW3WIRE>

We used the Bus Pirate’s auxiliary pin to toggle the A6281’s enable pin, but you could also bypass this feature by wiring EI directly to ground. A small ‘a’ in the Bus Pirate terminal takes the AUX/EI pin connection low, enabling the LED output.

A6281-IO.470

Two commands update the A6281 settings. The configuration command controls dot correction and clock settings. The LED pulse-width modulator (PWM) command updates the three 10bit values that set the red, green, and blue channel brightness. Both commands are 32 bits (4 bytes) long, bit 30 selects the configuration or pulse-width modulator command. Refer to the chart above, or datasheet page 7.

The interface protocol is like SPI, but the master-input-slave-output pin is unused. Data is sent most significant bit first, starting with bit 31. Commands are sent by clocking 32 bits into the chip and then toggling the latch pin.

Before we can start mixing colors, we need to setup the A628a’s internal clock and write the dot correction values.

RAW3WIRE>0b01000111 0b11110001 0b11111100 0b01111111 ][
WRITE: 0x47 <–write 32bits of data
WRITE: 0xF1
WRITE: 0xFC
WRITE: 0x7F
CS DISABLED <–latch pin high
CS ENABLED <–latch pin low
RAW3WIRE>

We wrote the values in binary so it’s easy to follow along in the table above. Remember that bit 31 is sent first, so the order of bits shown here is opposite of what is shown in the table.

The complete setup command is 32 bits (4 bytes) long. Bit 30 sets this as a configuration command (1). Bit 7 and 8 configure the clock source, value 00 configures the 800KHz internal oscillator (datasheet page 7). Three 7bit ‘dot correction’ values fine tune the LED color channels if you want to correct a wonky pixel in a large array (see the register locations in the table above). We set all the dot correction values to full (1111111). Several bits trigger test functions or don’t have a purpose, these should be entered as 0.

After entering 32 bits, toggle the A6281 latch pin (][) to lock the data into the register. Now that the chip is configured and the output enabled, we can finally play with the LED.

RAW3WIRE>0b00111111 0b11111111 0b11111111 0b11111111 ][
WRITE: 0x3F
WRITE: 0xFF
WRITE: 0xFF
WRITE: 0xFF
CS DISABLED
CS ENABLED
RAW3WIRE>

First, turn all the colors to full. Bit 31 (0) is ignored, bit 30 (0) indicates a LED pulse-width modulator update command, and the remaining bits set all three channels to 100%.  The three PWM values control the output intensity of each color as follows: blue (bits 29:20), red (bits 19:10), and green (bits 9:0). Raise and lower the latch pin (][) to end the command.

Next, test each each color individually.

RAW3WIRE>0b00111111 0b11110000 0b00000000 0b00000000 ][
WRITE: 0x3F
WRITE: 0xF0
WRITE: 0x00
WRITE: 0x00
CS DISABLED
CS ENABLED
RAW3WIRE>

Bit 30 (0) signals an LED PWM update command, followed by a 100% setting for the blue channel (1111111111) and 0% settings for the red and green channels. When we toggle the latch pin (][) the new values are saved and the LED color changes to blue.

RAW3WIRE>0b00000000 0b00001111 0b11111100 0b00000000 ][
WRITE: 0x00
WRITE: 0x0F
WRITE: 0xFC
WRITE: 0x00
CS DISABLED
CS ENABLED
RAW3WIRE>

This time we’ll set the LED to 100% red. Bit 30 (0) signals an LED PWM update command, followed by a 0% setting for the blue channel, a 100% setting for the red channel (1111111111), and a 0% setting for green.  When we toggle the latch pin (][) the LED color changes to red.

RAW3WIRE>0b00000000 0b00000000 0b00000011 0b11111111 ][
WRITE: 0x00
WRITE: 0x00
WRITE: 0x03
WRITE: 0xFF
CS DISABLED
CS ENABLED
RAW3WIRE>

Finally, we set the LED to 100% green. Bit 30 signals an LED PWM update, followed by 0% settings for the blue and red channels, and a 100% setting for the green channel (1111111111).  Toggle the latch pin (][) and the LED color changes to green.

Like this post? Check out the parts posts you may have missed. Want to request a part post? Please leave your suggestions in the comments.

Hack a Day review disclosure: Macetech gave us a couple free ShiftBrites at Maker Faire 2008.

11 thoughts on “Parts: ShiftBrite RGB LED Module (A6281)

  1. i have noticed that RGB LEDs are incapable of creating a true colour spectrum in most cases. for example, it’s really hard to make a good brown colour with an RGB LED.

    the problem seems to be that the output of each individual red, green and blue LED does not go low enough with PWM to produce the very low levels of each colour required for more subtle shades.

    the 10 bit PWM on the allegro is pointless, you will be lucky to get 4 bits of colour resolution from an RGB LED. it may seem like more in the demos where they fade from one colour to another, but that’s only dealing with primary colours which are some combination of full R/G/B.

    the problem is that even at the lowest end of PWM, the current required to turn the LED on is too high to get down to under about 40% brightness with a 1 in 1024 (10 bit) PWM. Any lower and the LED does not light at all.

    the only thing which may work is constant current control, but i have not had time to experiment with it yet.

  2. I love the shiftbrites. Great little devices. iirc, I bought like the last 10 of mace’s first production run. Work like a charm with the Arduino.

    I believe it was also his site that introduced me to Sparkfun. (As well as his eBay supplier for the RGB LEDs on the shiftbrites)

    I see he now has a Shiftbrite shield for the Arduino, I’ll have to add that to my to-buy list. :)

  3. i have matrix of 1024 allegro chips (same like shiftbright)

    I’m very disappointed with behavior of those chips when a little of radio electrical noise or other EMC trash enter to it, they go completely mad, especially if linked in chain….
    then nothing other help then re power… :-(
    for those project, this is trashed, money….
    pcb, was made pro. with good power and signal traces, with many capacitance for stability, so this is not design problem, but very bad designed chip…… (with poor support of allegro) ok it work for hobyst, but for larger pro. project fail.

  4. @kreso: It’s not made for 1024 daisy-chained chips!

    One would parallel-wire strips of 32 or 64, thus requiring 16< parallel data and latch outputs..

    stabilizing some of the lines, active repeating.. would also be an addition to stability

Leave a Reply to HakuCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.