WS2803 versus WS2801

Or this piece that cycles through each port one by one, using the WS2801 Color(r, g, b) method:

  for (int p = 0; p < 6; p++) {   // 6 groups of 3
    for (int c = 0; c < 3; c++) {   // each group has 3 ports
      switch(c) {
        case 0:
          strip.setPixelColor(p, Color(255, 0, 0));
          break;
        case 1:
          strip.setPixelColor(p, Color(0, 255, 0));
          break;
        case 2:
          strip.setPixelColor(p, Color(0, 0, 255));
          break;
      }
      strip.show();
      delay(50);
    }
    strip.setPixelColor(p, Color(0, 0, 0));
  }

Ultimately, it's just fine because most people will want to use RGB LEDs anyway, so with the ports being grouped it works out.

The next question is trying to figure out how to address individual outputs. With Adafruit's WS2801 library, it turns the outputs on in groups of 6. So if I send it Color(r, g, b) with r=255, g and b=0, I get ouputs 0, 3, 6, 9, 12, and 15 turned on. If I send r=0, g=255, and b=0, the next set of outputs come on, 1, 4, 7, 10, and 16. And with b=255, r and g=0, the last set comes on, 2, 5, 8, 11, and 17.

I think it's possible to address each one separately, it's figuring out how to change the library to do that.

Here is an updated version of the library that addresses each LED individually. Have not tested with the WS2803 - just WS2801.

Differences from the WS2801 proper library:
The led count used when creating the object should be the individual LED count
The setPixelColor method takes only one color param due to being single LED.
The getPixelColor method returns a standard 8 bit color value
The example just lights up one after another in a loop.

This should provide an easy starting point for addressing individually. I'll try to find time to test with WS2803 but have circuit questions.

WS2801Single.zip (3.9 KB)

The comments below are from initial testing only and are subject to change based on feedback.

Findings:
The 144 bit requirement means this chip needs to be fed in full 18 LED values. So if you have 52 LEDs, you have to say 54 LEDs in the setup and then just turn the last two off in your code if using the old library. I created a version of the single library that buffers the last part automatically allowing you to use 52 in your code.

Other notes:
The data does not go into the chips the say way. The order of the ports is normal 0 through 17 but the data is sent to each chip backwards. So if you have three chips, the first chip data should be chip 3 and the final chip data should be chip 1. An updated version of the library attached below - replacing the old one.

Updated Library:
Attached is the WS2803Single library:
Update 1) This version will buffer the difference if an increment of 18 LEDs is not used. Note that when you use numPixels() it will return the new LED count, not the value passed in. So if you start with 37 - it is buffered to 54 .. so numPixels() will return 54. In your code you can simply use the same value originally instantiated .. just do not rely on the numPixels method for this unless you want to include buffered LEDs not attached in your patterns.

Update 2) This library sends the data in the correct order (chips backwards - ports forward). This should make using the original library for WS2801 .. the singleWS2801 and this library work with no other change needed in the code outside the class and library names. Tested both SPI and bigbang methods.

WS2803Single.zip (4.18 KB)

Just a FYI - I updated the above library with changes noted as update 2 along with fixed findings. I did not want someone reading false findings so I just cleaned up the above post and posted the updated library. Leaving this post just in case someone had already been through the last post and/or downloaded it.

hello,
you can put as the WS2803 is connected to arduino. ?
I connect well, but it does not work.

http://arduino.cc/forum/index.php/topic,118406.30.html

Yep, and it works just fine with the proper code.

Thanks for your prompt response.
pull-up resistor, so connected?

forgiveness as well??

That's neither a pull-up nor a pull-down. There is no GND involved in a pull-up, and no VCC in a pull-down. Look at the various schematics on that wiki page.

Someone can put a picture of how to connect a "pull-up". As he says, KirAsh4.

THX.

If you're only using one, it won't matter. Leave them unconnected. If you're planning on using several of them and you happen to get close to 6 meter length, you need to add them to avoid reflection.

In other words, when I make modules with these, I create them with the ability of adding those resistors if I need them. If not they remain unconnected.

ok, but still not working. no LED lights.
I have also modified their library and nothing.

ps: not to stay with the doubt, could you put the resistecia concecta as "pull-up"?

ok, but still not working. I turn on the LED.
Also I have modified Their library and nothing.

ps: not to stay with the doubt, could you put the resistor connected as "pull-up"?

R2 and R3 are pull-up resistors.

you can put a video tutorial?
Thanks.

On what? Pull-up resistors? That's why I pointed you to the wiki page which talks about both pull-ups as well as pull-downs.

You still have the LED wired wrong. Is this a common cathode RGB LED?
If it is then it is likely only one colour will work.

A pull up resistor should be 4K7 and go from the pin to +5V, that is all. You do need them even with one chip.

I believe the RGB 5050 leds are common 'anything' that have 3 pads on each side: 3 x GND and 3 x V+

I usually bridge pads on the correct side to match my project(s)..

On the 5050's that I have, they're common anode, and the WS2801/WS2803 sink. So each cathode on the LED goes to a separate output pin on the chip and the anodes are tied together with VCC. And the datasheet specifically says 50R, not 4K7 for pull-ups.