Shop OBEX P1 Docs P2 Docs Learn Events
Fun with Shiftbrites — Parallax Forums

Fun with Shiftbrites

tomcrawfordtomcrawford Posts: 1,126
edited 2014-12-05 17:24 in Robotics
Shiftbrite(tm)
I like multi-color LEDs and had done some Christmas lights using Red/Green devices. The Shiftbrite comprises Red/Green/Blue LEDs in a single package, driven by a tiny computer using Pulse Width Modulation. Here is a pointer to the manufacturer's documentation. http://docs.macetech.com/doku.php/shiftbrite

Here is a link to a video. https://www.youtube.com/watch?v=FfW7RNOdI74

Driving Shiftbrite with a BS-2
To load a color triad into a shiftbrite, you shift a 32-bit value into it. Two controls bits which must be zeroes, and ten bits each for the three colors. The description in their documentation is confusing at best. It pretty clearly shows the right-most bit of the blue color being adjacent to the two control bits. Not so. Here is a working example.

SHIFTOUT Datapin, Clockpin, MSBFIRST, [0\2, BlueValue\10, RedValue\10, GreenValue\10]

The attached program includes driver subroutines for a number of different color depths, from 3 bits per color to ten.


Oddities
The data sheet says V+ should be between 5.5 and 9 volts. The examples I bought ran just fine on 5.0 volts.

The color mixing in the LED is Not Good. The primary colors are fine, but yellow, cyan, magenta, and especially white are clearly multiple LEDs. Of course, this is a problem in the LED package, not with the Shiftbrite. I have seen references to a spray-on material which is supposed to help diffuse the light. I haven't tried it myself.

The BS-2 SHIFTOUT instruction has an interesting nuance. If you use MSBFIRST and the bit count is less than the variable size (for example, if you shift 10 bits from a Word variable) it uses the Least Significant Bits (the right-most 10 bits) of the Word. To be sure, it is clearly documented, AND it turns out to be what you would like, but it is not what I would have expected.

It is difficult to take pictures of LEDs with cameras that have automatic exposure.

Ten Shiftbrites eat a 9-volt transistor battery in about two hours.


The project
I built a string of Christmas lights using ten Shiftbrite modules, driven by a BS-2. The photos include the BS-2 driver package and some results strung on a blue spruce. The program pretty much says it all.

I defined three arrays of ten Nibbles each, to contain the intensity of colors. There is code to control the over-all intensity according to the ambient light as measured with a photo-resistor. There are several Display modes, ranging from simple alternate red and green to fully random colors.

The subroutines at the bottom of the program drive the string with various color depths, although the code only ever uses four bit per color. In some cases it only drives the nearest device, relying on the string to propagate colors down the string.
1024 x 768 - 188K
1024 x 768 - 135K
1024 x 768 - 22K

Comments

  • tomcrawfordtomcrawford Posts: 1,126
    edited 2014-12-05 14:18
    Don't leave your ShiftBrites out in the rain. I did, and it killed five out of 40. Oddly enough, they die with all three LEDs "on".
  • NWCCTVNWCCTV Posts: 3,629
    edited 2014-12-05 17:24
    Really old thread. Video no longer works!!
Sign In or Register to comment.