Page 1 of 5 12345 LastLast
Results 1 to 10 of 41

Thread: Addressable LED strips

  1. #1
    Join Date
    May 2008
    Location
    nerdtown, USA
    Posts
    1,165

    Default Addressable LED strips

    I'm sure some, all or none of you have seen those flexible RGB LED strips that the Chinese factories are pumping out by the mile these days. They are pretty cool, it turns out; the LEDs are bright and the prices are pretty low (less than $100 for a five metre strip).

    Don't know what I'm talking about? Here's a video:

    http://www.youtube.com/watch?v=--jzCXobtMs

    We picked up some of the four-wire type, and were unsatisfied with the stock controller since it didn't really have any control over speed or pattern. So we decided to reverse engineer the protocol it uses to control them. It turns out that the LEDs are fully addressable in groups of three RGB packages. Each of the groups has a 24-bit register containing RGB information (actually, in BGR format) and can hold values of 0 to 254. At the end of the strip- there are 50 "pixels"- you send a 25-bit word consisting of a 0 followed by 24 ones. The bits are synchronously clocked in on the rising edge of the clock line, which is also used to drive the counters that generate PWM drive for the LEDs.

    What all of this means is that I hacked together a little driver board using a Teensy:

    http://picasaweb.google.com/closeeno...82070298305826

    Having succeeded in coding it for one strip, and tiring of the idea of building a multi-strip driver on perfboard, I hooked up pad2pad in VMware and designed this:

    http://picasaweb.google.com/closeeno...79405448378898

    When the prototype run comes in, I shall post the .pcb file and maybe we'll do a group buy... anyone want some?

    http://www.youtube.com/watch?v=K0GmL1FFoHE

  2. #2
    Join Date
    Jan 2008
    Location
    Stockholm, Sweden
    Posts
    799

    Default

    Very nice! I did not think the strips would be controllable like that. I had planned to line the edges of the ceiling in a room with RGB LED strips, but perhaps now I need to rethink how I'm going to use them.

    Surely this is not just a normal RGB LED strip. Have you found a good source for them? Would it work with this: http://www.dealextreme.com/details.dx/sku.14852 ?

  3. #3
    Join Date
    Aug 2008
    Location
    the hills
    Posts
    983

    Default

    Sweet!!

    I'd be in for the boards, especially with a good source for the strips.

  4. #4
    Join Date
    May 2008
    Location
    nerdtown, USA
    Posts
    1,165

    Default

    Quote Originally Posted by tocket View Post
    Very nice! I did not think the strips would be controllable like that. I had planned to line the edges of the ceiling in a room with RGB LED strips, but perhaps now I need to rethink how I'm going to use them.

    Surely this is not just a normal RGB LED strip. Have you found a good source for them? Would it work with this: http://www.dealextreme.com/details.dx/sku.14852 ?
    I do not believe those are the same type of device.

    The strips I am using are the ones with serial control and no "fader" wire. There are also said five-wire ones, and there are RGB ones that are only controllable as a whole strip.

    I'll post our source for them just as soon as the member of my team that buys these from China gets back online...
    Last edited by heroic; 05-15-2010 at 14:07.

  5. #5
    Join Date
    Aug 2008
    Location
    the hills
    Posts
    983

    Default

    Quote Originally Posted by heroic View Post

    I'll post our source for them just as soon as the member of my team that buys these from China gets back online...
    Thank you, Ma'am......

  6. #6
    Join Date
    Jun 2007
    Location
    Lake Geneva, WI.
    Posts
    2,704

    Default

    Great! Nice work! I need one of these for my friends bar I'm helping him build. Looking foward to seeing the price for the LED strips. Can you get them in shorter lengths?
    Thanks!

  7. #7
    Join Date
    May 2008
    Location
    nerdtown, USA
    Posts
    1,165

    Default

    Quote Originally Posted by 300EVIL View Post
    Great! Nice work! I need one of these for my friends bar I'm helping him build. Looking foward to seeing the price for the LED strips. Can you get them in shorter lengths?
    Thanks!
    You can only get them in 5m lengths, but you can cut them at the cut points- each group of three LEDs (and associated semiconductors) has a cut point. They even supply a little tube of RTV and a piece of cable to close the end with.

    Here's a bit of code to play with if you have an Arduino or Teensy:


    struct pixel {
    int r;
    int g;
    int b;
    };


    static int8_t left, right;
    static struct pixel leftc, rightc, ltrailc, rtrailc;
    static int8_t leftv, rightv;
    static bool started= false;

    int dataPin = 6;
    int clkPin = 5;

    #define CHIPS 50
    #define DELAY 1

    static struct pixel strip[CHIPS+2];

    static struct pixel colours[9] = {
    {
    254, 0, 0 }
    , // red
    {
    254, 100, 0 }
    , // orange
    {
    254, 254, 0 }
    , // yellow
    {
    0, 254, 0 }
    , // green
    {
    0, 100, 254 }
    , // blue
    {
    50, 0, 254 }
    , // indigo
    {
    100, 0, 254 }
    , // violet
    {
    254, 254, 254 }
    , // white
    {
    0,0,0 }
    ,
    };

    void setup() {
    char c;

    // blank the strip
    for (c=0; c<CHIPS; c++) {
    strip[c].r = 0;
    strip[c].b = 0;
    strip[c].g = 0;
    }
    ltrailc=colours[8];
    rtrailc=colours[8];

    generate_left_wave();
    generate_right_wave();
    started = true;

    pinMode(dataPin, OUTPUT);
    pinMode(clkPin, OUTPUT);

    Serial.begin(38400);
    }

    void slowShiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, byte val)
    {
    int i;

    for (i = 0; i < 8; i++) {
    if (bitOrder == LSBFIRST) {
    digitalWrite(dataPin, !!(val & (1 << i)));
    delayMicroseconds(DELAY);
    }
    else {
    digitalWrite(dataPin, !!(val & (1 << (7 - i))));
    delayMicroseconds(DELAY);
    }
    digitalWrite(clockPin, HIGH);
    delayMicroseconds(DELAY);
    digitalWrite(clockPin, LOW);
    delayMicroseconds(DELAY);
    }
    }


    void writeByte(byte b)
    {
    slowShiftOut(dataPin, clkPin, MSBFIRST, b);
    }

    void writeGuard(void)
    {
    digitalWrite(clkPin, 1);
    digitalWrite(dataPin, 0);
    delayMicroseconds(DELAY);
    digitalWrite(clkPin, 0);
    delayMicroseconds(DELAY);
    //writeByte(0x00);
    writeByte(0xff);
    writeByte(0xff);
    writeByte(0xff);
    }

    void writeFrame(struct pixel p)
    {
    writeByte(p.g);
    writeByte(p.b);
    writeByte(p.r);
    }

    void pushStrip(void)
    {
    char c;
    for (c=0; c<CHIPS; c++)
    writeFrame(strip[c+1]);

    writeGuard();
    }


    void generate_left_wave(void)
    {
    left = 1;
    leftc = colours[random(8)];
    leftv = 1;

    }

    void generate_right_wave(void)
    {
    right = CHIPS-1;
    rightc = colours[random(8)];
    rightv = -1;
    }

    void avgcolour (struct pixel *a, struct pixel *b, struct pixel *dest)
    {
    dest->r = (a->r + b->r) / 2;
    dest->g = (a->g + b->g) / 2;
    dest->b = (a->b + b->b) / 2;
    }

    void dim(struct pixel *x)
    {
    x->r = x->r * 0.5;
    x->g = x->g * 0.5;
    x->b = x->b * 0.5;
    }

    void loop()
    {
    int i;

    if (!started) {
    // invent some waves
    generate_left_wave();
    generate_right_wave();
    started = true;
    }

    for (i=0; i<CHIPS; i++) {
    dim(&strip[i]);
    }

    left += leftv;
    right += rightv;

    Serial.print("Left=");
    Serial.println(left, DEC);
    if (left == CHIPS || left <= 0) {
    generate_left_wave();
    Serial.println("Left.");
    ltrailc = colours[8];
    }

    if (right < 0 || right == CHIPS) {
    generate_right_wave();
    Serial.println("Right.");
    rtrailc = colours[8];
    }

    strip[left-leftv] = ltrailc;
    strip[left] = leftc;
    strip[right-rightv] = rtrailc;
    strip[right] = rightc;


    if (abs(left-right)<2) {
    leftv = -leftv;
    rightv = -rightv;

    avgcolour(&leftc, &rightc, &ltrailc);
    rtrailc = ltrailc;

    strip[left].r = 254;
    strip[left].g = 254;
    strip[left].b = 254;

    }

    if (left <= 0 && leftv < 0)
    generate_left_wave();
    if (right >= CHIPS && rightv > 0)
    generate_right_wave();


    for (i=0; i<5; i++) pushStrip();
    }


  8. #8
    Join Date
    Jun 2007
    Location
    Lake Geneva, WI.
    Posts
    2,704

    Default

    Quote Originally Posted by heroic View Post
    You can only get them in 5m lengths, but you can cut them at the cut points- each group of three LEDs (and associated semiconductors) has a cut point. They even supply a little tube of RTV and a piece of cable to close the end with.
    Oh nice! That works.

  9. #9
    Join Date
    Dec 2009
    Location
    Seattle, Wa
    Posts
    413

    Default

    Cool effects! Nice work guys. A friend and I experimented with some LED strips based on the HL1606 LED driver chip. We couldn't figure out get effects quite like that though, it seemed like the driver chip wasn't fast enough to shift out more than a few dozen LEDs at a decent frame rate.

    Would love to know where you purchased these!

    Thanks,
    Mike

  10. #10
    Join Date
    Aug 2005
    Location
    Silicon Valley
    Posts
    442

    Default

    Very nice. Is it possible to connect 2 or more of these for lengths longer than 5m? Will you be able to tell us your source for the strips soon?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •