Go Down

Topic: Driving Multiple WS2801 LED Strands Quickly (Read 1 time) previous topic - next topic

ElectricDiode

Hey guys. I have a project in which I have 1-5 different strands of WS2801 LEDs that I need to quickly control. Each strand can have a different number of LEDs, up to ~60 LEDs. I'm currently using Adafruit's WS2801 library.

Does anyone know if it's possible to share the clock line on multiple WS2801 strips? Particularly if the strips have different lengths. I figured it would make it faster only having to clock one pin instead of 5 different pins. Any other ideas to make this as efficient as possible?

I tried this with Adafruit's library but it didn't work as is. Also of note, I'm using a Bobuino with a ATmega1284p uC.


macegr

It's probably not going to be faster, and not worth pursuing unless you absolutely must have them synchronized. Here's why. The WS2801 is a clocked shift register input, so it's much more relaxed than the WS2811 for bit timing. So you're hoping that you can just present the current bit for all of the strings, possibly as a port write instead of a pin write....that would make sense, if that was all you had to do. In order to prepare the bits for transmission, you still need to increment through each of the output bytes, do the bitshift, grab the bit you want, and store it into a variable that you'll write to the port later. It ends up being almost the same amount of cycles to do all that preprocessing, versus just doing a normal SPI write.

Here's one way to gain a lot of speed. Use the SPI hardware output peripheral, and set up a demux IC to aim the SPI clock output at one of the strips. Then you just drop a byte into the SPI register, let the hardware do the sending, aim the demux at another strip, and fire away. Probably 100% speedup over a software-only approach.
Unique RGB LED Modules and Arduino shields: http://www.macetech.com/store

CrossRoads

ElectricDiode,
Didn't I describe doing just that for you in another thread already?
Instead of a demux, I suggested using an AND chip to gate the SCK line out to the strips.  Use an active High chip select ANDed with SCK - when the CS was High, the output follows SCK, and when Low the output is low.
Can output at up to 8 MHz speeds that way (max that SPI can do).
The WS2801 will support faster:
Maximum input clock frequency 25MHz

But 16 MHz Arduino hardware cannot, 8 MHz is fastest SPI output.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

ElectricDiode

Thanks for the responses guys. Great ideas, I'll be trying these out.



ElectricDiode,
Didn't I describe doing just that for you in another thread already?

Yes, indeed. It was in a private message. This thread here was created before I received your private message. Thanks for the follow up though.

I appreciate the help.

CrossRoads

Ok, too much going on. I lose track of what's where.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up