Go Down

Topic: string of WS2801 pixels not behaving as expected (Read 3 times) previous topic - next topic

megamasha

First, let me say I've googled and searched these forums.

I have an arduino Uno and a string of 50 WS2801-driven LEDs which I purchased here: http://www.powerledworld.com/en/50pc-x-waterproof-5v-12mm-rgb-diffused-led-pixels-ws2801-drivers-addressable-color.html

I have the 5v and ground wired up correctly, I believe. When just connected to power (i.e. no data being passed in) they default to all full-on white, and they happily stay that way.
I am running the lestleds program from the FastSPI library (I've tried the adafruit ws2801 library with similar results). For reference and completeness, here's the whole bang lot:

Code: [Select]
#include <FastSPI_LED.h>

#define NUM_LEDS 150

// Sometimes chipsets wire in a backwards sort of way
struct CRGB { unsigned char b; unsigned char r; unsigned char g; };
// struct CRGB { unsigned char r; unsigned char g; unsigned char b; };
struct CRGB *leds;

#define PIN 4

void setup()
{
  FastSPI_LED.setLeds(NUM_LEDS);
  //FastSPI_LED.setChipset(CFastSPI_LED::SPI_SM16716);
  //FastSPI_LED.setChipset(CFastSPI_LED::SPI_TM1809);
  //FastSPI_LED.setChipset(CFastSPI_LED::SPI_LPD6803);
  //FastSPI_LED.setChipset(CFastSPI_LED::SPI_HL1606);
  //FastSPI_LED.setChipset(CFastSPI_LED::SPI_595);
  FastSPI_LED.setChipset(CFastSPI_LED::SPI_WS2801);
  FastSPI_LED.setDataRate(0);

  FastSPI_LED.setPin(PIN);
 
  FastSPI_LED.init();
  FastSPI_LED.start();

  leds = (struct CRGB*)FastSPI_LED.getRGBData();
}

void loop() {
  // one at a time
  for(int j = 0; j < 3; j++) {
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
      memset(leds, 0, NUM_LEDS * 3);
      switch(j) {
        case 0: leds[i].r = 255; break;
        case 1: leds[i].g = 255; break;
        case 2: leds[i].b = 255; break;
      }
      FastSPI_LED.show();
      delay(10);
    }
  }

  // growing/receeding bars
  for(int j = 0; j < 3; j++) {
    memset(leds, 0, NUM_LEDS * 3);
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
      switch(j) {
        case 0: leds[i].r = 255; break;
        case 1: leds[i].g = 255; break;
        case 2: leds[i].b = 255; break;
      }
      FastSPI_LED.show();
      delay(10);
    }
    for(int i = NUM_LEDS-1 ; i >= 0; i-- ) {
      switch(j) {
        case 0: leds[i].r = 0; break;
        case 1: leds[i].g = 0; break;
        case 2: leds[i].b = 0; break;
      }
      FastSPI_LED.show();
      delay(1);
    }
  }
 
  // Fade in/fade out
  for(int j = 0; j < 3; j++ ) {
    memset(leds, 0, NUM_LEDS * 3);
    for(int k = 0; k < 256; k++) {
      for(int i = 0; i < NUM_LEDS; i++ ) {
        switch(j) {
          case 0: leds[i].r = k; break;
          case 1: leds[i].g = k; break;
          case 2: leds[i].b = k; break;
        }
      }
      FastSPI_LED.show();
      delay(3);
    }
    for(int k = 255; k >= 0; k--) {
      for(int i = 0; i < NUM_LEDS; i++ ) {
        switch(j) {
          case 0: leds[i].r = k; break;
          case 1: leds[i].g = k; break;
          case 2: leds[i].b = k; break;
        }
      }
      FastSPI_LED.show();
      delay(3);
    }
  }
}


When I connect the clock, data and ground lines to the lights (but not the +5V), they flicker a dim red. They flicker at different speeds for different parts of the loop, presumably as they're taking power off a combination of the clock and data lines (pins 13 and 11).

When the lights are connected with power, clock, data and ground, they initially come on full white, except for about 5 out of the 50 of them, which may turn green, blue, yellow, magenta and other colours that have 0x00 on some of the RGB chanels in the first <amount X> of time. After <amount X> of time, the pixels turn off, one by one in order. One of the parts of the loop program is causing this to happen, though I'm not sure which.
<amount X> depends on the value of setDataRate(), being a few seconds with 0 and perhaps 10ish with setDataRate(7). The important thing to note is that the result is the same but at a different speed with all values.
I have a 100µF cap over 5v and ground, which I've tried in both polarities to be sure.

I have tried a USB port for power (terrible form I know, but the USB port lives still) as well as a 30,000mAh battery (so presumably not switching).

It seems the lights are receiving information, as they can be switched off individually, and some of them are individually set to different colours, but it's erroneous information, as they're not following patterns that the code suggests they should.

Does anyone have any suggestions for things I've yet to try? I've tried swapping clock and data lines many times just to check they are indeed the right way around. I have tried connecting data and clock to the other end of the string. Then the lights never turn off.

Anything? Anyone? All help is gratefully received - as you can see, I have taken reasonable measures before asking for help.

Grumpy_Mike

Quote
When I connect the clock, data and ground lines to the lights (but not the +5V), they flicker a dim red.

NEVER EVER EVER EVER - connect up signals to a chip without connecting the power, it is one of the best ways of destroying a chip.

KirAsh4

Three things:
- Go download version 2 of the library.  Much better, much faster.

- Slow your data rate down.  The WS2801 ICs are very slow, so if you're using the version 1 of the library (which you are right now), set your data rate to 2 to start with:
Code: [Select]
FastSPI_LED.setDataRate(2);

If you decide to get version 2:
Code: [Select]
LEDS.addLeds<WS2801, 11, 13, BGR, DATA_RATE_MHZ(1)>(leds, NUM_LEDS);
Start at 1MHz, then gradually take it up, 2, 4, 8, etc., etc.

- As Mike said, never connect data lines without VCC and GND.

megamasha

OK, Thank you for your advice. I'll be sure not to connect the data and clock without the voltages too from now on.

Quote
<amount X> depends on the value of setDataRate(), being a few seconds with 0 and perhaps 10ish with setDataRate(7). The important thing to note is that the result is the same but at a different speed with all values.

Perhaps I wasn't quite explicit enough - I did try values from 0 to 7, including 2 as you suggest.

I forgot to mention that I'd initially tried version 2 of the library, but the example wasn't quite as well documented and when it failed I tried version 1 thinking it might be more tried and tested.
When I got a reponse from the string of lights suggesting I was making some progress, I stuck with version 1. I get much the same result with version 2 of the library as I have done with other attempts, except that the example code for version 2 doesn't seem to send data that turns all the leds off one by one.
When I connect the data and clock lines, a couple of pixels may change colour, but other than that, nothing happens.
This is using LEDS.addLeds<WS2801, 11, 13, BGR, DATA_RATE_MHZ(1)>(leds, NUM_LEDS); with the Fast2Dev example. Using decimal numbers like 0.2 won't compile, so I don't think I can go any slower.

I was wondering if this was an UNO-specific thing, so I checked it out with a nano, but with the same results. :-/

KirAsh4

This is probably going to sound dumb but, have you tried swapping the wires for what you think are data and clock?  Just because it's labeled that way does not mean they're not reversed.

Also, don't try to light up the whole string by pulling power from the Uno, you will damage the thing.  Feed power externally, or light up a few LEDs only.

The issue of all of them lighting up white when you connect VCC and GND doesn't sit right with me.  I don't have a single WS2801 string that does that.  The WS2801 IC is by default at 0% when you first apply power, not 100%.  Do something is really wrong here.  Either you're not connecting it right, or the string lies.

megamasha

No, that doesn't sound dumb. It's a reasonable troubleshooting step, and something I've tried. I've reversed, re-reversed and them reversed them back again. Only one way around ever seems to invoke a change in any of the pixels - and that's the way around I'm assuming is correct, but I always try the other way around too. I've not tried reversing +5V and GND, but being LEDs and given that they all light up for a whole minute wired with red as +5V and blue as GND, I'm assuming the other way around would leave me with something even less working than I already have.
I have to say I was disappointed when they all sprung into life when I connected power (I had first run them off the USB port, expecting them to default to off, and having written my code to only address 3 pixels. Having met people with fried USB ports from similar projects, I quickly yanked the USB cable out of the laptop again when I plugged in and saw them all light up), but with this being my first experience with WS2801s, I didn't realise this wasn't normal. I switched to an external power source, wrote some code which I thought should set them all to off in the setup() function, and when this didn't work, I suspected incorrect data rate or switched clock/data. Thus far, none of my troubleshooting has yielded a result where even one pixel responds as expected.

The only thing I haven't done yet (because of the time investment it would require) is bit-banging the pins manually (perhaps even randomly...) and seeing what they do, and trying to reverse-engineer some useful response out of them that way, but I thought the whole point of them being WS2801 chips is that they ought to work with at least ONE of the WS2801 libraries out there, especially the one recommended on the product information page!

Does anyone have anything else to recommend, something obvious or obscure I've missed perhaps, or do these just sound like a duff bunch?

KirAsh4

Can you take a high resolution picture of the end that you're using, with wires and 1 or 2 pixels?

Random color changes, in my experience, is due to the data and clock lines being swapped, or if the data rate is too high.  That's why I suggested swapping them.

The reason I'd like to see a high resolution picture is because the string that I have, has VCC and GND on red and white, while green and blue are data and clock respectively.  That's not to say they're all wired the same, something I know from experience. :)

megamasha

#7
Jun 24, 2013, 12:31 am Last Edit: Jun 24, 2013, 12:33 am by megamasha Reason: 1
I'd love to find out that I've got the wires wrong and a simple rewire will get everything up and running, though I'm sceptical. I've put a couple of images up here and here.
The casing on the pixels has a rough finish, so it's hard to make out what's written even with the right lighting and on the easiest-to-see pixel (as in the photo), though I think I can make out +5 (red), CD or CO (white), DC (green, really not sure on this one) and GND (blue).
As you can see in the first image, two of the wires are broken out - the grey one is connected to the blue one on the socket, and what I think is GND on the pixel, the red one just goes straight to wherever the red wires are attached on the pixels: +5V I think.

So, have I just got it all wrong, d'ya reckon?

KirAsh4

Ok, so those two wires sticking out, that's your external connection to a power supply, VCC and GND.  If you connect just those two, does the entire strip light up?  If so, something's wrong.  Unfortunately, the best way to figure it out is to do what I did: sacrifice one of the pixels.  Cut off the frosty sheathing with an Xacto knife.  All you need is the bottom most part, where the wires are soldered.  You can leave the rest of the sheathing intact.

But and as I expected, it is wired different than mine.  On mine, green and blue are the data/clock lines, while red and white are VCC and GND.  But the fact that the grey wire is connected to the blue wire inside the casing ... just odd.

Something I didn't mention before: I am making the assumption that you are connecting to the correct end, yes?  The string isn't bi-directional, you can only feed data in from one end only, but you can feed power in from either (or both) ends.  Generally, if it truly says 'CO', that's 'Clock Out' and you need Clock In.  But then I don't know what DC stands for (other than Direct Current that is.)

Mine is labeled:
VCC
GND
DATI (in) or DATO (out)
CLKI (in) or CLKO (out)

In that order.  Yours appears to have the data lines in the middle.  Just odd.  Different factory I guess.

megamasha

I may put together some more, but for the moment:

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

KirAsh4

That's freaky odd.  They behave like the DycoLEDS which are full on by default.  Those have a custom driver in them and you can't buy them (for cheap nor in small quantities last I checked.)  And you are certain these are WS2801s?  I still say sacrifice one of them at the end.  Rip the frosting off of the bottom part where the wires are soldered.  Or go further to expose the IC and read the numbers off of it.

6laz3r

#11
Sep 16, 2013, 02:57 pm Last Edit: Sep 16, 2013, 03:11 pm by 6laz3r Reason: 1
hi megamasha.... did you ever get these to work? i just got a strip of 18 of these pixels from a friend who is unable to use them. i can't either! does exactly what you described.. all of them light up when connected to power only. when i connect to arduino and upload sketches, only the first LED 'flickers'. others change colors randomly or not at all. also... i stripped off the plastic cladding on one of the pixels but the IC does not mention any part number! its blank!

-------------------------------------------------

update!

soon after posting the above, i played around with the sketch and found that selecting the LPD6803 chipset in the fastSPI library examples seems to work perfectly! the strip i have also claims to be ws2801, but apparently thats incorrect!

megamasha

No, I haven't got them to work. I contacted the manufacturer, who asked me to send them back. I have to pay postage, though they'll refund it if they find the pixels to be faulty. The whole process has taken a while (they didn't reply for weeks on end), but I'll be sending them back either this or next week. I'll try to remember to post the result here. Poke me if it's the year 2014 (or later) and this is the last post on this thread.

Arsenius

Hello Guys,
Today i got my first arduino and 3 pairs of WS2801 strips.
I ordered the led's here .

I was following this guide however only the LED at the output side of the string glows white.
while running the colorswirl program posted on above link sometimes the led does flash between the colors but only if i start wiggling the cable at the LED side a bit.

I already changed the cables between the led strip and the arduino, and tried a other LED strip but it has the same issue.

When i connect the led strip to power only it also only glows 1 led.

megamasha

It's now almost half way through 2014 and powerledworld have still not given me my money back for the faulty pixels (I know they were faulty - I've since purchased several strings from elsewhere and they all worked just fine).
I would recommend to anyone considering it: DO NOT PURCHASE FROM POWERLEDWORLD.COM - faulty products are a fact of life, but when it comes to customer service, THEIR SERVICE IS APPALLING (the worst I've experienced from any internet seller in the 12 years I've been buying online)

P.S. Arsenius: Your post belongs in a new thread.

Go Up