Multiplexing WS2803

I want to something like that (common cathode connected to WS2803 and RGB multiplexed by ATMega328p)

But unfortunately my knowledge about 328p programming is very limited, so I take few pieces of code that I found on net and now it's kind of working but it's flicker (mayby not too much, but before that I did that project with tlc5940 and and it wasn't flicker at all, I gived up with tlc5940 after 2 of 5 tlc5940 burnt out (only 9mA per LED, so it wasn't overloaded, but there was probably transmision problem on about 50cm cables between each of 4 tlc5940)).
Did anyone tried something like that or can anyone adopt tlc5940 code to work with WS2803?

Sorry for my bad english it's not my native language.

It's not designed to do that. The WS2801 is meant to sink current. You use the Atmega to trigger the ports on the WS2801. The cathodes are supposed to go to the WS2801, and anode's common. The Atmega sends data and clock signals to the WS2801 to turn on/off the individual ports. Creating that rainbow effect is easy. There are several effects that change every 30 seconds or so in this video. It was my window display last christmas:

Maybe it's not designed to work that way but I think that I've already done it and it's working, well... almost as I want.

For now i'm using Arduino Nano, one WS2803, one common cathode RGB LED and that piece of code:

#include "SPI.h"
#include "WS2803Single.h"

int counter = 0;
int rgbDelay = 800;

WS2803Single strip = WS2803Single(1);

void setup()
{
  strip.begin();

  strip.show();
  
  DDRC = B00000111;
  PORTC = B00000000;  
}
  
void loop()
{
  uint8_t red, green, blue;
  SetColorToIndex(counter, &red, &green, &blue);
  
  strip.setPixelColor(0, red);
  PORTC = B00000100;  
  strip.show();
  delayMicroseconds(rgbDelay);
  strip.setPixelColor(0, green);
  PORTC = B00000010;  
  strip.show();
  delayMicroseconds(rgbDelay);
  strip.setPixelColor(0, blue);
  PORTC = B00000001;  
  strip.show();
  delayMicroseconds(rgbDelay);

  counter++;
  counter = counter % 768;
}

static inline void SetColorToIndex(uint16_t color_index, uint8_t *r, uint8_t *g, uint8_t *b)
{
  uint8_t group = color_index >> 8;
  uint8_t value = (uint8_t)color_index;

  switch (group)
  {
    case 0:
      *r = 255 - value;
      *g = value;
      *b = 0;
    break;
    case 1:
      *r = 0;
      *g = 255 - value;
      *b = value;
    break;
    case 2:
      *r = value;
      *g = 0;
      *b = 255 - value;
    break;
  }
}

Colors are a little bit 'washed out' and it's flickering a little but it's working

I want to give it a try and connect all 18 RGB leds but I don't know if it's worth it.

TLC5940 works really great but I don't know how to get rid of transmission problems over long connection cables (I used MM74HC04M as buffers but that didn't work at all), unfortunately it's really easy to burn it.

I used MM74HC04M as buffers but that didn't work at all

Then you did not wire them right,

Grumpy_Mike:

I used MM74HC04M as buffers but that didn't work at all

Then you did not wire them right,

I used something like that:

But I didn't buffer SIN/SOUT only BLANK, DCPRG, GSCLK, SCLK, VPRG, XLAT.
I put that buffer between ATMega and first TLC5940, didn't work at all.

You sorta need SIN for the tlc5940, otherwise it will have no idea what to do

http://code.google.com/p/tlc5940arduino/

I used something like that:

Like is not good enough.
That is just a PCB footprint it is not telling anything about how you wired it up.
Anyway it looks totally wrong from what little I can glean from it.

When using a MM74HC04M you need the signal to pass through two buffers to get the signal the right way up.

This is one way of wiring up buffers in the PDF attached

Latch and clock buffering.pdf (21.5 KB)

funkyguy4000:
You sorta need SIN for the tlc5940, otherwise it will have no idea what to do

I know about that, i'ts connected but not buffered

Grumpy_Mike:

I used something like that:

Like is not good enough.
That is just a PCB footprint it is not telling anything about how you wired it up.
Anyway it looks totally wrong from what little I can glean from it.

When using a MM74HC04M you need the signal to pass through two buffers to get the signal the right way up.

I used exactly that PCB and 2x SMD MM74HC04M


Gate no. 1 is connected to gate no. 6, gate no. 2 to gate no. 5 and gate no. 3 to gate no. 4, in other words it's connected exactly as You say or am i missing something?

Unfortunately i don't have oscilloscope so I don't know if signal outgoing from buffer is correct or not.

Why do you have this obsession with buffering stuff?

From the diagram the gates are not connected the way you say they are dude.
Gate 1 is connected from pin 1 to pin 2. The gates are not internally connected to eachother.
The diagram is right there in front of you.

funkyguy4000 really? Can't You see it? I already posted PCB that I used with TLC5940 one post before the last one, that image in my last post is only MM74HC04M pinout nothing more...

About my obsession... try to use daisy chained TLC5940 over long cable lines, maybe after you burn few of not so cheap TLC5940 You will understand me.

As I said before... english is not my native laguage but that doesn't mean that I'm dumb

You really don't need to be rude... dude...

I have dude, I've never needed to buffer them over a 50cm cable.
If you need specific help with tlc5940's then a few good people here can help you.

You shouldn't need an oscilloscope with the footprint you are for the MM74HC04M unless your logic levels aren't at the proper level. The datasheet says it uses 3 not gates for each gate. If you use two gates then you will get the same output just buffered.

The WS2803 looks to only need one serial data line and one serial clock line. As if it communicates through I2C. Notice on the pinout in the datasheet that its serial out and clock out are already buffered.

Page 5 of the datasheet :

2-wire Control Mode 
When MS pin is connected to VCC, WS2803 operates in 2-wire control mode, at this mode, only 2 wires are needed to 
transmit the grayscale data. It is a low cost solution. Only 2 ports of MCU are needed to control over thousand WS2803 
chips.

I don't see the issue is seeing as how you have experience daisy chaining.

Dude, 50cm cable between each of 4 tlc5940 meen that the last one tlc5940 was on 2m cable... first two tlc5940 - no problem, third - sometimes few leds doesn't work (doesn't light up at all, rest work as expected), last tlc5940 - usually works but flicker alot, sometimes only one or two leds working and when thats happen its bad because it's overheating.
I tried really alot to make it work as it should but everything failed... now i'm waiting for new tlc5940 to arrive and then i try again but till that I try to use WS2803 because it's cheaper and as for now it doesn't overheat.
MM74HC04M buffer probably works correctly because if i use normal voltmeter to check voltage level output is in high state if input is in high state and in low if input is in low state but it doesn't work when it's connected between arduino and tlc5940 (without oscilloscope I can't check what's wrong and i didn't buffer SIN/SOUT because as far as I understand from datasheet there i no need for that).

In case of WS2803 I don't have problem with data connection but with my low arduino programming skills...
If I use common anode RGB LED everything works as it should no flicker or anything like that, but that way I can only use 6 RGB LEDs per one chip. With common cathode RGB LED and multiplexed RGB lines I could get 18 LEDs per chip and thats why I'm trying to do that...

I know that there are few good people here who can help me with tlc5940, I read everything what I found about tlc5940 on this board but my last hope... MM74HC04M buffer (read about it on this board) didn't work (at least for now) so I give a try with WS2803.

OK I see it now, but I am still not sure on your wiring arrangements, like did you just buffer each line and then run it in a chain?

Did you have any decoupling capacitors?
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html
A 0.1uF ceramic on each chip and at least one or two larger ones as well say 47uF. It could be that the chips were oscillating.
What Iref resistor did you choose for your 9mA?
What voltage have you got the anodes attached to? Are the LEDs close to the chip?